aboutsummaryrefslogtreecommitdiff
path: root/i386/i386at/acpi_parse_apic.c
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2021-03-28 17:03:18 +1100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-03-28 23:20:05 +0200
commit32cda7d7e9374b805ccd5b00ef9e1a28a3f68532 (patch)
tree074e9056025d2a928f1cff62a6f55dfb8b900455 /i386/i386at/acpi_parse_apic.c
parent0bdb36b86e2a1917e43886dca1fdf5ae98da2f1b (diff)
downloadgnumach-32cda7d7e9374b805ccd5b00ef9e1a28a3f68532.tar.gz
gnumach-32cda7d7e9374b805ccd5b00ef9e1a28a3f68532.tar.bz2
gnumach-32cda7d7e9374b805ccd5b00ef9e1a28a3f68532.zip
Existing SMP apic code improvements
* i386/i386/apic.c (acpi_get_irq_override): New function. (apic_get_ioapic): Make it return IoApicData* rather than IoApicData. (apic_print_info): Manage IoApicData* rather than IoApicData. * i386/i386/apic.h (struct ApicReg): Use uint32_t instead of unsigned. (struct ioapic_route_entry): New structure. (union ioapic_route_entry_union): New union. (ApicLocalUnit): Rename base to gsi_base. Add ioapic field. (APIC_IRQ_OVERRIDE_POLARITY_MASK, APIC_IRQ_OVERRIDE_TRIGGER_MASK): New macros. (acpi_get_irq_override, ): New prototype. (apic_get_ioapic): Update prototype. (lapic): New declaration. (IMCR_SELECT, IMCR_DATA, MODE_IMCR, IMCR_USE_PIC, IMCR_USE_APIC, LAPIC_ENABLE, LAPIC_NMI, LAPIC_DISABLE, LAPIC_TIMER_PERIODIC, LAPIC_TIMER_DIVIDE_2, LAPIC_TIMER_DIVIDE_4, LAPIC_TIMER_DIVIDE_8, LAPIC_TIMER_DIVIDE_16, LAPIC_TIMER_BASEDIV, NINTR, IOAPIC_FIXED, IOAPIC_PHYSICAL, IOAPIC_LOGICAL, IOAPIC_NMI, IOAPIC_EXTINT, IOAPIC_ACTIVE_HIGH, IOAPIC_ACTIVE_LOW, IOAPIC_EDGE_TRIGGERED, IOAPIC_LEVEL_TRIGGERED, IOAPIC_MASK_ENABLED, IOAPIC_MASK_DISABLED): New macros. * i386/i386at/acpi_parse_apic.h (struct acpi_apic_ioapic): Rename base field to gsi_base. * i386/i386at/acpi_parse_apic.c (acpi_apic_add_ioapic): Update to gsi_base new name. Set ioapic field. (acpi_apic_setup): Rename lapic to lapic_unit. Message-Id: <20210328060320.36194-5-damien@zamaudio.com>
Diffstat (limited to 'i386/i386at/acpi_parse_apic.c')
-rw-r--r--i386/i386at/acpi_parse_apic.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/i386/i386at/acpi_parse_apic.c b/i386/i386at/acpi_parse_apic.c
index 23edd032..3cf6f042 100644
--- a/i386/i386at/acpi_parse_apic.c
+++ b/i386/i386at/acpi_parse_apic.c
@@ -326,8 +326,10 @@ acpi_apic_add_ioapic(struct acpi_apic_ioapic *ioapic_entry)
/* Fill IOAPIC structure with its main fields */
io_apic.apic_id = ioapic_entry->apic_id;
io_apic.addr = ioapic_entry->addr;
- io_apic.base = ioapic_entry->base;
-
+ io_apic.gsi_base = ioapic_entry->gsi_base;
+ io_apic.ioapic = (ApicIoUnit *)kmem_map_aligned_table(ioapic_entry->addr,
+ sizeof(ApicIoUnit),
+ VM_PROT_READ | VM_PROT_WRITE);
/* Insert IOAPIC in the list. */
apic_add_ioapic(io_apic);
}
@@ -447,7 +449,7 @@ static int
acpi_apic_setup(struct acpi_apic *apic)
{
int apic_checksum;
- ApicLocalUnit* lapic;
+ ApicLocalUnit* lapic_unit;
uint8_t ncpus, nioapics;
/* Check the checksum of the APIC */
@@ -457,12 +459,13 @@ acpi_apic_setup(struct acpi_apic *apic)
return ACPI_BAD_CHECKSUM;
/* map common lapic address */
- lapic = kmem_map_aligned_table(apic->lapic_addr, sizeof(ApicLocalUnit), VM_PROT_READ);
+ lapic_unit = kmem_map_aligned_table(apic->lapic_addr, sizeof(ApicLocalUnit),
+ VM_PROT_READ | VM_PROT_WRITE);
- if (lapic == NULL)
+ if (lapic_unit == NULL)
return ACPI_NO_LAPIC;
- apic_lapic_init(lapic);
+ apic_lapic_init(lapic_unit);
acpi_apic_parse_table(apic);
ncpus = apic_get_numcpus();