aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/io_apic_64.c
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2008-07-10 14:16:47 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-12 02:44:56 -0400
commit4dc2f96cacd1e74c688f94348a3bfd0a980817d5 (patch)
treefc6674718336d4a3049390bef517a0425e1929e5 /arch/x86/kernel/io_apic_64.c
parentd94d93ca5cc36cd78c532def62772c98fe8ba5d7 (diff)
x64, x2apic/intr-remap: ioapic routines which deal with initial io-apic RTE setup
Generic ioapic specific routines which be used later during enabling interrupt-remapping. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: akpm@linux-foundation.org Cc: arjan@linux.intel.com Cc: andi@firstfloor.org Cc: ebiederm@xmission.com Cc: jbarnes@virtuousgeek.org Cc: steiner@sgi.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/io_apic_64.c')
-rw-r--r--arch/x86/kernel/io_apic_64.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 9e645cba11c4..84dd63c13d63 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -114,6 +114,9 @@ DEFINE_SPINLOCK(vector_lock);
114 */ 114 */
115int nr_ioapic_registers[MAX_IO_APICS]; 115int nr_ioapic_registers[MAX_IO_APICS];
116 116
117/* I/O APIC RTE contents at the OS boot up */
118struct IO_APIC_route_entry *early_ioapic_entries[MAX_IO_APICS];
119
117/* I/O APIC entries */ 120/* I/O APIC entries */
118struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; 121struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
119int nr_ioapics; 122int nr_ioapics;
@@ -446,6 +449,69 @@ static void clear_IO_APIC (void)
446 clear_IO_APIC_pin(apic, pin); 449 clear_IO_APIC_pin(apic, pin);
447} 450}
448 451
452/*
453 * Saves and masks all the unmasked IO-APIC RTE's
454 */
455int save_mask_IO_APIC_setup(void)
456{
457 union IO_APIC_reg_01 reg_01;
458 unsigned long flags;
459 int apic, pin;
460
461 /*
462 * The number of IO-APIC IRQ registers (== #pins):
463 */
464 for (apic = 0; apic < nr_ioapics; apic++) {
465 spin_lock_irqsave(&ioapic_lock, flags);
466 reg_01.raw = io_apic_read(apic, 1);
467 spin_unlock_irqrestore(&ioapic_lock, flags);
468 nr_ioapic_registers[apic] = reg_01.bits.entries+1;
469 }
470
471 for (apic = 0; apic < nr_ioapics; apic++) {
472 early_ioapic_entries[apic] =
473 kzalloc(sizeof(struct IO_APIC_route_entry) *
474 nr_ioapic_registers[apic], GFP_KERNEL);
475 if (!early_ioapic_entries[apic])
476 return -ENOMEM;
477 }
478
479 for (apic = 0; apic < nr_ioapics; apic++)
480 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
481 struct IO_APIC_route_entry entry;
482
483 entry = early_ioapic_entries[apic][pin] =
484 ioapic_read_entry(apic, pin);
485 if (!entry.mask) {
486 entry.mask = 1;
487 ioapic_write_entry(apic, pin, entry);
488 }
489 }
490 return 0;
491}
492
493void restore_IO_APIC_setup(void)
494{
495 int apic, pin;
496
497 for (apic = 0; apic < nr_ioapics; apic++)
498 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
499 ioapic_write_entry(apic, pin,
500 early_ioapic_entries[apic][pin]);
501}
502
503void reinit_intr_remapped_IO_APIC(int intr_remapping)
504{
505 /*
506 * for now plain restore of previous settings.
507 * TBD: In the case of OS enabling interrupt-remapping,
508 * IO-APIC RTE's need to be setup to point to interrupt-remapping
509 * table entries. for now, do a plain restore, and wait for
510 * the setup_IO_APIC_irqs() to do proper initialization.
511 */
512 restore_IO_APIC_setup();
513}
514
449int skip_ioapic_setup; 515int skip_ioapic_setup;
450int ioapic_force; 516int ioapic_force;
451 517