Module Name: src
Committed By: jmcneill
Date: Sat Feb 15 00:31:42 UTC 2025
Modified Files:
src/sys/arch/evbppc/wii: pic_pi.c
Log Message:
wii: Simplify Processor Interface pic code.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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 src/sys/arch/evbppc/wii/pic_pi.c:1.2
--- src/sys/arch/evbppc/wii/pic_pi.c:1.1 Sat Jan 20 21:36:00 2024
+++ src/sys/arch/evbppc/wii/pic_pi.c Sat Feb 15 00:31:42 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: pic_pi.c,v 1.1 2024/01/20 21:36:00 jmcneill Exp $ */
+/* $NetBSD: pic_pi.c,v 1.2 2025/02/15 00:31:42 jmcneill Exp $ */
/*-
* Copyright (c) 2024 Jared McNeill <[email protected]>
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic_pi.c,v 1.1 2024/01/20 21:36:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_pi.c,v 1.2 2025/02/15 00:31:42 jmcneill Exp $");
#include <sys/param.h>
#include <sys/intr.h>
@@ -45,9 +45,6 @@ __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)
@@ -56,32 +53,27 @@ void pi_init_intr(void);
static void
pi_enable_irq(struct pic_ops *pic, int irq, int type)
{
- pic_irqmask |= __BIT(irq);
- WR4(PI_INTMR, pic_irqmask & ~pic_actmask);
+ WR4(PI_INTMR, RD4(PI_INTMR) | __BIT(irq));
}
static void
pi_disable_irq(struct pic_ops *pic, int irq)
{
- pic_irqmask &= ~__BIT(irq);
- WR4(PI_INTMR, pic_irqmask & ~pic_actmask);
+ WR4(PI_INTMR, RD4(PI_INTMR) & ~__BIT(irq));
}
static int
pi_get_irq(struct pic_ops *pic, int mode)
{
- uint32_t raw, pend;
+ uint32_t pend;
int irq;
- raw = RD4(PI_INTSR);
- pend = raw & pic_irqmask;
+ pend = RD4(PI_INTSR) & RD4(PI_INTMR);
if (pend == 0) {
return 255;
}
irq = ffs32(pend) - 1;
-
- pic_actmask |= __BIT(irq);
- WR4(PI_INTMR, pic_irqmask & ~pic_actmask);
+ pend &= ~__BIT(irq);
return irq;
}
@@ -89,8 +81,6 @@ 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));
}
@@ -109,9 +99,6 @@ 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);