| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: gfpic.c,v 1.1 2024/01/02 07:27:51 thorpej Exp $ */ | | 1 | /* $NetBSD: gfpic.c,v 1.2 2024/04/24 14:41:13 thorpej Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2023 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2023 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe. | | 8 | * by Jason R. Thorpe. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * Support for the Goldfish virtual Programmable Interrupt Controller. | | 33 | * Support for the Goldfish virtual Programmable Interrupt Controller. |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | __KERNEL_RCSID(0, "$NetBSD: gfpic.c,v 1.1 2024/01/02 07:27:51 thorpej Exp $"); | | 37 | __KERNEL_RCSID(0, "$NetBSD: gfpic.c,v 1.2 2024/04/24 14:41:13 thorpej Exp $"); |
38 | | | 38 | |
39 | #include <sys/types.h> | | 39 | #include <sys/types.h> |
40 | #include <sys/systm.h> | | 40 | #include <sys/systm.h> |
41 | #include <sys/bus.h> | | 41 | #include <sys/bus.h> |
42 | | | 42 | |
43 | #include <dev/goldfish/gfpicvar.h> | | 43 | #include <dev/goldfish/gfpicvar.h> |
44 | | | 44 | |
45 | /* | | 45 | /* |
46 | * Goldfish PIC registers. | | 46 | * Goldfish PIC registers. |
47 | */ | | 47 | */ |
48 | #define GFPIC_STATUS (0 << 2) /* pending interrupt count */ | | 48 | #define GFPIC_STATUS (0 << 2) /* pending interrupt count */ |
49 | #define GFPIC_PENDING (1 << 2) /* pending interrupt bitmask */ | | 49 | #define GFPIC_PENDING (1 << 2) /* pending interrupt bitmask */ |
50 | #define GFPIC_DISABLE_ALL (2 << 2) /* disables / clears all interrupts */ | | 50 | #define GFPIC_DISABLE_ALL (2 << 2) /* disables / clears all interrupts */ |
| @@ -69,28 +69,26 @@ gfpic_attach(struct gfpic_softc *sc) | | | @@ -69,28 +69,26 @@ gfpic_attach(struct gfpic_softc *sc) |
69 | REG_WRITE(sc, GFPIC_DISABLE_ALL, 0); | | 69 | REG_WRITE(sc, GFPIC_DISABLE_ALL, 0); |
70 | } | | 70 | } |
71 | | | 71 | |
72 | /* | | 72 | /* |
73 | * gfpic_enable -- | | 73 | * gfpic_enable -- |
74 | * Enable the specified IRQ on a Goldfish virtual PIC. | | 74 | * Enable the specified IRQ on a Goldfish virtual PIC. |
75 | */ | | 75 | */ |
76 | void | | 76 | void |
77 | gfpic_enable(struct gfpic_softc *sc, int pirq) | | 77 | gfpic_enable(struct gfpic_softc *sc, int pirq) |
78 | { | | 78 | { |
79 | KASSERT(pirq >= 0); | | 79 | KASSERT(pirq >= 0); |
80 | KASSERT(pirq <= 31); | | 80 | KASSERT(pirq <= 31); |
81 | | | 81 | |
82 | device_printf(sc->sc_dev, "enabling IRQ %d (0x%08x)\n", | | | |
83 | pirq, (1U << pirq)); | | | |
84 | REG_WRITE(sc, GFPIC_ENABLE, (1U << pirq)); | | 82 | REG_WRITE(sc, GFPIC_ENABLE, (1U << pirq)); |
85 | } | | 83 | } |
86 | | | 84 | |
87 | /* | | 85 | /* |
88 | * gfpic_disable -- | | 86 | * gfpic_disable -- |
89 | * Disable the specified IRQ on a Goldfish virtual PIC. | | 87 | * Disable the specified IRQ on a Goldfish virtual PIC. |
90 | */ | | 88 | */ |
91 | void | | 89 | void |
92 | gfpic_disable(struct gfpic_softc *sc, int pirq) | | 90 | gfpic_disable(struct gfpic_softc *sc, int pirq) |
93 | { | | 91 | { |
94 | KASSERT(pirq >= 0); | | 92 | KASSERT(pirq >= 0); |
95 | KASSERT(pirq <= 31); | | 93 | KASSERT(pirq <= 31); |
96 | | | 94 | |