Changeset a83a802 in mainline for arch/ia32/src
- Timestamp:
- 2005-11-23T13:28:17Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8418c7d
- Parents:
- 607c5f9
- Location:
- arch/ia32/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/drivers/i8042.c
r607c5f9 ra83a802 43 43 * It takes care of low-level keyboard functions. 44 44 */ 45 46 #define i8042_DATA 0x60 47 #define i8042_STATUS 0x64 48 49 /** Keyboard commands. */ 50 #define KBD_ENABLE 0xf4 51 #define KBD_DISABLE 0xf5 52 #define KBD_ACK 0xfa 45 53 46 54 #define SPECIAL '?' … … 231 239 { 232 240 trap_register(VECTOR_KBD, i8042_interrupt); 241 trap_virtual_enable_irqs(1<<IRQ_KBD); 233 242 spinlock_initialize(&keylock); 234 243 chardev_initialize(&kbrd, &ops); … … 246 255 247 256 trap_virtual_eoi(); 248 x = inb( 0x60);257 x = inb(i8042_DATA); 249 258 if (x & KEY_RELEASE) 250 259 key_released(x ^ KEY_RELEASE); -
arch/ia32/src/ia32.c
r607c5f9 ra83a802 57 57 if (config.cpu_active == 1) { 58 58 bios_init(); 59 i8042_init(); /* keyboard controller */60 59 i8259_init(); /* PIC */ 61 60 i8254_init(); /* hard clock */ … … 90 89 void arch_post_smp_init(void) 91 90 { 92 trap_virtual_enable_irqs(1<<IRQ_KBD);91 i8042_init(); /* keyboard controller */ 93 92 } 94 93 -
arch/ia32/src/smp/apic.c
r607c5f9 ra83a802 41 41 42 42 /* 43 * This is functional, far-from-general-enough interface to the APIC. 44 * Advanced Programmable Interrupt Controller for MP systems. 43 * Advanced Programmable Interrupt Controller for SMP systems. 45 44 * Tested on: 46 45 * Bochs 2.0.2 - Bochs 2.2 with 2-8 CPUs … … 83 82 io_apic_disable_irqs(0xffff); 84 83 trap_register(VECTOR_CLK, l_apic_timer_interrupt); 85 for (i= 1; i<16; i++) {84 for (i=0; i<16; i++) { 86 85 int pin; 87 86 88 if ((pin = mps_irq_to_pin(i)) != -1) 89 io_apic_change_ioredtbl(pin,0xf,IVT_IRQBASE+i,LOPRI); 87 if ((pin = smp_irq_to_pin(i)) != -1) { 88 io_apic_change_ioredtbl(pin,0xff,IVT_IRQBASE+i,LOPRI); 89 } 90 90 } 91 91 … … 353 353 void io_apic_change_ioredtbl(int signal, int dest, __u8 v, int flags) 354 354 { 355 __u32 reglo, reghi;355 io_redirection_reg_t reg; 356 356 int dlvr = 0; 357 357 358 358 if (flags & LOPRI) 359 dlvr = 1; 360 361 reglo = io_apic_read(IOREDTBL + signal*2); 362 reghi = io_apic_read(IOREDTBL + signal*2 + 1); 363 364 reghi &= ~0x0f000000; 365 reghi |= (dest<<24); 366 367 reglo &= (~0x1ffff) | (1<<16); /* don't touch the mask */ 368 reglo |= (0<<15) | (0<<13) | (0<<11) | (dlvr<<8) | v; 369 370 io_apic_write(IOREDTBL + signal*2, reglo); 371 io_apic_write(IOREDTBL + signal*2 + 1, reghi); 359 dlvr = DELMOD_LOWPRI; 360 361 362 reg.lo = io_apic_read(IOREDTBL + signal*2); 363 reg.hi = io_apic_read(IOREDTBL + signal*2 + 1); 364 365 reg.dest = dest; 366 reg.destmod = DESTMOD_LOGIC; 367 reg.trigger_mode = TRIGMOD_EDGE; 368 reg.intpol = POLARITY_HIGH; 369 reg.delmod = dlvr; 370 reg.intvec = v; 371 372 io_apic_write(IOREDTBL + signal*2, reg.lo); 373 io_apic_write(IOREDTBL + signal*2 + 1, reg.hi); 372 374 } 373 375 374 376 void io_apic_disable_irqs(__u16 irqmask) 375 377 { 376 i nt i,pin;377 __u32 reglo;378 io_redirection_reg_t reg; 379 int i, pin; 378 380 379 381 for (i=0;i<16;i++) { … … 383 385 * mapping for the respective IRQ number. 384 386 */ 385 pin = mps_irq_to_pin(i);387 pin = smp_irq_to_pin(i); 386 388 if (pin != -1) { 387 reg lo = io_apic_read(IOREDTBL + pin*2);388 reg lo |= (1<<16);389 io_apic_write(IOREDTBL + pin*2, reglo);389 reg.lo = io_apic_read(IOREDTBL + pin*2); 390 reg.masked = true; 391 io_apic_write(IOREDTBL + pin*2, reg.lo); 390 392 } 391 393 … … 396 398 void io_apic_enable_irqs(__u16 irqmask) 397 399 { 398 int i, pin;399 __u32 reglo;400 int i, pin; 401 io_redirection_reg_t reg; 400 402 401 403 for (i=0;i<16;i++) { … … 405 407 * mapping for the respective IRQ number. 406 408 */ 407 pin = mps_irq_to_pin(i);409 pin = smp_irq_to_pin(i); 408 410 if (pin != -1) { 409 reg lo = io_apic_read(IOREDTBL + pin*2);410 reg lo &= ~(1<<16);411 io_apic_write(IOREDTBL + pin*2, reglo);411 reg.lo = io_apic_read(IOREDTBL + pin*2); 412 reg.masked = false; 413 io_apic_write(IOREDTBL + pin*2, reg.lo); 412 414 } 413 415 -
arch/ia32/src/smp/mps.c
r607c5f9 ra83a802 90 90 static bool is_bsp(index_t i); 91 91 static __u8 get_cpu_apic_id(index_t i); 92 static int mps_irq_to_pin(int irq); 92 93 93 94 struct smp_config_operations mps_config_operations = { … … 95 96 .cpu_enabled = is_cpu_enabled, 96 97 .cpu_bootstrap = is_bsp, 97 .cpu_apic_id = get_cpu_apic_id 98 .cpu_apic_id = get_cpu_apic_id, 99 .irq_to_pin = mps_irq_to_pin 98 100 }; 99 101 -
arch/ia32/src/smp/smp.c
r607c5f9 ra83a802 166 166 } 167 167 168 int smp_irq_to_pin(int irq) 169 { 170 ASSERT(ops != NULL); 171 return ops->irq_to_pin(irq); 172 } 173 168 174 #endif /* CONFIG_SMP */
Note:
See TracChangeset
for help on using the changeset viewer.