From dbbda3c238f47b5f5621068a047c404b92748b24 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Mon, 5 Apr 2021 21:59:21 +1000 Subject: ioapic: Fix arg passing of redirection entry Message-Id: <20210405115921.184572-3-damien@zamaudio.com> --- i386/i386at/ioapic.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'i386/i386at/ioapic.c') diff --git a/i386/i386at/ioapic.c b/i386/i386at/ioapic.c index 4d0f4fca..18a9bec6 100644 --- a/i386/i386at/ioapic.c +++ b/i386/i386at/ioapic.c @@ -114,15 +114,15 @@ ioapic_write(uint8_t id, uint8_t reg, uint32_t value) ioapic->window.r = value; } -static struct ioapic_route_entry -ioapic_read_entry(int apic, int pin) +static void +ioapic_read_entry(int apic, int pin, struct ioapic_route_entry *e) { union ioapic_route_entry_union entry; entry.lo = ioapic_read(apic, APIC_IO_REDIR_LOW(pin)); entry.hi = ioapic_read(apic, APIC_IO_REDIR_HIGH(pin)); - return entry.both; + *e = entry.both; } /* Write the high word first because mask bit is in low word */ @@ -142,7 +142,7 @@ ioapic_toggle_entry(int apic, int pin, int mask) { union ioapic_route_entry_union entry; - entry.both = ioapic_read_entry(apic, pin); + ioapic_read_entry(apic, pin, &entry.both); entry.both.mask = mask & 0x1; ioapic_write(apic, APIC_IO_REDIR_LOW(pin), entry.lo); } @@ -249,7 +249,8 @@ ioapic_irq_eoi(int pin) /* Workaround for old IOAPICs with no specific EOI */ /* Mask the pin and change to edge triggered */ - oldentry.both = entry.both = ioapic_read_entry(apic, pin); + ioapic_read_entry(apic, pin, &entry.both); + oldentry = entry; entry.both.mask = IOAPIC_MASK_DISABLED; entry.both.trigger = IOAPIC_EDGE_TRIGGERED; ioapic_write_entry(apic, pin, entry.both); @@ -259,7 +260,7 @@ ioapic_irq_eoi(int pin) } else { volatile ApicIoUnit *ioapic = apic_get_ioapic(apic)->ioapic; - entry.both = ioapic_read_entry(apic, pin); + ioapic_read_entry(apic, pin, &entry.both); ioapic->eoi.r = entry.both.vector; } -- cgit v1.2.3