diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2010-03-30 04:07:12 -0400 |
|---|---|---|
| committer | H. Peter Anvin <hpa@zytor.com> | 2010-05-04 16:35:03 -0400 |
| commit | 7716a5c4ff5f1f3dc5e9edcab125cbf7fceef0af (patch) | |
| tree | 83dc3248dd5eb9e9c098ae82da8c48a11dc60b42 | |
| parent | cf7500c0ea133d66f8449d86392d83f840102632 (diff) | |
x86, ioapic: Move nr_ioapic_registers calculation to mp_register_ioapic.
Now that all ioapic registration happens in mp_register_ioapic we can
move the calculation of nr_ioapic_registers there from enable_IO_APIC.
The number of ioapic registers is already calucated in mp_register_ioapic
so all that really needs to be done is to save the caluclated value
in nr_ioapic_registers.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
LKML-Reference: <1269936436-7039-11-git-send-email-ebiederm@xmission.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| -rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index f80725571577..dae9240bd287 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
| @@ -1953,20 +1953,8 @@ static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; | |||
| 1953 | 1953 | ||
| 1954 | void __init enable_IO_APIC(void) | 1954 | void __init enable_IO_APIC(void) |
| 1955 | { | 1955 | { |
| 1956 | union IO_APIC_reg_01 reg_01; | ||
| 1957 | int i8259_apic, i8259_pin; | 1956 | int i8259_apic, i8259_pin; |
| 1958 | int apic; | 1957 | int apic; |
| 1959 | unsigned long flags; | ||
| 1960 | |||
| 1961 | /* | ||
| 1962 | * The number of IO-APIC IRQ registers (== #pins): | ||
| 1963 | */ | ||
| 1964 | for (apic = 0; apic < nr_ioapics; apic++) { | ||
| 1965 | raw_spin_lock_irqsave(&ioapic_lock, flags); | ||
| 1966 | reg_01.raw = io_apic_read(apic, 1); | ||
| 1967 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); | ||
| 1968 | nr_ioapic_registers[apic] = reg_01.bits.entries+1; | ||
| 1969 | } | ||
| 1970 | 1958 | ||
| 1971 | if (!legacy_pic->nr_legacy_irqs) | 1959 | if (!legacy_pic->nr_legacy_irqs) |
| 1972 | return; | 1960 | return; |
| @@ -4293,6 +4281,7 @@ static int bad_ioapic(unsigned long address) | |||
| 4293 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | 4281 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) |
| 4294 | { | 4282 | { |
| 4295 | int idx = 0; | 4283 | int idx = 0; |
| 4284 | int entries; | ||
| 4296 | 4285 | ||
| 4297 | if (bad_ioapic(address)) | 4286 | if (bad_ioapic(address)) |
| 4298 | return; | 4287 | return; |
| @@ -4311,9 +4300,14 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | |||
| 4311 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups | 4300 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups |
| 4312 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). | 4301 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). |
| 4313 | */ | 4302 | */ |
| 4303 | entries = io_apic_get_redir_entries(idx); | ||
| 4314 | mp_gsi_routing[idx].gsi_base = gsi_base; | 4304 | mp_gsi_routing[idx].gsi_base = gsi_base; |
| 4315 | mp_gsi_routing[idx].gsi_end = gsi_base + | 4305 | mp_gsi_routing[idx].gsi_end = gsi_base + entries - 1; |
| 4316 | io_apic_get_redir_entries(idx) - 1; | 4306 | |
| 4307 | /* | ||
| 4308 | * The number of IO-APIC IRQ registers (== #pins): | ||
| 4309 | */ | ||
| 4310 | nr_ioapic_registers[idx] = entries; | ||
| 4317 | 4311 | ||
| 4318 | if (mp_gsi_routing[idx].gsi_end > gsi_end) | 4312 | if (mp_gsi_routing[idx].gsi_end > gsi_end) |
| 4319 | gsi_end = mp_gsi_routing[idx].gsi_end; | 4313 | gsi_end = mp_gsi_routing[idx].gsi_end; |
