summaryrefslogtreecommitdiff
path: root/src/southbridge
diff options
context:
space:
mode:
Diffstat (limited to 'src/southbridge')
-rw-r--r--src/southbridge/intel/i82870/ioapic.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/southbridge/intel/i82870/ioapic.c b/src/southbridge/intel/i82870/ioapic.c
index 4763703644..70440c02c2 100644
--- a/src/southbridge/intel/i82870/ioapic.c
+++ b/src/southbridge/intel/i82870/ioapic.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <arch/ioapic.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@@ -32,9 +33,6 @@ static void p64h2_ioapic_init(struct device *dev)
uint32_t memoryBase;
int apic_index, apic_id;
- volatile uint32_t *pIndexRegister; /* io APIC io memory space command address */
- volatile uint32_t *pWindowRegister; /* io APIC io memory space data address */
-
apic_index = num_p64h2_ioapics;
num_p64h2_ioapics++;
@@ -59,26 +57,11 @@ static void p64h2_ioapic_init(struct device *dev)
// NOTE: this address was assigned during enumeration of the bus
memoryBase = pci_read_config32(dev, PCI_BASE_ADDRESS_0);
- pIndexRegister = (volatile uint32_t *) memoryBase;
- pWindowRegister = (volatile uint32_t *)(memoryBase + 0x10);
-
- printk(BIOS_DEBUG, "IOAPIC %d at %02x:%02x.%01x MBAR = %p DataAddr = %p\n",
- apic_id, dev->bus->secondary, PCI_SLOT(dev->path.pci.devfn),
- PCI_FUNC(dev->path.pci.devfn), pIndexRegister, pWindowRegister);
-
- apic_id <<= 24; // Convert ID to bitmask
-
- *pIndexRegister = 0; // Select APIC ID register
- *pWindowRegister = (*pWindowRegister & ~(0x0f << 24)) | apic_id; // Set the ID
-
- if ((*pWindowRegister & (0x0f << 24)) != apic_id)
- die("%s failed", __func__);
- *pIndexRegister = 3; // Select Boot Configuration register
- *pWindowRegister |= 1; // Use Processor System Bus to deliver interrupts
+ set_ioapic_id((void *)memoryBase, apic_id);
- if (!(*pWindowRegister & 1))
- die("%s failed", __func__);
+ // Use Processor System Bus to deliver interrupts
+ ioapic_set_boot_config((void *)memoryBase, true);
}
static struct device_operations ioapic_ops = {