1*f5b064eeSdyoung /* $NetBSD: piix.c,v 1.15 2011/07/01 17:37:27 dyoung Exp $ */
2d6d9fbe2Sthorpej
3d6d9fbe2Sthorpej /*-
4d6d9fbe2Sthorpej * Copyright (c) 1999 The NetBSD Foundation, Inc.
5d6d9fbe2Sthorpej * All rights reserved.
6d6d9fbe2Sthorpej *
7d6d9fbe2Sthorpej * This code is derived from software contributed to The NetBSD Foundation
8d6d9fbe2Sthorpej * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9d6d9fbe2Sthorpej * NASA Ames Research Center.
10d6d9fbe2Sthorpej *
11d6d9fbe2Sthorpej * Redistribution and use in source and binary forms, with or without
12d6d9fbe2Sthorpej * modification, are permitted provided that the following conditions
13d6d9fbe2Sthorpej * are met:
14d6d9fbe2Sthorpej * 1. Redistributions of source code must retain the above copyright
15d6d9fbe2Sthorpej * notice, this list of conditions and the following disclaimer.
16d6d9fbe2Sthorpej * 2. Redistributions in binary form must reproduce the above copyright
17d6d9fbe2Sthorpej * notice, this list of conditions and the following disclaimer in the
18d6d9fbe2Sthorpej * documentation and/or other materials provided with the distribution.
19d6d9fbe2Sthorpej *
20d6d9fbe2Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21d6d9fbe2Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22d6d9fbe2Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23d6d9fbe2Sthorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24d6d9fbe2Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25d6d9fbe2Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26d6d9fbe2Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27d6d9fbe2Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28d6d9fbe2Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29d6d9fbe2Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30d6d9fbe2Sthorpej * POSSIBILITY OF SUCH DAMAGE.
31d6d9fbe2Sthorpej */
32d6d9fbe2Sthorpej
33d6d9fbe2Sthorpej /*
34d6d9fbe2Sthorpej * Copyright (c) 1999, by UCHIYAMA Yasushi
35d6d9fbe2Sthorpej * All rights reserved.
36d6d9fbe2Sthorpej *
37d6d9fbe2Sthorpej * Redistribution and use in source and binary forms, with or without
38d6d9fbe2Sthorpej * modification, are permitted provided that the following conditions
39d6d9fbe2Sthorpej * are met:
40d6d9fbe2Sthorpej * 1. Redistributions of source code must retain the above copyright
41d6d9fbe2Sthorpej * notice, this list of conditions and the following disclaimer.
42d6d9fbe2Sthorpej * 2. The name of the developer may NOT be used to endorse or promote products
43d6d9fbe2Sthorpej * derived from this software without specific prior written permission.
44d6d9fbe2Sthorpej *
45d6d9fbe2Sthorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
46d6d9fbe2Sthorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47d6d9fbe2Sthorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48d6d9fbe2Sthorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
49d6d9fbe2Sthorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50d6d9fbe2Sthorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51d6d9fbe2Sthorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52d6d9fbe2Sthorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53d6d9fbe2Sthorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54d6d9fbe2Sthorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55d6d9fbe2Sthorpej * SUCH DAMAGE.
56d6d9fbe2Sthorpej */
57d6d9fbe2Sthorpej
58d6d9fbe2Sthorpej /*
59ee2683e7Skochi * Support for the Intel PIIX PCI-ISA bridge interrupt controller
60ee2683e7Skochi * and ICHn I/O controller hub
61ee2683e7Skochi */
62ee2683e7Skochi
63ee2683e7Skochi /*
64ee2683e7Skochi * ICH2 and later support 8 interrupt routers while the first
65ee2683e7Skochi * generation (ICH and ICH0) support 4 which is same as PIIX.
66d6d9fbe2Sthorpej */
67d6d9fbe2Sthorpej
6895c969f2Slukem #include <sys/cdefs.h>
69*f5b064eeSdyoung __KERNEL_RCSID(0, "$NetBSD: piix.c,v 1.15 2011/07/01 17:37:27 dyoung Exp $");
7095c969f2Slukem
71d6d9fbe2Sthorpej #include <sys/param.h>
72d6d9fbe2Sthorpej #include <sys/systm.h>
73d6d9fbe2Sthorpej #include <sys/device.h>
74d6d9fbe2Sthorpej #include <sys/malloc.h>
75d6d9fbe2Sthorpej
76d6d9fbe2Sthorpej #include <machine/intr.h>
77*f5b064eeSdyoung #include <sys/bus.h>
78d6d9fbe2Sthorpej
79d6d9fbe2Sthorpej #include <dev/pci/pcivar.h>
80d6d9fbe2Sthorpej #include <dev/pci/pcireg.h>
81d6d9fbe2Sthorpej #include <dev/pci/pcidevs.h>
82d6d9fbe2Sthorpej
83d6d9fbe2Sthorpej #include <i386/pci/pci_intr_fixup.h>
84d6d9fbe2Sthorpej #include <i386/pci/piixreg.h>
85d6d9fbe2Sthorpej #include <i386/pci/piixvar.h>
86d6d9fbe2Sthorpej
872f9cb9c1Ssoda #ifdef PIIX_DEBUG
882f9cb9c1Ssoda #define DPRINTF(arg) printf arg
892f9cb9c1Ssoda #else
902f9cb9c1Ssoda #define DPRINTF(arg)
912f9cb9c1Ssoda #endif
922f9cb9c1Ssoda
93e8085086Skochi int piix_getclink(pciintr_icu_handle_t, int, int *);
94e8085086Skochi int ich_getclink(pciintr_icu_handle_t, int, int *);
95e8085086Skochi int piix_get_intr(pciintr_icu_handle_t, int, int *);
96e8085086Skochi int piix_set_intr(pciintr_icu_handle_t, int, int);
972f9cb9c1Ssoda #ifdef PIIX_DEBUG
98e8085086Skochi void piix_pir_dump(struct piix_handle *);
9932cdfb5cSkochi void ich_pir_dump(struct piix_handle *);
1002f9cb9c1Ssoda #endif
101d6d9fbe2Sthorpej
102d6d9fbe2Sthorpej const struct pciintr_icu piix_pci_icu = {
103d6d9fbe2Sthorpej piix_getclink,
104d6d9fbe2Sthorpej piix_get_intr,
105d6d9fbe2Sthorpej piix_set_intr,
106d6d9fbe2Sthorpej piix_get_trigger,
107d6d9fbe2Sthorpej piix_set_trigger,
108d6d9fbe2Sthorpej };
109d6d9fbe2Sthorpej
110ee2683e7Skochi const struct pciintr_icu ich_pci_icu = {
111ee2683e7Skochi ich_getclink,
112ee2683e7Skochi piix_get_intr,
113ee2683e7Skochi piix_set_intr,
114ee2683e7Skochi piix_get_trigger,
115ee2683e7Skochi piix_set_trigger,
116ee2683e7Skochi };
117ee2683e7Skochi
118ee2683e7Skochi static int piix_max_link = 3;
119ee2683e7Skochi
120d6d9fbe2Sthorpej int
piix_init(pci_chipset_tag_t pc,bus_space_tag_t iot,pcitag_t tag,pciintr_icu_tag_t * ptagp,pciintr_icu_handle_t * phandp)121e8085086Skochi piix_init(pci_chipset_tag_t pc, bus_space_tag_t iot, pcitag_t tag,
122e8085086Skochi pciintr_icu_tag_t *ptagp, pciintr_icu_handle_t *phandp)
123d6d9fbe2Sthorpej {
124d6d9fbe2Sthorpej struct piix_handle *ph;
125d6d9fbe2Sthorpej
126d6d9fbe2Sthorpej ph = malloc(sizeof(*ph), M_DEVBUF, M_NOWAIT);
127d6d9fbe2Sthorpej if (ph == NULL)
128d6d9fbe2Sthorpej return (1);
129d6d9fbe2Sthorpej
130d6d9fbe2Sthorpej ph->ph_iot = iot;
131d6d9fbe2Sthorpej ph->ph_pc = pc;
132d6d9fbe2Sthorpej ph->ph_tag = tag;
133d6d9fbe2Sthorpej
134d6d9fbe2Sthorpej if (bus_space_map(iot, PIIX_REG_ELCR, PIIX_REG_ELCR_SIZE, 0,
135d6d9fbe2Sthorpej &ph->ph_elcr_ioh) != 0) {
136d6d9fbe2Sthorpej free(ph, M_DEVBUF);
137d6d9fbe2Sthorpej return (1);
138d6d9fbe2Sthorpej }
139d6d9fbe2Sthorpej
1402f9cb9c1Ssoda #ifdef PIIX_DEBUG
1412f9cb9c1Ssoda piix_pir_dump(ph);
1422f9cb9c1Ssoda #endif
143d6d9fbe2Sthorpej *ptagp = &piix_pci_icu;
144d6d9fbe2Sthorpej *phandp = ph;
145d6d9fbe2Sthorpej return (0);
146d6d9fbe2Sthorpej }
147d6d9fbe2Sthorpej
148f86d875aSjmcneill void
piix_uninit(pciintr_icu_handle_t v)149f86d875aSjmcneill piix_uninit(pciintr_icu_handle_t v)
150f86d875aSjmcneill {
151f86d875aSjmcneill struct piix_handle *ph = v;
152f86d875aSjmcneill
153f86d875aSjmcneill if (ph == NULL)
154f86d875aSjmcneill return;
155f86d875aSjmcneill
156f86d875aSjmcneill bus_space_unmap(ph->ph_iot, ph->ph_elcr_ioh, PIIX_REG_ELCR_SIZE);
157f86d875aSjmcneill
158f86d875aSjmcneill return;
159f86d875aSjmcneill }
160f86d875aSjmcneill
161d6d9fbe2Sthorpej int
ich_init(pci_chipset_tag_t pc,bus_space_tag_t iot,pcitag_t tag,pciintr_icu_tag_t * ptagp,pciintr_icu_handle_t * phandp)162e8085086Skochi ich_init(pci_chipset_tag_t pc, bus_space_tag_t iot, pcitag_t tag,
163e8085086Skochi pciintr_icu_tag_t *ptagp, pciintr_icu_handle_t *phandp)
164ee2683e7Skochi {
165ee2683e7Skochi int rv;
166ee2683e7Skochi
167ee2683e7Skochi rv = piix_init(pc, iot, tag, ptagp, phandp);
168ee2683e7Skochi
169ee2683e7Skochi if (rv == 0) {
170ee2683e7Skochi piix_max_link = 7;
171ee2683e7Skochi *ptagp = &ich_pci_icu;
17232cdfb5cSkochi
17332cdfb5cSkochi #ifdef PIIX_DEBUG
17432cdfb5cSkochi ich_pir_dump(*phandp);
17532cdfb5cSkochi #endif
176ee2683e7Skochi }
177ee2683e7Skochi
178ee2683e7Skochi return (rv);
179ee2683e7Skochi }
180ee2683e7Skochi
181ee2683e7Skochi int
piix_getclink(pciintr_icu_handle_t v,int link,int * clinkp)182168cd830Schristos piix_getclink(pciintr_icu_handle_t v, int link, int *clinkp)
183d6d9fbe2Sthorpej {
1842f9cb9c1Ssoda DPRINTF(("PIIX link value 0x%x: ", link));
185d6d9fbe2Sthorpej
186d6d9fbe2Sthorpej /* Pattern 1: simple. */
187d6d9fbe2Sthorpej if (PIIX_LEGAL_LINK(link - 1)) {
188d6d9fbe2Sthorpej *clinkp = link - 1;
1892f9cb9c1Ssoda DPRINTF(("PIRQ %d (simple)\n", *clinkp));
190d6d9fbe2Sthorpej return (0);
191d6d9fbe2Sthorpej }
192d6d9fbe2Sthorpej
193d6d9fbe2Sthorpej /* Pattern 2: configuration register offset */
194d6d9fbe2Sthorpej if (link >= 0x60 && link <= 0x63) {
195d6d9fbe2Sthorpej *clinkp = link - 0x60;
1962f9cb9c1Ssoda DPRINTF(("PIRQ %d (register offset)\n", *clinkp));
197d6d9fbe2Sthorpej return (0);
198d6d9fbe2Sthorpej }
199d6d9fbe2Sthorpej
2004b995bb9Sexplorer /*
2014b995bb9Sexplorer * XXX Pattern 3: configuration register offset 1
2024b995bb9Sexplorer * Some BIOS return 0x68, 0x69
2034b995bb9Sexplorer */
2044b995bb9Sexplorer if (link >= 0x68 && link <= 0x69) {
2054b995bb9Sexplorer *clinkp = link - 0x67;
2064b995bb9Sexplorer DPRINTF(("PIRQ %d (register offset 1)\n", *clinkp));
2074b995bb9Sexplorer return (0);
2084b995bb9Sexplorer }
2094b995bb9Sexplorer
2102f9cb9c1Ssoda DPRINTF(("bogus IRQ selection source\n"));
211d6d9fbe2Sthorpej return (1);
212d6d9fbe2Sthorpej }
213d6d9fbe2Sthorpej
214d6d9fbe2Sthorpej int
ich_getclink(pciintr_icu_handle_t v,int link,int * clinkp)215e8085086Skochi ich_getclink(pciintr_icu_handle_t v, int link, int *clinkp)
216ee2683e7Skochi {
217ee2683e7Skochi /*
218ee2683e7Skochi * configuration registers 0x68..0x6b are for PIRQ[EFGH]
219ee2683e7Skochi */
220ee2683e7Skochi if (link >= 0x68 && link <= 0x6b) {
221ee2683e7Skochi *clinkp = link - 0x68 + 4;
22232cdfb5cSkochi DPRINTF(("PIIX link value 0x%x: ", link));
223ee2683e7Skochi DPRINTF(("PIRQ %d (register offset)\n", *clinkp));
224ee2683e7Skochi return (0);
225ee2683e7Skochi }
226ee2683e7Skochi
227ee2683e7Skochi return piix_getclink(v, link, clinkp);
228ee2683e7Skochi }
229ee2683e7Skochi
230ee2683e7Skochi int
piix_get_intr(pciintr_icu_handle_t v,int clink,int * irqp)231e8085086Skochi piix_get_intr(pciintr_icu_handle_t v, int clink, int *irqp)
232d6d9fbe2Sthorpej {
233d6d9fbe2Sthorpej struct piix_handle *ph = v;
234d6d9fbe2Sthorpej int shift;
235d6d9fbe2Sthorpej pcireg_t reg;
236ee2683e7Skochi int cfgreg;
237d6d9fbe2Sthorpej
238d6d9fbe2Sthorpej if (PIIX_LEGAL_LINK(clink) == 0)
239d6d9fbe2Sthorpej return (1);
240d6d9fbe2Sthorpej
241ee2683e7Skochi cfgreg = clink <= 3 ? PIIX_CFG_PIRQ : PIIX_CFG_PIRQ2;
242ee2683e7Skochi clink &= 0x03;
243ee2683e7Skochi
244ee2683e7Skochi reg = pci_conf_read(ph->ph_pc, ph->ph_tag, cfgreg);
245d6d9fbe2Sthorpej shift = clink << 3;
246d6d9fbe2Sthorpej if ((reg >> shift) & PIIX_CFG_PIRQ_NONE)
247ab4edb55Sfvdl *irqp = X86_PCI_INTERRUPT_LINE_NO_CONNECTION;
248d6d9fbe2Sthorpej else
249d6d9fbe2Sthorpej *irqp = PIIX_PIRQ(reg, clink);
250d6d9fbe2Sthorpej
251d6d9fbe2Sthorpej return (0);
252d6d9fbe2Sthorpej }
253d6d9fbe2Sthorpej
254d6d9fbe2Sthorpej int
piix_set_intr(pciintr_icu_handle_t v,int clink,int irq)255e8085086Skochi piix_set_intr(pciintr_icu_handle_t v, int clink, int irq)
256d6d9fbe2Sthorpej {
257d6d9fbe2Sthorpej struct piix_handle *ph = v;
258d6d9fbe2Sthorpej int shift;
259d6d9fbe2Sthorpej pcireg_t reg;
260ee2683e7Skochi int cfgreg;
261d6d9fbe2Sthorpej
262d6d9fbe2Sthorpej if (PIIX_LEGAL_LINK(clink) == 0 || PIIX_LEGAL_IRQ(irq) == 0)
263d6d9fbe2Sthorpej return (1);
264d6d9fbe2Sthorpej
265ee2683e7Skochi cfgreg = clink <= 3 ? PIIX_CFG_PIRQ : PIIX_CFG_PIRQ2;
266ee2683e7Skochi clink &= 0x03;
267ee2683e7Skochi
268ee2683e7Skochi reg = pci_conf_read(ph->ph_pc, ph->ph_tag, cfgreg);
269d6d9fbe2Sthorpej shift = clink << 3;
270d6d9fbe2Sthorpej reg &= ~((PIIX_CFG_PIRQ_NONE | PIIX_CFG_PIRQ_MASK) << shift);
271d6d9fbe2Sthorpej reg |= irq << shift;
272ee2683e7Skochi pci_conf_write(ph->ph_pc, ph->ph_tag, cfgreg, reg);
273d6d9fbe2Sthorpej
274d6d9fbe2Sthorpej return (0);
275d6d9fbe2Sthorpej }
276d6d9fbe2Sthorpej
277d6d9fbe2Sthorpej int
piix_get_trigger(pciintr_icu_handle_t v,int irq,int * triggerp)278e8085086Skochi piix_get_trigger(pciintr_icu_handle_t v, int irq, int *triggerp)
279d6d9fbe2Sthorpej {
280d6d9fbe2Sthorpej struct piix_handle *ph = v;
281d6d9fbe2Sthorpej int off, bit;
28268da4482Sperry uint8_t elcr;
283d6d9fbe2Sthorpej
284d6d9fbe2Sthorpej if (PIIX_LEGAL_IRQ(irq) == 0)
285d6d9fbe2Sthorpej return (1);
286d6d9fbe2Sthorpej
287d6d9fbe2Sthorpej off = (irq > 7) ? 1 : 0;
288d6d9fbe2Sthorpej bit = irq & 7;
289d6d9fbe2Sthorpej
290d6d9fbe2Sthorpej elcr = bus_space_read_1(ph->ph_iot, ph->ph_elcr_ioh, off);
291d6d9fbe2Sthorpej if (elcr & (1 << bit))
292d6d9fbe2Sthorpej *triggerp = IST_LEVEL;
293d6d9fbe2Sthorpej else
294d6d9fbe2Sthorpej *triggerp = IST_EDGE;
295d6d9fbe2Sthorpej
296d6d9fbe2Sthorpej return (0);
297d6d9fbe2Sthorpej }
298d6d9fbe2Sthorpej
299d6d9fbe2Sthorpej int
piix_set_trigger(pciintr_icu_handle_t v,int irq,int trigger)300e8085086Skochi piix_set_trigger(pciintr_icu_handle_t v, int irq, int trigger)
301d6d9fbe2Sthorpej {
302d6d9fbe2Sthorpej struct piix_handle *ph = v;
303d6d9fbe2Sthorpej int off, bit;
30468da4482Sperry uint8_t elcr;
305d6d9fbe2Sthorpej
306d6d9fbe2Sthorpej if (PIIX_LEGAL_IRQ(irq) == 0)
307d6d9fbe2Sthorpej return (1);
308d6d9fbe2Sthorpej
309d6d9fbe2Sthorpej off = (irq > 7) ? 1 : 0;
310d6d9fbe2Sthorpej bit = irq & 7;
311d6d9fbe2Sthorpej
312d6d9fbe2Sthorpej elcr = bus_space_read_1(ph->ph_iot, ph->ph_elcr_ioh, off);
313d6d9fbe2Sthorpej if (trigger == IST_LEVEL)
314d6d9fbe2Sthorpej elcr |= (1 << bit);
315d6d9fbe2Sthorpej else
316d6d9fbe2Sthorpej elcr &= ~(1 << bit);
317d6d9fbe2Sthorpej bus_space_write_1(ph->ph_iot, ph->ph_elcr_ioh, off, elcr);
318d6d9fbe2Sthorpej
319d6d9fbe2Sthorpej return (0);
320d6d9fbe2Sthorpej }
3212f9cb9c1Ssoda
3222f9cb9c1Ssoda #ifdef PIIX_DEBUG
3232f9cb9c1Ssoda void
piix_pir_dump(struct piix_handle * ph)324e8085086Skochi piix_pir_dump(struct piix_handle *ph)
3252f9cb9c1Ssoda {
3262f9cb9c1Ssoda int i, irq;
3272f9cb9c1Ssoda pcireg_t irqs = pci_conf_read(ph->ph_pc, ph->ph_tag, PIIX_CFG_PIRQ);
32868da4482Sperry uint8_t elcr[2];
3292f9cb9c1Ssoda
3302f9cb9c1Ssoda elcr[0] = bus_space_read_1(ph->ph_iot, ph->ph_elcr_ioh, 0);
3312f9cb9c1Ssoda elcr[1] = bus_space_read_1(ph->ph_iot, ph->ph_elcr_ioh, 1);
3322f9cb9c1Ssoda
3332f9cb9c1Ssoda for (i = 0; i < 4; i++) {
3342f9cb9c1Ssoda irq = PIIX_PIRQ(irqs, i);
3352f9cb9c1Ssoda if (irq & PIIX_CFG_PIRQ_NONE)
3362f9cb9c1Ssoda printf("PIIX PIRQ %d: irq none (0x%x)\n", i, irq);
3372f9cb9c1Ssoda else
3382f9cb9c1Ssoda printf("PIIX PIRQ %d: irq %d\n", i, irq);
3392f9cb9c1Ssoda }
3402f9cb9c1Ssoda printf("PIIX irq:");
3412f9cb9c1Ssoda for (i = 0; i < 16; i++)
3422f9cb9c1Ssoda printf(" %2d", i);
3432f9cb9c1Ssoda printf("\n");
3442f9cb9c1Ssoda printf(" trigger:");
3452f9cb9c1Ssoda for (i = 0; i < 16; i++)
3462f9cb9c1Ssoda printf(" %c", (elcr[(i & 8) ? 1 : 0] & (1 << (i & 7))) ?
3472f9cb9c1Ssoda 'L' : 'E');
3482f9cb9c1Ssoda printf("\n");
3492f9cb9c1Ssoda }
35032cdfb5cSkochi
35132cdfb5cSkochi void
ich_pir_dump(struct piix_handle * ph)35232cdfb5cSkochi ich_pir_dump(struct piix_handle *ph)
35332cdfb5cSkochi {
35432cdfb5cSkochi int i, irq;
35532cdfb5cSkochi pcireg_t irqs = pci_conf_read(ph->ph_pc, ph->ph_tag, PIIX_CFG_PIRQ2);
35632cdfb5cSkochi
35732cdfb5cSkochi for (i = 0; i < 4; i++) {
35832cdfb5cSkochi irq = PIIX_PIRQ(irqs, i);
35932cdfb5cSkochi if (irq & PIIX_CFG_PIRQ_NONE)
36032cdfb5cSkochi printf("PIIX PIRQ %d: irq none (0x%x)\n", i+4, irq);
36132cdfb5cSkochi else
36232cdfb5cSkochi printf("PIIX PIRQ %d: irq %d\n", i+4, irq);
36332cdfb5cSkochi }
36432cdfb5cSkochi }
3652f9cb9c1Ssoda #endif /* PIIX_DEBUG */
366