diff options
| author | Jeremy Fitzhardinge <jeremy@goop.org> | 2009-02-09 15:05:47 -0500 |
|---|---|---|
| committer | Jeremy Fitzhardinge <jeremy@goop.org> | 2009-02-09 17:04:26 -0500 |
| commit | c3e137d1e882c4fab9adcce7ae2be9bf3eb64c4c (patch) | |
| tree | 7451219c94644303457d0522d9366b802e33f7ea | |
| parent | 4924e228ae039029a9503ad571d91086e4042c90 (diff) | |
x86: add mp_find_ioapic_pin
Add mp_find_ioapic_pin() to find an IO APIC's specific pin from a GSI,
and use this function within acpi/boot. Make it non-static so other
code can use it too.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
| -rw-r--r-- | arch/x86/include/asm/mpspec.h | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/acpi/boot.c | 16 |
2 files changed, 14 insertions, 3 deletions
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h index b59371a312f1..5916c8df09d9 100644 --- a/arch/x86/include/asm/mpspec.h +++ b/arch/x86/include/asm/mpspec.h | |||
| @@ -78,6 +78,7 @@ extern int acpi_probe_gsi(void); | |||
| 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); | 80 | extern int mp_find_ioapic(int gsi); |
| 81 | extern int mp_find_ioapic_pin(int ioapic, int gsi); | ||
| 81 | #else | 82 | #else |
| 82 | static inline int | 83 | static inline int |
| 83 | 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 068b900f4b06..bba162c81d5b 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
| @@ -887,6 +887,16 @@ 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 |
