diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-11 04:49:40 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-11 04:49:40 -0500 |
commit | d5b5a232b2f2b6e64762308e90d47248dddfd72f (patch) | |
tree | 968c0568b62d6eeeec22a2ca07f1be6de07c437d | |
parent | 0e81cb59c7120191c0243c686b591797bc79e5c6 (diff) | |
parent | bf56957d176c279175464f385f3eb03d65819328 (diff) |
Merge branch 'x86/apic' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen into x86/apic
-rw-r--r-- | arch/x86/include/asm/apic.h | 35 | ||||
-rw-r--r-- | arch/x86/include/asm/hw_irq.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/io_apic.h | 6 | ||||
-rw-r--r-- | arch/x86/include/asm/mpspec.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 18 | ||||
-rw-r--r-- | arch/x86/kernel/io_apic.c | 10 |
6 files changed, 56 insertions, 17 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index b03711d7990b..f4835a1be360 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -139,12 +139,35 @@ struct apic_ops { | |||
139 | 139 | ||
140 | extern struct apic_ops *apic_ops; | 140 | extern struct apic_ops *apic_ops; |
141 | 141 | ||
142 | #define apic_read (apic_ops->read) | 142 | static inline u32 apic_read(u32 reg) |
143 | #define apic_write (apic_ops->write) | 143 | { |
144 | #define apic_icr_read (apic_ops->icr_read) | 144 | return apic_ops->read(reg); |
145 | #define apic_icr_write (apic_ops->icr_write) | 145 | } |
146 | #define apic_wait_icr_idle (apic_ops->wait_icr_idle) | 146 | |
147 | #define safe_apic_wait_icr_idle (apic_ops->safe_wait_icr_idle) | 147 | static inline void apic_write(u32 reg, u32 val) |
148 | { | ||
149 | apic_ops->write(reg, val); | ||
150 | } | ||
151 | |||
152 | static inline u64 apic_icr_read(void) | ||
153 | { | ||
154 | return apic_ops->icr_read(); | ||
155 | } | ||
156 | |||
157 | static inline void apic_icr_write(u32 low, u32 high) | ||
158 | { | ||
159 | apic_ops->icr_write(low, high); | ||
160 | } | ||
161 | |||
162 | static inline void apic_wait_icr_idle(void) | ||
163 | { | ||
164 | apic_ops->wait_icr_idle(); | ||
165 | } | ||
166 | |||
167 | static inline u32 safe_apic_wait_icr_idle(void) | ||
168 | { | ||
169 | return apic_ops->safe_wait_icr_idle(); | ||
170 | } | ||
148 | 171 | ||
149 | extern int get_physical_broadcast(void); | 172 | extern int get_physical_broadcast(void); |
150 | 173 | ||
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index 1b82781b898d..370e1c83bb49 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h | |||
@@ -65,9 +65,7 @@ extern void disable_IO_APIC(void); | |||
65 | extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn); | 65 | extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn); |
66 | extern void setup_ioapic_dest(void); | 66 | extern void setup_ioapic_dest(void); |
67 | 67 | ||
68 | #ifdef CONFIG_X86_64 | ||
69 | extern void enable_IO_APIC(void); | 68 | extern void enable_IO_APIC(void); |
70 | #endif | ||
71 | 69 | ||
72 | /* Statistics */ | 70 | /* Statistics */ |
73 | extern atomic_t irq_err_count; | 71 | extern atomic_t irq_err_count; |
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 309d0e23193a..59cb4a1317b7 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -169,6 +169,12 @@ extern void reinit_intr_remapped_IO_APIC(int); | |||
169 | 169 | ||
170 | extern void probe_nr_irqs_gsi(void); | 170 | extern void probe_nr_irqs_gsi(void); |
171 | 171 | ||
172 | extern int setup_ioapic_entry(int apic, int irq, | ||
173 | struct IO_APIC_route_entry *entry, | ||
174 | unsigned int destination, int trigger, | ||
175 | int polarity, int vector); | ||
176 | extern void ioapic_write_entry(int apic, int pin, | ||
177 | struct IO_APIC_route_entry e); | ||
172 | #else /* !CONFIG_X86_IO_APIC */ | 178 | #else /* !CONFIG_X86_IO_APIC */ |
173 | #define io_apic_assign_pci_irqs 0 | 179 | #define io_apic_assign_pci_irqs 0 |
174 | static const int timer_through_8259 = 0; | 180 | static const int timer_through_8259 = 0; |
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h index 8c5620147c40..5916c8df09d9 100644 --- a/arch/x86/include/asm/mpspec.h +++ b/arch/x86/include/asm/mpspec.h | |||
@@ -77,6 +77,8 @@ extern int acpi_probe_gsi(void); | |||
77 | #ifdef CONFIG_X86_IO_APIC | 77 | #ifdef CONFIG_X86_IO_APIC |
78 | extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin, | 78 | extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin, |
79 | u32 gsi, int triggering, int polarity); | 79 | u32 gsi, int triggering, int polarity); |
80 | extern int mp_find_ioapic(int gsi); | ||
81 | extern int mp_find_ioapic_pin(int ioapic, int gsi); | ||
80 | #else | 82 | #else |
81 | static inline int | 83 | static inline int |
82 | mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin, | 84 | mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin, |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index c334fe75dcd6..bba162c81d5b 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -872,7 +872,7 @@ static struct { | |||
872 | DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); | 872 | DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); |
873 | } mp_ioapic_routing[MAX_IO_APICS]; | 873 | } mp_ioapic_routing[MAX_IO_APICS]; |
874 | 874 | ||
875 | static int mp_find_ioapic(int gsi) | 875 | int mp_find_ioapic(int gsi) |
876 | { | 876 | { |
877 | int i = 0; | 877 | int i = 0; |
878 | 878 | ||
@@ -887,6 +887,16 @@ static int mp_find_ioapic(int gsi) | |||
887 | return -1; | 887 | return -1; |
888 | } | 888 | } |
889 | 889 | ||
890 | int mp_find_ioapic_pin(int ioapic, int gsi) | ||
891 | { | ||
892 | if (WARN_ON(ioapic == -1)) | ||
893 | return -1; | ||
894 | if (WARN_ON(gsi > mp_ioapic_routing[ioapic].gsi_end)) | ||
895 | return -1; | ||
896 | |||
897 | return gsi - mp_ioapic_routing[ioapic].gsi_base; | ||
898 | } | ||
899 | |||
890 | static u8 __init uniq_ioapic_id(u8 id) | 900 | static u8 __init uniq_ioapic_id(u8 id) |
891 | { | 901 | { |
892 | #ifdef CONFIG_X86_32 | 902 | #ifdef CONFIG_X86_32 |
@@ -1022,7 +1032,7 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
1022 | ioapic = mp_find_ioapic(gsi); | 1032 | ioapic = mp_find_ioapic(gsi); |
1023 | if (ioapic < 0) | 1033 | if (ioapic < 0) |
1024 | return; | 1034 | return; |
1025 | pin = gsi - mp_ioapic_routing[ioapic].gsi_base; | 1035 | pin = mp_find_ioapic_pin(ioapic, gsi); |
1026 | 1036 | ||
1027 | /* | 1037 | /* |
1028 | * TBD: This check is for faulty timer entries, where the override | 1038 | * TBD: This check is for faulty timer entries, where the override |
@@ -1142,7 +1152,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity) | |||
1142 | return gsi; | 1152 | return gsi; |
1143 | } | 1153 | } |
1144 | 1154 | ||
1145 | ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base; | 1155 | ioapic_pin = mp_find_ioapic_pin(ioapic, gsi); |
1146 | 1156 | ||
1147 | #ifdef CONFIG_X86_32 | 1157 | #ifdef CONFIG_X86_32 |
1148 | if (ioapic_renumber_irq) | 1158 | if (ioapic_renumber_irq) |
@@ -1231,7 +1241,7 @@ int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin, | |||
1231 | mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); | 1241 | mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); |
1232 | ioapic = mp_find_ioapic(gsi); | 1242 | ioapic = mp_find_ioapic(gsi); |
1233 | mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id; | 1243 | mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id; |
1234 | mp_irq.dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base; | 1244 | mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi); |
1235 | 1245 | ||
1236 | save_mp_irq(&mp_irq); | 1246 | save_mp_irq(&mp_irq); |
1237 | #endif | 1247 | #endif |
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c index 56e51eb551a5..7248ca11bdcd 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/io_apic.c | |||
@@ -486,7 +486,7 @@ __ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e) | |||
486 | io_apic_write(apic, 0x10 + 2*pin, eu.w1); | 486 | io_apic_write(apic, 0x10 + 2*pin, eu.w1); |
487 | } | 487 | } |
488 | 488 | ||
489 | static void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e) | 489 | void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e) |
490 | { | 490 | { |
491 | unsigned long flags; | 491 | unsigned long flags; |
492 | spin_lock_irqsave(&ioapic_lock, flags); | 492 | spin_lock_irqsave(&ioapic_lock, flags); |
@@ -1478,10 +1478,10 @@ static void ioapic_register_intr(int irq, struct irq_desc *desc, unsigned long t | |||
1478 | handle_edge_irq, "edge"); | 1478 | handle_edge_irq, "edge"); |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | static int setup_ioapic_entry(int apic_id, int irq, | 1481 | int setup_ioapic_entry(int apic_id, int irq, |
1482 | struct IO_APIC_route_entry *entry, | 1482 | struct IO_APIC_route_entry *entry, |
1483 | unsigned int destination, int trigger, | 1483 | unsigned int destination, int trigger, |
1484 | int polarity, int vector) | 1484 | int polarity, int vector) |
1485 | { | 1485 | { |
1486 | /* | 1486 | /* |
1487 | * add it to the IO-APIC irq-routing table: | 1487 | * add it to the IO-APIC irq-routing table: |