Changeset a35b458 in mainline for kernel/arch/ia32/src/smp/mps.c
- Timestamp:
- 2018-03-02T20:10:49Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
-
kernel/arch/ia32/src/smp/mps.c (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/smp/mps.c
r3061bc1 ra35b458 75 75 { 76 76 assert(i < processor_entry_cnt); 77 77 78 78 return processor_entries[i].l_apic_id; 79 79 } … … 82 82 { 83 83 assert(i < processor_entry_cnt); 84 84 85 85 /* 86 86 * FIXME: The current local APIC driver limits usable … … 90 90 if (i > 7) 91 91 return false; 92 92 93 93 return ((processor_entries[i].cpu_flags & 0x01) == 0x01); 94 94 } … … 97 97 { 98 98 assert(i < processor_entry_cnt); 99 99 100 100 return ((processor_entries[i].cpu_flags & 0x02) == 0x02); 101 101 } … … 104 104 { 105 105 size_t i; 106 106 107 107 for (i = 0; i < io_intr_entry_cnt; i++) { 108 108 if (io_intr_entries[i].src_bus_irq == irq && … … 110 110 return io_intr_entries[i].dst_io_apic_pin; 111 111 } 112 112 113 113 return -1; 114 114 } … … 131 131 unsigned int i; 132 132 uint8_t sum; 133 133 134 134 for (i = 0, sum = 0; i < 16; i++) 135 135 sum = (uint8_t) (sum + base[i]); 136 136 137 137 return (sum == 0); 138 138 } … … 147 147 uint8_t sum; 148 148 uint16_t i; 149 149 150 150 /* Compute the checksum for the base table */ 151 151 for (i = 0, sum = 0; i < ct->base_table_length; i++) 152 152 sum = (uint8_t) (sum + base[i]); 153 153 154 154 if (sum) 155 155 return false; 156 156 157 157 /* Compute the checksum for the extended table */ 158 158 for (i = 0, sum = 0; i < ct->ext_table_length; i++) 159 159 sum = (uint8_t) (sum + ext[i]); 160 160 161 161 return (sum == ct->ext_table_checksum); 162 162 } … … 169 169 if ((pr->cpu_flags & (1 << 0)) == 0) 170 170 return; 171 171 172 172 apic_id_mask |= (1 << pr->l_apic_id); 173 173 } … … 177 177 #ifdef MPSCT_VERBOSE 178 178 char buf[7]; 179 179 180 180 memcpy((void *) buf, (void *) bus->bus_type, 6); 181 181 buf[6] = 0; 182 182 183 183 log(LF_ARCH, LVL_DEBUG, "MPS: bus=%" PRIu8 " (%s)", bus->bus_id, buf); 184 184 #endif … … 190 190 if ((ioa->io_apic_flags & 1) == 0) 191 191 return; 192 192 193 193 if (io_apic_cnt++ > 0) { 194 194 /* … … 197 197 return; 198 198 } 199 199 200 200 io_apic = (uint32_t *) (uintptr_t) ioa->io_apic; 201 201 } … … 207 207 log_begin(LF_ARCH, LVL_DEBUG); 208 208 log_printf("MPS: "); 209 209 210 210 switch (iointr->intr_type) { 211 211 case 0: … … 222 222 break; 223 223 } 224 224 225 225 log_printf(", "); 226 226 227 227 switch (iointr->poel & 3) { 228 228 case 0: … … 239 239 break; 240 240 } 241 241 242 242 log_printf(", "); 243 243 244 244 switch ((iointr->poel >> 2) & 3) { 245 245 case 0: … … 256 256 break; 257 257 } 258 258 259 259 log_printf(", bus=%" PRIu8 " irq=%" PRIu8 " io_apic=%" PRIu8" pin=%" 260 260 PRIu8, iointr->src_bus_id, iointr->src_bus_irq, … … 270 270 log_begin(LF_ARCH, LVL_DEBUG); 271 271 log_printf("MPS: "); 272 272 273 273 switch (lintr->intr_type) { 274 274 case 0: … … 285 285 break; 286 286 } 287 287 288 288 log_printf(", "); 289 289 290 290 switch (lintr->poel & 3) { 291 291 case 0: … … 302 302 break; 303 303 } 304 304 305 305 log_printf(", "); 306 306 307 307 switch ((lintr->poel >> 2) & 3) { 308 308 case 0: … … 319 319 break; 320 320 } 321 321 322 322 log_printf(", bus=%" PRIu8 " irq=%" PRIu8 " l_apic=%" PRIu8" pin=%" 323 323 PRIu8, lintr->src_bus_id, lintr->src_bus_irq, … … 331 331 uint8_t *ext = (uint8_t *) ct + ct->base_table_length; 332 332 uint8_t *cur; 333 333 334 334 for (cur = ext; cur < ext + ct->ext_table_length; 335 335 cur += cur[CT_EXT_ENTRY_LEN]) { … … 349 349 return; 350 350 } 351 351 352 352 if (!mps_ct_check()) { 353 353 log(LF_ARCH, LVL_WARN, "MPS: Wrong ct checksum"); 354 354 return; 355 355 } 356 356 357 357 if (ct->oem_table) { 358 358 log(LF_ARCH, LVL_WARN, "MPS: ct->oem_table not supported"); 359 359 return; 360 360 } 361 361 362 362 l_apic = (uint32_t *) (uintptr_t) ct->l_apic; 363 363 364 364 uint8_t *cur = &ct->base_table[0]; 365 365 uint16_t i; 366 366 367 367 for (i = 0; i < ct->entry_count; i++) { 368 368 switch (*cur) { … … 411 411 } 412 412 } 413 413 414 414 /* 415 415 * Process extended entries. … … 432 432 unsigned int j; 433 433 unsigned int length[2] = { 1024, 64 * 1024 }; 434 434 435 435 /* 436 436 * Find MP Floating Pointer Structure … … 439 439 * 2. search 64K starting at 0xf0000 440 440 */ 441 441 442 442 addr[0] = (uint8_t *) PA2KA(ebda ? ebda : 639 * 1024); 443 443 for (i = 0; i < 2; i++) { … … 450 450 } 451 451 } 452 452 453 453 return; 454 454 455 455 fs_found: 456 456 log(LF_ARCH, LVL_NOTE, "%p: MPS Floating Pointer Structure", fs); 457 457 458 458 if ((fs->config_type == 0) && (fs->configuration_table)) { 459 459 if (fs->mpfib2 >> 7) { … … 461 461 return; 462 462 } 463 463 464 464 ct = (struct mps_ct *) PA2KA((uintptr_t) fs->configuration_table); 465 465 configure_via_ct(); 466 466 } else 467 467 configure_via_default(fs->config_type); 468 468 469 469 if (processor_entry_cnt > 0) 470 470 config.cpu_count = processor_entry_cnt;
Note:
See TracChangeset
for help on using the changeset viewer.
