Module Name: src Committed By: martin Date: Thu Mar 27 19:00:14 UTC 2025
Modified Files: src/sys/arch/evbppc/wii [netbsd-10]: pic_pi.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #1073): sys/arch/evbppc/wii/pic_pi.c: revision 1.4 wii: Revert pic_pi.c r1.2 and r1.3. The simplification of pic_pi.c in r1.2 introduced a performance regression with sdhc. Revert to the original implementation. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/evbppc/wii/pic_pi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/evbppc/wii/pic_pi.c diff -u src/sys/arch/evbppc/wii/pic_pi.c:1.1.2.4 src/sys/arch/evbppc/wii/pic_pi.c:1.1.2.5 --- src/sys/arch/evbppc/wii/pic_pi.c:1.1.2.4 Sat Feb 22 13:10:17 2025 +++ src/sys/arch/evbppc/wii/pic_pi.c Thu Mar 27 19:00:14 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: pic_pi.c,v 1.1.2.4 2025/02/22 13:10:17 martin Exp $ */ +/* $NetBSD: pic_pi.c,v 1.1.2.5 2025/03/27 19:00:14 martin Exp $ */ /*- * Copyright (c) 2024 Jared McNeill <jmcne...@invisible.ca> @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pic_pi.c,v 1.1.2.4 2025/02/22 13:10:17 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_pi.c,v 1.1.2.5 2025/03/27 19:00:14 martin Exp $"); #include <sys/param.h> #include <sys/intr.h> @@ -45,6 +45,9 @@ __KERNEL_RCSID(0, "$NetBSD: pic_pi.c,v 1 #include <arch/powerpc/pic/picvar.h> #include <machine/wii.h> +static uint32_t pic_irqmask; +static uint32_t pic_actmask; + void pi_init_intr(void); #define WR4(reg, val) out32(reg, val) @@ -53,29 +56,32 @@ void pi_init_intr(void); static void pi_enable_irq(struct pic_ops *pic, int irq, int type) { - WR4(PI_INTMR, RD4(PI_INTMR) | __BIT(irq)); + pic_irqmask |= __BIT(irq); + WR4(PI_INTMR, pic_irqmask & ~pic_actmask); } static void pi_disable_irq(struct pic_ops *pic, int irq) { - WR4(PI_INTMR, RD4(PI_INTMR) & ~__BIT(irq)); + pic_irqmask &= ~__BIT(irq); + WR4(PI_INTMR, pic_irqmask & ~pic_actmask); } static int pi_get_irq(struct pic_ops *pic, int mode) { - static uint32_t pend; + uint32_t raw, pend; int irq; - if (mode == PIC_GET_IRQ) { - pend = RD4(PI_INTSR) & RD4(PI_INTMR); - } + raw = RD4(PI_INTSR); + pend = raw & pic_irqmask; if (pend == 0) { return 255; } irq = ffs32(pend) - 1; - pend &= ~__BIT(irq); + + pic_actmask |= __BIT(irq); + WR4(PI_INTMR, pic_irqmask & ~pic_actmask); return irq; } @@ -83,6 +89,8 @@ pi_get_irq(struct pic_ops *pic, int mode static void pi_ack_irq(struct pic_ops *pic, int irq) { + pic_actmask &= ~__BIT(irq); + WR4(PI_INTMR, pic_irqmask & ~pic_actmask); WR4(PI_INTSR, __BIT(irq)); } @@ -101,6 +109,9 @@ static struct pic_ops pic = { void pi_init_intr(void) { + pic_irqmask = 0; + pic_actmask = 0; + /* Mask and clear all interrupts. */ WR4(PI_INTMR, 0); WR4(PI_INTSR, ~0U);