X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=arch%2Fx86%2Flib%2Fpirq_routing.c;h=e5f0e6142418930c65ec35b8f3064ec7f50fd3f5;hb=edf18a83f8dc993279947cfc7faaba7dedf1ad82;hp=a93d355d8a2457e3e049db8b07d1986a6c98a56e;hpb=2ee490a0245b65826a8ce8e42e34c9bf805d3656;p=oweals%2Fu-boot.git diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c index a93d355d8a..e5f0e61424 100644 --- a/arch/x86/lib/pirq_routing.c +++ b/arch/x86/lib/pirq_routing.c @@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2015, Bin Meng * * Part of this file is ported from coreboot src/arch/x86/boot/pirq_routing.c - * - * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -11,9 +10,8 @@ #include #include -static bool irq_already_routed[16]; - -static u8 pirq_get_next_free_irq(struct udevice *dev, u8 *pirq, u16 bitmap) +static u8 pirq_get_next_free_irq(struct udevice *dev, u8 *pirq, u16 bitmap, + bool irq_already_routed[]) { int i, link; u8 irq = 0; @@ -55,9 +53,11 @@ void pirq_route_irqs(struct udevice *dev, struct irq_info *irq, int num) { unsigned char irq_slot[MAX_INTX_ENTRIES]; unsigned char pirq[CONFIG_MAX_PIRQ_LINKS]; + bool irq_already_routed[16]; int i, intx; memset(pirq, 0, CONFIG_MAX_PIRQ_LINKS); + memset(irq_already_routed, '\0', sizeof(irq_already_routed)); /* Set PCI IRQs */ for (i = 0; i < num; i++) { @@ -83,7 +83,8 @@ void pirq_route_irqs(struct udevice *dev, struct irq_info *irq, int num) /* yet not routed */ if (!pirq[link]) { - irq = pirq_get_next_free_irq(dev, pirq, bitmap); + irq = pirq_get_next_free_irq(dev, pirq, bitmap, + irq_already_routed); pirq[link] = irq; } else { irq = pirq[link]; @@ -114,14 +115,14 @@ u32 copy_pirq_routing_table(u32 addr, struct irq_routing_table *rt) addr = ALIGN(addr, 16); debug("Copying Interrupt Routing Table to 0x%x\n", addr); - memcpy((void *)addr, rt, rt->size); + memcpy((void *)(uintptr_t)addr, rt, rt->size); /* * We do the sanity check here against the copied table after memcpy, * as something might go wrong after the memcpy, which is normally * due to the F segment decode is not turned on to systeam RAM. */ - rom_rt = (struct irq_routing_table *)addr; + rom_rt = (struct irq_routing_table *)(uintptr_t)addr; if (rom_rt->signature != PIRQ_SIGNATURE || rom_rt->version != PIRQ_VERSION || rom_rt->size % 16) { printf("Interrupt Routing Table not valid\n");