/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ /* * common/cmd_testsmpcache.c * * Copyright (C) 2020 Amlogic, Inc. All rights reserved. * */ #include #include #include #include #include #include #include DECLARE_GLOBAL_DATA_PTR; #define CPU_ON 1 #define CPU_OFF 0 #define STACK_SIZE 4096 typedef void (*test_pattern_t)(unsigned int *memstart, unsigned int count); unsigned long core_stack[NR_CPUS][STACK_SIZE/8] __attribute__ ((aligned (16))); unsigned core_online[NR_CPUS]; unsigned long core_entry_fn[NR_CPUS]; unsigned long gd_addr; unsigned int val; void test_cache_pattern1(unsigned int *memstart, unsigned int count) { unsigned long i; unsigned int *addr; unsigned long size; int ret; int process; int errcnt; printf("test cache pattern1 -- : "); flush_dcache_all(); addr = memstart; size = count/sizeof(unsigned); for (i=0; ibd; memstart = (unsigned int *)(bd->bi_dram[0].start + bd->bi_dram[0].size); count = CONFIG_SYS_MEM_TOP_HIDE; printf("\n===========cpu%d test start: offset: 0x%x, count: %x\n", cpuidx, (unsigned)(unsigned long)memstart, count); for (i=0; i 2) { printf("usage: testsmpcache cpu-[0~7|a]\n"); return 0; } if (strlen(argv[1]) != 5) { printf("usage: testsmpcache cpu-[0~7|a]\n"); return 0; } cpuarg += 4; switch (*cpuarg) { case '0' ... '7': cpuid = *cpuarg - '0'; if (cpuid >= get_core_max()) { printf("usage: testsmpcache cpu-[0~7|a]\n"); return 0; } test_cpus |= (1 << cpuid); break; case 'a': for (i = 0; i < get_core_max(); i++) test_cpus |= (1 << i); break; default: printf("usage: testsmpcache cpu-[0~7|a]\n"); return 0; } gd_addr = (unsigned long)gd; flush_dcache_all(); if ((test_cpus & 0x1) == 0x1) test_cache(0); for (i = 1; i < get_core_max(); i++) { if ((test_cpus & (1<