Use vaddr_t instead uint32_t for storing a pc since the latter won't work in a LP64 kernel.diff -r1.28.24.2 -r1.28.24.3 src/sys/arch/mips/sibyte/dev/sbmac.c
(matt)
--- src/sys/arch/mips/sibyte/dev/sbmac.c 2009/11/23 18:28:46 1.28.24.2
+++ src/sys/arch/mips/sibyte/dev/sbmac.c 2009/11/23 18:46:50 1.28.24.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sbmac.c,v 1.28.24.2 2009/11/23 18:28:46 matt Exp $ */ | 1 | /* $NetBSD: sbmac.c,v 1.28.24.3 2009/11/23 18:46:50 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2000, 2001, 2004 | 4 | * Copyright 2000, 2001, 2004 | |
5 | * Broadcom Corporation. All rights reserved. | 5 | * Broadcom Corporation. All rights reserved. | |
6 | * | 6 | * | |
7 | * This software is furnished under license and may be used and copied only | 7 | * This software is furnished under license and may be used and copied only | |
8 | * in accordance with the following terms and conditions. Subject to these | 8 | * in accordance with the following terms and conditions. Subject to these | |
9 | * conditions, you may download, copy, install, use, modify and distribute | 9 | * conditions, you may download, copy, install, use, modify and distribute | |
10 | * modified or unmodified copies of this software in source and/or binary | 10 | * modified or unmodified copies of this software in source and/or binary | |
11 | * form. No title or ownership is transferred hereby. | 11 | * form. No title or ownership is transferred hereby. | |
12 | * | 12 | * | |
13 | * 1) Any source code used, modified or distributed must reproduce and | 13 | * 1) Any source code used, modified or distributed must reproduce and | |
14 | * retain this copyright notice and list of conditions as they appear in | 14 | * retain this copyright notice and list of conditions as they appear in | |
@@ -23,27 +23,27 @@ | @@ -23,27 +23,27 @@ | |||
23 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF | 23 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF | |
24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | 24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | |
25 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE | 25 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE | |
26 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE | 26 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE | |
27 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 27 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | 29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | |
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | |
32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.28.24.2 2009/11/23 18:28:46 matt Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.28.24.3 2009/11/23 18:46:50 matt Exp $"); | |
37 | 37 | |||
38 | #include "bpfilter.h" | 38 | #include "bpfilter.h" | |
39 | #include "opt_inet.h" | 39 | #include "opt_inet.h" | |
40 | #include "opt_ns.h" | 40 | #include "opt_ns.h" | |
41 | 41 | |||
42 | #include <sys/param.h> | 42 | #include <sys/param.h> | |
43 | #include <sys/systm.h> | 43 | #include <sys/systm.h> | |
44 | #include <sys/sockio.h> | 44 | #include <sys/sockio.h> | |
45 | #include <sys/mbuf.h> | 45 | #include <sys/mbuf.h> | |
46 | #include <sys/malloc.h> | 46 | #include <sys/malloc.h> | |
47 | #include <sys/kernel.h> | 47 | #include <sys/kernel.h> | |
48 | #include <sys/socket.h> | 48 | #include <sys/socket.h> | |
49 | #include <sys/queue.h> | 49 | #include <sys/queue.h> | |
@@ -242,27 +242,27 @@ static int sbdma_add_rcvbuffer(sbmacdma_ | @@ -242,27 +242,27 @@ static int sbdma_add_rcvbuffer(sbmacdma_ | |||
242 | static int sbdma_add_txbuffer(sbmacdma_t *d, struct mbuf *m); | 242 | static int sbdma_add_txbuffer(sbmacdma_t *d, struct mbuf *m); | |
243 | static void sbdma_emptyring(sbmacdma_t *d); | 243 | static void sbdma_emptyring(sbmacdma_t *d); | |
244 | static void sbdma_fillring(sbmacdma_t *d); | 244 | static void sbdma_fillring(sbmacdma_t *d); | |
245 | static void sbdma_rx_process(struct sbmac_softc *sc, sbmacdma_t *d); | 245 | static void sbdma_rx_process(struct sbmac_softc *sc, sbmacdma_t *d); | |
246 | static void sbdma_tx_process(struct sbmac_softc *sc, sbmacdma_t *d); | 246 | static void sbdma_tx_process(struct sbmac_softc *sc, sbmacdma_t *d); | |
247 | static void sbmac_initctx(struct sbmac_softc *s); | 247 | static void sbmac_initctx(struct sbmac_softc *s); | |
248 | static void sbmac_channel_start(struct sbmac_softc *s); | 248 | static void sbmac_channel_start(struct sbmac_softc *s); | |
249 | static void sbmac_channel_stop(struct sbmac_softc *s); | 249 | static void sbmac_channel_stop(struct sbmac_softc *s); | |
250 | static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *, | 250 | static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *, | |
251 | sbmac_state_t); | 251 | sbmac_state_t); | |
252 | static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff); | 252 | static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff); | |
253 | static void sbmac_init_and_start(struct sbmac_softc *sc); | 253 | static void sbmac_init_and_start(struct sbmac_softc *sc); | |
254 | static uint64_t sbmac_addr2reg(u_char *ptr); | 254 | static uint64_t sbmac_addr2reg(u_char *ptr); | |
255 | static void sbmac_intr(void *xsc, uint32_t status, uint32_t pc); | 255 | static void sbmac_intr(void *xsc, uint32_t status, vaddr_t pc); | |
256 | static void sbmac_start(struct ifnet *ifp); | 256 | static void sbmac_start(struct ifnet *ifp); | |
257 | static void sbmac_setmulti(struct sbmac_softc *sc); | 257 | static void sbmac_setmulti(struct sbmac_softc *sc); | |
258 | static int sbmac_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data); | 258 | static int sbmac_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data); | |
259 | static int sbmac_ioctl(struct ifnet *ifp, u_long command, void *data); | 259 | static int sbmac_ioctl(struct ifnet *ifp, u_long command, void *data); | |
260 | static void sbmac_watchdog(struct ifnet *ifp); | 260 | static void sbmac_watchdog(struct ifnet *ifp); | |
261 | static int sbmac_match(struct device *parent, struct cfdata *match, void *aux); | 261 | static int sbmac_match(struct device *parent, struct cfdata *match, void *aux); | |
262 | static void sbmac_attach(struct device *parent, struct device *self, void *aux); | 262 | static void sbmac_attach(struct device *parent, struct device *self, void *aux); | |
263 | static int sbmac_set_speed(struct sbmac_softc *s, sbmac_speed_t speed); | 263 | static int sbmac_set_speed(struct sbmac_softc *s, sbmac_speed_t speed); | |
264 | static int sbmac_set_duplex(struct sbmac_softc *s, sbmac_duplex_t duplex, | 264 | static int sbmac_set_duplex(struct sbmac_softc *s, sbmac_duplex_t duplex, | |
265 | sbmac_fc_t fc); | 265 | sbmac_fc_t fc); | |
266 | static void sbmac_tick(void *arg); | 266 | static void sbmac_tick(void *arg); | |
267 | 267 | |||
268 | 268 | |||
@@ -1721,27 +1721,27 @@ sbmac_set_duplex(struct sbmac_softc *s, | @@ -1721,27 +1721,27 @@ sbmac_set_duplex(struct sbmac_softc *s, | |||
1721 | * SBMAC_INTR() | 1721 | * SBMAC_INTR() | |
1722 | * | 1722 | * | |
1723 | * Interrupt handler for MAC interrupts | 1723 | * Interrupt handler for MAC interrupts | |
1724 | * | 1724 | * | |
1725 | * Input parameters: | 1725 | * Input parameters: | |
1726 | * MAC structure | 1726 | * MAC structure | |
1727 | * | 1727 | * | |
1728 | * Return value: | 1728 | * Return value: | |
1729 | * nothing | 1729 | * nothing | |
1730 | */ | 1730 | */ | |
1731 | 1731 | |||
1732 | /* ARGSUSED */ | 1732 | /* ARGSUSED */ | |
1733 | static void | 1733 | static void | |
1734 | sbmac_intr(void *xsc, uint32_t status, uint32_t pc) | 1734 | sbmac_intr(void *xsc, uint32_t status, vaddr_t pc) | |
1735 | { | 1735 | { | |
1736 | struct sbmac_softc *sc = (struct sbmac_softc *) xsc; | 1736 | struct sbmac_softc *sc = (struct sbmac_softc *) xsc; | |
1737 | struct ifnet *ifp = &sc->sc_ethercom.ec_if; | 1737 | struct ifnet *ifp = &sc->sc_ethercom.ec_if; | |
1738 | uint64_t isr; | 1738 | uint64_t isr; | |
1739 | 1739 | |||
1740 | for (;;) { | 1740 | for (;;) { | |
1741 | 1741 | |||
1742 | /* | 1742 | /* | |
1743 | * Read the ISR (this clears the bits in the real register) | 1743 | * Read the ISR (this clears the bits in the real register) | |
1744 | */ | 1744 | */ | |
1745 | 1745 | |||
1746 | isr = SBMAC_READCSR(sc->sbm_isr); | 1746 | isr = SBMAC_READCSR(sc->sbm_isr); | |
1747 | 1747 |
--- src/sys/arch/mips/sibyte/dev/sbscn.c 2009/11/23 18:28:47 1.27.14.1
+++ src/sys/arch/mips/sibyte/dev/sbscn.c 2009/11/23 18:46:50 1.27.14.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sbscn.c,v 1.27.14.1 2009/11/23 18:28:47 matt Exp $ */ | 1 | /* $NetBSD: sbscn.c,v 1.27.14.2 2009/11/23 18:46:50 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2000, 2001 | 4 | * Copyright 2000, 2001 | |
5 | * Broadcom Corporation. All rights reserved. | 5 | * Broadcom Corporation. All rights reserved. | |
6 | * | 6 | * | |
7 | * This software is furnished under license and may be used and copied only | 7 | * This software is furnished under license and may be used and copied only | |
8 | * in accordance with the following terms and conditions. Subject to these | 8 | * in accordance with the following terms and conditions. Subject to these | |
9 | * conditions, you may download, copy, install, use, modify and distribute | 9 | * conditions, you may download, copy, install, use, modify and distribute | |
10 | * modified or unmodified copies of this software in source and/or binary | 10 | * modified or unmodified copies of this software in source and/or binary | |
11 | * form. No title or ownership is transferred hereby. | 11 | * form. No title or ownership is transferred hereby. | |
12 | * | 12 | * | |
13 | * 1) Any source code used, modified or distributed must reproduce and | 13 | * 1) Any source code used, modified or distributed must reproduce and | |
14 | * retain this copyright notice and list of conditions as they appear in | 14 | * retain this copyright notice and list of conditions as they appear in | |
@@ -99,27 +99,27 @@ | @@ -99,27 +99,27 @@ | |||
99 | * | 99 | * | |
100 | * This DUART is quite similar in programming model to the scn2681/68681 | 100 | * This DUART is quite similar in programming model to the scn2681/68681 | |
101 | * DUARTs supported by the NetBSD/amiga `mfc' and NetBSD/pc532 `scn' | 101 | * DUARTs supported by the NetBSD/amiga `mfc' and NetBSD/pc532 `scn' | |
102 | * driver, but substantial rework would have been necessary to make | 102 | * driver, but substantial rework would have been necessary to make | |
103 | * those drivers sane w.r.t. bus_space (which would then have been | 103 | * those drivers sane w.r.t. bus_space (which would then have been | |
104 | * required on NetBSD/sbmips very early on), and to accommodate the | 104 | * required on NetBSD/sbmips very early on), and to accommodate the | |
105 | * different register mappings. | 105 | * different register mappings. | |
106 | * | 106 | * | |
107 | * So, another driver. Eventually there should be One True Driver, | 107 | * So, another driver. Eventually there should be One True Driver, | |
108 | * but we're not here to save the world. | 108 | * but we're not here to save the world. | |
109 | */ | 109 | */ | |
110 | 110 | |||
111 | #include <sys/cdefs.h> | 111 | #include <sys/cdefs.h> | |
112 | __KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.27.14.1 2009/11/23 18:28:47 matt Exp $"); | 112 | __KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.27.14.2 2009/11/23 18:46:50 matt Exp $"); | |
113 | 113 | |||
114 | #define SBSCN_DEBUG | 114 | #define SBSCN_DEBUG | |
115 | 115 | |||
116 | #include "opt_ddb.h" | 116 | #include "opt_ddb.h" | |
117 | 117 | |||
118 | #include "rnd.h" | 118 | #include "rnd.h" | |
119 | #if NRND > 0 && defined(RND_SBSCN) | 119 | #if NRND > 0 && defined(RND_SBSCN) | |
120 | #include <sys/rnd.h> | 120 | #include <sys/rnd.h> | |
121 | #endif | 121 | #endif | |
122 | 122 | |||
123 | #include <sys/param.h> | 123 | #include <sys/param.h> | |
124 | #include <sys/systm.h> | 124 | #include <sys/systm.h> | |
125 | #include <sys/ioctl.h> | 125 | #include <sys/ioctl.h> | |
@@ -160,27 +160,27 @@ void sbscn_start(struct tty *); | @@ -160,27 +160,27 @@ void sbscn_start(struct tty *); | |||
160 | int sbscn_hwiflow(struct tty *, int); | 160 | int sbscn_hwiflow(struct tty *, int); | |
161 | 161 | |||
162 | void sbscn_loadchannelregs(struct sbscn_channel *); | 162 | void sbscn_loadchannelregs(struct sbscn_channel *); | |
163 | void sbscn_dohwiflow(struct sbscn_channel *); | 163 | void sbscn_dohwiflow(struct sbscn_channel *); | |
164 | void sbscn_break(struct sbscn_channel *, int); | 164 | void sbscn_break(struct sbscn_channel *, int); | |
165 | void sbscn_modem(struct sbscn_channel *, int); | 165 | void sbscn_modem(struct sbscn_channel *, int); | |
166 | void tiocm_to_sbscn(struct sbscn_channel *, int, int); | 166 | void tiocm_to_sbscn(struct sbscn_channel *, int, int); | |
167 | int sbscn_to_tiocm(struct sbscn_channel *); | 167 | int sbscn_to_tiocm(struct sbscn_channel *); | |
168 | void sbscn_iflush(struct sbscn_channel *); | 168 | void sbscn_iflush(struct sbscn_channel *); | |
169 | 169 | |||
170 | int sbscn_init(u_long addr, int chan, int rate, tcflag_t cflag); | 170 | int sbscn_init(u_long addr, int chan, int rate, tcflag_t cflag); | |
171 | int sbscn_common_getc(u_long addr, int chan); | 171 | int sbscn_common_getc(u_long addr, int chan); | |
172 | void sbscn_common_putc(u_long addr, int chan, int c); | 172 | void sbscn_common_putc(u_long addr, int chan, int c); | |
173 | void sbscn_intr(void *arg, uint32_t status, uint32_t pc); | 173 | void sbscn_intr(void *arg, uint32_t status, vaddr_t pc); | |
174 | 174 | |||
175 | int sbscn_cngetc(dev_t dev); | 175 | int sbscn_cngetc(dev_t dev); | |
176 | void sbscn_cnputc(dev_t dev, int c); | 176 | void sbscn_cnputc(dev_t dev, int c); | |
177 | void sbscn_cnpollc(dev_t dev, int on); | 177 | void sbscn_cnpollc(dev_t dev, int on); | |
178 | 178 | |||
179 | extern struct cfdriver sbscn_cd; | 179 | extern struct cfdriver sbscn_cd; | |
180 | 180 | |||
181 | dev_type_open(sbscnopen); | 181 | dev_type_open(sbscnopen); | |
182 | dev_type_close(sbscnclose); | 182 | dev_type_close(sbscnclose); | |
183 | dev_type_read(sbscnread); | 183 | dev_type_read(sbscnread); | |
184 | dev_type_write(sbscnwrite); | 184 | dev_type_write(sbscnwrite); | |
185 | dev_type_ioctl(sbscnioctl); | 185 | dev_type_ioctl(sbscnioctl); | |
186 | dev_type_stop(sbscnstop); | 186 | dev_type_stop(sbscnstop); | |
@@ -1461,27 +1461,27 @@ sbscn_soft(void *arg) | @@ -1461,27 +1461,27 @@ sbscn_soft(void *arg) | |||
1461 | 1461 | |||
1462 | if (ch->ch_st_check) { | 1462 | if (ch->ch_st_check) { | |
1463 | ch->ch_st_check = 0; | 1463 | ch->ch_st_check = 0; | |
1464 | sbscn_stsoft(ch, tp); | 1464 | sbscn_stsoft(ch, tp); | |
1465 | } | 1465 | } | |
1466 | 1466 | |||
1467 | if (ch->ch_tx_done) { | 1467 | if (ch->ch_tx_done) { | |
1468 | ch->ch_tx_done = 0; | 1468 | ch->ch_tx_done = 0; | |
1469 | sbscn_txsoft(ch, tp); | 1469 | sbscn_txsoft(ch, tp); | |
1470 | } | 1470 | } | |
1471 | } | 1471 | } | |
1472 | 1472 | |||
1473 | void | 1473 | void | |
1474 | sbscn_intr(void *arg, uint32_t status, uint32_t pc) | 1474 | sbscn_intr(void *arg, uint32_t status, vaddr_t pc) | |
1475 | { | 1475 | { | |
1476 | struct sbscn_channel *ch = arg; | 1476 | struct sbscn_channel *ch = arg; | |
1477 | u_char *put, *end; | 1477 | u_char *put, *end; | |
1478 | u_int cc; | 1478 | u_int cc; | |
1479 | u_char isr, sr; | 1479 | u_char isr, sr; | |
1480 | 1480 | |||
1481 | /* read ISR */ | 1481 | /* read ISR */ | |
1482 | isr = READ_REG(ch->ch_isr_base) & ch->ch_imr; | 1482 | isr = READ_REG(ch->ch_isr_base) & ch->ch_imr; | |
1483 | if (isr == 0) | 1483 | if (isr == 0) | |
1484 | return; | 1484 | return; | |
1485 | 1485 | |||
1486 | end = ch->ch_ebuf; | 1486 | end = ch->ch_ebuf; | |
1487 | put = ch->ch_rbput; | 1487 | put = ch->ch_rbput; |
--- src/sys/arch/mips/sibyte/dev/sbtimer.c 2009/11/23 18:28:47 1.13.28.1
+++ src/sys/arch/mips/sibyte/dev/sbtimer.c 2009/11/23 18:46:50 1.13.28.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sbtimer.c,v 1.13.28.1 2009/11/23 18:28:47 matt Exp $ */ | 1 | /* $NetBSD: sbtimer.c,v 1.13.28.2 2009/11/23 18:46:50 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2000, 2001 | 4 | * Copyright 2000, 2001 | |
5 | * Broadcom Corporation. All rights reserved. | 5 | * Broadcom Corporation. All rights reserved. | |
6 | * | 6 | * | |
7 | * This software is furnished under license and may be used and copied only | 7 | * This software is furnished under license and may be used and copied only | |
8 | * in accordance with the following terms and conditions. Subject to these | 8 | * in accordance with the following terms and conditions. Subject to these | |
9 | * conditions, you may download, copy, install, use, modify and distribute | 9 | * conditions, you may download, copy, install, use, modify and distribute | |
10 | * modified or unmodified copies of this software in source and/or binary | 10 | * modified or unmodified copies of this software in source and/or binary | |
11 | * form. No title or ownership is transferred hereby. | 11 | * form. No title or ownership is transferred hereby. | |
12 | * | 12 | * | |
13 | * 1) Any source code used, modified or distributed must reproduce and | 13 | * 1) Any source code used, modified or distributed must reproduce and | |
14 | * retain this copyright notice and list of conditions as they appear in | 14 | * retain this copyright notice and list of conditions as they appear in | |
@@ -23,27 +23,27 @@ | @@ -23,27 +23,27 @@ | |||
23 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF | 23 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF | |
24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | 24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | |
25 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE | 25 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE | |
26 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE | 26 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE | |
27 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 27 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | 29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | |
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | |
32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: sbtimer.c,v 1.13.28.1 2009/11/23 18:28:47 matt Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: sbtimer.c,v 1.13.28.2 2009/11/23 18:46:50 matt Exp $"); | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/kernel.h> | 41 | #include <sys/kernel.h> | |
42 | 42 | |||
43 | #include <mips/locore.h> | 43 | #include <mips/locore.h> | |
44 | 44 | |||
45 | #include <mips/sibyte/include/sb1250_regs.h> | 45 | #include <mips/sibyte/include/sb1250_regs.h> | |
46 | #include <mips/sibyte/include/sb1250_scd.h> | 46 | #include <mips/sibyte/include/sb1250_scd.h> | |
47 | #include <mips/sibyte/dev/sbscdvar.h> | 47 | #include <mips/sibyte/dev/sbscdvar.h> | |
48 | 48 | |||
49 | struct sbtimer_softc { | 49 | struct sbtimer_softc { | |
@@ -54,50 +54,49 @@ struct sbtimer_softc { | @@ -54,50 +54,49 @@ struct sbtimer_softc { | |||
54 | }; | 54 | }; | |
55 | #define SBTIMER_CLOCK 1 | 55 | #define SBTIMER_CLOCK 1 | |
56 | #define SBTIMER_STATCLOCK 2 | 56 | #define SBTIMER_STATCLOCK 2 | |
57 | 57 | |||
58 | #define READ_REG(rp) (mips3_ld((volatile uint64_t *)(rp))) | 58 | #define READ_REG(rp) (mips3_ld((volatile uint64_t *)(rp))) | |
59 | #define WRITE_REG(rp, val) (mips3_sd((volatile uint64_t *)(rp), (val))) | 59 | #define WRITE_REG(rp, val) (mips3_sd((volatile uint64_t *)(rp), (val))) | |
60 | 60 | |||
61 | static int sbtimer_match(struct device *, struct cfdata *, void *); | 61 | static int sbtimer_match(struct device *, struct cfdata *, void *); | |
62 | static void sbtimer_attach(struct device *, struct device *, void *); | 62 | static void sbtimer_attach(struct device *, struct device *, void *); | |
63 | 63 | |||
64 | CFATTACH_DECL(sbtimer, sizeof(struct sbtimer_softc), | 64 | CFATTACH_DECL(sbtimer, sizeof(struct sbtimer_softc), | |
65 | sbtimer_match, sbtimer_attach, NULL, NULL); | 65 | sbtimer_match, sbtimer_attach, NULL, NULL); | |
66 | 66 | |||
67 | static void sbtimer_clockintr(void *arg, uint32_t status, uint32_t pc); | 67 | static void sbtimer_clockintr(void *arg, uint32_t status, vaddr_t pc); | |
68 | static void sbtimer_statclockintr(void *arg, uint32_t status, | 68 | static void sbtimer_statclockintr(void *arg, uint32_t status, vaddr_t pc); | |
69 | uint32_t pc); | 69 | static void sbtimer_miscintr(void *arg, uint32_t status, vaddr_t pc); | |
70 | static void sbtimer_miscintr(void *arg, uint32_t status, uint32_t pc); | |||
71 | 70 | |||
72 | static void sbtimer_clock_init(void *arg); | 71 | static void sbtimer_clock_init(void *arg); | |
73 | 72 | |||
74 | static int | 73 | static int | |
75 | sbtimer_match(struct device *parent, struct cfdata *match, void *aux) | 74 | sbtimer_match(struct device *parent, struct cfdata *match, void *aux) | |
76 | { | 75 | { | |
77 | struct sbscd_attach_args *sap = aux; | 76 | struct sbscd_attach_args *sap = aux; | |
78 | 77 | |||
79 | if (sap->sa_locs.sa_type != SBSCD_DEVTYPE_TIMER) | 78 | if (sap->sa_locs.sa_type != SBSCD_DEVTYPE_TIMER) | |
80 | return (0); | 79 | return (0); | |
81 | 80 | |||
82 | return 1; | 81 | return 1; | |
83 | } | 82 | } | |
84 | 83 | |||
85 | static void | 84 | static void | |
86 | sbtimer_attach(struct device *parent, struct device *self, void *aux) | 85 | sbtimer_attach(struct device *parent, struct device *self, void *aux) | |
87 | { | 86 | { | |
88 | struct sbscd_attach_args *sa = aux; | 87 | struct sbscd_attach_args *sa = aux; | |
89 | struct sbtimer_softc *sc = (struct sbtimer_softc *)self; | 88 | struct sbtimer_softc *sc = (struct sbtimer_softc *)self; | |
90 | void (*fun)(void *, uint32_t, uint32_t); | 89 | void (*fun)(void *, uint32_t, vaddr_t); | |
91 | int ipl; | 90 | int ipl; | |
92 | const char *comment = ""; | 91 | const char *comment = ""; | |
93 | 92 | |||
94 | sc->sc_flags = device_cfdata(&sc->sc_dev)->cf_flags; | 93 | sc->sc_flags = device_cfdata(&sc->sc_dev)->cf_flags; | |
95 | sc->sc_addr_icnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base + | 94 | sc->sc_addr_icnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base + | |
96 | sa->sa_locs.sa_offset + R_SCD_TIMER_INIT); | 95 | sa->sa_locs.sa_offset + R_SCD_TIMER_INIT); | |
97 | sc->sc_addr_cnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base + | 96 | sc->sc_addr_cnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base + | |
98 | sa->sa_locs.sa_offset + R_SCD_TIMER_CNT); | 97 | sa->sa_locs.sa_offset + R_SCD_TIMER_CNT); | |
99 | sc->sc_addr_cfg = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base + | 98 | sc->sc_addr_cfg = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base + | |
100 | sa->sa_locs.sa_offset + R_SCD_TIMER_CFG); | 99 | sa->sa_locs.sa_offset + R_SCD_TIMER_CFG); | |
101 | 100 | |||
102 | printf(": "); | 101 | printf(": "); | |
103 | if ((sc->sc_flags & SBTIMER_CLOCK) != 0) { | 102 | if ((sc->sc_flags & SBTIMER_CLOCK) != 0) { | |
@@ -154,60 +153,60 @@ sbtimer_clock_init(void *arg) | @@ -154,60 +153,60 @@ sbtimer_clock_init(void *arg) | |||
154 | 153 | |||
155 | WRITE_REG(sc->sc_addr_cfg, 0x00); /* XXX */ | 154 | WRITE_REG(sc->sc_addr_cfg, 0x00); /* XXX */ | |
156 | if (G_SYS_PLL_DIV(READ_REG(MIPS_PHYS_TO_KSEG1(A_SCD_SYSTEM_CFG))) == 0) { | 155 | if (G_SYS_PLL_DIV(READ_REG(MIPS_PHYS_TO_KSEG1(A_SCD_SYSTEM_CFG))) == 0) { | |
157 | printf("%s: PLL_DIV == 0; speeding up clock ticks for simulator\n", | 156 | printf("%s: PLL_DIV == 0; speeding up clock ticks for simulator\n", | |
158 | sc->sc_dev.dv_xname); | 157 | sc->sc_dev.dv_xname); | |
159 | WRITE_REG(sc->sc_addr_icnt, (tick/100) - 1); /* XXX */ | 158 | WRITE_REG(sc->sc_addr_icnt, (tick/100) - 1); /* XXX */ | |
160 | } else { | 159 | } else { | |
161 | WRITE_REG(sc->sc_addr_icnt, tick - 1); /* XXX */ | 160 | WRITE_REG(sc->sc_addr_icnt, tick - 1); /* XXX */ | |
162 | } | 161 | } | |
163 | WRITE_REG(sc->sc_addr_cfg, 0x03); /* XXX */ | 162 | WRITE_REG(sc->sc_addr_cfg, 0x03); /* XXX */ | |
164 | } | 163 | } | |
165 | 164 | |||
166 | static void | 165 | static void | |
167 | sbtimer_clockintr(void *arg, uint32_t status, uint32_t pc) | 166 | sbtimer_clockintr(void *arg, uint32_t status, vaddr_t pc) | |
168 | { | 167 | { | |
169 | struct sbtimer_softc *sc = arg; | 168 | struct sbtimer_softc *sc = arg; | |
170 | struct clockframe cf; | 169 | struct clockframe cf; | |
171 | 170 | |||
172 | /* clear interrupt, but leave timer enabled and in repeating mode */ | 171 | /* clear interrupt, but leave timer enabled and in repeating mode */ | |
173 | WRITE_REG(sc->sc_addr_cfg, 0x03); /* XXX */ | 172 | WRITE_REG(sc->sc_addr_cfg, 0x03); /* XXX */ | |
174 | 173 | |||
175 | cf.pc = pc; | 174 | cf.pc = pc; | |
176 | cf.sr = status; | 175 | cf.sr = status; | |
177 | 176 | |||
178 | hardclock(&cf); | 177 | hardclock(&cf); | |
179 | 178 | |||
180 | /* | 179 | /* | |
181 | * We never want a CPU core clock interrupt, so adjust the CP0 | 180 | * We never want a CPU core clock interrupt, so adjust the CP0 | |
182 | * compare register to just before the CP0 clock register's value | 181 | * compare register to just before the CP0 clock register's value | |
183 | * each time. | 182 | * each time. | |
184 | */ | 183 | */ | |
185 | mips3_cp0_compare_write(mips3_cp0_count_read() - 1); | 184 | mips3_cp0_compare_write(mips3_cp0_count_read() - 1); | |
186 | } | 185 | } | |
187 | 186 | |||
188 | static void | 187 | static void | |
189 | sbtimer_statclockintr(void *arg, uint32_t status, uint32_t pc) | 188 | sbtimer_statclockintr(void *arg, uint32_t status, vaddr_t pc) | |
190 | { | 189 | { | |
191 | struct sbtimer_softc *sc = arg; | 190 | struct sbtimer_softc *sc = arg; | |
192 | struct clockframe cf; | 191 | struct clockframe cf; | |
193 | 192 | |||
194 | /* clear intr & disable timer, reset initial count, re-enable timer */ | 193 | /* clear intr & disable timer, reset initial count, re-enable timer */ | |
195 | WRITE_REG(sc->sc_addr_cfg, 0x00); /* XXX */ | 194 | WRITE_REG(sc->sc_addr_cfg, 0x00); /* XXX */ | |
196 | /* XXX more to do */ | 195 | /* XXX more to do */ | |
197 | 196 | |||
198 | cf.pc = pc; | 197 | cf.pc = pc; | |
199 | cf.sr = status; | 198 | cf.sr = status; | |
200 | 199 | |||
201 | statclock(&cf); | 200 | statclock(&cf); | |
202 | } | 201 | } | |
203 | 202 | |||
204 | static void | 203 | static void | |
205 | sbtimer_miscintr(void *arg, uint32_t status, uint32_t pc) | 204 | sbtimer_miscintr(void *arg, uint32_t status, vaddr_t pc) | |
206 | { | 205 | { | |
207 | struct sbtimer_softc *sc = arg; | 206 | struct sbtimer_softc *sc = arg; | |
208 | 207 | |||
209 | /* disable timer */ | 208 | /* disable timer */ | |
210 | WRITE_REG(sc->sc_addr_cfg, 0x00); /* XXX */ | 209 | WRITE_REG(sc->sc_addr_cfg, 0x00); /* XXX */ | |
211 | 210 | |||
212 | /* XXX more to do */ | 211 | /* XXX more to do */ | |
213 | } | 212 | } |
--- src/sys/arch/sbmips/include/systemsw.h 2008/01/08 14:38:48 1.7
+++ src/sys/arch/sbmips/include/systemsw.h 2009/11/23 18:46:50 1.7.28.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: systemsw.h,v 1.7 2008/01/08 14:38:48 simonb Exp $ */ | 1 | /* $NetBSD: systemsw.h,v 1.7.28.1 2009/11/23 18:46:50 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2000, 2001 | 4 | * Copyright 2000, 2001 | |
5 | * Broadcom Corporation. All rights reserved. | 5 | * Broadcom Corporation. All rights reserved. | |
6 | * | 6 | * | |
7 | * This software is furnished under license and may be used and copied only | 7 | * This software is furnished under license and may be used and copied only | |
8 | * in accordance with the following terms and conditions. Subject to these | 8 | * in accordance with the following terms and conditions. Subject to these | |
9 | * conditions, you may download, copy, install, use, modify and distribute | 9 | * conditions, you may download, copy, install, use, modify and distribute | |
10 | * modified or unmodified copies of this software in source and/or binary | 10 | * modified or unmodified copies of this software in source and/or binary | |
11 | * form. No title or ownership is transferred hereby. | 11 | * form. No title or ownership is transferred hereby. | |
12 | * | 12 | * | |
13 | * 1) Any source code used, modified or distributed must reproduce and | 13 | * 1) Any source code used, modified or distributed must reproduce and | |
14 | * retain this copyright notice and list of conditions as they appear in | 14 | * retain this copyright notice and list of conditions as they appear in | |
@@ -29,35 +29,35 @@ | @@ -29,35 +29,35 @@ | |||
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | 29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | |
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | |
32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #ifndef _SBMIPS_SYSTEMSW_H_ | 35 | #ifndef _SBMIPS_SYSTEMSW_H_ | |
36 | #define _SBMIPS_SYSTEMSW_H_ | 36 | #define _SBMIPS_SYSTEMSW_H_ | |
37 | 37 | |||
38 | #include <sys/types.h> | 38 | #include <sys/types.h> | |
39 | 39 | |||
40 | struct systemsw { | 40 | struct systemsw { | |
41 | /* ordered to match likely locality. */ | 41 | /* ordered to match likely locality. */ | |
42 | void (*s_cpu_intr)(uint32_t, uint32_t, uint32_t, uint32_t); | 42 | void (*s_cpu_intr)(uint32_t, uint32_t, vaddr_t, uint32_t); | |
43 | 43 | |||
44 | void *s_clock_arg; | 44 | void *s_clock_arg; | |
45 | void (*s_clock_init)(void *); | 45 | void (*s_clock_init)(void *); | |
46 | 46 | |||
47 | void *s_statclock_arg; | 47 | void *s_statclock_arg; | |
48 | void (*s_statclock_init)(void *); | 48 | void (*s_statclock_init)(void *); | |
49 | void (*s_statclock_setrate)(void *, int); | 49 | void (*s_statclock_setrate)(void *, int); | |
50 | 50 | |||
51 | void *(*s_intr_establish)(u_int, u_int, | 51 | void *(*s_intr_establish)(u_int, u_int, | |
52 | void (*fun)(void *, uint32_t, uint32_t), void *); | 52 | void (*fun)(void *, uint32_t, vaddr_t), void *); | |
53 | }; | 53 | }; | |
54 | extern struct systemsw systemsw; | 54 | extern struct systemsw systemsw; | |
55 | 55 | |||
56 | int system_set_clockfns(void *, void (*)(void *)); | 56 | int system_set_clockfns(void *, void (*)(void *)); | |
57 | int system_set_todrfns(void *, void (*)(void *, time_t), void (*)(void *)); | 57 | int system_set_todrfns(void *, void (*)(void *, time_t), void (*)(void *)); | |
58 | 58 | |||
59 | #define cpu_intr_establish(n,s,f,a) ((*systemsw.s_intr_establish)(n,s,f,a)) | 59 | #define cpu_intr_establish(n,s,f,a) ((*systemsw.s_intr_establish)(n,s,f,a)) | |
60 | 60 | |||
61 | void sb1250_icu_init(void); | 61 | void sb1250_icu_init(void); | |
62 | 62 | |||
63 | #endif /* _SBMIPS_SYSTEMSW_H_ */ | 63 | #endif /* _SBMIPS_SYSTEMSW_H_ */ |
--- src/sys/arch/sbmips/sbmips/sb1250_icu.c 2009/11/23 18:28:47 1.9.36.1
+++ src/sys/arch/sbmips/sbmips/sb1250_icu.c 2009/11/23 18:46:50 1.9.36.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sb1250_icu.c,v 1.9.36.1 2009/11/23 18:28:47 matt Exp $ */ | 1 | /* $NetBSD: sb1250_icu.c,v 1.9.36.2 2009/11/23 18:46:50 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2000, 2001 | 4 | * Copyright 2000, 2001 | |
5 | * Broadcom Corporation. All rights reserved. | 5 | * Broadcom Corporation. All rights reserved. | |
6 | * | 6 | * | |
7 | * This software is furnished under license and may be used and copied only | 7 | * This software is furnished under license and may be used and copied only | |
8 | * in accordance with the following terms and conditions. Subject to these | 8 | * in accordance with the following terms and conditions. Subject to these | |
9 | * conditions, you may download, copy, install, use, modify and distribute | 9 | * conditions, you may download, copy, install, use, modify and distribute | |
10 | * modified or unmodified copies of this software in source and/or binary | 10 | * modified or unmodified copies of this software in source and/or binary | |
11 | * form. No title or ownership is transferred hereby. | 11 | * form. No title or ownership is transferred hereby. | |
12 | * | 12 | * | |
13 | * 1) Any source code used, modified or distributed must reproduce and | 13 | * 1) Any source code used, modified or distributed must reproduce and | |
14 | * retain this copyright notice and list of conditions as they appear in | 14 | * retain this copyright notice and list of conditions as they appear in | |
@@ -23,68 +23,68 @@ | @@ -23,68 +23,68 @@ | |||
23 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF | 23 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF | |
24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | 24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | |
25 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE | 25 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE | |
26 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE | 26 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE | |
27 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 27 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | 29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | |
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | |
32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: sb1250_icu.c,v 1.9.36.1 2009/11/23 18:28:47 matt Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: sb1250_icu.c,v 1.9.36.2 2009/11/23 18:46:50 matt Exp $"); | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/systm.h> | 39 | #include <sys/systm.h> | |
40 | #include <sys/device.h> | 40 | #include <sys/device.h> | |
41 | #include <sys/malloc.h> | 41 | #include <sys/malloc.h> | |
42 | 42 | |||
43 | /* XXX for uvmexp */ | 43 | /* XXX for uvmexp */ | |
44 | #include <uvm/uvm_extern.h> | 44 | #include <uvm/uvm_extern.h> | |
45 | 45 | |||
46 | #include <machine/systemsw.h> | 46 | #include <machine/systemsw.h> | |
47 | #include <mips/locore.h> | 47 | #include <mips/locore.h> | |
48 | 48 | |||
49 | /* XXX for now, this copes with one cpu only, and assumes it's CPU 0 */ | 49 | /* XXX for now, this copes with one cpu only, and assumes it's CPU 0 */ | |
50 | 50 | |||
51 | /* imr values corresponding to each pin */ | 51 | /* imr values corresponding to each pin */ | |
52 | uint64_t ints_for_line[6]; | 52 | uint64_t ints_for_line[6]; | |
53 | uint64_t imr_all; | 53 | uint64_t imr_all; | |
54 | 54 | |||
55 | struct sb1250_ihand { | 55 | struct sb1250_ihand { | |
56 | void (*fun)(void *, uint32_t, uint32_t); | 56 | void (*fun)(void *, uint32_t, vaddr_t); | |
57 | void *arg; | 57 | void *arg; | |
58 | int level; | 58 | int level; | |
59 | struct evcnt count; | 59 | struct evcnt count; | |
60 | }; | 60 | }; | |
61 | static struct sb1250_ihand sb1250_ihands[64]; /* XXX */ | 61 | static struct sb1250_ihand sb1250_ihands[64]; /* XXX */ | |
62 | 62 | |||
63 | #define SB1250_I_IMR_ADDR (MIPS_PHYS_TO_KSEG1(0x10020000 + 0x0028)) | 63 | #define SB1250_I_IMR_ADDR (MIPS_PHYS_TO_KSEG1(0x10020000 + 0x0028)) | |
64 | #define SB1250_I_IMR_SSTATUS (MIPS_PHYS_TO_KSEG1(0x10020000 + 0x0040)) | 64 | #define SB1250_I_IMR_SSTATUS (MIPS_PHYS_TO_KSEG1(0x10020000 + 0x0040)) | |
65 | #define SB1250_I_MAP(x) \ | 65 | #define SB1250_I_MAP(x) \ | |
66 | (MIPS_PHYS_TO_KSEG1(0x10020000 + 0x0200 + (x) * 8)) | 66 | (MIPS_PHYS_TO_KSEG1(0x10020000 + 0x0200 + (x) * 8)) | |
67 | #define SB1250_I_MAP_I0 0x00 | 67 | #define SB1250_I_MAP_I0 0x00 | |
68 | #define SB1250_I_MAP_I1 0x01 | 68 | #define SB1250_I_MAP_I1 0x01 | |
69 | #define SB1250_I_MAP_I2 0x02 | 69 | #define SB1250_I_MAP_I2 0x02 | |
70 | /* XXX */ | 70 | /* XXX */ | |
71 | 71 | |||
72 | #define READ_REG(rp) (mips3_ld((volatile uint64_t *)(rp))) | 72 | #define READ_REG(rp) (mips3_ld((volatile uint64_t *)(rp))) | |
73 | #define WRITE_REG(rp, val) (mips3_sd((volatile uint64_t *)(rp), (val))) | 73 | #define WRITE_REG(rp, val) (mips3_sd((volatile uint64_t *)(rp), (val))) | |
74 | 74 | |||
75 | static void sb1250_cpu_intr(uint32_t, uint32_t, uint32_t, uint32_t); | 75 | static void sb1250_cpu_intr(uint32_t, uint32_t, vaddr_t, uint32_t); | |
76 | static void *sb1250_intr_establish(u_int, u_int, | 76 | static void *sb1250_intr_establish(u_int, u_int, | |
77 | void (*fun)(void *, uint32_t, uint32_t), void *); | 77 | void (*fun)(void *, uint32_t, vaddr_t), void *); | |
78 | 78 | |||
79 | void | 79 | void | |
80 | sb1250_icu_init(void) | 80 | sb1250_icu_init(void) | |
81 | { | 81 | { | |
82 | int i; | 82 | int i; | |
83 | char *name; | 83 | char *name; | |
84 | 84 | |||
85 | /* zero out the list of used interrupts/lines */ | 85 | /* zero out the list of used interrupts/lines */ | |
86 | memset(ints_for_line, 0, sizeof ints_for_line); | 86 | memset(ints_for_line, 0, sizeof ints_for_line); | |
87 | imr_all = 0xffffffffffffffffULL; | 87 | imr_all = 0xffffffffffffffffULL; | |
88 | memset(sb1250_ihands, 0, sizeof sb1250_ihands); | 88 | memset(sb1250_ihands, 0, sizeof sb1250_ihands); | |
89 | 89 | |||
90 | systemsw.s_cpu_intr = sb1250_cpu_intr; | 90 | systemsw.s_cpu_intr = sb1250_cpu_intr; | |
@@ -93,27 +93,27 @@ sb1250_icu_init(void) | @@ -93,27 +93,27 @@ sb1250_icu_init(void) | |||
93 | WRITE_REG(SB1250_I_IMR_ADDR, imr_all); | 93 | WRITE_REG(SB1250_I_IMR_ADDR, imr_all); | |
94 | 94 | |||
95 | for (i = 0; i < 64; i++) { | 95 | for (i = 0; i < 64; i++) { | |
96 | WRITE_REG(SB1250_I_MAP(i), SB1250_I_MAP_I0); | 96 | WRITE_REG(SB1250_I_MAP(i), SB1250_I_MAP_I0); | |
97 | /* XXX add irq name arrays for various CPU models? */ | 97 | /* XXX add irq name arrays for various CPU models? */ | |
98 | name = malloc(8, M_DEVBUF, M_NOWAIT); | 98 | name = malloc(8, M_DEVBUF, M_NOWAIT); | |
99 | snprintf(name, 8, "irq %d", i); | 99 | snprintf(name, 8, "irq %d", i); | |
100 | evcnt_attach_dynamic(&sb1250_ihands[i].count, EVCNT_TYPE_INTR, | 100 | evcnt_attach_dynamic(&sb1250_ihands[i].count, EVCNT_TYPE_INTR, | |
101 | NULL, "sb1250", name); /* XXX "sb1250"? */ | 101 | NULL, "sb1250", name); /* XXX "sb1250"? */ | |
102 | } | 102 | } | |
103 | } | 103 | } | |
104 | 104 | |||
105 | static void | 105 | static void | |
106 | sb1250_cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending) | 106 | sb1250_cpu_intr(uint32_t status, uint32_t cause, vaddr_t pc, uint32_t ipending) | |
107 | { | 107 | { | |
108 | int i, j; | 108 | int i, j; | |
109 | uint64_t sstatus; | 109 | uint64_t sstatus; | |
110 | uint32_t cycles; | 110 | uint32_t cycles; | |
111 | struct cpu_info *ci; | 111 | struct cpu_info *ci; | |
112 | 112 | |||
113 | ci = curcpu(); | 113 | ci = curcpu(); | |
114 | ci->ci_idepth++; | 114 | ci->ci_idepth++; | |
115 | uvmexp.intrs++; | 115 | uvmexp.intrs++; | |
116 | 116 | |||
117 | /* XXX do something if 5? */ | 117 | /* XXX do something if 5? */ | |
118 | if (ipending & (MIPS_INT_MASK_0 << 5)) { | 118 | if (ipending & (MIPS_INT_MASK_0 << 5)) { | |
119 | cycles = mips3_cp0_count_read(); | 119 | cycles = mips3_cp0_count_read(); | |
@@ -144,27 +144,27 @@ sb1250_cpu_intr(uint32_t status, uint32_ | @@ -144,27 +144,27 @@ sb1250_cpu_intr(uint32_t status, uint32_ | |||
144 | _splset(MIPS_SR_INT_IE | ((status & ~cause) & MIPS_HARD_INT_MASK)); | 144 | _splset(MIPS_SR_INT_IE | ((status & ~cause) & MIPS_HARD_INT_MASK)); | |
145 | 145 | |||
146 | #ifdef __HAVE_FAST_SOFTINTS | 146 | #ifdef __HAVE_FAST_SOFTINTS | |
147 | ipending &= (MIPS_SOFT_INT_MASK_1|MIPS_SOFT_INT_MASK_0); | 147 | ipending &= (MIPS_SOFT_INT_MASK_1|MIPS_SOFT_INT_MASK_0); | |
148 | if (ipending == 0) | 148 | if (ipending == 0) | |
149 | return; | 149 | return; | |
150 | _clrsoftintr(ipending); | 150 | _clrsoftintr(ipending); | |
151 | softintr_dispatch(ipending); | 151 | softintr_dispatch(ipending); | |
152 | #endif | 152 | #endif | |
153 | } | 153 | } | |
154 | 154 | |||
155 | static void * | 155 | static void * | |
156 | sb1250_intr_establish(u_int num, u_int ipl, | 156 | sb1250_intr_establish(u_int num, u_int ipl, | |
157 | void (*fun)(void *, uint32_t, uint32_t), void *arg) | 157 | void (*fun)(void *, uint32_t, vaddr_t), void *arg) | |
158 | { | 158 | { | |
159 | int s, line; | 159 | int s, line; | |
160 | 160 | |||
161 | s = splhigh(); | 161 | s = splhigh(); | |
162 | 162 | |||
163 | if (num >= 64) /* XXX */ | 163 | if (num >= 64) /* XXX */ | |
164 | panic("invalid interrupt number (0x%x)", num); | 164 | panic("invalid interrupt number (0x%x)", num); | |
165 | if (ipl >= _NIPL) | 165 | if (ipl >= _NIPL) | |
166 | panic("invalid ipl (0x%x)", ipl); | 166 | panic("invalid ipl (0x%x)", ipl); | |
167 | 167 | |||
168 | if (sb1250_ihands[num].fun != NULL) | 168 | if (sb1250_ihands[num].fun != NULL) | |
169 | panic("cannot share sb1250 interrupts"); | 169 | panic("cannot share sb1250 interrupts"); | |
170 | 170 |
--- src/sys/arch/sbmips/sbmips/systemsw.c 2008/01/08 14:38:48 1.14
+++ src/sys/arch/sbmips/sbmips/systemsw.c 2009/11/23 18:46:51 1.14.28.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: systemsw.c,v 1.14 2008/01/08 14:38:48 simonb Exp $ */ | 1 | /* $NetBSD: systemsw.c,v 1.14.28.1 2009/11/23 18:46:51 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2000, 2001 | 4 | * Copyright 2000, 2001 | |
5 | * Broadcom Corporation. All rights reserved. | 5 | * Broadcom Corporation. All rights reserved. | |
6 | * | 6 | * | |
7 | * This software is furnished under license and may be used and copied only | 7 | * This software is furnished under license and may be used and copied only | |
8 | * in accordance with the following terms and conditions. Subject to these | 8 | * in accordance with the following terms and conditions. Subject to these | |
9 | * conditions, you may download, copy, install, use, modify and distribute | 9 | * conditions, you may download, copy, install, use, modify and distribute | |
10 | * modified or unmodified copies of this software in source and/or binary | 10 | * modified or unmodified copies of this software in source and/or binary | |
11 | * form. No title or ownership is transferred hereby. | 11 | * form. No title or ownership is transferred hereby. | |
12 | * | 12 | * | |
13 | * 1) Any source code used, modified or distributed must reproduce and | 13 | * 1) Any source code used, modified or distributed must reproduce and | |
14 | * retain this copyright notice and list of conditions as they appear in | 14 | * retain this copyright notice and list of conditions as they appear in | |
@@ -23,43 +23,43 @@ | @@ -23,43 +23,43 @@ | |||
23 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF | 23 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF | |
24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | 24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | |
25 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE | 25 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE | |
26 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE | 26 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE | |
27 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 27 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | 29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | |
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | |
32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: systemsw.c,v 1.14 2008/01/08 14:38:48 simonb Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: systemsw.c,v 1.14.28.1 2009/11/23 18:46:51 matt Exp $"); | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/systm.h> | 39 | #include <sys/systm.h> | |
40 | #include <sys/kernel.h> | 40 | #include <sys/kernel.h> | |
41 | #include <sys/cpu.h> | 41 | #include <sys/cpu.h> | |
42 | 42 | |||
43 | #include <mips/locore.h> | 43 | #include <mips/locore.h> | |
44 | #include <mips/mips3_clock.h> | 44 | #include <mips/mips3_clock.h> | |
45 | 45 | |||
46 | #include <machine/intr.h> | 46 | #include <machine/intr.h> | |
47 | #include <machine/systemsw.h> | 47 | #include <machine/systemsw.h> | |
48 | 48 | |||
49 | 49 | |||
50 | /* trivial functions for function switch */ | 50 | /* trivial functions for function switch */ | |
51 | static void clock_init_triv(void *); | 51 | static void clock_init_triv(void *); | |
52 | static void cpu_intr_triv(uint32_t, uint32_t, uint32_t, uint32_t); | 52 | static void cpu_intr_triv(uint32_t, uint32_t, vaddr_t, uint32_t); | |
53 | 53 | |||
54 | /* system function switch */ | 54 | /* system function switch */ | |
55 | struct systemsw systemsw = { | 55 | struct systemsw systemsw = { | |
56 | cpu_intr_triv, | 56 | cpu_intr_triv, | |
57 | 57 | |||
58 | NULL, /* clock intr arg */ | 58 | NULL, /* clock intr arg */ | |
59 | clock_init_triv, | 59 | clock_init_triv, | |
60 | 60 | |||
61 | NULL, /* statclock arg */ | 61 | NULL, /* statclock arg */ | |
62 | NULL, /* s_statclock_init: dflt no-op */ | 62 | NULL, /* s_statclock_init: dflt no-op */ | |
63 | NULL, /* s_statclock_setrate: dflt no-op */ | 63 | NULL, /* s_statclock_setrate: dflt no-op */ | |
64 | 64 | |||
65 | NULL, /* intr_establish */ | 65 | NULL, /* intr_establish */ | |
@@ -67,27 +67,27 @@ struct systemsw systemsw = { | @@ -67,27 +67,27 @@ struct systemsw systemsw = { | |||
67 | 67 | |||
68 | int | 68 | int | |
69 | system_set_clockfns(void *arg, void (*init)(void *)) | 69 | system_set_clockfns(void *arg, void (*init)(void *)) | |
70 | { | 70 | { | |
71 | 71 | |||
72 | if (systemsw.s_clock_init != clock_init_triv) | 72 | if (systemsw.s_clock_init != clock_init_triv) | |
73 | return 1; | 73 | return 1; | |
74 | systemsw.s_clock_arg = arg; | 74 | systemsw.s_clock_arg = arg; | |
75 | systemsw.s_clock_init = init; | 75 | systemsw.s_clock_init = init; | |
76 | return 0; | 76 | return 0; | |
77 | } | 77 | } | |
78 | 78 | |||
79 | static void | 79 | static void | |
80 | cpu_intr_triv(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending) | 80 | cpu_intr_triv(uint32_t status, uint32_t cause, vaddr_t pc, uint32_t ipending) | |
81 | { | 81 | { | |
82 | 82 | |||
83 | panic("cpu_intr_triv"); | 83 | panic("cpu_intr_triv"); | |
84 | } | 84 | } | |
85 | 85 | |||
86 | void | 86 | void | |
87 | cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending) | 87 | cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending) | |
88 | { | 88 | { | |
89 | 89 | |||
90 | (*systemsw.s_cpu_intr)(status, cause, pc, ipending); | 90 | (*systemsw.s_cpu_intr)(status, cause, pc, ipending); | |
91 | } | 91 | } | |
92 | 92 | |||
93 | static void | 93 | static void |