Rev 2448 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2448 | Rev 2464 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | #include <arch/cpu.h> |
36 | #include <arch/cpu.h> |
37 | #include <cpu.h> |
37 | #include <cpu.h> |
38 | #include <arch.h> |
38 | #include <arch.h> |
39 | #include <print.h> |
39 | #include <print.h> |
40 | 40 | ||
41 | - | ||
42 | /** Number of indexes left out in the #imp_data array */ |
41 | /** Number of indexes left out in the #imp_data array */ |
43 | #define IMP_DATA_START_OFFSET 0x40 |
42 | #define IMP_DATA_START_OFFSET 0x40 |
44 | 43 | ||
45 | /** Implementators (vendor) names */ |
44 | /** Implementators (vendor) names */ |
46 | static char * imp_data[] = { |
45 | static char *imp_data[] = { |
47 | "?", /* IMP_DATA_START_OFFSET */ |
46 | "?", /* IMP_DATA_START_OFFSET */ |
48 | "ARM Ltd", /* 0x41 */ |
47 | "ARM Ltd", /* 0x41 */ |
49 | "", /* 0x42 */ |
48 | "", /* 0x42 */ |
50 | "", /* 0x43 */ |
49 | "", /* 0x43 */ |
51 | "Digital Equipment Corporation", /* 0x44 */ |
50 | "Digital Equipment Corporation", /* 0x44 */ |
52 | "", "", "", "", "", "", "", "", "", "", "", /* 0x4f */ |
51 | "", "", "", "", "", "", "", "", "", "", /* 0x45 - 0x4e */ |
53 | "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 0x5f */ |
52 | "", "", "", "", "", "", "", "", "", "", /* 0x4f - 0x58 */ |
54 | "", "", "", "", "", "", "", "", "", /* 0x68 */ |
53 | "", "", "", "", "", "", "", "", "", "", /* 0x59 - 0x62 */ |
- | 54 | "", "", "", "", "", "", /* 0x63 - 0x68 */ |
|
55 | "Intel Corporation" /* 0x69 */ |
55 | "Intel Corporation" /* 0x69 */ |
56 | }; |
56 | }; |
57 | 57 | ||
58 | /** Length of the #imp_data array */ |
58 | /** Length of the #imp_data array */ |
59 | static int imp_data_length = sizeof(imp_data)/sizeof(char *); |
59 | static int imp_data_length = sizeof(imp_data) / sizeof(char *); |
Line 91... | Line 91... | ||
91 | cpu->arch_num = (ident << 12) >> 28; |
91 | cpu->arch_num = (ident << 12) >> 28; |
92 | cpu->prim_part_num = (ident << 16) >> 20; |
92 | cpu->prim_part_num = (ident << 16) >> 20; |
93 | cpu->rev_num = (ident << 28) >> 28; |
93 | cpu->rev_num = (ident << 28) >> 28; |
94 | } |
94 | } |
95 | 95 | ||
96 | - | ||
97 | /** Does nothing on ARM. */ |
96 | /** Does nothing on ARM. */ |
98 | void cpu_arch_init(void) |
97 | void cpu_arch_init(void) |
99 | { |
98 | { |
100 | } |
99 | } |
101 | 100 | ||
102 | - | ||
103 | /** Retrieves processor identification and stores it to #CPU.arch */ |
101 | /** Retrieves processor identification and stores it to #CPU.arch */ |
104 | void cpu_identify(void) |
102 | void cpu_identify(void) |
105 | { |
103 | { |
106 | arch_cpu_identify(&CPU->arch); |
104 | arch_cpu_identify(&CPU->arch); |
107 | } |
105 | } |
108 | 106 | ||
109 | - | ||
110 | /** Prints CPU identification. */ |
107 | /** Prints CPU identification. */ |
111 | void cpu_print_report(cpu_t *m) |
108 | void cpu_print_report(cpu_t *m) |
112 | { |
109 | { |
113 | char * vendor = imp_data[0]; |
110 | char * vendor = imp_data[0]; |
114 | char * architecture = arch_data[0]; |
111 | char * architecture = arch_data[0]; |
115 | cpu_arch_t * cpu_arch = &m->arch; |
112 | cpu_arch_t * cpu_arch = &m->arch; |
116 | 113 | ||
- | 114 | if ((cpu_arch->imp_num) > 0 && |
|
117 | if ( (cpu_arch->imp_num) > 0 && (cpu_arch->imp_num < (imp_data_length + IMP_DATA_START_OFFSET)) ) { |
115 | (cpu_arch->imp_num < (imp_data_length + IMP_DATA_START_OFFSET))) { |
118 | vendor = imp_data[cpu_arch->imp_num - IMP_DATA_START_OFFSET]; |
116 | vendor = imp_data[cpu_arch->imp_num - IMP_DATA_START_OFFSET]; |
119 | } |
117 | } |
120 | 118 | ||
- | 119 | if ((cpu_arch->arch_num) > 0 && |
|
121 | if ( (cpu_arch->arch_num) > 0 && (cpu_arch->arch_num < arch_data_length) ) { |
120 | (cpu_arch->arch_num < arch_data_length)) { |
122 | architecture = arch_data[cpu_arch->arch_num]; |
121 | architecture = arch_data[cpu_arch->arch_num]; |
123 | } |
122 | } |
124 | 123 | ||
125 | printf("cpu%d: vendor=%s, architecture=ARM %s, part number=%x, variant=%x, revision=%x\n", |
124 | printf("cpu%d: vendor=%s, architecture=ARM%s, part number=%x, " |
- | 125 | "variant=%x, revision=%x\n", |
|
126 | m->id, vendor, architecture, cpu_arch->prim_part_num, cpu_arch->variant_num, cpu_arch->rev_num); |
126 | m->id, vendor, architecture, cpu_arch->prim_part_num, |
- | 127 | cpu_arch->variant_num, cpu_arch->rev_num); |
|
127 | } |
128 | } |
128 | 129 | ||
129 | /** @} |
130 | /** @} |
130 | */ |
131 | */ |