Changeset 9149135 in mainline
- 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
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/include/interrupt.h
rf701b236 r9149135 35 35 #define IVT_ITEMS IDT_ITEMS 36 36 37 #define EXC_COUNT 32 38 #define IRQ_COUNT 16 39 37 40 #define IVT_EXCBASE 0 38 #define EXCLAST 31 39 40 #define IVT_IRQBASE (IVT_EXCBASE+EXCLAST+1) 41 #define IRQLAST 15 42 43 #define IVT_FREEBASE (IVT_IRQBASE+IRQLAST+1) 41 #define IVT_IRQBASE (IVT_EXCBASE+EXC_COUNT) 42 #define IVT_FREEBASE (IVT_IRQBASE+IRQ_COUNT) 44 43 45 44 #define IRQ_CLK 0 -
arch/ia32/include/smp/apic.h
rf701b236 r9149135 36 36 #define LOPRI (1<<0) 37 37 38 #define APIC_ID_COUNT 16 39 38 40 /* local APIC macros */ 39 41 #define IPI_INIT 0 … … 86 88 #define TIMER_PERIODIC 0x1 87 89 88 #define SEND_PENDING (1<<12) 90 /** Delivery status. */ 91 #define DELIVS_IDLE 0x0 92 #define DELIVS_PENDING 0x1 93 94 /** Destination masks. */ 95 #define DEST_ALL 0xff 89 96 90 97 /** Interrupt Command Register. */ … … 225 232 /** Local APIC ID Register. */ 226 233 #define L_APIC_ID (0x020/sizeof(__u32)) 227 union l apic_id {234 union l_apic_id { 228 235 __u32 value; 229 236 struct { … … 232 239 } __attribute__ ((packed)); 233 240 }; 234 typedef union l apic_id lapic_id_t;241 typedef union l_apic_id l_apic_id_t; 235 242 236 243 /* Local APIC Version Register */ … … 285 292 286 293 } __attribute__ ((packed)); 287 288 294 typedef struct io_redirection_reg io_redirection_reg_t; 295 296 297 /** IO APIC Identification Register. */ 298 union io_apic_id { 299 __u32 value; 300 struct { 301 unsigned : 24; /**< Reserved. */ 302 unsigned apic_id : 4; /**< IO APIC ID. */ 303 unsigned : 4; /**< Reserved. */ 304 } __attribute__ ((packed)); 305 }; 306 typedef union io_apic_id io_apic_id_t; 289 307 290 308 extern volatile __u32 *l_apic; -
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 -
genarch/include/acpi/madt.h
rf701b236 r9149135 80 80 __u8 bus; 81 81 __u8 source; 82 __u32 global_int r;82 __u32 global_int; 83 83 __u16 flags; 84 84 } __attribute__ ((packed)); -
genarch/src/acpi/matd.c
rf701b236 r9149135 227 227 { 228 228 ASSERT(override->source < sizeof(isa_irq_map)/sizeof(int)); 229 printf(" Remapping irq%d to IO APIC pin%d\n", override->source, override->global_intr);230 isa_irq_map[override->source] = override->global_intr;231 229 printf("MADT: ignoring %s entry: bus=%d, source=%d, global_int=%d, flags=%W\n", 230 entry[override->header.type], override->bus, override->source, 231 override->global_int, override->flags); 232 232 } 233 233
Note:
See TracChangeset
for help on using the changeset viewer.