Rev 2101 | Rev 2462 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2101 | Rev 2441 | ||
|---|---|---|---|
| Line 52... | Line 52... | ||
| 52 | */ |
52 | */ |
| 53 | 53 | ||
| 54 | #define FS_SIGNATURE 0x5f504d5f |
54 | #define FS_SIGNATURE 0x5f504d5f |
| 55 | #define CT_SIGNATURE 0x504d4350 |
55 | #define CT_SIGNATURE 0x504d4350 |
| 56 | 56 | ||
| 57 | int mps_fs_check(uint8_t *base); |
57 | static int mps_fs_check(uint8_t *base); |
| 58 | int mps_ct_check(void); |
58 | static int mps_ct_check(void); |
| 59 | 59 | ||
| 60 | int configure_via_ct(void); |
60 | static int configure_via_ct(void); |
| 61 | int configure_via_default(uint8_t n); |
61 | static int configure_via_default(uint8_t n); |
| 62 | 62 | ||
| 63 | int ct_processor_entry(struct __processor_entry *pr); |
63 | static int ct_processor_entry(struct __processor_entry *pr); |
| 64 | void ct_bus_entry(struct __bus_entry *bus); |
64 | static void ct_bus_entry(struct __bus_entry *bus); |
| 65 | void ct_io_apic_entry(struct __io_apic_entry *ioa); |
65 | static void ct_io_apic_entry(struct __io_apic_entry *ioa); |
| 66 | void ct_io_intr_entry(struct __io_intr_entry *iointr); |
66 | static void ct_io_intr_entry(struct __io_intr_entry *iointr); |
| 67 | void ct_l_intr_entry(struct __l_intr_entry *lintr); |
67 | static void ct_l_intr_entry(struct __l_intr_entry *lintr); |
| 68 | 68 | ||
| 69 | void ct_extended_entries(void); |
69 | static void ct_extended_entries(void); |
| 70 | 70 | ||
| 71 | static struct mps_fs *fs; |
71 | static struct mps_fs *fs; |
| 72 | static struct mps_ct *ct; |
72 | static struct mps_ct *ct; |
| 73 | 73 | ||
| 74 | struct __processor_entry *processor_entries = NULL; |
74 | struct __processor_entry *processor_entries = NULL; |
| Line 106... | Line 106... | ||
| 106 | } |
106 | } |
| 107 | 107 | ||
| 108 | bool is_cpu_enabled(index_t i) |
108 | bool is_cpu_enabled(index_t i) |
| 109 | { |
109 | { |
| 110 | ASSERT(i < processor_entry_cnt); |
110 | ASSERT(i < processor_entry_cnt); |
| 111 | return processor_entries[i].cpu_flags & 0x1; |
111 | return (bool) ((processor_entries[i].cpu_flags & 0x01) == 0x01); |
| 112 | } |
112 | } |
| 113 | 113 | ||
| 114 | bool is_bsp(index_t i) |
114 | bool is_bsp(index_t i) |
| 115 | { |
115 | { |
| 116 | ASSERT(i < processor_entry_cnt); |
116 | ASSERT(i < processor_entry_cnt); |
| 117 | return processor_entries[i].cpu_flags & 0x2; |
117 | return (bool) ((processor_entries[i].cpu_flags & 0x02) == 0x02); |
| 118 | } |
118 | } |
| 119 | 119 | ||
| 120 | uint8_t get_cpu_apic_id(index_t i) |
120 | uint8_t get_cpu_apic_id(index_t i) |
| 121 | { |
121 | { |
| 122 | ASSERT(i < processor_entry_cnt); |
122 | ASSERT(i < processor_entry_cnt); |
| Line 131... | Line 131... | ||
| 131 | { |
131 | { |
| 132 | unsigned int i; |
132 | unsigned int i; |
| 133 | uint8_t sum; |
133 | uint8_t sum; |
| 134 | 134 | ||
| 135 | for (i = 0, sum = 0; i < 16; i++) |
135 | for (i = 0, sum = 0; i < 16; i++) |
| 136 | sum += base[i]; |
136 | sum = (uint8_t) (sum + base[i]); |
| 137 | 137 | ||
| 138 | return !sum; |
138 | return !sum; |
| 139 | } |
139 | } |
| 140 | 140 | ||
| 141 | /* |
141 | /* |
| Line 148... | Line 148... | ||
| 148 | uint8_t sum; |
148 | uint8_t sum; |
| 149 | int i; |
149 | int i; |
| 150 | 150 | ||
| 151 | /* count the checksum for the base table */ |
151 | /* count the checksum for the base table */ |
| 152 | for (i=0,sum=0; i < ct->base_table_length; i++) |
152 | for (i=0,sum=0; i < ct->base_table_length; i++) |
| 153 | sum += base[i]; |
153 | sum = (uint8_t) (sum + base[i]); |
| 154 | 154 | ||
| 155 | if (sum) |
155 | if (sum) |
| 156 | return 0; |
156 | return 0; |
| 157 | 157 | ||
| 158 | /* count the checksum for the extended table */ |
158 | /* count the checksum for the extended table */ |
| 159 | for (i=0,sum=0; i < ct->ext_table_length; i++) |
159 | for (i=0,sum=0; i < ct->ext_table_length; i++) |
| 160 | sum += ext[i]; |
160 | sum = (uint8_t) (sum + ext[i]); |
| 161 | 161 | ||
| 162 | return sum == ct->ext_table_checksum; |
162 | return sum == ct->ext_table_checksum; |
| 163 | } |
163 | } |
| 164 | 164 | ||
| 165 | void mps_init(void) |
165 | void mps_init(void) |
| Line 284... | Line 284... | ||
| 284 | */ |
284 | */ |
| 285 | ct_extended_entries(); |
285 | ct_extended_entries(); |
| 286 | return cnt; |
286 | return cnt; |
| 287 | } |
287 | } |
| 288 | 288 | ||
| 289 | int configure_via_default(uint8_t n) |
289 | int configure_via_default(uint8_t n __attribute__((unused))) |
| 290 | { |
290 | { |
| 291 | /* |
291 | /* |
| 292 | * Not yet implemented. |
292 | * Not yet implemented. |
| 293 | */ |
293 | */ |
| 294 | printf("%s: not supported\n", __FUNCTION__); |
294 | printf("%s: not supported\n", __FUNCTION__); |
| 295 | return 1; |
295 | return 1; |
| 296 | } |
296 | } |
| 297 | 297 | ||
| 298 | 298 | ||
| 299 | int ct_processor_entry(struct __processor_entry *pr) |
299 | int ct_processor_entry(struct __processor_entry *pr __attribute__((unused))) |
| 300 | { |
300 | { |
| 301 | /* |
301 | /* |
| 302 | * Ignore processors which are not marked enabled. |
302 | * Ignore processors which are not marked enabled. |
| 303 | */ |
303 | */ |
| 304 | if ((pr->cpu_flags & (1<<0)) == 0) |
304 | if ((pr->cpu_flags & (1<<0)) == 0) |
| Line 306... | Line 306... | ||
| 306 | 306 | ||
| 307 | apic_id_mask |= (1<<pr->l_apic_id); |
307 | apic_id_mask |= (1<<pr->l_apic_id); |
| 308 | return 1; |
308 | return 1; |
| 309 | } |
309 | } |
| 310 | 310 | ||
| 311 | void ct_bus_entry(struct __bus_entry *bus) |
311 | void ct_bus_entry(struct __bus_entry *bus __attribute__((unused))) |
| 312 | { |
312 | { |
| 313 | #ifdef MPSCT_VERBOSE |
313 | #ifdef MPSCT_VERBOSE |
| 314 | char buf[7]; |
314 | char buf[7]; |
| 315 | memcpy((void *) buf, (void *) bus->bus_type, 6); |
315 | memcpy((void *) buf, (void *) bus->bus_type, 6); |
| 316 | buf[6] = 0; |
316 | buf[6] = 0; |
| Line 335... | Line 335... | ||
| 335 | 335 | ||
| 336 | io_apic = (uint32_t *)(uintptr_t)ioa->io_apic; |
336 | io_apic = (uint32_t *)(uintptr_t)ioa->io_apic; |
| 337 | } |
337 | } |
| 338 | 338 | ||
| 339 | //#define MPSCT_VERBOSE |
339 | //#define MPSCT_VERBOSE |
| 340 | void ct_io_intr_entry(struct __io_intr_entry *iointr) |
340 | void ct_io_intr_entry(struct __io_intr_entry *iointr __attribute__((unused))) |
| 341 | { |
341 | { |
| 342 | #ifdef MPSCT_VERBOSE |
342 | #ifdef MPSCT_VERBOSE |
| 343 | switch (iointr->intr_type) { |
343 | switch (iointr->intr_type) { |
| 344 | case 0: printf("INT"); break; |
344 | case 0: printf("INT"); break; |
| 345 | case 1: printf("NMI"); break; |
345 | case 1: printf("NMI"); break; |
| Line 366... | Line 366... | ||
| 366 | printf("io_apic%d,pin%d", iointr->dst_io_apic_id, iointr->dst_io_apic_pin); |
366 | printf("io_apic%d,pin%d", iointr->dst_io_apic_id, iointr->dst_io_apic_pin); |
| 367 | putchar('\n'); |
367 | putchar('\n'); |
| 368 | #endif |
368 | #endif |
| 369 | } |
369 | } |
| 370 | 370 | ||
| 371 | void ct_l_intr_entry(struct __l_intr_entry *lintr) |
371 | void ct_l_intr_entry(struct __l_intr_entry *lintr __attribute__((unused))) |
| 372 | { |
372 | { |
| 373 | #ifdef MPSCT_VERBOSE |
373 | #ifdef MPSCT_VERBOSE |
| 374 | switch (lintr->intr_type) { |
374 | switch (lintr->intr_type) { |
| 375 | case 0: printf("INT"); break; |
375 | case 0: printf("INT"); break; |
| 376 | case 1: printf("NMI"); break; |
376 | case 1: printf("NMI"); break; |