[coreboot] New patch to review for coreboot: d1d02bc ioapic: Unify some code
Patrick Georgi (patrick@georgi-clan.de)
gerrit at coreboot.org
Wed Jan 23 13:15:53 CET 2013
Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2185
-gerrit
commit d1d02bccd1a823ea357155856100eb3991c4a999
Author: Patrick Georgi <patrick at georgi-clan.de>
Date: Wed Jan 23 13:11:12 2013 +0100
ioapic: Unify some code
No need to keep duplicate variants of counting ioapic interrupts.
Change-Id: I512860297309c46e05cc5379bf61479878817b1e
Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
3rdparty | 2 +-
src/arch/x86/lib/ioapic.c | 30 +++++++++++++++---------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/3rdparty b/3rdparty
index 7eb78b1..4c0dcf9 160000
--- a/3rdparty
+++ b/3rdparty
@@ -1 +1 @@
-Subproject commit 7eb78b1109242653c60cccd741951dcb58f51cec
+Subproject commit 4c0dcf96ae73ba31bf9aa689768a5ecd47bac19e
diff --git a/src/arch/x86/lib/ioapic.c b/src/arch/x86/lib/ioapic.c
index e05d80c..fc5e307 100644
--- a/src/arch/x86/lib/ioapic.c
+++ b/src/arch/x86/lib/ioapic.c
@@ -34,15 +34,10 @@ static void io_apic_write(u32 ioapic_base, u32 reg, u32 value)
write32(ioapic_base + 0x10, value);
}
-void clear_ioapic(u32 ioapic_base)
+static int ioapic_interrupt_count(int ioapic_base)
{
- u32 low, high;
- u32 i, ioapic_interrupts;
-
- printk(BIOS_DEBUG, "IOAPIC: Clearing IOAPIC at 0x%08x\n", ioapic_base);
-
/* Read the available number of interrupts. */
- ioapic_interrupts = (io_apic_read(ioapic_base, 0x01) >> 16) & 0xff;
+ int ioapic_interrupts = (io_apic_read(ioapic_base, 0x01) >> 16) & 0xff;
if (ioapic_interrupts == 0xff)
ioapic_interrupts = 23;
ioapic_interrupts += 1; /* Bits 23-16 specify the maximum redirection
@@ -50,6 +45,18 @@ void clear_ioapic(u32 ioapic_base)
minus 1. */
printk(BIOS_DEBUG, "IOAPIC: %d interrupts\n", ioapic_interrupts);
+ return ioapic_interrupts;
+}
+
+void clear_ioapic(u32 ioapic_base)
+{
+ u32 low, high;
+ u32 i, ioapic_interrupts;
+
+ printk(BIOS_DEBUG, "IOAPIC: Clearing IOAPIC at 0x%08x\n", ioapic_base);
+
+ ioapic_interrupts = ioapic_interrupt_count(ioapic_base);
+
low = DISABLED;
high = NONE;
@@ -86,14 +93,7 @@ void setup_ioapic(u32 ioapic_base, u8 ioapic_id)
(ioapic_id << 24));
}
- /* Read the available number of interrupts. */
- ioapic_interrupts = (io_apic_read(ioapic_base, 0x01) >> 16) & 0xff;
- if (ioapic_interrupts == 0xff)
- ioapic_interrupts = 23;
- ioapic_interrupts += 1; /* Bits 23-16 specify the maximum redirection
- entry, which is the number of interrupts
- minus 1. */
- printk(BIOS_DEBUG, "IOAPIC: %d interrupts\n", ioapic_interrupts);
+ ioapic_interrupts = ioapic_interrupt_count(ioapic_base);
#if CONFIG_IOAPIC_INTERRUPTS_ON_FSB
/*
More information about the coreboot
mailing list