CVS commit: [netbsd-7] src/sys/arch/sparc64/dev
Module Name:src Committed By: riz Date: Tue Jan 26 01:25:33 UTC 2016 Modified Files: src/sys/arch/sparc64/dev [netbsd-7]: schizo.c schizoreg.h schizovar.h Log Message: Pull up following revision(s) (requested by jdc in ticket #1064): sys/arch/sparc64/dev/schizo.c: revision 1.34 sys/arch/sparc64/dev/schizo.c: revision 1.35 sys/arch/sparc64/dev/schizovar.h: revision 1.7 sys/arch/sparc64/dev/schizoreg.h: revision 1.10 sys/arch/sparc64/dev/schizoreg.h: revision 1.11 add some tomatillo specific information to schizo_pbm_regs. Set the target JPID for all interrupts on Tomatillo. If the "ino-bitmap" property is available, use it to route error interrupts. Minor cosmetic changes. Add register printing when DEBUG is defined. Use __BIT() for some masks to fix the sparc build. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.31.8.1 -r1.31.8.2 src/sys/arch/sparc64/dev/schizo.c cvs rdiff -u -r1.9 -r1.9.14.1 src/sys/arch/sparc64/dev/schizoreg.h cvs rdiff -u -r1.6 -r1.6.14.1 src/sys/arch/sparc64/dev/schizovar.h 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/sparc64/dev/schizo.c diff -u src/sys/arch/sparc64/dev/schizo.c:1.31.8.1 src/sys/arch/sparc64/dev/schizo.c:1.31.8.2 --- src/sys/arch/sparc64/dev/schizo.c:1.31.8.1 Mon Nov 10 17:59:57 2014 +++ src/sys/arch/sparc64/dev/schizo.c Tue Jan 26 01:25:32 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: schizo.c,v 1.31.8.1 2014/11/10 17:59:57 snj Exp $ */ +/* $NetBSD: schizo.c,v 1.31.8.2 2016/01/26 01:25:32 riz Exp $ */ /* $OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $ */ /* @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.31.8.1 2014/11/10 17:59:57 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.31.8.2 2016/01/26 01:25:32 riz Exp $"); #include #include @@ -74,6 +74,10 @@ static int schizo_match(device_t, cfdata static void schizo_attach(device_t, device_t, void *); static int schizo_print(void *aux, const char *p); +#ifdef DEBUG +void schizo_print_regs(int unit, int what); +#endif + CFATTACH_DECL_NEW(schizo, sizeof(struct schizo_softc), schizo_match, schizo_attach, NULL, NULL); @@ -143,8 +147,8 @@ schizo_attach(device_t parent, device_t struct schizo_pbm *pbm; struct iommu_state *is; struct pcibus_attach_args pba; - uint64_t reg, eccctrl; - int *busranges = NULL, nranges; + uint64_t reg, eccctrl, ino_bitmap; + int *busranges = NULL, nranges, *ino_bitmaps = NULL, nbitmaps; char *str; bool no_sc; @@ -180,6 +184,9 @@ schizo_attach(device_t parent, device_t if (pbm == NULL) panic("schizo: can't alloc schizo pbm"); +#ifdef DEBUG + sc->sc_pbm = pbm; +#endif pbm->sp_sc = sc; pbm->sp_regt = sc->sc_bustag; @@ -194,11 +201,25 @@ schizo_attach(device_t parent, device_t if (bus_space_map(sc->sc_bustag, ma->ma_reg[0].ur_paddr, ma->ma_reg[0].ur_len, BUS_SPACE_MAP_LINEAR, >sp_intrh)) { - aprint_error(": failed to interrupt map registers\n"); + aprint_error(": failed to map interrupt registers\n"); kmem_free(pbm, sizeof(*pbm)); return; } +#ifdef DEBUG + /* + * Map ichip registers + */ + if (sc->sc_tomatillo) + if (bus_space_map(sc->sc_bustag, ma->ma_reg[3].ur_paddr, + ma->ma_reg[3].ur_len, + BUS_SPACE_MAP_LINEAR, >sp_ichiph)) { + aprint_error(": failed to map ichip registers\n"); + kmem_free(pbm, sizeof(*pbm)); + return; + } +#endif + if (prom_getprop(sc->sc_node, "ranges", sizeof(struct schizo_range), >sp_nrange, (void **)>sp_range)) panic("schizo: can't get ranges"); @@ -207,7 +228,7 @@ schizo_attach(device_t parent, device_t (void **))) panic("schizo: can't get bus-range"); - aprint_normal(": \"%s\", version %d, ign %x, bus %c %d to %d\n", + aprint_normal(": %s, version %d, ign %x, bus %c %d to %d\n", sc->sc_tomatillo ? "Tomatillo" : "Schizo", sc->sc_ver, sc->sc_ign, pbm->sp_bus_a ? 'A' : 'B', busranges[0], busranges[1]); aprint_naive("\n"); @@ -304,20 +325,34 @@ schizo_attach(device_t parent, device_t SCZ_PCIDIAG_D_INTSYNC); schizo_pbm_write(pbm, SCZ_PCI_DIAG, reg); - if (pbm->sp_bus_a) + if (prom_getprop(sc->sc_node, "ino-bitmap", sizeof(int), , + (void **)_bitmaps)) { + /* No property - set defaults (double map UE, CE, SERR). */ + if (pbm->sp_bus_a) + ino_bitmap = __BIT(SCZ_PCIERR_A_INO); + else + ino_bitmap = __BIT(SCZ_PCIERR_B_INO); + ino_bitmap |= __BIT(SCZ_UE_INO) | __BIT(SCZ_CE_INO) | + __BIT(SCZ_SERR_INO); + } else + ino_bitmap = (uint64_t) ino_bitmaps[1] << 32 | ino_bitmaps[0]; + DPRINTF(SDB_INTR, ("ino_bitmap=0x%016" PRIx64 "\n", ino_bitmap)); + + if (ino_bitmap & __BIT(SCZ_PCIERR_A_INO)) schizo_set_intr(sc, pbm, PIL_HIGH, schizo_pci_error, pbm, SCZ_PCIERR_A_INO, "pci_a"); - else + if (ino_bitmap & __BIT(SCZ_PCIERR_B_INO)) schizo_set_intr(sc, pbm, PIL_HIGH, schizo_pci_error, pbm,
CVS commit: [netbsd-7] src/sys/arch/sparc64/dev
Module Name:src Committed By: snj Date: Sat Dec 26 22:11:38 UTC 2015 Modified Files: src/sys/arch/sparc64/dev [netbsd-7]: zs.c Log Message: Pull up following revision(s) (requested by tsutsui in ticket #1050): sys/arch/sparc64/dev/zs.c: revision 1.75 Add a missing newline in zs at sbus attach message. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.74.12.1 src/sys/arch/sparc64/dev/zs.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/sparc64/dev/zs.c diff -u src/sys/arch/sparc64/dev/zs.c:1.74 src/sys/arch/sparc64/dev/zs.c:1.74.12.1 --- src/sys/arch/sparc64/dev/zs.c:1.74 Sat Oct 27 17:18:12 2012 +++ src/sys/arch/sparc64/dev/zs.c Sat Dec 26 22:11:38 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: zs.c,v 1.74 2012/10/27 17:18:12 chs Exp $ */ +/* $NetBSD: zs.c,v 1.74.12.1 2015/12/26 22:11:38 snj Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.74 2012/10/27 17:18:12 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.74.12.1 2015/12/26 22:11:38 snj Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -259,6 +259,7 @@ zs_attach_sbus(device_t parent, device_t zsc->zsc_dmatag = sa->sa_dmatag; zsc->zsc_promunit = prom_getpropint(sa->sa_node, "slave", -2); zsc->zsc_node = sa->sa_node; + aprint_normal("\n"); zs_attach(zsc, zsaddr[zs_unit], sa->sa_pri); }
CVS commit: [netbsd-7] src/sys/arch/sparc64/dev
Module Name:src Committed By: martin Date: Sat Feb 21 18:28:13 UTC 2015 Modified Files: src/sys/arch/sparc64/dev [netbsd-7]: lom.c Log Message: Pull up following revision(s) (requested by nakayama in ticket #539): sys/arch/sparc64/dev/lom.c: revision 1.14 Fix queue handling to make the watchdog timer actually works on netbsd-7 if it is configured by wdogctl=YES in rc.conf, and also avoid a hangup duaring shutdown. - don't put an entry which is already in the queue. - read a first entry properly to handle the queue. - check the lom status if input buffer is empty before writing. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c diff -u src/sys/arch/sparc64/dev/lom.c:1.13 src/sys/arch/sparc64/dev/lom.c:1.13.4.1 --- src/sys/arch/sparc64/dev/lom.c:1.13 Tue Feb 25 18:30:08 2014 +++ src/sys/arch/sparc64/dev/lom.c Sat Feb 21 18:28:13 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lom.c,v 1.13 2014/02/25 18:30:08 pooka Exp $ */ +/* $NetBSD: lom.c,v 1.13.4.1 2015/02/21 18:28:13 martin Exp $ */ /* $OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis @@ -17,7 +17,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.13 2014/02/25 18:30:08 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.13.4.1 2015/02/21 18:28:13 martin Exp $); #include sys/param.h #include sys/device.h @@ -600,7 +600,15 @@ lom1_write_polled(struct lom_softc *sc, static void lom1_queue_cmd(struct lom_softc *sc, struct lom_cmd *lc) { + struct lom_cmd *lcp; + mutex_enter(sc-sc_queue_mtx); + TAILQ_FOREACH(lcp, sc-sc_queue, lc_next) { + if (lcp == lc) { + mutex_exit(sc-sc_queue_mtx); + return; + } + } TAILQ_INSERT_TAIL(sc-sc_queue, lc, lc_next); if (sc-sc_state == LOM_STATE_IDLE) { sc-sc_state = LOM_STATE_CMD; @@ -818,13 +826,21 @@ lom2_write_polled(struct lom_softc *sc, static void lom2_queue_cmd(struct lom_softc *sc, struct lom_cmd *lc) { + struct lom_cmd *lcp; uint8_t str; mutex_enter(sc-sc_queue_mtx); + TAILQ_FOREACH(lcp, sc-sc_queue, lc_next) { + if (lcp == lc) { + mutex_exit(sc-sc_queue_mtx); + return; + } + } TAILQ_INSERT_TAIL(sc-sc_queue, lc, lc_next); if (sc-sc_state == LOM_STATE_IDLE) { str = bus_space_read_1(sc-sc_iot, sc-sc_ioh, LOM2_STATUS); if ((str LOM2_STATUS_IBF) == 0) { + lc = TAILQ_FIRST(sc-sc_queue); bus_space_write_1(sc-sc_iot, sc-sc_ioh, LOM2_CMD, lc-lc_cmd); sc-sc_state = LOM_STATE_DATA; @@ -852,9 +868,11 @@ lom2_intr(void *arg) } if (lc-lc_cmd LOM_IDX_WRITE) { - bus_space_write_1(sc-sc_iot, sc-sc_ioh, - LOM2_DATA, lc-lc_data); - lc-lc_cmd = ~LOM_IDX_WRITE; + if ((str LOM2_STATUS_IBF) == 0) { + bus_space_write_1(sc-sc_iot, sc-sc_ioh, + LOM2_DATA, lc-lc_data); + lc-lc_cmd = ~LOM_IDX_WRITE; + } mutex_exit(sc-sc_queue_mtx); return (1); } @@ -871,6 +889,7 @@ lom2_intr(void *arg) if (!TAILQ_EMPTY(sc-sc_queue)) { str = bus_space_read_1(sc-sc_iot, sc-sc_ioh, LOM2_STATUS); if ((str LOM2_STATUS_IBF) == 0) { + lc = TAILQ_FIRST(sc-sc_queue); bus_space_write_1(sc-sc_iot, sc-sc_ioh, LOM2_CMD, lc-lc_cmd); sc-sc_state = LOM_STATE_DATA;
CVS commit: [netbsd-7] src/sys/arch/sparc64/dev
Module Name:src Committed By: snj Date: Fri Nov 7 21:17:21 UTC 2014 Modified Files: src/sys/arch/sparc64/dev [netbsd-7]: sab.c Log Message: Pull up following revision(s) (requested by nakayama in ticket #186): sys/arch/sparc64/dev/sab.c: revision 1.53 Convert sab_shutdown from deprecated shutdownhook_establish(9) API to PMF(9) framework. Tested on Ultra 60 with serial console. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.52.2.1 src/sys/arch/sparc64/dev/sab.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/sparc64/dev/sab.c diff -u src/sys/arch/sparc64/dev/sab.c:1.52 src/sys/arch/sparc64/dev/sab.c:1.52.2.1 --- src/sys/arch/sparc64/dev/sab.c:1.52 Fri Jul 25 08:10:35 2014 +++ src/sys/arch/sparc64/dev/sab.c Fri Nov 7 21:17:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sab.c,v 1.52 2014/07/25 08:10:35 dholland Exp $ */ +/* $NetBSD: sab.c,v 1.52.2.1 2014/11/07 21:17:21 snj Exp $ */ /* $OpenBSD: sab.c,v 1.7 2002/04/08 17:49:42 jason Exp $ */ /* @@ -42,7 +42,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sab.c,v 1.52 2014/07/25 08:10:35 dholland Exp $); +__KERNEL_RCSID(0, $NetBSD: sab.c,v 1.52.2.1 2014/11/07 21:17:21 snj Exp $); #include opt_kgdb.h #include sys/types.h @@ -152,7 +152,7 @@ void sabtty_flush(struct sabtty_softc *) int sabtty_speed(int); void sabtty_console_flags(struct sabtty_softc *); void sabtty_cnpollc(struct sabtty_softc *, int); -void sabtty_shutdown(void *); +bool sabtty_shutdown(device_t, int); int sabttyparam(struct sabtty_softc *, struct tty *, struct termios *); #ifdef KGDB @@ -470,7 +470,7 @@ sabtty_attach(device_t parent, device_t cn_tab-cn_getc = sab_cngetc; maj = cdevsw_lookup_major(sabtty_cdevsw); cn_tab-cn_dev = makedev(maj, device_unit(self)); - shutdownhook_establish(sabtty_shutdown, sc); + pmf_device_register1(self, NULL, NULL, sabtty_shutdown); cn_init_magic(sabtty_cnm_state); cn_set_magic(\047\001); /* default magic is BREAK */ } @@ -1321,10 +1321,10 @@ sabtty_console_flags(struct sabtty_softc sc-sc_flags |= SABTTYF_IS_RSC; } -void -sabtty_shutdown(void *vsc) +bool +sabtty_shutdown(device_t dev, int how) { - struct sabtty_softc *sc = vsc; + struct sabtty_softc *sc = device_private(dev); /* Have to put the chip back into single char mode */ sc-sc_flags |= SABTTYF_DONTDDB; @@ -1332,6 +1332,7 @@ sabtty_shutdown(void *vsc) sabtty_cec_wait(sc); SAB_WRITE(sc, SAB_CMDR, SAB_CMDR_RRES); sabtty_cec_wait(sc); + return true; } #ifdef KGDB