Changeset 9149135 in mainline for arch/ia32/src/smp/apic.c
- Timestamp:
- 2005-11-24T18:43:46Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 78c32b4
- Parents:
- f701b236
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/smp/apic.c
rf701b236 r9149135 65 65 static int apic_poll_errors(void); 66 66 67 #ifdef LAPIC_VERBOSE 67 68 static char *delmod_str[] = { 68 69 "Fixed", … … 105 106 "Polarity Low" 106 107 }; 108 #endif /* LAPIC_VERBOSE */ 107 109 108 110 /** Initialize APIC on BSP. */ 109 111 void apic_init(void) 110 112 { 111 __u32 tmp, id, i; 113 io_apic_id_t idreg; 114 int i; 112 115 113 116 trap_register(VECTOR_APIC_SPUR, apic_spurious); … … 124 127 io_apic_disable_irqs(0xffff); 125 128 trap_register(VECTOR_CLK, l_apic_timer_interrupt); 126 for (i =0; i<16; i++) {129 for (i = 0; i < IRQ_COUNT; i++) { 127 130 int pin; 128 131 129 132 if ((pin = smp_irq_to_pin(i)) != -1) { 130 io_apic_change_ioredtbl(pin, 0xff, IVT_IRQBASE+i, LOPRI);133 io_apic_change_ioredtbl(pin, DEST_ALL, IVT_IRQBASE+i, LOPRI); 131 134 } 132 135 } 133 136 134 135 137 /* 136 138 * Ensure that io_apic has unique ID. 137 139 */ 138 tmp = io_apic_read(IOAPICID); 139 id = (tmp >> 24) & 0xf; 140 if ((1<<id) & apic_id_mask) { 141 int i; 142 143 for (i=0; i<15; i++) { 140 idreg.value = io_apic_read(IOAPICID); 141 if ((1<<idreg.apic_id) & apic_id_mask) { /* see if IO APIC ID is used already */ 142 for (i = 0; i < APIC_ID_COUNT; i++) { 144 143 if (!((1<<i) & apic_id_mask)) { 145 io_apic_write(IOAPICID, (tmp & (~(0xf<<24))) | (i<<24)); 144 idreg.apic_id = i; 145 io_apic_write(IOAPICID, idreg.value); 146 146 break; 147 147 } … … 153 153 */ 154 154 l_apic_init(); 155 155 156 l_apic_debug(); 156 157 } … … 179 180 180 181 if (esr.send_checksum_error) 181 printf("Send C SError\n");182 printf("Send Checksum Error\n"); 182 183 if (esr.receive_checksum_error) 183 printf("Receive C SError\n");184 printf("Receive Checksum Error\n"); 184 185 if (esr.send_accept_error) 185 186 printf("Send Accept Error\n"); … … 217 218 218 219 icr.lo = l_apic[ICRlo]; 219 if (icr. lo & SEND_PENDING)220 if (icr.delivs == DELIVS_PENDING) 220 221 printf("IPI is pending.\n"); 221 222 … … 260 261 261 262 icr.lo = l_apic[ICRlo]; 262 if (icr. lo & SEND_PENDING)263 if (icr.delivs == DELIVS_PENDING) 263 264 printf("IPI is pending.\n"); 264 265 … … 293 294 } 294 295 295 296 296 return apic_poll_errors(); 297 297 } … … 367 367 368 368 l_apic[ICRT] = t1-t2; 369 370 369 } 371 370 … … 414 413 __u8 l_apic_id(void) 415 414 { 416 l apic_id_t lapic_id;417 418 lapic_id.value = l_apic[L_APIC_ID];419 return lapic_id.apic_id;415 l_apic_id_t idreg; 416 417 idreg.value = l_apic[L_APIC_ID]; 418 return idreg.apic_id; 420 419 } 421 420 … … 491 490 492 491 for (i=0;i<16;i++) { 493 if ( (irqmask>>i) & 1) {492 if (irqmask & (1<<i)) { 494 493 /* 495 494 * Mask the signal input in IO APIC if there is a … … 517 516 518 517 for (i=0;i<16;i++) { 519 if ( (irqmask>>i) & 1) {518 if (irqmask & (1<<i)) { 520 519 /* 521 520 * Unmask the signal input in IO APIC if there is a … … 531 530 } 532 531 } 533 534 532 } 535 533
Note:
See TracChangeset
for help on using the changeset viewer.