aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2011-05-18 19:31:36 -0400
committerIngo Molnar <mingo@elte.hu>2011-05-20 07:40:57 -0400
commit57a6f74023c7fd943160d7635bbc8d9f66e2ab54 (patch)
tree36d084d8a479dbebfb4e2466161686bc08a638f1 /arch/x86/kernel/apic
parentb69c6c3becc102f3eebc4ebba582abfe76be3f45 (diff)
x86, ioapic: Consolidate ioapic_saved_data[] into 'struct ioapic'
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: daniel.blueman@gmail.com Link: http://lkml.kernel.org/r/20110518233157.830697056@sbsiddha-MOBL3.sc.intel.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic')
-rw-r--r--arch/x86/kernel/apic/io_apic.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 2a18a98a3b04..ceff2d26e498 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -81,6 +81,10 @@ static struct ioapic {
81 * # of IRQ routing registers 81 * # of IRQ routing registers
82 */ 82 */
83 int nr_registers; 83 int nr_registers;
84 /*
85 * Saved state during suspend/resume, or while enabling intr-remap.
86 */
87 struct IO_APIC_route_entry *saved_registers;
84} ioapics[MAX_IO_APICS]; 88} ioapics[MAX_IO_APICS];
85 89
86/* I/O APIC entries */ 90/* I/O APIC entries */
@@ -102,11 +106,6 @@ int mp_irq_entries;
102/* GSI interrupts */ 106/* GSI interrupts */
103static int nr_irqs_gsi = NR_IRQS_LEGACY; 107static int nr_irqs_gsi = NR_IRQS_LEGACY;
104 108
105/*
106 * Saved I/O APIC state during suspend/resume, or while enabling intr-remap.
107*/
108static struct IO_APIC_route_entry *ioapic_saved_data[MAX_IO_APICS];
109
110#if defined (CONFIG_MCA) || defined (CONFIG_EISA) 109#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
111int mp_bus_id_to_type[MAX_MP_BUSSES]; 110int mp_bus_id_to_type[MAX_MP_BUSSES];
112#endif 111#endif
@@ -187,10 +186,10 @@ int __init arch_early_irq_init(void)
187 } 186 }
188 187
189 for (i = 0; i < nr_ioapics; i++) { 188 for (i = 0; i < nr_ioapics; i++) {
190 ioapic_saved_data[i] = 189 ioapics[i].saved_registers =
191 kzalloc(sizeof(struct IO_APIC_route_entry) * 190 kzalloc(sizeof(struct IO_APIC_route_entry) *
192 ioapics[i].nr_registers, GFP_KERNEL); 191 ioapics[i].nr_registers, GFP_KERNEL);
193 if (!ioapic_saved_data[i]) 192 if (!ioapics[i].saved_registers)
194 pr_err("IOAPIC %d: suspend/resume impossible!\n", i); 193 pr_err("IOAPIC %d: suspend/resume impossible!\n", i);
195 } 194 }
196 195
@@ -639,13 +638,13 @@ int save_ioapic_entries(void)
639 int err = 0; 638 int err = 0;
640 639
641 for (apic = 0; apic < nr_ioapics; apic++) { 640 for (apic = 0; apic < nr_ioapics; apic++) {
642 if (!ioapic_saved_data[apic]) { 641 if (!ioapics[apic].saved_registers) {
643 err = -ENOMEM; 642 err = -ENOMEM;
644 continue; 643 continue;
645 } 644 }
646 645
647 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) 646 for (pin = 0; pin < ioapics[apic].nr_registers; pin++)
648 ioapic_saved_data[apic][pin] = 647 ioapics[apic].saved_registers[pin] =
649 ioapic_read_entry(apic, pin); 648 ioapic_read_entry(apic, pin);
650 } 649 }
651 650
@@ -660,13 +659,13 @@ void mask_ioapic_entries(void)
660 int apic, pin; 659 int apic, pin;
661 660
662 for (apic = 0; apic < nr_ioapics; apic++) { 661 for (apic = 0; apic < nr_ioapics; apic++) {
663 if (!ioapic_saved_data[apic]) 662 if (ioapics[apic].saved_registers)
664 continue; 663 continue;
665 664
666 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) { 665 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) {
667 struct IO_APIC_route_entry entry; 666 struct IO_APIC_route_entry entry;
668 667
669 entry = ioapic_saved_data[apic][pin]; 668 entry = ioapics[apic].saved_registers[pin];
670 if (!entry.mask) { 669 if (!entry.mask) {
671 entry.mask = 1; 670 entry.mask = 1;
672 ioapic_write_entry(apic, pin, entry); 671 ioapic_write_entry(apic, pin, entry);
@@ -676,19 +675,19 @@ void mask_ioapic_entries(void)
676} 675}
677 676
678/* 677/*
679 * Restore IO APIC entries which was saved in ioapic_saved_data 678 * Restore IO APIC entries which was saved in the ioapic structure.
680 */ 679 */
681int restore_ioapic_entries(void) 680int restore_ioapic_entries(void)
682{ 681{
683 int apic, pin; 682 int apic, pin;
684 683
685 for (apic = 0; apic < nr_ioapics; apic++) { 684 for (apic = 0; apic < nr_ioapics; apic++) {
686 if (!ioapic_saved_data[apic]) 685 if (ioapics[apic].saved_registers)
687 continue; 686 continue;
688 687
689 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) 688 for (pin = 0; pin < ioapics[apic].nr_registers; pin++)
690 ioapic_write_entry(apic, pin, 689 ioapic_write_entry(apic, pin,
691 ioapic_saved_data[apic][pin]); 690 ioapics[apic].saved_registers[pin]);
692 } 691 }
693 return 0; 692 return 0;
694} 693}