38,28 → 38,28 |
#include <arch.h> |
#include <print.h> |
|
|
/** Number of indexes left out in the #imp_data array */ |
#define IMP_DATA_START_OFFSET 0x40 |
|
/** Implementators (vendor) names */ |
static char * imp_data[] = { |
"?", /* IMP_DATA_START_OFFSET */ |
"ARM Ltd", /* 0x41 */ |
"", /* 0x42 */ |
"", /* 0x43 */ |
"Digital Equipment Corporation", /* 0x44 */ |
"", "", "", "", "", "", "", "", "", "", "", /* 0x4f */ |
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 0x5f */ |
"", "", "", "", "", "", "", "", "", /* 0x68 */ |
"Intel Corporation" /* 0x69 */ |
static char *imp_data[] = { |
"?", /* IMP_DATA_START_OFFSET */ |
"ARM Ltd", /* 0x41 */ |
"", /* 0x42 */ |
"", /* 0x43 */ |
"Digital Equipment Corporation", /* 0x44 */ |
"", "", "", "", "", "", "", "", "", "", /* 0x45 - 0x4e */ |
"", "", "", "", "", "", "", "", "", "", /* 0x4f - 0x58 */ |
"", "", "", "", "", "", "", "", "", "", /* 0x59 - 0x62 */ |
"", "", "", "", "", "", /* 0x63 - 0x68 */ |
"Intel Corporation" /* 0x69 */ |
}; |
|
/** Length of the #imp_data array */ |
static int imp_data_length = sizeof(imp_data)/sizeof(char *); |
static int imp_data_length = sizeof(imp_data) / sizeof(char *); |
|
/** Architecture names */ |
static char * arch_data[] = { |
static char *arch_data[] = { |
"?", /* 0x0 */ |
"4", /* 0x1 */ |
"4T", /* 0x2 */ |
71,7 → 71,7 |
}; |
|
/** Length of the #arch_data array */ |
static int arch_data_length = sizeof(arch_data)/sizeof(char *); |
static int arch_data_length = sizeof(arch_data) / sizeof(char *); |
|
|
/** Retrieves processor identification from CP15 register 0. |
78,11 → 78,11 |
* |
* @param cpu Structure for storing CPU identification. |
*/ |
static void arch_cpu_identify(cpu_arch_t * cpu) |
static void arch_cpu_identify(cpu_arch_t *cpu) |
{ |
uint32_t ident; |
asm volatile ( |
"mrc p15, 0, %0, c0, c0, 0 \n" |
"mrc p15, 0, %0, c0, c0, 0\n" |
: "=r" (ident) |
); |
|
93,13 → 93,11 |
cpu->rev_num = (ident << 28) >> 28; |
} |
|
|
/** Does nothing on ARM. */ |
void cpu_arch_init(void) |
{ |
} |
|
|
/** Retrieves processor identification and stores it to #CPU.arch */ |
void cpu_identify(void) |
{ |
106,7 → 104,6 |
arch_cpu_identify(&CPU->arch); |
} |
|
|
/** Prints CPU identification. */ |
void cpu_print_report(cpu_t *m) |
{ |
114,16 → 111,20 |
char * architecture = arch_data[0]; |
cpu_arch_t * cpu_arch = &m->arch; |
|
if ( (cpu_arch->imp_num) > 0 && (cpu_arch->imp_num < (imp_data_length + IMP_DATA_START_OFFSET)) ) { |
if ((cpu_arch->imp_num) > 0 && |
(cpu_arch->imp_num < (imp_data_length + IMP_DATA_START_OFFSET))) { |
vendor = imp_data[cpu_arch->imp_num - IMP_DATA_START_OFFSET]; |
} |
|
if ( (cpu_arch->arch_num) > 0 && (cpu_arch->arch_num < arch_data_length) ) { |
if ((cpu_arch->arch_num) > 0 && |
(cpu_arch->arch_num < arch_data_length)) { |
architecture = arch_data[cpu_arch->arch_num]; |
} |
|
printf("cpu%d: vendor=%s, architecture=ARM %s, part number=%x, variant=%x, revision=%x\n", |
m->id, vendor, architecture, cpu_arch->prim_part_num, cpu_arch->variant_num, cpu_arch->rev_num); |
printf("cpu%d: vendor=%s, architecture=ARM%s, part number=%x, " |
"variant=%x, revision=%x\n", |
m->id, vendor, architecture, cpu_arch->prim_part_num, |
cpu_arch->variant_num, cpu_arch->rev_num); |
} |
|
/** @} |