CVS commit: src/sys/dev/sbus
Module Name:src Committed By: mrg Date: Mon Apr 12 09:23:33 UTC 2021 Modified Files: src/sys/dev/sbus: magma.c Log Message: handle cd1400_compute_baud() failure and avoid reading uninitialised variables. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/dev/sbus/magma.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/dev/sbus/magma.c diff -u src/sys/dev/sbus/magma.c:1.61 src/sys/dev/sbus/magma.c:1.62 --- src/sys/dev/sbus/magma.c:1.61 Sun Nov 10 21:16:37 2019 +++ src/sys/dev/sbus/magma.c Mon Apr 12 09:23:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: magma.c,v 1.61 2019/11/10 21:16:37 chs Exp $ */ +/* $NetBSD: magma.c,v 1.62 2021/04/12 09:23:32 mrg Exp $ */ /*- * Copyright (c) 1998 Iain Hibbert @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.61 2019/11/10 21:16:37 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.62 2021/04/12 09:23:32 mrg Exp $"); #if 0 #define MAGMA_DEBUG @@ -1743,7 +1743,10 @@ mbpp_recv(struct mbpp_port *mp, void *pt cd1400_write_reg(cd, CD1400_CAR, 0); /* input strobe at 100kbaud (10microseconds) */ - cd1400_compute_baud(10, cd->cd_clock, , ); + if (cd1400_compute_baud(10, cd->cd_clock, , )) { + splx(s); + return 0; + } cd1400_write_reg(cd, CD1400_RCOR, rcor); cd1400_write_reg(cd, CD1400_RBPR, rbpr);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: isaki Date: Sat Feb 6 13:02:28 UTC 2021 Modified Files: src/sys/dev/sbus: dbri.c Log Message: Remove an extra mutex_spin_exit() in error path. This is a part of rev 1.38. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/sbus/dbri.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.44 src/sys/dev/sbus/dbri.c:1.45 --- src/sys/dev/sbus/dbri.c:1.44 Sat Feb 6 09:15:11 2021 +++ src/sys/dev/sbus/dbri.c Sat Feb 6 13:02:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $ */ +/* $NetBSD: dbri.c,v 1.45 2021/02/06 13:02:28 isaki Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.45 2021/02/06 13:02:28 isaki Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -1065,7 +1065,6 @@ mmcodec_setcontrol(struct dbri_softc *sc if (error == EINTR) { DPRINTF("%s: interrupted\n", device_xname(sc->sc_dev)); ret = -1; - mutex_spin_exit(>sc_intr_lock); goto fail; } bail++;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: isaki Date: Sat Feb 6 09:15:11 UTC 2021 Modified Files: src/sys/dev/sbus: dbri.c dbrivar.h Log Message: Remove something like counters. - Counting {open,close} is done by the MI audio layer. - trigger_* is not called again between trigger_* and halt_*. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/sbus/dbri.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/sbus/dbrivar.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.43 src/sys/dev/sbus/dbri.c:1.44 --- src/sys/dev/sbus/dbri.c:1.43 Tue Aug 25 13:36:41 2020 +++ src/sys/dev/sbus/dbri.c Sat Feb 6 09:15:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.43 2020/08/25 13:36:41 skrll Exp $ */ +/* $NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.43 2020/08/25 13:36:41 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -368,7 +368,6 @@ dbri_attach_sbus(device_t parent, device sc->sc_locked = 0; sc->sc_desc_used = 0; - sc->sc_refcount = 0; sc->sc_playing = 0; sc->sc_recording = 0; sc->sc_init_done = 0; @@ -1894,8 +1893,7 @@ dbri_trigger_output(void *hdl, void *sta struct dbri_softc *sc = hdl; unsigned long count, num; - if (sc->sc_playing) - return 0; + KASSERT(sc->sc_playing == 0); count = (unsigned long)(((char *)end - (char *)start)); num = count / blksize; @@ -1937,8 +1935,7 @@ dbri_trigger_input(void *hdl, void *star struct dbri_softc *sc = hdl; unsigned long count, num; - if (sc->sc_recording) - return 0; + KASSERT(sc->sc_recording == 0); count = (unsigned long)(((char *)end - (char *)start)); num = count / blksize; @@ -2051,14 +2048,9 @@ dbri_open(void *cookie, int flags) { struct dbri_softc *sc = cookie; - DPRINTF("%s: %d\n", __func__, sc->sc_refcount); - - if (sc->sc_refcount == 0) { - dbri_bring_up(sc); - } - - sc->sc_refcount++; + DPRINTF("%s\n", __func__); + dbri_bring_up(sc); return 0; } @@ -2067,16 +2059,11 @@ dbri_close(void *cookie) { struct dbri_softc *sc = cookie; - DPRINTF("%s: %d\n", __func__, sc->sc_refcount); - - sc->sc_refcount--; - KASSERT(sc->sc_refcount >= 0); - if (sc->sc_refcount > 0) - return; + DPRINTF("%s\n", __func__); + KASSERT(sc->sc_playing == 0); + KASSERT(sc->sc_recording == 0); dbri_set_power(sc, 0); - sc->sc_playing = 0; - sc->sc_recording = 0; } static bool @@ -2097,7 +2084,7 @@ dbri_resume(device_t self, const pmf_qua if (sc->sc_powerstate != 0) return true; - aprint_verbose("resume: %d\n", sc->sc_refcount); + aprint_verbose("resume\n"); if (sc->sc_playing) { volatile uint32_t *cmd; Index: src/sys/dev/sbus/dbrivar.h diff -u src/sys/dev/sbus/dbrivar.h:1.16 src/sys/dev/sbus/dbrivar.h:1.17 --- src/sys/dev/sbus/dbrivar.h:1.16 Wed May 8 13:40:19 2019 +++ src/sys/dev/sbus/dbrivar.h Sat Feb 6 09:15:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dbrivar.h,v 1.16 2019/05/08 13:40:19 isaki Exp $ */ +/* $NetBSD: dbrivar.h,v 1.17 2021/02/06 09:15:11 isaki Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -140,7 +140,6 @@ struct dbri_softc { int sc_waitseen; - int sc_refcount; int sc_playing; int sc_recording;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: thorpej Date: Fri Dec 18 02:04:17 UTC 2020 Modified Files: src/sys/dev/sbus: bpp.c Log Message: Use sel{record,remove}_knote(). To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/sbus/bpp.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/dev/sbus/bpp.c diff -u src/sys/dev/sbus/bpp.c:1.45 src/sys/dev/sbus/bpp.c:1.46 --- src/sys/dev/sbus/bpp.c:1.45 Sat May 23 23:42:42 2020 +++ src/sys/dev/sbus/bpp.c Fri Dec 18 02:04:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bpp.c,v 1.45 2020/05/23 23:42:42 ad Exp $ */ +/* $NetBSD: bpp.c,v 1.46 2020/12/18 02:04:17 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.45 2020/05/23 23:42:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.46 2020/12/18 02:04:17 thorpej Exp $"); #include #include @@ -509,7 +509,7 @@ filt_bpprdetach(struct knote *kn) int s; s = splbpp(); - SLIST_REMOVE(>sc_rsel.sel_klist, kn, knote, kn_selnext); + selremove_knote(>sc_rsel, kn); splx(s); } @@ -534,7 +534,7 @@ filt_bppwdetach(struct knote *kn) int s; s = splbpp(); - SLIST_REMOVE(>sc_wsel.sel_klist, kn, knote, kn_selnext); + selremove_knote(>sc_wsel, kn); splx(s); } @@ -561,19 +561,19 @@ int bppkqfilter(dev_t dev, struct knote *kn) { struct bpp_softc *sc; - struct klist *klist; + struct selinfo *sip; int s; sc = device_lookup_private(_cd, BPPUNIT(dev)); switch (kn->kn_filter) { case EVFILT_READ: - klist = >sc_rsel.sel_klist; + sip = >sc_rsel; kn->kn_fop = _filtops; break; case EVFILT_WRITE: - klist = >sc_wsel.sel_klist; + sip = >sc_wsel; kn->kn_fop = _filtops; break; @@ -584,7 +584,7 @@ bppkqfilter(dev_t dev, struct knote *kn) kn->kn_hook = sc; s = splbpp(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + selrecord_knote(sip, kn); splx(s); return 0;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: riastradh Date: Sun Sep 6 17:22:45 UTC 2020 Modified Files: src/sys/dev/sbus: genfb_sbus.c Log Message: uvm/uvm_extern.h, not machine/pmap.h, for pmap(9). Sort includes. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/sbus/genfb_sbus.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/dev/sbus/genfb_sbus.c diff -u src/sys/dev/sbus/genfb_sbus.c:1.12 src/sys/dev/sbus/genfb_sbus.c:1.13 --- src/sys/dev/sbus/genfb_sbus.c:1.12 Sat Sep 5 16:30:11 2020 +++ src/sys/dev/sbus/genfb_sbus.c Sun Sep 6 17:22:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb_sbus.c,v 1.12 2020/09/05 16:30:11 riastradh Exp $ */ +/* $NetBSD: genfb_sbus.c,v 1.13 2020/09/06 17:22:44 riastradh Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -29,23 +29,25 @@ /* an SBus frontend for the generic fb console driver */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb_sbus.c,v 1.12 2020/09/05 16:30:11 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb_sbus.c,v 1.13 2020/09/06 17:22:44 riastradh Exp $"); #include -#include +#include + #include +#include +#include #include #include -#include +#include + +#include -#include #include -#include #include #include #include - #include struct genfb_sbus_softc {
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: skrll Date: Tue Aug 25 13:36:41 UTC 2020 Modified Files: src/sys/dev/sbus: dbri.c Log Message: Style on config_finalize_register arguments - make consistent will all other callers of config_finalize_register To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/sbus/dbri.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.42 src/sys/dev/sbus/dbri.c:1.43 --- src/sys/dev/sbus/dbri.c:1.42 Sat Feb 29 06:06:29 2020 +++ src/sys/dev/sbus/dbri.c Tue Aug 25 13:36:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.42 2020/02/29 06:06:29 isaki Exp $ */ +/* $NetBSD: dbri.c,v 1.43 2020/08/25 13:36:41 skrll Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.42 2020/02/29 06:06:29 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.43 2020/08/25 13:36:41 skrll Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -372,7 +372,7 @@ dbri_attach_sbus(device_t parent, device sc->sc_playing = 0; sc->sc_recording = 0; sc->sc_init_done = 0; - config_finalize_register(self, _config_interrupts); + config_finalize_register(self, dbri_config_interrupts); return; }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: thorpej Date: Thu Mar 19 02:58:54 UTC 2020 Modified Files: src/sys/dev/sbus: be.c qe.c Log Message: Don't bother with IFF_OACTIVE. Just keep processing so long as sc->sc_rb.rb_td_nbusy is less than sc->sc_rb.rb_ntbuf. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/dev/sbus/be.c cvs rdiff -u -r1.76 -r1.77 src/sys/dev/sbus/qe.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.95 src/sys/dev/sbus/be.c:1.96 --- src/sys/dev/sbus/be.c:1.95 Wed Jan 29 05:59:06 2020 +++ src/sys/dev/sbus/be.c Thu Mar 19 02:58:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.95 2020/01/29 05:59:06 thorpej Exp $ */ +/* $NetBSD: be.c,v 1.96 2020/03/19 02:58:54 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.95 2020/01/29 05:59:06 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.96 2020/03/19 02:58:54 thorpej Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -569,12 +569,10 @@ be_read(struct be_softc *sc, int idx, in /* * Start output on interface. - * We make two assumptions here: + * We make an assumption here: * 1) that the current priority is set to splnet _before_ this code * is called *and* is returned to the appropriate priority after * return - * 2) that the IFF_OACTIVE flag is checked before this code is called - * (i.e. that the output part of the interface is idle) */ void bestart(struct ifnet *ifp) @@ -585,12 +583,12 @@ bestart(struct ifnet *ifp) unsigned int bix, len; unsigned int ntbuf = sc->sc_rb.rb_ntbuf; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) != IFF_RUNNING) return; bix = sc->sc_rb.rb_tdhead; - for (;;) { + while (sc->sc_rb.rb_td_nbusy < ntbuf) { IFQ_DEQUEUE(>if_snd, m); if (m == 0) break; @@ -617,10 +615,7 @@ bestart(struct ifnet *ifp) if (++bix == QEC_XD_RING_MAXSIZE) bix = 0; - if (++sc->sc_rb.rb_td_nbusy == ntbuf) { - ifp->if_flags |= IFF_OACTIVE; - break; - } + sc->sc_rb.rb_td_nbusy++; } sc->sc_rb.rb_tdhead = bix; @@ -875,7 +870,6 @@ betint(struct be_softc *sc) if (txflags & QEC_XD_OWN) break; - ifp->if_flags &= ~IFF_OACTIVE; if_statinc(ifp, if_opackets); if (++bix == QEC_XD_RING_MAXSIZE) @@ -1108,7 +1102,6 @@ beinit(struct ifnet *ifp) goto out; ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; callout_reset(>sc_tick_ch, hz, be_tick, sc); Index: src/sys/dev/sbus/qe.c diff -u src/sys/dev/sbus/qe.c:1.76 src/sys/dev/sbus/qe.c:1.77 --- src/sys/dev/sbus/qe.c:1.76 Wed Jan 29 05:59:06 2020 +++ src/sys/dev/sbus/qe.c Thu Mar 19 02:58:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: qe.c,v 1.76 2020/01/29 05:59:06 thorpej Exp $ */ +/* $NetBSD: qe.c,v 1.77 2020/03/19 02:58:54 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.76 2020/01/29 05:59:06 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.77 2020/03/19 02:58:54 thorpej Exp $"); #define QEDEBUG @@ -425,12 +425,10 @@ qe_read(struct qe_softc *sc, int idx, in /* * Start output on interface. - * We make two assumptions here: + * We make an assumption here: * 1) that the current priority is set to splnet _before_ this code * is called *and* is returned to the appropriate priority after * return - * 2) that the IFF_OACTIVE flag is checked before this code is called - * (i.e. that the output part of the interface is idle) */ void qestart(struct ifnet *ifp) @@ -441,12 +439,12 @@ qestart(struct ifnet *ifp) unsigned int bix, len; unsigned int ntbuf = sc->sc_rb.rb_ntbuf; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) != IFF_RUNNING) return; bix = sc->sc_rb.rb_tdhead; - for (;;) { + while (sc->sc_rb.rb_td_nbusy < ntbuf) { IFQ_DEQUEUE(>if_snd, m); if (m == 0) break; @@ -473,10 +471,7 @@ qestart(struct ifnet *ifp) if (++bix == QEC_XD_RING_MAXSIZE) bix = 0; - if (++sc->sc_rb.rb_td_nbusy == ntbuf) { - ifp->if_flags |= IFF_OACTIVE; - break; - } + sc->sc_rb.rb_td_nbusy++; } sc->sc_rb.rb_tdhead = bix; @@ -626,7 +621,6 @@ qe_tint(struct qe_softc *sc) if (txflags & QEC_XD_OWN) break; - ifp->if_flags &= ~IFF_OACTIVE; if_statinc(ifp, if_opackets); if (++bix == QEC_XD_RING_MAXSIZE) @@ -1046,7 +1040,6 @@ qeinit(struct qe_softc *sc) qe_mcreset(sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; splx(s); }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: isaki Date: Sat Feb 29 06:06:29 UTC 2020 Modified Files: src/sys/dev/sbus: dbri.c Log Message: round_blocksize must return a multiple of the framesize even if passed blocksize is greater than the upper limit. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/sbus/dbri.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.41 src/sys/dev/sbus/dbri.c:1.42 --- src/sys/dev/sbus/dbri.c:1.41 Sat Jun 8 08:02:38 2019 +++ src/sys/dev/sbus/dbri.c Sat Feb 29 06:06:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.41 2019/06/08 08:02:38 isaki Exp $ */ +/* $NetBSD: dbri.c,v 1.42 2020/02/29 06:06:29 isaki Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.41 2019/06/08 08:02:38 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.42 2020/02/29 06:06:29 isaki Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -1636,8 +1636,8 @@ dbri_round_blocksize(void *hdl, int bs, const audio_params_t *param) { - if (bs > 0x1fff) - return 0x1fff; + if (bs > 0x1ffc) + return 0x1ffc; return bs; }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: thorpej Date: Wed Jan 29 05:59:06 UTC 2020 Modified Files: src/sys/dev/sbus: be.c qe.c Log Message: Adopt . To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/dev/sbus/be.c cvs rdiff -u -r1.75 -r1.76 src/sys/dev/sbus/qe.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.94 src/sys/dev/sbus/be.c:1.95 --- src/sys/dev/sbus/be.c:1.94 Wed May 29 10:07:30 2019 +++ src/sys/dev/sbus/be.c Wed Jan 29 05:59:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.94 2019/05/29 10:07:30 msaitoh Exp $ */ +/* $NetBSD: be.c,v 1.95 2020/01/29 05:59:06 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.94 2019/05/29 10:07:30 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.95 2020/01/29 05:59:06 thorpej Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -550,7 +550,7 @@ be_read(struct be_softc *sc, int idx, in printf("%s: invalid packet size %d; dropping\n", ifp->if_xname, len); #endif - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -559,7 +559,7 @@ be_read(struct be_softc *sc, int idx, in */ m = be_get(sc, idx, len); if (m == NULL) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -686,7 +686,7 @@ bewatchdog(struct ifnet *ifp) struct be_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev)); - ++sc->sc_ethercom.ec_if.if_oerrors; + if_statinc(ifp, if_oerrors); bereset(sc); } @@ -850,11 +850,11 @@ betint(struct be_softc *sc) /* * Unload collision counters */ - ifp->if_collisions += + if_statadd(ifp, if_collisions, bus_space_read_4(t, br, BE_BRI_NCCNT) + bus_space_read_4(t, br, BE_BRI_FCCNT) + bus_space_read_4(t, br, BE_BRI_EXCNT) + - bus_space_read_4(t, br, BE_BRI_LTCNT); + bus_space_read_4(t, br, BE_BRI_LTCNT)); /* * the clear the hardware counters @@ -876,7 +876,7 @@ betint(struct be_softc *sc) break; ifp->if_flags &= ~IFF_OACTIVE; - ifp->if_opackets++; + if_statinc(ifp, if_opackets); if (++bix == QEC_XD_RING_MAXSIZE) bix = 0; Index: src/sys/dev/sbus/qe.c diff -u src/sys/dev/sbus/qe.c:1.75 src/sys/dev/sbus/qe.c:1.76 --- src/sys/dev/sbus/qe.c:1.75 Wed May 29 10:07:30 2019 +++ src/sys/dev/sbus/qe.c Wed Jan 29 05:59:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: qe.c,v 1.75 2019/05/29 10:07:30 msaitoh Exp $ */ +/* $NetBSD: qe.c,v 1.76 2020/01/29 05:59:06 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.75 2019/05/29 10:07:30 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.76 2020/01/29 05:59:06 thorpej Exp $"); #define QEDEBUG @@ -406,7 +406,7 @@ qe_read(struct qe_softc *sc, int idx, in printf("%s: invalid packet size %d; dropping\n", ifp->if_xname, len); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -415,7 +415,7 @@ qe_read(struct qe_softc *sc, int idx, in */ m = qe_get(sc, idx, len); if (m == NULL) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -532,7 +532,7 @@ qewatchdog(struct ifnet *ifp) struct qe_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev)); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); qereset(sc); } @@ -627,7 +627,7 @@ qe_tint(struct qe_softc *sc) break; ifp->if_flags &= ~IFF_OACTIVE; - ifp->if_opackets++; + if_statinc(ifp, if_opackets); if (++bix == QEC_XD_RING_MAXSIZE) bix = 0; @@ -705,21 +705,23 @@ qe_eint(struct qe_softc *sc, uint32_t wh const char *xname = device_xname(self); int r = 0, rst = 0; + net_stat_ref_t nsr = IF_STAT_GETREF(ifp); + if (why & QE_CR_STAT_EDEFER) { printf("%s: excessive tx defers.\n", xname); r |= 1; - ifp->if_oerrors++; + if_statinc_ref(nsr, if_oerrors); } if (why & QE_CR_STAT_CLOSS) { printf("%s: no carrier, link down?\n", xname); - ifp->if_oerrors++; + if_statinc_ref(nsr, if_oerrors); r |= 1; } if (why & QE_CR_STAT_ERETRIES) { printf("%s: excessive tx retries\n", xname); - ifp->if_oerrors++; + if_statinc_ref(nsr, if_oerrors); r |= 1; rst = 1; } @@ -727,14 +729,14 @@ qe_eint(struct qe_softc *sc, uint32_t wh if (why & QE_CR_STAT_LCOLL) { printf("%s: late tx transmission\n", xname); - ifp->if_oerrors++; + if_statinc_ref(nsr, if_oerrors); r |= 1; rst = 1; } if (why & QE_CR_STAT_FUFLOW) { printf("%s: tx fifo underflow\n", xname); - ifp->if_oerrors++; + if_statinc_ref(nsr, if_oerrors); r |= 1; rst = 1; } @@ -750,8 +752,8 @@ qe_eint(struct qe_softc *sc, uint32_t wh } if (why & QE_CR_STAT_TCCOFLOW) { - ifp->if_collisions += 256; - ifp->if_oerrors += 256; +
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: thorpej Date: Wed Mar 13 22:30:01 UTC 2019 Modified Files: src/sys/dev/sbus: zx.c Log Message: In zx_cursor_color(), don't throw away the second half of the color map data. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/sbus/zx.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/dev/sbus/zx.c diff -u src/sys/dev/sbus/zx.c:1.43 src/sys/dev/sbus/zx.c:1.44 --- src/sys/dev/sbus/zx.c:1.43 Wed Mar 13 22:12:46 2019 +++ src/sys/dev/sbus/zx.c Wed Mar 13 22:30:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: zx.c,v 1.43 2019/03/13 22:12:46 thorpej Exp $ */ +/* $NetBSD: zx.c,v 1.44 2019/03/13 22:30:01 thorpej Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.43 2019/03/13 22:12:46 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.44 2019/03/13 22:30:01 thorpej Exp $"); #include #include @@ -771,7 +771,7 @@ zx_cursor_color(struct zx_softc *sc) tmp = sc->sc_curcmap[1] | (sc->sc_curcmap[3] << 8) | (sc->sc_curcmap[5] << 16); - bus_space_write_4(sc->sc_bt, sc->sc_bhzcu, zcu_data, sc->sc_curcmap[1]); + bus_space_write_4(sc->sc_bt, sc->sc_bhzcu, zcu_data, tmp); bus_space_write_4(sc->sc_bt, sc->sc_bhzcu, zcu_misc, bus_space_read_4(sc->sc_bt, sc->sc_bhzcu, zcu_misc) | 0x03);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: thorpej Date: Wed Mar 13 22:12:47 UTC 2019 Modified Files: src/sys/dev/sbus: zx.c Log Message: Fix an issue with FIOCSCURSOR FB_CUR_SETCMAP on zx described here: http://mail-index.netbsd.org/port-sparc/2019/02/11/msg002134.html by replacing the fubyte() calls with copyin() into temporary buffers. The other issue in zx_cursor_color() mentioned in that message will be addressed separately. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/sbus/zx.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/dev/sbus/zx.c diff -u src/sys/dev/sbus/zx.c:1.42 src/sys/dev/sbus/zx.c:1.43 --- src/sys/dev/sbus/zx.c:1.42 Mon Sep 3 16:29:33 2018 +++ src/sys/dev/sbus/zx.c Wed Mar 13 22:12:46 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: zx.c,v 1.42 2018/09/03 16:29:33 riastradh Exp $ */ +/* $NetBSD: zx.c,v 1.43 2019/03/13 22:12:46 thorpej Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.42 2018/09/03 16:29:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.43 2019/03/13 22:12:46 thorpej Exp $"); #include #include @@ -475,16 +475,24 @@ zxioctl(dev_t dev, u_long cmd, void *dat if (cu->cmap.index > 2 || cu->cmap.count > 2 - cu->cmap.index) return (EINVAL); - for (i = 0; i < cu->cmap.count; i++) { -if ((v = fubyte(>cmap.red[i])) < 0) - return (EFAULT); -sc->sc_curcmap[i + cu->cmap.index + 0] = v; -if ((v = fubyte(>cmap.green[i])) < 0) - return (EFAULT); -sc->sc_curcmap[i + cu->cmap.index + 2] = v; -if ((v = fubyte(>cmap.blue[i])) < 0) - return (EFAULT); -sc->sc_curcmap[i + cu->cmap.index + 4] = v; + + uint8_t red[2], green[2], blue[2]; + const u_int cnt = cu->cmap.count; + + if (cnt && + ((error = copyin(cu->cmap.red, red, cnt)) || + (error = copyin(cu->cmap.green, green, cnt)) || + (error = copyin(cu->cmap.blue, blue, cnt { +return error; + } + + for (i = 0; i < cnt; i++) { +sc->sc_curcmap[i + cu->cmap.index + 0] = +red[i]; +sc->sc_curcmap[i + cu->cmap.index + 2] = +green[i]; +sc->sc_curcmap[i + cu->cmap.index + 4] = +blue[i]; } zx_cursor_color(sc); }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Mar 28 15:33:44 UTC 2018 Modified Files: src/sys/dev/sbus: mgx.c Log Message: set WSSCREEN_RESIZE To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/sbus/mgx.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.12 src/sys/dev/sbus/mgx.c:1.13 --- src/sys/dev/sbus/mgx.c:1.12 Fri Aug 4 23:54:46 2017 +++ src/sys/dev/sbus/mgx.c Wed Mar 28 15:33:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.12 2017/08/04 23:54:46 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.13 2018/03/28 15:33:44 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include -__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.12 2017/08/04 23:54:46 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.13 2018/03/28 15:33:44 macallan Exp $"); #include #include @@ -941,7 +941,8 @@ mgx_init_screen(void *cookie, struct vco rasops_init(ri, 0, 0); - ri->ri_caps = WSSCREEN_REVERSE | WSSCREEN_WSCOLORS | WSSCREEN_UNDERLINE; + ri->ri_caps = WSSCREEN_REVERSE | WSSCREEN_WSCOLORS | + WSSCREEN_UNDERLINE | WSSCREEN_RESIZE; rasops_reconfig(ri, ri->ri_height / ri->ri_font->fontheight, ri->ri_width / ri->ri_font->fontwidth);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: mrg Date: Tue Feb 6 09:21:07 UTC 2018 Modified Files: src/sys/dev/sbus: esp_sbus.c Log Message: db_esp() has a missing {} issue in debug code. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/sbus/esp_sbus.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/dev/sbus/esp_sbus.c diff -u src/sys/dev/sbus/esp_sbus.c:1.53 src/sys/dev/sbus/esp_sbus.c:1.54 --- src/sys/dev/sbus/esp_sbus.c:1.53 Sat Oct 18 08:33:28 2014 +++ src/sys/dev/sbus/esp_sbus.c Tue Feb 6 09:21:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: esp_sbus.c,v 1.53 2014/10/18 08:33:28 snj Exp $ */ +/* $NetBSD: esp_sbus.c,v 1.54 2018/02/06 09:21:07 mrg Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.53 2014/10/18 08:33:28 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.54 2018/02/06 09:21:07 mrg Exp $"); #include #include @@ -752,12 +752,13 @@ db_esp(db_expr_t addr, bool have_addr, d " busy %d used %x\n", t, (int)li->lun, li->untagged, li->busy, li->used); -for (i = 0; i < 256; i++) +for (i = 0; i < 256; i++) { ecb = li->queued[i]; if (ecb != NULL) { db_printf("ecb %p tag %x\n", ecb, i); } +} } } }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: mrg Date: Fri Jan 12 05:59:20 UTC 2018 Modified Files: src/sys/dev/sbus: dbri.c Log Message: fix several KASSERT()s and locking in a few places. fixes DIAGNOSTIC kernels and still plays. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/sbus/dbri.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.37 src/sys/dev/sbus/dbri.c:1.38 --- src/sys/dev/sbus/dbri.c:1.37 Thu Dec 21 21:56:29 2017 +++ src/sys/dev/sbus/dbri.c Fri Jan 12 05:59:20 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.37 2017/12/21 21:56:29 macallan Exp $ */ +/* $NetBSD: dbri.c,v 1.38 2018/01/12 05:59:20 mrg Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.37 2017/12/21 21:56:29 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.38 2018/01/12 05:59:20 mrg Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -461,15 +461,14 @@ dbri_config_interrupts(device_t dev) dbri_init(sc); - mutex_spin_exit(>sc_intr_lock); - - /* talking to the codec needs working interrupts */ if (mmcodec_init(sc) == -1) { + mutex_spin_exit(>sc_intr_lock); printf("%s: no codec detected, aborting\n", device_xname(dev)); return 0; } + mutex_spin_exit(>sc_intr_lock); /* Attach ourselves to the high level audio interface */ audio_attach_mi(_hw_if, sc, sc->sc_dev); @@ -550,7 +549,7 @@ dbri_init(struct dbri_softc *sc) bus_addr_t dmaaddr; int n; - KASSERT(mutex_owned(sc->sc_intr_lock)); + KASSERT(mutex_owned(>sc_intr_lock)); dbri_reset(sc); sc->sc_mm.status = 0; @@ -624,7 +623,7 @@ dbri_command_send(struct dbri_softc *sc, bus_space_tag_t iot = sc->sc_iot; int maxloops = 100; - KASSERT(mutex_owned(sc->sc_intr_lock)); + KASSERT(mutex_owned(>sc_intr_lock)); sc->sc_locked--; @@ -671,7 +670,7 @@ dbri_process_interrupt_buffer(struct dbr int32_t i; int orig_irqp = sc->sc_irqp; - KASSERT(mutex_owned(sc->sc_intr_lock)); + KASSERT(mutex_owned(>sc_intr_lock)); while ((i = sc->sc_dma->intr[sc->sc_irqp]) != 0) { sc->sc_dma->intr[sc->sc_irqp] = 0; @@ -1003,6 +1002,8 @@ mmcodec_setcontrol(struct dbri_softc *sc int error, bail = 0; #endif + KASSERT(mutex_owned(>sc_intr_lock)); + /* * Temporarily mute outputs and wait 125 us to make sure that it * happens. This avoids clicking noises. @@ -1068,7 +1069,6 @@ mmcodec_setcontrol(struct dbri_softc *sc goto fail; } #else - mutex_spin_enter(>sc_intr_lock); while (((sc->sc_mm.status & 0xe4) != CS4215_ONE) && (bail < 10)) { DPRINTF("%s: cv_wait_sig %p\n", device_xname(sc->sc_dev), sc); error = cv_timedwait_sig(>sc_cv, >sc_intr_lock, hz); @@ -1080,7 +1080,6 @@ mmcodec_setcontrol(struct dbri_softc *sc } bail++; } - mutex_spin_exit(>sc_intr_lock); if (bail >= 10) { aprint_error("%s: switching to control mode timed out (%x %x)\n", device_xname(sc->sc_dev), sc->sc_mm.status, @@ -2025,6 +2024,7 @@ dbri_commit(void *hdl) if (sc->sc_whack_codec == 0) return 0; + mutex_spin_enter(>sc_intr_lock); ret = mmcodec_setcontrol(sc); if (ret) { DPRINTF("%s: control mode failed. Mutex %s PIL %x\n", __func__, @@ -2033,6 +2033,7 @@ dbri_commit(void *hdl) } else DPRINTF("%s: control mode ok\n", __func__); mmcodec_init_data(sc); + mutex_spin_exit(>sc_intr_lock); return 0; } @@ -2225,8 +2226,9 @@ dbri_open(void *cookie, int flags) DPRINTF("%s: %d\n", __func__, sc->sc_refcount); - if (sc->sc_refcount == 0) + if (sc->sc_refcount == 0) { dbri_bring_up(sc); + } sc->sc_refcount++;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: mrg Date: Fri Dec 8 07:47:00 UTC 2017 Modified Files: src/sys/dev/sbus: dbri.c dbrivar.h Log Message: fix audiomp bugs: - switch from tsleep/wakeup to condvar - fix locking in a bunch of places. there were several locking against myself issues. also: - don't let dbri_process_interrupt_buffer() loop more than once over the array of intrs. this fixes hangs when using audio on ss20 in -current, but does not make audio work. it eventually times out with eg: dbri0: switching to control mode timed out (0 f6) and may leave a sample in the audio buffer repeating. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/sbus/dbri.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/sbus/dbrivar.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.35 src/sys/dev/sbus/dbri.c:1.36 --- src/sys/dev/sbus/dbri.c:1.35 Sat Oct 19 21:00:32 2013 +++ src/sys/dev/sbus/dbri.c Fri Dec 8 07:47:00 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.35 2013/10/19 21:00:32 mrg Exp $ */ +/* $NetBSD: dbri.c,v 1.36 2017/12/08 07:47:00 mrg Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.35 2013/10/19 21:00:32 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.36 2017/12/08 07:47:00 mrg Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -367,6 +367,10 @@ dbri_attach_sbus(device_t parent, device mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE); mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); +#ifndef DBRI_SPIN + cv_init(>sc_cv, "dbricv"); +#endif + bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_SCHED, dbri_intr, sc); @@ -444,8 +448,11 @@ dbri_config_interrupts(device_t dev) { struct dbri_softc *sc = device_private(dev); - if (sc->sc_init_done != 0) + mutex_spin_enter(>sc_intr_lock); + if (sc->sc_init_done != 0) { + mutex_spin_exit(>sc_intr_lock); return 0; + } sc->sc_init_done = 1; @@ -453,14 +460,19 @@ dbri_config_interrupts(device_t dev) if (mmcodec_init(sc) == -1) { printf("%s: no codec detected, aborting\n", device_xname(dev)); + mutex_spin_exit(>sc_intr_lock); return 0; } + mutex_spin_exit(>sc_intr_lock); /* Attach ourselves to the high level audio interface */ audio_attach_mi(_hw_if, sc, sc->sc_dev); /* power down until open() */ + mutex_spin_enter(>sc_intr_lock); dbri_set_power(sc, 0); + mutex_spin_exit(>sc_intr_lock); + return 0; } @@ -532,6 +544,8 @@ dbri_init(struct dbri_softc *sc) bus_addr_t dmaaddr; int n; + KASSERT(mutex_owned(sc->sc_intr_lock)); + dbri_reset(sc); cmd = dbri_command_lock(sc); @@ -562,6 +576,7 @@ dbri_init(struct dbri_softc *sc) *(cmd++) = dmaaddr; dbri_command_send(sc, cmd); + return (0); } @@ -603,7 +618,7 @@ dbri_command_send(struct dbri_softc *sc, bus_space_tag_t iot = sc->sc_iot; int maxloops = 100; - mutex_spin_enter(>sc_intr_lock); + KASSERT(mutex_owned(sc->sc_intr_lock)); sc->sc_locked--; @@ -641,8 +656,6 @@ dbri_command_send(struct dbri_softc *sc, } } - mutex_spin_exit(>sc_intr_lock); - return; } @@ -650,6 +663,9 @@ static void dbri_process_interrupt_buffer(struct dbri_softc *sc) { int32_t i; + int orig_irqp = sc->sc_irqp; + + KASSERT(mutex_owned(sc->sc_intr_lock)); while ((i = sc->sc_dma->intr[sc->sc_irqp]) != 0) { sc->sc_dma->intr[sc->sc_irqp] = 0; @@ -661,6 +677,10 @@ dbri_process_interrupt_buffer(struct dbr sc->sc_irqp++; dbri_process_interrupt(sc, i); + + /* don't loop more than once. */ + if (orig_irqp == sc->sc_irqp) + break; } return; @@ -688,6 +708,7 @@ dbri_process_interrupt(struct dbri_softc int td; struct dbri_desc *dd; + DPRINTF("%s:%d tx complete\n", __func__, channel); td = sc->sc_pipe[channel].desc; dd = >sc_desc[td]; @@ -696,7 +717,7 @@ dbri_process_interrupt(struct dbri_softc break; } case DBRI_INTR_FXDT: /* fixed data change */ - DPRINTF("dbri_intr: Fixed data change (%d: %x)\n", channel, + DPRINTF("%s:%d: Fixed data change: %x\n", __func__, channel, val); #if 0 printf("reg: %08x\n", sc->sc_mm.status); @@ -706,8 +727,8 @@ dbri_process_interrupt(struct dbri_softc if (sc->sc_pipe[channel].prec) *(sc->sc_pipe[channel].prec) = val; #ifndef DBRI_SPIN - DPRINTF("%s: wakeup %p\n", device_xname(sc->sc_dev), sc); - wakeup(sc); + DPRINTF("%s: cv_broadcast %p\n", device_xname(sc->sc_dev), sc); + cv_broadcast(>sc_cv); #endif break; case DBRI_INTR_SBRI: @@ -718,6 +739,7 @@ dbri_process_interrupt(struct dbri_softc int td; struct dbri_desc *dd; + DPRINTF("dbri_intr: buffer ready (%d)\n", channel); td = sc->sc_pipe[channel].desc; dd = >sc_desc[td]; @@ -973,6 +995,8 @@ mmcodec_setcontrol(struct dbri_softc *sc int bail = 0; #if DBRI_SPIN int i;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Fri Aug 4 23:54:46 UTC 2017 Modified Files: src/sys/dev/sbus: mgx.c Log Message: - store bitmap fonts in vram - don't try to force buffer flushes - avoid 64bit writes to vram -> no more corruption of font bitmaps To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/sbus/mgx.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.11 src/sys/dev/sbus/mgx.c:1.12 --- src/sys/dev/sbus/mgx.c:1.11 Sat Jul 29 03:32:00 2017 +++ src/sys/dev/sbus/mgx.c Fri Aug 4 23:54:46 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.11 2017/07/29 03:32:00 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.12 2017/08/04 23:54:46 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include -__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.11 2017/07/29 03:32:00 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.12 2017/08/04 23:54:46 macallan Exp $"); #include #include @@ -94,6 +94,7 @@ struct mgx_softc { struct wsscreen_list sc_screenlist; struct vcons_data vd; glyphcache sc_gc; + uint8_t sc_in[256]; }; static int mgx_match(device_t, cfdata_t, void *); @@ -110,7 +111,7 @@ static int mgx_putcmap(struct mgx_softc static int mgx_getcmap(struct mgx_softc *, struct wsdisplay_cmap *); static int mgx_wait_engine(struct mgx_softc *); __unused static int mgx_wait_host(struct mgx_softc *); -static int mgx_wait_fifo(struct mgx_softc *, unsigned int); +/*static*/ int mgx_wait_fifo(struct mgx_softc *, unsigned int); static void mgx_bitblt(void *, int, int, int, int, int, int, int); static void mgx_rectfill(void *, int, int, int, int, long); @@ -122,6 +123,7 @@ static void mgx_copycols(void *, int, in static void mgx_erasecols(void *, int, int, int, long); static void mgx_copyrows(void *, int, int, int); static void mgx_eraserows(void *, int, int, long); +static void mgx_adapt(struct vcons_screen *, void *); static int mgx_do_cursor(struct mgx_softc *, struct wsdisplay_cursor *); static void mgx_set_cursor(struct mgx_softc *); @@ -237,7 +239,7 @@ mgx_attach(device_t parent, device_t sel struct rasops_info *ri; unsigned long defattr; bus_space_handle_t bh; - int node = sa->sa_node; + int node = sa->sa_node, bsize; int isconsole; aprint_normal("\n"); @@ -267,7 +269,7 @@ mgx_attach(device_t parent, device_t sel } sc->sc_fbaddr = bus_space_vaddr(sa->sa_bustag, bh); } - + if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, sa->sa_reg[4].oa_base, 0x1000, 0, @@ -318,8 +320,8 @@ mgx_attach(device_t parent, device_t sel vcons_init(>vd, sc, >sc_defaultscreen_descr, _accessops); sc->vd.init_screen = mgx_init_screen; - sc->vd.show_screen_cookie = >sc_gc; - sc->vd.show_screen_cb = glyphcache_adapt; + sc->vd.show_screen_cookie = sc; + sc->vd.show_screen_cb = mgx_adapt; vcons_init_screen(>vd, >sc_console_screen, 1, ); sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; @@ -340,9 +342,10 @@ mgx_attach(device_t parent, device_t sel * leave some room between visible screen and glyph cache for upload * buffers used by putchar_mono() */ + bsize = (32 * 1024 * sc->sc_stride - 1) / sc->sc_stride; glyphcache_init(>sc_gc, - sc->sc_height + 5, - (0x40 / sc->sc_stride) - sc->sc_height - 5, + sc->sc_height + bsize, + (0x40 / sc->sc_stride) - (sc->sc_height + bsize), sc->sc_width, ri->ri_font->fontwidth, ri->ri_font->fontheight, @@ -378,16 +381,6 @@ mgx_attach(device_t parent, device_t sel fb->fb_type.fb_cmsize = 256; fb->fb_type.fb_size = sc->sc_fbsize; fb_attach(>sc_fb, isconsole); - -#if 0 - { - uint32_t ap; - /* reads 0xfd21 */ - mgx_write_4(sc, ATR_APERTURE, 0x); - ap = mgx_read_4(sc, ATR_APERTURE); - printf("aperture: %08x\n", ap); - } -#endif } static void @@ -514,7 +507,7 @@ mgx_wait_host(struct mgx_softc *sc) return i; } -static int +/*static inline*/ int mgx_wait_fifo(struct mgx_softc *sc, unsigned int nfifo) { unsigned int i; @@ -580,7 +573,7 @@ mgx_setup(struct mgx_softc *sc, int dept sc->sc_stride = sc->sc_width * (depth >> 3); stride = sc->sc_stride >> 3; #ifdef MGX_DEBUG - sc->sc_height = 600; + sc->sc_height -= 150; #endif sc->sc_depth = depth; @@ -628,24 +621,7 @@ mgx_setup(struct mgx_softc *sc, int dept mgx_write_1(sc, ATR_CURSOR_ENABLE, 0); sc->sc_cursor = (uint8_t *)sc->sc_fbaddr + sc->sc_fbsize - 1024; memset(sc->sc_cursor, 0xf0, 1024); - -#ifdef MGX_DEBUG - int j; - mgx_write_vga(sc, SEQ_INDEX, 0x10); - mgx_write_vga(sc, SEQ_DATA, 0x12); - for (i = 0x10; i < 0x30; i += 16) { - printf("%02x:", i); - for (j = 0; j < 16; j++) { - mgx_write_vga(sc, SEQ_INDEX, i + j); - printf(" %02x", mgx_read_vga(sc, SEQ_DATA)); - } - printf("\n"); - } -#if 0 -
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Sat Jul 29 03:32:00 UTC 2017 Modified Files: src/sys/dev/sbus: mgx.c Log Message: make comment match code... To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/sbus/mgx.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.10 src/sys/dev/sbus/mgx.c:1.11 --- src/sys/dev/sbus/mgx.c:1.10 Sat Jul 29 03:29:49 2017 +++ src/sys/dev/sbus/mgx.c Sat Jul 29 03:32:00 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.10 2017/07/29 03:29:49 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.11 2017/07/29 03:32:00 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include -__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.10 2017/07/29 03:29:49 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.11 2017/07/29 03:32:00 macallan Exp $"); #include #include @@ -752,7 +752,7 @@ mgx_putchar_mono(void *cookie, int row, struct vcons_screen *scr = ri->ri_hw; struct mgx_softc *sc = scr->scr_cookie; void *s, *d; - uint32_t fg, bg, scratch = (sc->sc_stride * sc->sc_height + 31) & ~31; + uint32_t fg, bg, scratch = (sc->sc_stride * sc->sc_height + 7) & ~7; int x, y, wi, he; wi = font->fontwidth; @@ -785,7 +785,7 @@ mgx_putchar_mono(void *cookie, int row, * bitmaps need at least 16bit. */ sc->sc_buf = (sc->sc_buf + 1) & 3; /* rotate through 4 buffers */ - scratch += sc->sc_buf * ((ri->ri_fontscale + 31) & ~31); + scratch += sc->sc_buf * ((ri->ri_fontscale + 7) & ~7); s = WSFONT_GLYPH(c, font); d = (uint8_t *)sc->sc_fbaddr + scratch; memcpy(d, s, ri->ri_fontscale);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Sat Jul 29 03:29:49 UTC 2017 Modified Files: src/sys/dev/sbus: mgx.c mgxreg.h Log Message: - use hardware to draw bitmap fonts - while there enable font loading etc. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/sbus/mgx.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/sbus/mgxreg.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.9 src/sys/dev/sbus/mgx.c:1.10 --- src/sys/dev/sbus/mgx.c:1.9 Sat May 7 15:32:08 2016 +++ src/sys/dev/sbus/mgx.c Sat Jul 29 03:29:49 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.9 2016/05/07 15:32:08 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.10 2017/07/29 03:29:49 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include -__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.9 2016/05/07 15:32:08 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.10 2017/07/29 03:29:49 macallan Exp $"); #include #include @@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.9 #include #include #include +#include #include #include @@ -85,7 +86,7 @@ struct mgx_softc { u_char sc_cmap_blue[256]; int sc_cursor_x, sc_cursor_y; int sc_hotspot_x, sc_hotspot_y; - int sc_video; + int sc_video, sc_buf; void (*sc_putchar)(void *, int, int, u_int, long); struct vcons_screen sc_console_screen; struct wsscreen_descr sc_defaultscreen_descr; @@ -114,7 +115,8 @@ static int mgx_wait_fifo(struct mgx_soft static void mgx_bitblt(void *, int, int, int, int, int, int, int); static void mgx_rectfill(void *, int, int, int, int, long); -static void mgx_putchar(void *, int, int, u_int, long); +static void mgx_putchar_aa(void *, int, int, u_int, long); +static void mgx_putchar_mono(void *, int, int, u_int, long); static void mgx_cursor(void *, int, int, int); static void mgx_copycols(void *, int, int, int, int); static void mgx_erasecols(void *, int, int, int, long); @@ -295,7 +297,8 @@ mgx_attach(device_t parent, device_t sel 0, 0, NULL, 8, 16, - WSSCREEN_WSCOLORS | WSSCREEN_HILIT, + WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE | + WSSCREEN_RESIZE, NULL }; @@ -315,6 +318,8 @@ mgx_attach(device_t parent, device_t sel vcons_init(>vd, sc, >sc_defaultscreen_descr, _accessops); sc->vd.init_screen = mgx_init_screen; + sc->vd.show_screen_cookie = >sc_gc; + sc->vd.show_screen_cb = glyphcache_adapt; vcons_init_screen(>vd, >sc_console_screen, 1, ); sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; @@ -331,6 +336,10 @@ mgx_attach(device_t parent, device_t sel sc->sc_gc.gc_blitcookie = sc; sc->sc_gc.gc_rop = ROP_SRC; + /* + * leave some room between visible screen and glyph cache for upload + * buffers used by putchar_mono() + */ glyphcache_init(>sc_gc, sc->sc_height + 5, (0x40 / sc->sc_stride) - sc->sc_height - 5, @@ -535,6 +544,7 @@ mgx_setup(struct mgx_softc *sc, int dept if (mgx_wait_fifo(sc, FIFO_AT24) == 0) return; + sc->sc_buf = 0; /* read name from sequencer */ for (i = 0; i < 8; i++) { mgx_write_vga(sc, SEQ_INDEX, i + 0x11); @@ -597,9 +607,12 @@ mgx_setup(struct mgx_softc *sc, int dept default: return; /* not supported */ } + mgx_wait_fifo(sc, 4); mgx_write_1(sc, ATR_CLIP_CONTROL, 0); mgx_write_1(sc, ATR_BYTEMASK, 0xff); mgx_write_1(sc, ATR_PIXEL, reg); + mgx_write_4(sc, ATR_OFFSET, 0); + mgx_wait_fifo(sc, 4); mgx_write_vga(sc, CRTC_INDEX, 0x13); mgx_write_vga(sc, CRTC_DATA, stride & 0xff); mgx_write_vga(sc, CRTC_INDEX, 0x1c); @@ -609,6 +622,7 @@ mgx_setup(struct mgx_softc *sc, int dept if (depth != MGX_DEPTH) mgx_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height, 0); + mgx_wait_fifo(sc, 4); /* initialize hardware cursor stuff */ mgx_write_2(sc, ATR_CURSOR_ADDRESS, (sc->sc_fbsize - 1024) >> 10); mgx_write_1(sc, ATR_CURSOR_ENABLE, 0); @@ -685,7 +699,7 @@ mgx_rectfill(void *cookie, int x, int y, } static void -mgx_putchar(void *cookie, int row, int col, u_int c, long attr) +mgx_putchar_aa(void *cookie, int row, int col, u_int c, long attr) { struct rasops_info *ri = cookie; struct wsdisplay_font *font = PICK_FONT(ri, c); @@ -709,6 +723,7 @@ mgx_putchar(void *cookie, int row, int c mgx_rectfill(sc, x, y + he - 2, wi, 1, fg); return; } + rv = glyphcache_try(>sc_gc, c, x, y, attr); if (rv != GC_OK) { volatile uint32_t junk; @@ -730,6 +745,74 @@ mgx_putchar(void *cookie, int row, int c } static void +mgx_putchar_mono(void *cookie, int row, int col, u_int c, long attr) +{ + struct rasops_info *ri = cookie; + struct wsdisplay_font *font = PICK_FONT(ri, c); + struct vcons_screen *scr = ri->ri_hw; + struct mgx_softc *sc = scr->scr_cookie; + void *s, *d; + uint32_t fg, bg, scratch = (sc->sc_stride * sc->sc_height + 31) & ~31;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: maxv Date: Sun Jun 25 12:02:59 UTC 2017 Modified Files: src/sys/dev/sbus: be.c Log Message: spl leak, found by Mootja a long time ago To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/dev/sbus/be.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.85 src/sys/dev/sbus/be.c:1.86 --- src/sys/dev/sbus/be.c:1.85 Thu Dec 15 09:28:06 2016 +++ src/sys/dev/sbus/be.c Sun Jun 25 12:02:59 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.85 2016/12/15 09:28:06 ozaki-r Exp $ */ +/* $NetBSD: be.c,v 1.86 2017/06/25 12:02:59 maxv Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.85 2016/12/15 09:28:06 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.86 2017/06/25 12:02:59 maxv Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -1119,6 +1119,7 @@ beinit(struct ifnet *ifp) callout_reset(>sc_tick_ch, hz, be_tick, sc); + splx(s); return 0; out: splx(s);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: martin Date: Tue May 2 08:11:16 UTC 2017 Modified Files: src/sys/dev/sbus: cs4231_sbus.c Log Message: Make it compile with AUDIODEBUG To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/sbus/cs4231_sbus.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/dev/sbus/cs4231_sbus.c diff -u src/sys/dev/sbus/cs4231_sbus.c:1.49 src/sys/dev/sbus/cs4231_sbus.c:1.50 --- src/sys/dev/sbus/cs4231_sbus.c:1.49 Wed Nov 23 23:07:36 2011 +++ src/sys/dev/sbus/cs4231_sbus.c Tue May 2 08:11:16 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231_sbus.c,v 1.49 2011/11/23 23:07:36 jmcneill Exp $ */ +/* $NetBSD: cs4231_sbus.c,v 1.50 2017/05/02 08:11:16 martin Exp $ */ /*- * Copyright (c) 1998, 1999, 2002, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.49 2011/11/23 23:07:36 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.50 2017/05/02 08:11:16 martin Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -129,7 +129,7 @@ const struct audio_hw_if audiocs_sbus_hw #ifdef AUDIO_DEBUG -static void cs4231_sbus_regdump(char *, struct cs4231_sbus_softc *); +static void cs4231_sbus_regdump(const char *, struct cs4231_sbus_softc *); #endif static int cs4231_sbus_intr(void *); @@ -200,30 +200,30 @@ cs4231_sbus_attach(device_t parent, devi #ifdef AUDIO_DEBUG static void -cs4231_sbus_regdump(char *label, struct cs4231_sbus_softc *sc) +cs4231_sbus_regdump(const char *label, struct cs4231_sbus_softc *sc) { char bits[128]; printf("cs4231regdump(%s): regs:", label); printf("dmapva: 0x%x; ", - bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_PVA)); + bus_space_read_4(sc->sc_bt, sc->sc_bh, APC_DMA_PVA)); printf("dmapc: 0x%x; ", - bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_PC)); + bus_space_read_4(sc->sc_bt, sc->sc_bh, APC_DMA_PC)); printf("dmapnva: 0x%x; ", - bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_PNVA)); + bus_space_read_4(sc->sc_bt, sc->sc_bh, APC_DMA_PNVA)); printf("dmapnc: 0x%x\n", - bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_PNC)); + bus_space_read_4(sc->sc_bt, sc->sc_bh, APC_DMA_PNC)); printf("dmacva: 0x%x; ", - bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CVA)); + bus_space_read_4(sc->sc_bt, sc->sc_bh, APC_DMA_CVA)); printf("dmacc: 0x%x; ", - bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CC)); + bus_space_read_4(sc->sc_bt, sc->sc_bh, APC_DMA_CC)); printf("dmacnva: 0x%x; ", - bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CNVA)); + bus_space_read_4(sc->sc_bt, sc->sc_bh, APC_DMA_CNVA)); printf("dmacnc: 0x%x\n", - bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CNC)); + bus_space_read_4(sc->sc_bt, sc->sc_bh, APC_DMA_CNC)); snprintb(bits, sizeof(bits), APC_BITS, - bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CSR)); + bus_space_read_4(sc->sc_bt, sc->sc_bh, APC_DMA_CSR)); printf("apc_dmacsr=%s\n", bits); ad1848_dump_regs(>sc_cs4231.sc_ad1848);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Fri Sep 23 17:45:25 UTC 2016 Modified Files: src/sys/dev/sbus: tcx.c Log Message: - finally fix tcx_clearscreen() and tcx_eraserows() to actually work, and not just by accident - sprinkle volatile in order to force gcc 5.4 to emit ldd/std for 64bit accesses - BLIT and STIP spaces require those To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.56 src/sys/dev/sbus/tcx.c:1.57 --- src/sys/dev/sbus/tcx.c:1.56 Fri Jul 25 08:10:38 2014 +++ src/sys/dev/sbus/tcx.c Fri Sep 23 17:45:25 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.56 2014/07/25 08:10:38 dholland Exp $ */ +/* $NetBSD: tcx.c,v 1.57 2016/09/23 17:45:25 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.56 2014/07/25 08:10:38 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.57 2016/09/23 17:45:25 macallan Exp $"); #include #include @@ -87,8 +87,8 @@ struct tcx_softc { bus_space_handle_t sc_bt; /* Brooktree registers */ bus_space_handle_t sc_thc; /* THC registers */ uint8_t *sc_fbaddr; /* framebuffer */ - uint64_t *sc_rblit; /* blitspace */ - uint64_t *sc_rstip; /* stipple space */ + volatile uint64_t *sc_rblit; /* blitspace */ + volatile uint64_t *sc_rstip; /* stipple space */ short sc_8bit; /* true if 8-bit hardware */ short sc_blanked; /* true if blanked */ @@ -884,11 +884,11 @@ static void tcx_clearscreen(struct tcx_softc *sc, int spc) { /* ROP in the upper 4bit is necessary, tcx actually uses it */ - uint64_t bg = 0x3000LL; - uint64_t spc64; + volatile uint64_t bg = 0x3000LL; + volatile uint64_t spc64; int i, len; - spc64 = ((spc & 3) << 24) | sc->sc_bg; + spc64 = ((spc & 3) << 24); bg |= (spc64 << 32); len = sc->sc_fb.fb_type.fb_width * sc->sc_fb.fb_type.fb_height; @@ -947,7 +947,7 @@ tcx_eraserows(void *cookie, int start, i struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; struct tcx_softc *sc = scr->scr_cookie; - uint64_t temp; + volatile uint64_t temp; int i, last, first, len, leftover; i = ri->ri_width * ri->ri_font->fontheight * nrows; @@ -957,14 +957,14 @@ tcx_eraserows(void *cookie, int start, i (ri->ri_font->fontheight * start + ri->ri_yorigin); last = first + len; temp = 0x3000LL | - ((uint64_t)ri->ri_devcmap[(attr >> 16) & 0xff] << 32); + ((uint64_t)((ri->ri_devcmap[(attr >> 16) & 0xff]) & 0xff) << 32); - for (i = first; i <= last; i+= 32) - sc->sc_rblit[i] = temp; + for (i = first; i < last; i+= 32) + sc->sc_rstip[i] = temp; if (leftover > 0) { temp &= 0xLL << (32 - leftover); - sc->sc_rblit[i] = temp; + sc->sc_rstip[i] = temp; } } /* @@ -979,7 +979,7 @@ tcx_putchar(void *cookie, int row, int c struct wsdisplay_font *font = PICK_FONT(ri, c); struct vcons_screen *scr = ri->ri_hw; struct tcx_softc *sc = scr->scr_cookie; - uint64_t bg, fg, temp, mask; + volatile uint64_t bg, fg, temp, mask; int addr, i, uc, shift; uint32_t fmask; uint8_t *cdata; @@ -1045,7 +1045,7 @@ tcx_putchar(void *cookie, int row, int c } } else { /* and now the split case ( man this hardware is dumb ) */ - uint64_t bgr, maskr, fgr; + volatile uint64_t bgr, maskr, fgr; uint32_t bork; shift = addr & 0x1f;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Sat May 7 15:32:08 UTC 2016 Modified Files: src/sys/dev/sbus: mgx.c Log Message: add Sun /dev/fb* style goop To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/sbus/mgx.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.8 src/sys/dev/sbus/mgx.c:1.9 --- src/sys/dev/sbus/mgx.c:1.8 Fri Mar 4 22:08:09 2016 +++ src/sys/dev/sbus/mgx.c Sat May 7 15:32:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.8 2016/03/04 22:08:09 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.9 2016/05/07 15:32:08 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include -__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.8 2016/03/04 22:08:09 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.9 2016/05/07 15:32:08 macallan Exp $"); #include #include @@ -58,11 +58,14 @@ __KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.8 #include #include +#include "ioconf.h" + #include "opt_wsemul.h" #include "opt_mgx.h" struct mgx_softc { device_t sc_dev; + struct fbdevice sc_fb; /* frame buffer device */ bus_space_tag_t sc_tag; bus_space_handle_t sc_blith; bus_space_handle_t sc_vgah; @@ -136,6 +139,35 @@ struct wsdisplay_accessops mgx_accessops NULL, /* scroll */ }; +static void mgx_unblank(device_t); + +dev_type_open(mgxopen); +dev_type_close(mgxclose); +dev_type_ioctl(mgxioctl); +dev_type_mmap(mgxmmap); + +const struct cdevsw mgx_cdevsw = { + .d_open = mgxopen, + .d_close = mgxclose, + .d_read = noread, + .d_write = nowrite, + .d_ioctl = mgxioctl, + .d_stop = nostop, + .d_tty = notty, + .d_poll = nopoll, + .d_mmap = mgxmmap, + .d_kqfilter = nokqfilter, + .d_discard = nodiscard, + .d_flag = D_OTHER +}; + +/* frame buffer generic driver */ +static struct fbdriver mgx_fbdriver = { + mgx_unblank, mgxopen, mgxclose, mgxioctl, nopoll, mgxmmap, + nokqfilter +}; + + static inline void mgx_write_vga(struct mgx_softc *sc, uint32_t reg, uint8_t val) { @@ -199,6 +231,7 @@ mgx_attach(device_t parent, device_t sel struct mgx_softc *sc = device_private(self); struct sbus_attach_args *sa = args; struct wsemuldisplaydev_attach_args aa; + struct fbdevice *fb = >sc_fb; struct rasops_info *ri; unsigned long defattr; bus_space_handle_t bh; @@ -321,6 +354,22 @@ mgx_attach(device_t parent, device_t sel config_found(self, , wsemuldisplaydevprint); + /* now the Sun fb goop */ + fb->fb_driver = _fbdriver; + fb->fb_device = sc->sc_dev; + fb->fb_flags = device_cfdata(sc->sc_dev)->cf_flags & FB_USERMASK; + fb->fb_type.fb_type = FBTYPE_MGX; + fb->fb_pixels = NULL; + + fb->fb_type.fb_depth = 32; + fb->fb_type.fb_width = sc->sc_width; + fb->fb_type.fb_height = sc->sc_height; + fb->fb_linebytes = sc->sc_stride * 4; + + fb->fb_type.fb_cmsize = 256; + fb->fb_type.fb_size = sc->sc_fbsize; + fb_attach(>sc_fb, isconsole); + #if 0 { uint32_t ap; @@ -854,6 +903,22 @@ mgx_ioctl(void *v, void *vs, u_long cmd, wdf->cmsize = 256; return 0; + case FBIOGTYPE: + *(struct fbtype *)data = sc->sc_fb.fb_type; + break; + + case FBIOGATTR: +#define fba ((struct fbgattr *)data) + fba->real_type = sc->sc_fb.fb_type.fb_type; + fba->owner = 0; /* XXX ??? */ + fba->fbtype = sc->sc_fb.fb_type; + fba->sattr.flags = 0; + fba->sattr.emu_type = sc->sc_fb.fb_type.fb_type; + fba->sattr.dev_specific[0] = -1; + fba->emu_types[0] = sc->sc_fb.fb_type.fb_type; + fba->emu_types[1] = -1; +#undef fba + break; case FBIOGVIDEO: case WSDISPLAYIO_GVIDEO: *(int *)data = sc->sc_video; @@ -1096,3 +1161,88 @@ mgx_set_video(struct mgx_softc *sc, int } mgx_write_1(sc, ATR_DPMS, reg); } + +/* Sun fb dev goop */ +static void +mgx_unblank(device_t dev) +{ + struct mgx_softc *sc = device_private(dev); + + mgx_set_video(sc, WSDISPLAYIO_VIDEO_ON); +} + +paddr_t +mgxmmap(dev_t dev, off_t offset, int prot) +{ + struct mgx_softc *sc = device_lookup_private(_cd, minor(dev)); + + /* regular fb mapping at 0 */ + if ((offset >= 0) && (offset < sc->sc_fbsize)) { + return bus_space_mmap(sc->sc_tag, sc->sc_paddr, + offset, prot, BUS_SPACE_MAP_LINEAR); + } + + /* + * Blitter registers at 0x8000, only in mapped mode. + * Restrict to root, even though I'm fairly sure the DMA engine lives + * elsewhere ( and isn't documented anyway ) + */ + if (kauth_authorize_machdep(kauth_cred_get(), + KAUTH_MACHDEP_UNMANAGEDMEM, + NULL, NULL, NULL, NULL) != 0) { + aprint_normal("%s: mmap() rejected.\n", + device_xname(sc->sc_dev)); + return -1; + } + if ((sc->sc_mode == WSDISPLAYIO_MODE_MAPPED) && + (offset >= 0x8000) && (offset < 0x80001000)) { + return bus_space_mmap(sc->sc_tag, sc->sc_rpaddr, + offset, prot, BUS_SPACE_MAP_LINEAR); + } + return -1; +} + +int +mgxopen(dev_t dev, int flags, int mode, struct lwp *l) +{ +
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Thu Apr 21 18:24:02 UTC 2016 Modified Files: src/sys/dev/sbus: cgtwelve.c cgtwelvereg.h Log Message: fix some tpyos, add some comments To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/sbus/cgtwelve.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/sbus/cgtwelvereg.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/dev/sbus/cgtwelve.c diff -u src/sys/dev/sbus/cgtwelve.c:1.5 src/sys/dev/sbus/cgtwelve.c:1.6 --- src/sys/dev/sbus/cgtwelve.c:1.5 Wed Jan 11 16:08:57 2012 +++ src/sys/dev/sbus/cgtwelve.c Thu Apr 21 18:24:02 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cgtwelve.c,v 1.5 2012/01/11 16:08:57 macallan Exp $ */ +/* $NetBSD: cgtwelve.c,v 1.6 2016/04/21 18:24:02 macallan Exp $ */ /*- * Copyright (c) 2010 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the Sun CG12 / Matrox SG3 graphics board */ #include -__KERNEL_RCSID(0, "$NetBSD: cgtwelve.c,v 1.5 2012/01/11 16:08:57 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgtwelve.c,v 1.6 2016/04/21 18:24:02 macallan Exp $"); #include #include @@ -422,7 +422,7 @@ cgtwelve_setup(struct cgtwelve_softc *sc cgtwelve_select_ovl(sc, CG12_SEL_OVL); memset(sc->sc_fbaddr, 0, 0x2); - /* and make sure we can write the 24bit fb */ + /* and make sure we can write the 8bit fb */ cgtwelve_select_ovl(sc, CG12_SEL_8BIT); break; case 24: Index: src/sys/dev/sbus/cgtwelvereg.h diff -u src/sys/dev/sbus/cgtwelvereg.h:1.2 src/sys/dev/sbus/cgtwelvereg.h:1.3 --- src/sys/dev/sbus/cgtwelvereg.h:1.2 Wed Apr 14 04:37:11 2010 +++ src/sys/dev/sbus/cgtwelvereg.h Thu Apr 21 18:24:02 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cgtwelvereg.h,v 1.2 2010/04/14 04:37:11 macallan Exp $ */ +/* $NetBSD: cgtwelvereg.h,v 1.3 2016/04/21 18:24:02 macallan Exp $ */ /*- * Copyright (c) 2010 Michael Lorenz @@ -156,7 +156,7 @@ #define DWGCTL_AUTOLINE_OPEN 0x0001 #define DWGCTL_LINE_CLOSED 0x0002 #define DWGCTL_AUTOLINE_CLOSED 0x0003 -#define DWGCTL_TRAPEXOID 0x0004 +#define DWGCTL_TRAPEZOID 0x0004 #define DWGCTL_BITBLT 0x0008 #define DWGCTL_UPLOAD 0x0009 #define DWGCTL_DOWNLOAD 0x000a @@ -181,7 +181,7 @@ #define DWGCTL_BLT_TRANSPARENT 0x4000 /* for color exp. */ #define CG12APU_SAM 0x0274 -#define CG12APU_SGN 0x0278 +#define CG12APU_SGN 0x0278 /* analog to Athena's SIGN register? */ #define CG12APU_LENGTH 0x027c #define CG12APU_DWG_R0 0x0280 #define CG12APU_DWG_R1 0x0284 @@ -193,7 +193,7 @@ #define CG12APU_DWG_R7 0x029c #define CG12APU_RELOAD_CTL 0x02a0 #define CG12APU_RELOAD_STB 0x02a4 -#define CG12APU_C_XLEFT 0x02a8 +#define CG12APU_C_XLEFT 0x02a8 /* clipping? */ #define CG12APU_C_YTOP 0x02ac #define CG12APU_C_XRIGHT 0x02b0 #define CG12APU_C_YBOTTOM 0x02b4 @@ -270,7 +270,7 @@ #define CG12_WID_ENABLE_3 3 /* overlay/cursor enable has 3 colors */ #define CG12_WID_ALT_CMAP 4 /* use alternate colormap */ #define CG12_WID_DBL_BUF_DISP_A 5 /* double buffering display A */ -#define CG12_WID_DBL_BUF_DISP_B 6 /* double buffering display A */ +#define CG12_WID_DBL_BUF_DISP_B 6 /* double buffering display B */ #define CG12_WID_ATTRS 7 /* total no of attributes */ /* WSC */ @@ -293,5 +293,7 @@ #define CG12_EIC_DCLONGR 0x0730 #define CG12_EIC_DCFLOATR 0x0734 #define CG12_EIC_RESET 0x073c +#define CG12EIC_RESET_SYS 0x0100 +#define CG12EIC_RESET_DSP 0x0200 #endif /* CG12REG_H */
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Thu Apr 21 18:10:57 UTC 2016 Modified Files: src/sys/dev/sbus: cgthree_sbus.c p9100.c zx.c Log Message: more RASTERCONSOLE purging To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sbus/cgthree_sbus.c cvs rdiff -u -r1.62 -r1.63 src/sys/dev/sbus/p9100.c cvs rdiff -u -r1.40 -r1.41 src/sys/dev/sbus/zx.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/dev/sbus/cgthree_sbus.c diff -u src/sys/dev/sbus/cgthree_sbus.c:1.30 src/sys/dev/sbus/cgthree_sbus.c:1.31 --- src/sys/dev/sbus/cgthree_sbus.c:1.30 Tue Sep 14 18:28:18 2010 +++ src/sys/dev/sbus/cgthree_sbus.c Thu Apr 21 18:10:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cgthree_sbus.c,v 1.30 2010/09/14 18:28:18 macallan Exp $ */ +/* $NetBSD: cgthree_sbus.c,v 1.31 2016/04/21 18:10:57 macallan Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cgthree_sbus.c,v 1.30 2010/09/14 18:28:18 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgthree_sbus.c,v 1.31 2016/04/21 18:10:57 macallan Exp $"); #include #include @@ -172,6 +172,7 @@ cgthreeattach_sbus(device_t parent, devi if (name == NULL) name = "cgthree"; + fb->fb_pixels = NULL; if (sa->sa_npromvaddrs != 0) fb->fb_pixels = (void *)(u_long)sa->sa_promvaddrs[0]; if (fb->fb_pixels == NULL) { Index: src/sys/dev/sbus/p9100.c diff -u src/sys/dev/sbus/p9100.c:1.62 src/sys/dev/sbus/p9100.c:1.63 --- src/sys/dev/sbus/p9100.c:1.62 Fri Jul 25 08:10:38 2014 +++ src/sys/dev/sbus/p9100.c Thu Apr 21 18:10:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.62 2014/07/25 08:10:38 dholland Exp $ */ +/* $NetBSD: p9100.c,v 1.63 2016/04/21 18:10:57 macallan Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.62 2014/07/25 08:10:38 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.63 2016/04/21 18:10:57 macallan Exp $"); #include #include @@ -207,7 +207,6 @@ static void p9100_ramdac_write_ctl(struc static void p9100_init_engine(struct p9100_softc *); static int p9100_set_depth(struct p9100_softc *, int); -#if NWSDISPLAY > 0 static void p9100_sync(struct p9100_softc *); static void p9100_bitblt(void *, int, int, int, int, int, int, int); static void p9100_rectfill(void *, int, int, int, int, uint32_t); @@ -236,7 +235,6 @@ static paddr_t p9100_mmap(void *, void * static void p9100_init_screen(void *, struct vcons_screen *, int, long *); -#endif static void p9100_init_cursor(struct p9100_softc *); @@ -256,7 +254,6 @@ static bool p9100_resume(device_t, const static void p9100_set_extvga(void *, int); #endif -#if NWSDISPLAY > 0 struct wsdisplay_accessops p9100_accessops = { p9100_ioctl, p9100_mmap, @@ -267,7 +264,6 @@ struct wsdisplay_accessops p9100_accesso NULL, /* polls */ NULL, /* scroll */ }; -#endif #ifdef PNOZZ_USE_LATCH #define PNOZZ_LATCH(sc, off) if(sc->sc_last_offset != (off & 0xff80)) { \ @@ -305,11 +301,9 @@ p9100_sbus_attach(device_t parent, devic int i, j; uint8_t ver, cmap[768]; -#if NWSDISPLAY > 0 struct wsemuldisplaydev_attach_args aa; struct rasops_info *ri; unsigned long defattr; -#endif sc->sc_last_offset = 0x; sc->sc_dev = self; @@ -354,7 +348,7 @@ p9100_sbus_attach(device_t parent, devic * P9100 - all register accesses need to be 'latched in' whenever we * go to another 0x80 aligned 'page' by reading the framebuffer at the * same offset - * XXX apparently the latter isn't true - my SP3GX works fine without + * XXX apparently the latter isn't true - my SB3GX works fine without */ #ifdef PNOZZ_USE_LATCH if (fb->fb_pixels == NULL) { @@ -424,8 +418,14 @@ p9100_sbus_attach(device_t parent, devic printf(", %d entry colormap", fb->fb_type.fb_cmsize); /* make sure we are not blanked */ - if (isconsole) + if (isconsole) { + p9100_set_video(sc, 1); + delay(1000); + /* hopefully make my oldish PLL lock */ + p9100_set_video(sc, 0); + delay(100); p9100_set_video(sc, 1); + } /* register with power management */ sc->sc_video = 1; @@ -437,14 +437,9 @@ p9100_sbus_attach(device_t parent, devic if (isconsole) { printf(" (console)\n"); -#ifdef RASTERCONSOLE - /*p9100loadcmap(sc, 255, 1);*/ - fbrcons_init(fb); -#endif } else printf("\n"); -#if NWSDISPLAY > 0 wsfont_init(); #ifdef PNOZZ_DEBUG @@ -504,7 +499,7 @@ p9100_sbus_attach(device_t parent, devic aa.accesscookie = >vd; config_found(self, , wsemuldisplaydevprint); -#endif + fb->fb_type.fb_size = fb->fb_type.fb_height * fb->fb_linebytes; printf("%s: rev %d / %x, %dx%d, depth %d mem %x\n", device_xname(self), @@ -518,7 +513,7 @@ p9100_sbus_attach(device_t parent, devic #if NTCTRL > 0 /* register callback for external monitor status change */
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Fri Mar 4 22:08:09 UTC 2016 Modified Files: src/sys/dev/sbus: mgx.c Log Message: allow mmap()ing blitter registers To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/sbus/mgx.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.7 src/sys/dev/sbus/mgx.c:1.8 --- src/sys/dev/sbus/mgx.c:1.7 Thu Feb 25 17:09:39 2016 +++ src/sys/dev/sbus/mgx.c Fri Mar 4 22:08:09 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.7 2016/02/25 17:09:39 joerg Exp $ */ +/* $NetBSD: mgx.c,v 1.8 2016/03/04 22:08:09 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include -__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.7 2016/02/25 17:09:39 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.8 2016/03/04 22:08:09 macallan Exp $"); #include #include @@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.7 #include #include #include +#include #include #include @@ -65,7 +66,7 @@ struct mgx_softc { bus_space_tag_t sc_tag; bus_space_handle_t sc_blith; bus_space_handle_t sc_vgah; - bus_addr_t sc_paddr; + bus_addr_t sc_paddr, sc_rpaddr; void *sc_fbaddr; uint8_t *sc_cursor; int sc_width; @@ -159,6 +160,14 @@ mgx_read_1(struct mgx_softc *sc, uint32_ return bus_space_read_1(sc->sc_tag, sc->sc_blith, reg ^ 3); } +#if 0 +static inline uint32_t +mgx_read_4(struct mgx_softc *sc, uint32_t reg) +{ + return bus_space_read_4(sc->sc_tag, sc->sc_blith, reg); +} +#endif + static inline void mgx_write_2(struct mgx_softc *sc, uint32_t reg, uint16_t val) { @@ -202,6 +211,8 @@ mgx_attach(device_t parent, device_t sel sc->sc_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_slot, sa->sa_reg[8].oa_base); + sc->sc_rpaddr = sbus_bus_addr(sa->sa_bustag, sa->sa_slot, + sa->sa_reg[5].oa_base + MGX_REG_ATREG_OFFSET); /* read geometry information from the device tree */ sc->sc_width = prom_getpropint(sa->sa_node, "width", 1152); @@ -311,17 +322,14 @@ mgx_attach(device_t parent, device_t sel config_found(self, , wsemuldisplaydevprint); #if 0 - uint32_t *fb = sc->sc_fbaddr; - int i, j; - for (i = 0; i < 256; i += 16) { - printf("%04x:", i); - for (j = 0; j < 16; j += 4) { - printf(" %08x", fb[(i + j) >> 2]); - } - printf("\n"); + { + uint32_t ap; + /* reads 0xfd21 */ + mgx_write_4(sc, ATR_APERTURE, 0x); + ap = mgx_read_4(sc, ATR_APERTURE); + printf("aperture: %08x\n", ap); } #endif - } static void @@ -659,6 +667,10 @@ mgx_putchar(void *cookie, int row, int c mgx_wait_engine(sc); sc->sc_putchar(cookie, row, col, c, attr & ~1); if (rv == GC_ADD) { + /* + * try to make sure the glyph made it all the way to + * video memory before trying to blit it into the cache + */ junk = *(uint32_t *)sc->sc_fbaddr; __USE(junk); glyphcache_add(>sc_gc, c, x, y); @@ -922,7 +934,7 @@ mgx_ioctl(void *v, void *vs, u_long cmd, case WSDISPLAYIO_GET_FBINFO: { struct wsdisplayio_fbinfo *fbi = data; - + fbi->fbi_fbsize = sc->sc_fbsize - 1024; fbi->fbi_width = sc->sc_width; fbi->fbi_height = sc->sc_height; @@ -955,6 +967,23 @@ mgx_mmap(void *v, void *vs, off_t offset offset, prot, BUS_SPACE_MAP_LINEAR); } + /* + * Blitter registers at 0x8000, only in mapped mode. + * Restrict to root, even though I'm fairly sure the DMA engine lives + * elsewhere ( and isn't documented anyway ) + */ + if (kauth_authorize_machdep(kauth_cred_get(), + KAUTH_MACHDEP_UNMANAGEDMEM, + NULL, NULL, NULL, NULL) != 0) { + aprint_normal("%s: mmap() rejected.\n", + device_xname(sc->sc_dev)); + return -1; + } + if ((sc->sc_mode == WSDISPLAYIO_MODE_MAPPED) && + (offset >= 0x8000) && (offset < 0x80001000)) { + return bus_space_mmap(sc->sc_tag, sc->sc_rpaddr, + offset, prot, BUS_SPACE_MAP_LINEAR); + } return -1; }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: joerg Date: Thu Feb 25 17:09:39 UTC 2016 Modified Files: src/sys/dev/sbus: mgx.c Log Message: Mark mgx_wait_host explicitly as unused. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/sbus/mgx.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.6 src/sys/dev/sbus/mgx.c:1.7 --- src/sys/dev/sbus/mgx.c:1.6 Thu Feb 11 20:53:06 2016 +++ src/sys/dev/sbus/mgx.c Thu Feb 25 17:09:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.6 2016/02/11 20:53:06 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.7 2016/02/25 17:09:39 joerg Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include -__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.6 2016/02/11 20:53:06 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.7 2016/02/25 17:09:39 joerg Exp $"); #include #include @@ -104,7 +104,7 @@ static void mgx_init_palette(struct mgx_ static int mgx_putcmap(struct mgx_softc *, struct wsdisplay_cmap *); static int mgx_getcmap(struct mgx_softc *, struct wsdisplay_cmap *); static int mgx_wait_engine(struct mgx_softc *); -static int mgx_wait_host(struct mgx_softc *); +__unused static int mgx_wait_host(struct mgx_softc *); static int mgx_wait_fifo(struct mgx_softc *, unsigned int); static void mgx_bitblt(void *, int, int, int, int, int, int, int);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Thu Feb 11 20:53:06 UTC 2016 Modified Files: src/sys/dev/sbus: mgx.c mgxreg.h Log Message: support screen blanking and hw cursor To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/sbus/mgx.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sbus/mgxreg.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.5 src/sys/dev/sbus/mgx.c:1.6 --- src/sys/dev/sbus/mgx.c:1.5 Thu Feb 11 02:23:44 2016 +++ src/sys/dev/sbus/mgx.c Thu Feb 11 20:53:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.5 2016/02/11 02:23:44 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.6 2016/02/11 20:53:06 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include -__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.5 2016/02/11 02:23:44 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.6 2016/02/11 20:53:06 macallan Exp $"); #include #include @@ -67,6 +67,7 @@ struct mgx_softc { bus_space_handle_t sc_vgah; bus_addr_t sc_paddr; void *sc_fbaddr; + uint8_t *sc_cursor; int sc_width; int sc_height; int sc_stride; @@ -78,6 +79,9 @@ struct mgx_softc { u_char sc_cmap_red[256]; u_char sc_cmap_green[256]; u_char sc_cmap_blue[256]; + int sc_cursor_x, sc_cursor_y; + int sc_hotspot_x, sc_hotspot_y; + int sc_video; void (*sc_putchar)(void *, int, int, u_int, long); struct vcons_screen sc_console_screen; struct wsscreen_descr sc_defaultscreen_descr; @@ -113,6 +117,10 @@ static void mgx_erasecols(void *, int, i static void mgx_copyrows(void *, int, int, int); static void mgx_eraserows(void *, int, int, long); +static int mgx_do_cursor(struct mgx_softc *, struct wsdisplay_cursor *); +static void mgx_set_cursor(struct mgx_softc *); +static void mgx_set_video(struct mgx_softc *, int); + CFATTACH_DECL_NEW(mgx, sizeof(struct mgx_softc), mgx_match, mgx_attach, NULL, NULL); @@ -152,6 +160,12 @@ mgx_read_1(struct mgx_softc *sc, uint32_ } static inline void +mgx_write_2(struct mgx_softc *sc, uint32_t reg, uint16_t val) +{ + bus_space_write_2(sc->sc_tag, sc->sc_blith, reg ^ 2, val); +} + +static inline void mgx_write_4(struct mgx_softc *sc, uint32_t reg, uint32_t val) { bus_space_write_4(sc->sc_tag, sc->sc_blith, reg, val); @@ -240,6 +254,13 @@ mgx_attach(device_t parent, device_t sel WSSCREEN_WSCOLORS | WSSCREEN_HILIT, NULL }; + + sc->sc_cursor_x = 0; + sc->sc_cursor_y = 0; + sc->sc_hotspot_x = 0; + sc->sc_hotspot_y = 0; + sc->sc_video = WSDISPLAYIO_VIDEO_ON; + sc->sc_screens[0] = >sc_defaultscreen_descr; sc->sc_screenlist = (struct wsscreen_list){1, sc->sc_screens}; @@ -526,6 +547,17 @@ mgx_setup(struct mgx_softc *sc, int dept mgx_write_vga(sc, CRTC_DATA, stride & 0xff); mgx_write_vga(sc, CRTC_INDEX, 0x1c); mgx_write_vga(sc, CRTC_DATA, (stride & 0xf00) >> 4); + + /* clean up the screen if we're switching to != 8bit */ + if (depth != MGX_DEPTH) + mgx_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height, 0); + + /* initialize hardware cursor stuff */ + mgx_write_2(sc, ATR_CURSOR_ADDRESS, (sc->sc_fbsize - 1024) >> 10); + mgx_write_1(sc, ATR_CURSOR_ENABLE, 0); + sc->sc_cursor = (uint8_t *)sc->sc_fbaddr + sc->sc_fbsize - 1024; + memset(sc->sc_cursor, 0xf0, 1024); + #ifdef MGX_DEBUG int j; mgx_write_vga(sc, SEQ_INDEX, 0x10); @@ -812,11 +844,12 @@ mgx_ioctl(void *v, void *vs, u_long cmd, case FBIOGVIDEO: case WSDISPLAYIO_GVIDEO: - *(int *)data = 1; + *(int *)data = sc->sc_video; return 0; case WSDISPLAYIO_SVIDEO: case FBIOSVIDEO: + mgx_set_video(sc, *(int *)data); return 0; case WSDISPLAYIO_LINEBYTES: @@ -852,11 +885,45 @@ mgx_ioctl(void *v, void *vs, u_long cmd, case WSDISPLAYIO_PUTCMAP: return mgx_putcmap(sc, (struct wsdisplay_cmap *)data); + case WSDISPLAYIO_GCURPOS: + { +struct wsdisplay_curpos *cp = (void *)data; + +cp->x = sc->sc_cursor_x; +cp->y = sc->sc_cursor_y; + } + return 0; + + case WSDISPLAYIO_SCURPOS: + { +struct wsdisplay_curpos *cp = (void *)data; + +sc->sc_cursor_x = cp->x; +sc->sc_cursor_y = cp->y; +mgx_set_cursor(sc); + } + return 0; + + case WSDISPLAYIO_GCURMAX: + { +struct wsdisplay_curpos *cp = (void *)data; + +cp->x = 64; +cp->y = 64; + } + return 0; + + case WSDISPLAYIO_SCURSOR: + { +struct wsdisplay_cursor *cursor = (void *)data; + +return mgx_do_cursor(sc, cursor); + } case WSDISPLAYIO_GET_FBINFO: { struct wsdisplayio_fbinfo *fbi = data; -fbi->fbi_fbsize = sc->sc_fbsize; +fbi->fbi_fbsize = sc->sc_fbsize - 1024; fbi->fbi_width = sc->sc_width; fbi->fbi_height = sc->sc_height; fbi->fbi_bitsperpixel = sc->sc_depth; @@ -890,3 +957,113 @@ mgx_mmap(void *v, void *vs, off_t offset return -1; } + +static int
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Thu Feb 11 02:23:44 UTC 2016 Modified Files: src/sys/dev/sbus: files.sbus mgx.c mgxreg.h Log Message: switch to 32bit colour in WSDISPLAYIO_MODE_MAPPED, now X with wsfb will work Not optimal though - for some reason the framebuffer's endianness in 32bit colour is wrong and I have no idea (yet) how to change that, so many apps using xrender will crash. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/sbus/files.sbus cvs rdiff -u -r1.4 -r1.5 src/sys/dev/sbus/mgx.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/sbus/mgxreg.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/dev/sbus/files.sbus diff -u src/sys/dev/sbus/files.sbus:1.41 src/sys/dev/sbus/files.sbus:1.42 --- src/sys/dev/sbus/files.sbus:1.41 Sun Jan 4 18:18:20 2015 +++ src/sys/dev/sbus/files.sbus Thu Feb 11 02:23:44 2016 @@ -1,4 +1,4 @@ -# $NetBSD: files.sbus,v 1.41 2015/01/04 18:18:20 macallan Exp $ +# $NetBSD: files.sbus,v 1.42 2016/02/11 02:23:44 macallan Exp $ # # Config file and device description for machine-independent SBUS code. # Included by ports that need it. @@ -156,7 +156,8 @@ attach cgtwelve at sbus file dev/sbus/cgtwelve.c cgtwelve # SSB MGX -defflag opt_mgx.h MGX_DEBUG -device mgx: fb, rasops8, wsemuldisplaydev, vcons, glyphcache +defflag opt_mgx.h MGX_DEBUG +defparam opt_mgx.h MGX_DEPTH=8 +device mgx: fb, rasops8, rasops32, wsemuldisplaydev, vcons, glyphcache attach mgx at sbus file dev/sbus/mgx.c mgx Index: src/sys/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.4 src/sys/dev/sbus/mgx.c:1.5 --- src/sys/dev/sbus/mgx.c:1.4 Tue Jan 6 17:41:30 2015 +++ src/sys/dev/sbus/mgx.c Thu Feb 11 02:23:44 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.4 2015/01/06 17:41:30 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.5 2016/02/11 02:23:44 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include -__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.4 2015/01/06 17:41:30 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.5 2016/02/11 02:23:44 macallan Exp $"); #include #include @@ -58,7 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.4 #include #include "opt_wsemul.h" - +#include "opt_mgx.h" struct mgx_softc { device_t sc_dev; @@ -70,8 +70,10 @@ struct mgx_softc { int sc_width; int sc_height; int sc_stride; + int sc_depth; int sc_fbsize; int sc_mode; + char sc_name[8]; uint32_t sc_dec; u_char sc_cmap_red[256]; u_char sc_cmap_green[256]; @@ -98,6 +100,7 @@ static void mgx_init_palette(struct mgx_ static int mgx_putcmap(struct mgx_softc *, struct wsdisplay_cmap *); static int mgx_getcmap(struct mgx_softc *, struct wsdisplay_cmap *); static int mgx_wait_engine(struct mgx_softc *); +static int mgx_wait_host(struct mgx_softc *); static int mgx_wait_fifo(struct mgx_softc *, unsigned int); static void mgx_bitblt(void *, int, int, int, int, int, int, int); @@ -124,6 +127,36 @@ struct wsdisplay_accessops mgx_accessops NULL, /* scroll */ }; +static inline void +mgx_write_vga(struct mgx_softc *sc, uint32_t reg, uint8_t val) +{ + bus_space_write_1(sc->sc_tag, sc->sc_vgah, reg ^ 3, val); +} + +static inline uint8_t +mgx_read_vga(struct mgx_softc *sc, uint32_t reg) +{ + return bus_space_read_1(sc->sc_tag, sc->sc_vgah, reg ^ 3); +} + +static inline void +mgx_write_1(struct mgx_softc *sc, uint32_t reg, uint8_t val) +{ + bus_space_write_1(sc->sc_tag, sc->sc_blith, reg ^ 3, val); +} + +static inline uint8_t +mgx_read_1(struct mgx_softc *sc, uint32_t reg) +{ + return bus_space_read_1(sc->sc_tag, sc->sc_blith, reg ^ 3); +} + +static inline void +mgx_write_4(struct mgx_softc *sc, uint32_t reg, uint32_t val) +{ + bus_space_write_4(sc->sc_tag, sc->sc_blith, reg, val); +} + static int mgx_match(device_t parent, cfdata_t cf, void *aux) { @@ -159,8 +192,8 @@ mgx_attach(device_t parent, device_t sel /* read geometry information from the device tree */ sc->sc_width = prom_getpropint(sa->sa_node, "width", 1152); sc->sc_height = prom_getpropint(sa->sa_node, "height", 900); - sc->sc_stride = prom_getpropint(sa->sa_node, "linebytes", 900); - sc->sc_fbsize = sc->sc_height * sc->sc_stride; + sc->sc_stride = prom_getpropint(sa->sa_node, "linebytes", 1152); + sc->sc_fbsize = prom_getpropint(sa->sa_node, "fb_size", 0x0040); sc->sc_fbaddr = NULL; if (sc->sc_fbaddr == NULL) { if (sbus_bus_map(sa->sa_bustag, @@ -169,14 +202,12 @@ mgx_attach(device_t parent, device_t sel sc->sc_fbsize, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, ) != 0) { - aprint_error_dev(self, "cannot map framebuffer\n"); + aprint_error_dev(self, "couldn't map framebuffer\n"); return; } sc->sc_fbaddr = bus_space_vaddr(sa->sa_bustag, bh); } - aprint_normal_dev(self, "%d x %d\n", sc->sc_width, sc->sc_height); - if
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: martin Date: Tue Dec 1 08:22:30 UTC 2015 Modified Files: src/sys/dev/sbus: stp4020.c Log Message: Remove some diagnostic/debug messages. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/sbus/stp4020.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/dev/sbus/stp4020.c diff -u src/sys/dev/sbus/stp4020.c:1.68 src/sys/dev/sbus/stp4020.c:1.69 --- src/sys/dev/sbus/stp4020.c:1.68 Sun Oct 4 08:20:24 2015 +++ src/sys/dev/sbus/stp4020.c Tue Dec 1 08:22:30 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: stp4020.c,v 1.68 2015/10/04 08:20:24 joerg Exp $ */ +/* $NetBSD: stp4020.c,v 1.69 2015/12/01 08:22:30 martin Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.68 2015/10/04 08:20:24 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.69 2015/12/01 08:22:30 martin Exp $"); #include #include @@ -632,7 +632,7 @@ stp4020_intr(void *arg) #ifndef SUN4U int s; #endif - int i, r = 0, cd_change = 0; + int i, r = 0; #ifndef SUN4U @@ -666,7 +666,6 @@ stp4020_intr(void *arg) /* * Card status change detect */ - cd_change = 1; r = 1; if ((v & (STP4020_ISR0_CD1ST|STP4020_ISR0_CD2ST)) == (STP4020_ISR0_CD1ST|STP4020_ISR0_CD2ST)){ if ((h->flags & STP4020_SOCKET_BUSY) == 0) { @@ -716,15 +715,11 @@ stp4020_intr(void *arg) /* informational messages */ if ((v & STP4020_ISR0_BVD1CHG) != 0) { /* ignore if this is caused by insert or removal */ - if (!cd_change) -printf("stp4020[%d]: Battery change 1\n", h->sock); r = 1; } if ((v & STP4020_ISR0_BVD2CHG) != 0) { /* ignore if this is caused by insert or removal */ - if (!cd_change) -printf("stp4020[%d]: Battery change 2\n", h->sock); r = 1; }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: christos Date: Fri Nov 20 19:09:23 UTC 2015 Modified Files: src/sys/dev/sbus: zx.c Log Message: kill subyte. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/sbus/zx.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/dev/sbus/zx.c diff -u src/sys/dev/sbus/zx.c:1.39 src/sys/dev/sbus/zx.c:1.40 --- src/sys/dev/sbus/zx.c:1.39 Wed Jan 11 11:08:57 2012 +++ src/sys/dev/sbus/zx.c Fri Nov 20 14:09:23 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: zx.c,v 1.39 2012/01/11 16:08:57 macallan Exp $ */ +/* $NetBSD: zx.c,v 1.40 2015/11/20 19:09:23 christos Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.39 2012/01/11 16:08:57 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.40 2015/11/20 19:09:23 christos Exp $"); #include #include @@ -388,7 +388,7 @@ zxioctl(dev_t dev, u_long cmd, void *dat struct fbcmap *cm; struct fbcursor *cu; uint32_t curbits[2][32]; - int rv, v, count, i; + int rv, v, count, i, error; sc = device_lookup_private(_cd, minor(dev)); @@ -537,20 +537,23 @@ zxioctl(dev_t dev, u_long cmd, void *dat return (rv); } if (cu->cmap.red != NULL) { - if (cu->cmap.index > 2 || - cu->cmap.count > 2 - cu->cmap.index) -return (EINVAL); - for (i = 0; i < cu->cmap.count; i++) { -v = sc->sc_curcmap[i + cu->cmap.index + 0]; -if (subyte(>cmap.red[i], v)) - return (EFAULT); -v = sc->sc_curcmap[i + cu->cmap.index + 2]; -if (subyte(>cmap.green[i], v)) - return (EFAULT); -v = sc->sc_curcmap[i + cu->cmap.index + 4]; -if (subyte(>cmap.blue[i], v)) - return (EFAULT); + uint8_t red[2], green[2], blue[2]; + const uint8_t *ccm = sc->sc_curcmap; + cm = >cmap; + + if (cm->index > 2 || cm->count > 2 - cm->index) +return EINVAL; + + for (i = 0; i < cm->count; i++) { +red[i] = ccm[i + cm->index + 0]; +green[i] = ccm[i + cm->index + 2]; +blue[i] = ccm[i + cm->index + 4]; } + + if ((error = copyout(red, cm->red, cm->count)) || + (error = copyout(green, cm->green, cm->count)) || + (error = copyout(blue, cm->blue, cm->count))) +return error; } else { cu->cmap.index = 0; cu->cmap.count = 2;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: joerg Date: Sun Oct 4 08:20:24 UTC 2015 Modified Files: src/sys/dev/sbus: stp4020.c Log Message: Drop unused (inline) function. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/sbus/stp4020.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/dev/sbus/stp4020.c diff -u src/sys/dev/sbus/stp4020.c:1.67 src/sys/dev/sbus/stp4020.c:1.68 --- src/sys/dev/sbus/stp4020.c:1.67 Sat Oct 27 17:18:37 2012 +++ src/sys/dev/sbus/stp4020.c Sun Oct 4 08:20:24 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: stp4020.c,v 1.67 2012/10/27 17:18:37 chs Exp $ */ +/* $NetBSD: stp4020.c,v 1.68 2015/10/04 08:20:24 joerg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.67 2012/10/27 17:18:37 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.68 2015/10/04 08:20:24 joerg Exp $"); #include #include @@ -152,7 +152,6 @@ static void stp4020_dump_regs(struct stp static int stp4020_rd_sockctl(struct stp4020_socket *, int); static void stp4020_wr_sockctl(struct stp4020_socket *, int, int); -static int stp4020_rd_winctl(struct stp4020_socket *, int, int); static void stp4020_wr_winctl(struct stp4020_socket *, int, int, int); void stp4020_delay(struct stp4020_softc *sc, unsigned int); @@ -222,14 +221,6 @@ stp4020_wr_sockctl(struct stp4020_socket bus_space_write_2(h->tag, h->regs, o, v); } -static inline int -stp4020_rd_winctl(struct stp4020_socket *h, int win, int idx) -{ - int o = (STP4020_SOCKREGS_SIZE * (h->sock)) + - (STP4020_WINREGS_SIZE * win) + idx; - return (bus_space_read_2(h->tag, h->regs, o)); -} - static inline void stp4020_wr_winctl(struct stp4020_socket *h, int win, int idx, int v) {
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Jan 6 13:54:18 UTC 2015 Modified Files: src/sys/dev/sbus: mgx.c Log Message: - enable alpha fonts now that we have acceleration and glyphcache - fix drawing of underlined characters - try to flush framebuffer writes before reading them with the blitter To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/sbus/mgx.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.2 src/sys/dev/sbus/mgx.c:1.3 --- src/sys/dev/sbus/mgx.c:1.2 Sun Jan 4 18:18:20 2015 +++ src/sys/dev/sbus/mgx.c Tue Jan 6 13:54:18 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.2 2015/01/04 18:18:20 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.3 2015/01/06 13:54:18 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mgx.c,v 1.2 2015/01/04 18:18:20 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: mgx.c,v 1.3 2015/01/06 13:54:18 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -465,17 +465,17 @@ mgx_putchar(void *cookie, int row, int c return; } rv = glyphcache_try(sc-sc_gc, c, x, y, attr); - if (rv == GC_OK) - return; - mgx_wait_engine(sc); - sc-sc_putchar(cookie, row, col, c, attr ~1); + if (rv != GC_OK) { + volatile uint32_t junk; - if (rv == GC_ADD) { - glyphcache_add(sc-sc_gc, c, x, y); - } else { - if (attr 1) - mgx_rectfill(sc, x, y + he - 2, wi, 1, fg); + mgx_wait_engine(sc); + sc-sc_putchar(cookie, row, col, c, attr ~1); + junk = *(uint32_t *)sc-sc_fbaddr; + if (rv == GC_ADD) + glyphcache_add(sc-sc_gc, c, x, y); } + if (attr 1) + mgx_rectfill(sc, x, y + he - 2, wi, 1, fg); } static void @@ -589,18 +589,10 @@ mgx_init_screen(void *cookie, struct vco ri-ri_width = sc-sc_width; ri-ri_height = sc-sc_height; ri-ri_stride = sc-sc_stride; - ri-ri_flg = RI_CENTER; + ri-ri_flg = RI_CENTER | RI_ENABLE_ALPHA; -#if _LP64 - /* - * XXX - * Assuming all 64bit SPARCs are fast enough to render anti-aliased - * text on the fly. Matters only as long as we don't have acceleration - * and glyphcache. - */ if (ri-ri_depth == 8) - ri-ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA; -#endif + ri-ri_flg |= RI_8BIT_IS_RGB; ri-ri_bits = sc-sc_fbaddr;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Jan 6 17:41:31 UTC 2015 Modified Files: src/sys/dev/sbus: mgx.c Log Message: implement WSDISPLAYIO_*CMAP and WSDISPLAYIO_GET_FBINFO ioctl()s now X with wsfb works properly To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sbus/mgx.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/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.3 src/sys/dev/sbus/mgx.c:1.4 --- src/sys/dev/sbus/mgx.c:1.3 Tue Jan 6 13:54:18 2015 +++ src/sys/dev/sbus/mgx.c Tue Jan 6 17:41:30 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.3 2015/01/06 13:54:18 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.4 2015/01/06 17:41:30 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mgx.c,v 1.3 2015/01/06 13:54:18 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: mgx.c,v 1.4 2015/01/06 17:41:30 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -95,6 +95,8 @@ static void mgx_init_screen(void *, stru static void mgx_write_dac(struct mgx_softc *, int, int, int, int); static void mgx_setup(struct mgx_softc *, int); static void mgx_init_palette(struct mgx_softc *); +static int mgx_putcmap(struct mgx_softc *, struct wsdisplay_cmap *); +static int mgx_getcmap(struct mgx_softc *, struct wsdisplay_cmap *); static int mgx_wait_engine(struct mgx_softc *); static int mgx_wait_fifo(struct mgx_softc *, unsigned int); @@ -305,6 +307,67 @@ mgx_init_palette(struct mgx_softc *sc) } static int +mgx_putcmap(struct mgx_softc *sc, struct wsdisplay_cmap *cm) +{ + u_char *r, *g, *b; + u_int index = cm-index; + u_int count = cm-count; + int i, error; + u_char rbuf[256], gbuf[256], bbuf[256]; + + if (cm-index = 256 || cm-count 256 || + (cm-index + cm-count) 256) + return EINVAL; + error = copyin(cm-red, rbuf[index], count); + if (error) + return error; + error = copyin(cm-green, gbuf[index], count); + if (error) + return error; + error = copyin(cm-blue, bbuf[index], count); + if (error) + return error; + + memcpy(sc-sc_cmap_red[index], rbuf[index], count); + memcpy(sc-sc_cmap_green[index], gbuf[index], count); + memcpy(sc-sc_cmap_blue[index], bbuf[index], count); + + r = sc-sc_cmap_red[index]; + g = sc-sc_cmap_green[index]; + b = sc-sc_cmap_blue[index]; + + for (i = 0; i count; i++) { + mgx_write_dac(sc, index, *r, *g, *b); + index++; + r++, g++, b++; + } + return 0; +} + +static int +mgx_getcmap(struct mgx_softc *sc, struct wsdisplay_cmap *cm) +{ + u_int index = cm-index; + u_int count = cm-count; + int error; + + if (index = 255 || count 256 || index + count 256) + return EINVAL; + + error = copyout(sc-sc_cmap_red[index], cm-red, count); + if (error) + return error; + error = copyout(sc-sc_cmap_green[index], cm-green, count); + if (error) + return error; + error = copyout(sc-sc_cmap_blue[index], cm-blue, count); + if (error) + return error; + + return 0; +} + +static int mgx_wait_engine(struct mgx_softc *sc) { unsigned int i; @@ -471,6 +534,7 @@ mgx_putchar(void *cookie, int row, int c mgx_wait_engine(sc); sc-sc_putchar(cookie, row, col, c, attr ~1); junk = *(uint32_t *)sc-sc_fbaddr; + __USE(junk); if (rv == GC_ADD) glyphcache_add(sc-sc_gc, c, x, y); } @@ -660,14 +724,32 @@ mgx_ioctl(void *v, void *vs, u_long cmd, if (new_mode == WSDISPLAYIO_MODE_EMUL) { mgx_setup(sc, 8); + glyphcache_wipe(sc-sc_gc); + mgx_init_palette(sc); vcons_redraw_screen(ms); } else { mgx_setup(sc, 32); } } } - } + return 0; + + case WSDISPLAYIO_GETCMAP: + return mgx_getcmap(sc, (struct wsdisplay_cmap *)data); + case WSDISPLAYIO_PUTCMAP: + return mgx_putcmap(sc, (struct wsdisplay_cmap *)data); + + case WSDISPLAYIO_GET_FBINFO: + { +struct wsdisplayio_fbinfo *fbi = data; +int ret; + +ret = wsdisplayio_get_fbinfo(ms-scr_ri, fbi); +fbi-fbi_fbsize = 0x40; +return ret; + } + } return EPASSTHROUGH; }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Sun Jan 4 18:18:20 UTC 2015 Modified Files: src/sys/dev/sbus: files.sbus mgx.c mgxreg.h Log Message: support hardware acceleration, adapted from OpenBSD TODO: figure out how to do host blits so we can get away without mapping the framebuffer To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/dev/sbus/files.sbus cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sbus/mgx.c src/sys/dev/sbus/mgxreg.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/dev/sbus/files.sbus diff -u src/sys/dev/sbus/files.sbus:1.40 src/sys/dev/sbus/files.sbus:1.41 --- src/sys/dev/sbus/files.sbus:1.40 Tue Dec 16 21:01:34 2014 +++ src/sys/dev/sbus/files.sbus Sun Jan 4 18:18:20 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.sbus,v 1.40 2014/12/16 21:01:34 macallan Exp $ +# $NetBSD: files.sbus,v 1.41 2015/01/04 18:18:20 macallan Exp $ # # Config file and device description for machine-independent SBUS code. # Included by ports that need it. @@ -157,6 +157,6 @@ file dev/sbus/cgtwelve.c cgtwelve # SSB MGX defflag opt_mgx.h MGX_DEBUG -device mgx: fb, rasops8, wsemuldisplaydev, vcons +device mgx: fb, rasops8, wsemuldisplaydev, vcons, glyphcache attach mgx at sbus file dev/sbus/mgx.c mgx Index: src/sys/dev/sbus/mgx.c diff -u src/sys/dev/sbus/mgx.c:1.1 src/sys/dev/sbus/mgx.c:1.2 --- src/sys/dev/sbus/mgx.c:1.1 Tue Dec 16 21:01:34 2014 +++ src/sys/dev/sbus/mgx.c Sun Jan 4 18:18:20 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mgx.c,v 1.1 2014/12/16 21:01:34 macallan Exp $ */ +/* $NetBSD: mgx.c,v 1.2 2015/01/04 18:18:20 macallan Exp $ */ /*- * Copyright (c) 2014 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the SSB 4096V-MGX graphics card */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mgx.c,v 1.1 2014/12/16 21:01:34 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: mgx.c,v 1.2 2015/01/04 18:18:20 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -52,6 +52,7 @@ __KERNEL_RCSID(0, $NetBSD: mgx.c,v 1.1 #include dev/rasops/rasops.h #include dev/wscons/wsdisplay_vconsvar.h +#include dev/wscons/wsdisplay_glyphcachevar.h #include dev/ic/vgareg.h #include dev/sbus/mgxreg.h @@ -71,14 +72,17 @@ struct mgx_softc { int sc_stride; int sc_fbsize; int sc_mode; + uint32_t sc_dec; u_char sc_cmap_red[256]; u_char sc_cmap_green[256]; u_char sc_cmap_blue[256]; + void (*sc_putchar)(void *, int, int, u_int, long); struct vcons_screen sc_console_screen; struct wsscreen_descr sc_defaultscreen_descr; const struct wsscreen_descr *sc_screens[1]; struct wsscreen_list sc_screenlist; struct vcons_data vd; + glyphcache sc_gc; }; static int mgx_match(device_t, cfdata_t, void *); @@ -91,6 +95,18 @@ static void mgx_init_screen(void *, stru static void mgx_write_dac(struct mgx_softc *, int, int, int, int); static void mgx_setup(struct mgx_softc *, int); static void mgx_init_palette(struct mgx_softc *); +static int mgx_wait_engine(struct mgx_softc *); +static int mgx_wait_fifo(struct mgx_softc *, unsigned int); + +static void mgx_bitblt(void *, int, int, int, int, int, int, int); +static void mgx_rectfill(void *, int, int, int, int, long); + +static void mgx_putchar(void *, int, int, u_int, long); +static void mgx_cursor(void *, int, int, int); +static void mgx_copycols(void *, int, int, int, int); +static void mgx_erasecols(void *, int, int, int, long); +static void mgx_copyrows(void *, int, int, int); +static void mgx_eraserows(void *, int, int, long); CFATTACH_DECL_NEW(mgx, sizeof(struct mgx_softc), mgx_match, mgx_attach, NULL, NULL); @@ -143,13 +159,14 @@ mgx_attach(device_t parent, device_t sel sc-sc_height = prom_getpropint(sa-sa_node, height, 900); sc-sc_stride = prom_getpropint(sa-sa_node, linebytes, 900); sc-sc_fbsize = sc-sc_height * sc-sc_stride; - sc-sc_fbaddr = NULL; //(void *)(unsigned long)prom_getpropint(sa-sa_node, address, 0); + sc-sc_fbaddr = NULL; if (sc-sc_fbaddr == NULL) { if (sbus_bus_map(sa-sa_bustag, sa-sa_slot, sa-sa_reg[8].oa_base, sc-sc_fbsize, - BUS_SPACE_MAP_LINEAR, bh) != 0) { + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, + bh) != 0) { aprint_error_dev(self, cannot map framebuffer\n); return; } @@ -169,8 +186,8 @@ mgx_attach(device_t parent, device_t sel if (sbus_bus_map(sa-sa_bustag, sa-sa_slot, - sa-sa_reg[5].oa_base, 0x1000, 0, - sc-sc_blith) != 0) { + sa-sa_reg[5].oa_base + MGX_REG_ATREG_OFFSET, 0x1000, + 0, sc-sc_blith) != 0) { aprint_error(%s: couldn't map blitter registers\n, device_xname(sc-sc_dev)); return; @@ -207,10 +224,24 @@ mgx_attach(device_t parent, device_t sel sc-sc_defaultscreen_descr.textops = ri-ri_ops; sc-sc_defaultscreen_descr.capabilities = ri-ri_caps; + sc-sc_gc.gc_bitblt = mgx_bitblt; + sc-sc_gc.gc_rectfill = mgx_rectfill; + sc-sc_gc.gc_blitcookie = sc; + sc-sc_gc.gc_rop =
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Dec 16 21:01:34 UTC 2014 Modified Files: src/sys/dev/sbus: files.sbus Added Files: src/sys/dev/sbus: mgx.c mgxreg.h Log Message: first draft of a driver for SMSI,mgx More or less an Alliance Semiconductors ProMotion AT24 with some PCI-SBus glue and 4MB framebuffer. No acceleration yet, just enough wsdisplay/vcons setup and DAC programming to be functional. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/sbus/files.sbus cvs rdiff -u -r0 -r1.1 src/sys/dev/sbus/mgx.c src/sys/dev/sbus/mgxreg.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/dev/sbus/files.sbus diff -u src/sys/dev/sbus/files.sbus:1.39 src/sys/dev/sbus/files.sbus:1.40 --- src/sys/dev/sbus/files.sbus:1.39 Sat Oct 20 13:52:11 2012 +++ src/sys/dev/sbus/files.sbus Tue Dec 16 21:01:34 2014 @@ -1,4 +1,4 @@ -# $NetBSD: files.sbus,v 1.39 2012/10/20 13:52:11 macallan Exp $ +# $NetBSD: files.sbus,v 1.40 2014/12/16 21:01:34 macallan Exp $ # # Config file and device description for machine-independent SBUS code. # Included by ports that need it. @@ -154,3 +154,9 @@ defflag opt_cgtwelve.h CG12_DEBUG CG12_C device cgtwelve: fb, rasops1, rasops8, wsemuldisplaydev, vcons attach cgtwelve at sbus file dev/sbus/cgtwelve.c cgtwelve + +# SSB MGX +defflag opt_mgx.h MGX_DEBUG +device mgx: fb, rasops8, wsemuldisplaydev, vcons +attach mgx at sbus +file dev/sbus/mgx.c mgx Added files: Index: src/sys/dev/sbus/mgx.c diff -u /dev/null src/sys/dev/sbus/mgx.c:1.1 --- /dev/null Tue Dec 16 21:01:34 2014 +++ src/sys/dev/sbus/mgx.c Tue Dec 16 21:01:34 2014 @@ -0,0 +1,368 @@ +/* $NetBSD: mgx.c,v 1.1 2014/12/16 21:01:34 macallan Exp $ */ + +/*- + * Copyright (c) 2014 Michael Lorenz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* a console driver for the SSB 4096V-MGX graphics card */ + +#include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: mgx.c,v 1.1 2014/12/16 21:01:34 macallan Exp $); + +#include sys/param.h +#include sys/systm.h +#include sys/buf.h +#include sys/device.h +#include sys/ioctl.h +#include sys/conf.h +#include sys/kmem.h + +#include sys/bus.h +#include machine/autoconf.h + +#include dev/sbus/sbusvar.h +#include dev/sun/fbio.h +#include dev/sun/fbvar.h + +#include dev/wscons/wsdisplayvar.h +#include dev/wscons/wsconsio.h +#include dev/wsfont/wsfont.h +#include dev/rasops/rasops.h + +#include dev/wscons/wsdisplay_vconsvar.h + +#include dev/ic/vgareg.h +#include dev/sbus/mgxreg.h + +#include opt_wsemul.h + + +struct mgx_softc { + device_t sc_dev; + bus_space_tag_t sc_tag; + bus_space_handle_t sc_blith; + bus_space_handle_t sc_vgah; + bus_addr_t sc_paddr; + void *sc_fbaddr; + int sc_width; + int sc_height; + int sc_stride; + int sc_fbsize; + int sc_mode; + u_char sc_cmap_red[256]; + u_char sc_cmap_green[256]; + u_char sc_cmap_blue[256]; + struct vcons_screen sc_console_screen; + struct wsscreen_descr sc_defaultscreen_descr; + const struct wsscreen_descr *sc_screens[1]; + struct wsscreen_list sc_screenlist; + struct vcons_data vd; +}; + +static int mgx_match(device_t, cfdata_t, void *); +static void mgx_attach(device_t, device_t, void *); +static int mgx_ioctl(void *, void *, u_long, void *, int, + struct lwp*); +static paddr_t mgx_mmap(void *, void *, off_t, int); +static void mgx_init_screen(void *, struct vcons_screen *, int, + long *); +static void mgx_write_dac(struct mgx_softc *, int, int, int, int); +static void mgx_setup(struct mgx_softc *, int); +static void mgx_init_palette(struct mgx_softc *); + +CFATTACH_DECL_NEW(mgx, sizeof(struct
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Jul 22 04:55:51 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c Log Message: restore the right colour map when X exits To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.54 src/sys/dev/sbus/tcx.c:1.55 --- src/sys/dev/sbus/tcx.c:1.54 Wed Jul 16 17:58:35 2014 +++ src/sys/dev/sbus/tcx.c Tue Jul 22 04:55:51 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.54 2014/07/16 17:58:35 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.55 2014/07/22 04:55:51 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.54 2014/07/16 17:58:35 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.55 2014/07/22 04:55:51 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -163,6 +163,7 @@ static void tcx_loadcmap(struct tcx_soft static int tcx_ioctl(void *, void *, u_long, void *, int, struct lwp *); static paddr_t tcx_mmap(void *, void *, off_t, int); +static void tcx_init_cmap(struct tcx_softc *); static void tcx_init_screen(void *, struct vcons_screen *, int, long *); static void tcx_clearscreen(struct tcx_softc *, int); static void tcx_copyrows(void *, int, int, int); @@ -212,7 +213,7 @@ tcxattach(device_t parent, device_t self int node; struct fbdevice *fb = sc-sc_fb; bus_space_handle_t bh; - int isconsole, i, j; + int isconsole; uint32_t confreg; sc-sc_dev = self; @@ -377,17 +378,6 @@ tcxattach(device_t parent, device_t self /* reset cursor frame buffer controls */ tcx_reset(sc); - /* Initialize the default color map. */ - j = 0; - for (i = 0; i 256; i++) { - - sc-sc_cmap_red[i] = rasops_cmap[j]; - sc-sc_cmap_green[i] = rasops_cmap[j + 1]; - sc-sc_cmap_blue[i] = rasops_cmap[j + 2]; - j += 3; - } - tcx_loadcmap(sc, 0, 256); - if (!sc-sc_8bit) tcx_set_cursor(sc); @@ -415,6 +405,7 @@ tcxattach(device_t parent, device_t self sc-sc_bg = ri-ri_devcmap[(defattr 16) 0xff]; tcx_clearscreen(sc, 0); + tcx_init_cmap(sc); tcx_defscreendesc.nrows = ri-ri_rows; tcx_defscreendesc.ncols = ri-ri_cols; @@ -536,6 +527,23 @@ tcx_reset(struct tcx_softc *sc) } static void +tcx_init_cmap(struct tcx_softc *sc) +{ + int i, j; + + /* Initialize the default color map. */ + j = 0; + for (i = 0; i 256; i++) { + + sc-sc_cmap_red[i] = rasops_cmap[j]; + sc-sc_cmap_green[i] = rasops_cmap[j + 1]; + sc-sc_cmap_blue[i] = rasops_cmap[j + 2]; + j += 3; + } + tcx_loadcmap(sc, 0, 256); +} + +static void tcx_loadcmap(struct tcx_softc *sc, int start, int ncolors) { int i; @@ -760,7 +768,7 @@ tcx_ioctl(void *v, void *vs, u_long cmd, sc-sc_mode = new_mode; if (new_mode == WSDISPLAYIO_MODE_EMUL) { - tcx_loadcmap(sc, 0, 256); + tcx_init_cmap(sc); tcx_clearscreen(sc, 0); vcons_redraw_screen(ms); } else if (!sc-sc_8bit)
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Jul 16 17:58:35 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c tcxreg.h Log Message: - move all register definitions and hardware documenting comments to tcxreg.h - expand hardware documenting comments no functional change To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/sbus/tcx.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/sbus/tcxreg.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.53 src/sys/dev/sbus/tcx.c:1.54 --- src/sys/dev/sbus/tcx.c:1.53 Mon Jul 7 15:22:07 2014 +++ src/sys/dev/sbus/tcx.c Wed Jul 16 17:58:35 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.53 2014/07/07 15:22:07 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.54 2014/07/16 17:58:35 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.53 2014/07/07 15:22:07 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.54 2014/07/16 17:58:35 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -124,30 +124,6 @@ struct wsscreen_list tcx_screenlist = { _tcx_scrlist }; -/* - * The S24 provides the framebuffer RAM mapped in three ways: - * 26 bits per pixel, in 32-bit words; the low-order 24 bits are - * blue, green, and red values, and the other two bits select the - * display modes, per pixel); - * 24 bits per pixel, in 32-bit words; the high-order byte reads as - * zero, and is ignored on writes (so the mode bits cannot be altered); - * 8 bits per pixel, unpadded; writes to this space do not modify the - * other 18 bits. - */ -#define TCX_CTL_8_MAPPED 0x /* 8 bits, uses color map */ -#define TCX_CTL_24_MAPPED 0x0100 /* 24 bits, uses color map */ -#define TCX_CTL_24_LEVEL 0x0300 /* 24 bits, ignores color map */ -#define TCX_CTL_PIXELMASK 0x00FF /* mask for index/level */ - -/* - * differences between S24 and tcx, as far as this driver is concerned: - * - S24 has 4MB VRAM, 24bit + 2bit control planes, no expansion possible - * - tcx has 1MB VRAM, 8bit, no control planes, may have a VSIMM toat bumps - * VRAM to 2MB - * - tcx can apply ROPs to STIP operations, unlike S24 - * - tcx has a Bt458 DAC, just like CG6. S24 has an ATT 20C567 - */ - /* autoconfiguration driver */ static void tcxattach(device_t, device_t, void *); static int tcxmatch(device_t, cfdata_t, void *); @@ -263,7 +239,7 @@ tcxattach(device_t parent, device_t self /* * actual FB size ( of the 8bit region ) - * no need to restrict userland mappings to the visible VRAM + * no reason to restrict userland mappings to the visible VRAM */ if (sc-sc_8bit) { aprint_normal( (8-bit only TCX)\n); Index: src/sys/dev/sbus/tcxreg.h diff -u src/sys/dev/sbus/tcxreg.h:1.5 src/sys/dev/sbus/tcxreg.h:1.6 --- src/sys/dev/sbus/tcxreg.h:1.5 Thu Aug 6 18:26:03 2009 +++ src/sys/dev/sbus/tcxreg.h Wed Jul 16 17:58:35 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcxreg.h,v 1.5 2009/08/06 18:26:03 macallan Exp $ */ +/* $NetBSD: tcxreg.h,v 1.6 2014/07/16 17:58:35 macallan Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,21 +29,43 @@ */ /* + * differences between S24 and tcx, as far as this driver is concerned: + * - S24 has 4MB VRAM, 24bit + 2bit control planes, no expansion possible + * - tcx has 1MB VRAM, 8bit, no control planes, may have a VSIMM that bumps + * VRAM to 2MB + * - tcx can apply ROPs to STIP operations, unlike S24 + * - tcx has a Bt458 DAC, just like CG6. S24 has an ATT 20C567 + * - the chip itself seems to be (almost) the same, just with different DACs + * and VRAM configuration + */ + +/* * A TCX is composed of numerous groups of control registers, all with TLAs: * DHC - ??? * TEC - transform engine control? * THC - TEC Hardware Configuration * ROM - a 128Kbyte ROM with who knows what in it. - * STIP - ??? - * RSTIP - Raw ??? - * BLIT - ??? - * RBLIT - Raw ??? + * STIP - stipple engine, doesn't write attribute bits + * RSTIP - stipple engine, writes attribute bits + * BLIT - blit engine, doesn't copy attribute bits + * RBLIT - blit engine, does copy attribute bits * ALT - ??? * colormap - see below * frame buffer memory (video RAM) * possible other stuff * + * RSTIP and RBLIT are set to size zero on my SS4's tcx, they work anyway + * though. No sense using them since tcx has only the lower 8bit planes, + * with no control planes, so there is no actual difference to STIP and + * BLIT ops, and things like qemu and temlib may not actually implement + * them. + * The hardware cursor registers in the THC range are cut off by the size + * attribute but seem to exist, although the parts that display the cursor + * ( the DAC's overlay support ) only exist on the S24. + * At this point I wouldn't be surprised if 8bit tcx
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Mon Jul 7 15:22:07 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c Log Message: actually put the colour space ID where it belongs in tcx_clearscreen() To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.52 src/sys/dev/sbus/tcx.c:1.53 --- src/sys/dev/sbus/tcx.c:1.52 Tue Jun 24 05:04:14 2014 +++ src/sys/dev/sbus/tcx.c Mon Jul 7 15:22:07 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.52 2014/06/24 05:04:14 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.53 2014/07/07 15:22:07 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.52 2014/06/24 05:04:14 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.53 2014/07/07 15:22:07 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -903,9 +903,8 @@ tcx_clearscreen(struct tcx_softc *sc, in uint64_t spc64; int i, len; - bg |= ((uint64_t)sc-sc_bg 32); - spc64 = (spc 3) 24; - bg |= spc64; + spc64 = ((spc 3) 24) | sc-sc_bg; + bg |= (spc64 32); len = sc-sc_fb.fb_type.fb_width * sc-sc_fb.fb_type.fb_height; for (i = 0; i len; i += 32)
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Jun 24 05:04:14 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c Log Message: use STIP/BLIT on 8bit tcx and RSTIP/RBLIT on S24 To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.51 src/sys/dev/sbus/tcx.c:1.52 --- src/sys/dev/sbus/tcx.c:1.51 Wed Jun 18 04:54:09 2014 +++ src/sys/dev/sbus/tcx.c Tue Jun 24 05:04:14 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.51 2014/06/18 04:54:09 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.52 2014/06/24 05:04:14 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.51 2014/06/18 04:54:09 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.52 2014/06/24 05:04:14 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -331,30 +331,64 @@ tcxattach(device_t parent, device_t self } sc-sc_fbaddr = bus_space_vaddr(sa-sa_bustag, bh); - /* RBLIT space */ - if (sbus_bus_map(sa-sa_bustag, - sc-sc_physaddr[TCX_REG_RBLIT].oa_space, - sc-sc_physaddr[TCX_REG_RBLIT].oa_base, - sc-sc_fbsize 3, - BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, - bh) != 0) { - aprint_error_dev(self, tcxattach: cannot map RBLIT space\n); - return; - } - sc-sc_rblit = bus_space_vaddr(sa-sa_bustag, bh); - - /* RSTIP space */ - if (sbus_bus_map(sa-sa_bustag, - sc-sc_physaddr[TCX_REG_RSTIP].oa_space, - sc-sc_physaddr[TCX_REG_RSTIP].oa_base, - sc-sc_fbsize 3, - BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, - bh) != 0) { - aprint_error_dev(self, tcxattach: cannot map RSTIP space\n); - return; + /* + * 8bit tcx has the RSTIP and RBLIT ranges set to size 0. + * On Real Hardware they work anyway ( on my SS4 at least ) but + * emulators may not be so forgiving. + */ + if (sc-sc_8bit) { + /* BLIT space */ + if (sbus_bus_map(sa-sa_bustag, + sc-sc_physaddr[TCX_REG_BLIT].oa_space, + sc-sc_physaddr[TCX_REG_BLIT].oa_base, + sc-sc_fbsize 3, + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, + bh) != 0) { + aprint_error_dev(self, + tcxattach: cannot map BLIT space\n); + return; + } + sc-sc_rblit = bus_space_vaddr(sa-sa_bustag, bh); + + /* STIP space */ + if (sbus_bus_map(sa-sa_bustag, + sc-sc_physaddr[TCX_REG_STIP].oa_space, + sc-sc_physaddr[TCX_REG_STIP].oa_base, + sc-sc_fbsize 3, + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, + bh) != 0) { + aprint_error_dev(self, + tcxattach: cannot map STIP space\n); + return; + } + sc-sc_rstip = bus_space_vaddr(sa-sa_bustag, bh); + } else { + /* RBLIT space */ + if (sbus_bus_map(sa-sa_bustag, + sc-sc_physaddr[TCX_REG_RBLIT].oa_space, + sc-sc_physaddr[TCX_REG_RBLIT].oa_base, + sc-sc_fbsize 3, + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, + bh) != 0) { + aprint_error_dev(self, + tcxattach: cannot map RBLIT space\n); + return; + } + sc-sc_rblit = bus_space_vaddr(sa-sa_bustag, bh); + + /* RSTIP space */ + if (sbus_bus_map(sa-sa_bustag, + sc-sc_physaddr[TCX_REG_RSTIP].oa_space, + sc-sc_physaddr[TCX_REG_RSTIP].oa_base, + sc-sc_fbsize 3, + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, + bh) != 0) { + aprint_error_dev(self, + tcxattach: cannot map RSTIP space\n); + return; + } + sc-sc_rstip = bus_space_vaddr(sa-sa_bustag, bh); } - sc-sc_rstip = bus_space_vaddr(sa-sa_bustag, bh); - isconsole = fb_is_console(node); confreg = bus_space_read_4(sa-sa_bustag, sc-sc_thc, THC_CONFIG);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Jun 17 10:47:27 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c Log Message: remove last remnants of CG8 emulation To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.48 src/sys/dev/sbus/tcx.c:1.49 --- src/sys/dev/sbus/tcx.c:1.48 Tue May 13 05:30:38 2014 +++ src/sys/dev/sbus/tcx.c Tue Jun 17 10:47:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.48 2014/05/13 05:30:38 martin Exp $ */ +/* $NetBSD: tcx.c,v 1.49 2014/06/17 10:47:27 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,13 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.48 2014/05/13 05:30:38 martin Exp $); - -/* - * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; - * it is bypassed on the 8-bit version (onboard framebuffer for SS4) - */ -#undef TCX_CG8 +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.49 2014/06/17 10:47:27 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -205,19 +199,6 @@ struct wsdisplay_accessops tcx_accessops #define OBPNAME SUNW,tcx -#ifdef TCX_CG8 -/* - * For CG8 emulation, we map the 32-bit-deep framebuffer at an offset of - * 256K; the cg8 space begins with a mono overlay plane and an overlay - * enable plane (128K bytes each, 1 bit per pixel), immediately followed - * by the color planes, 32 bits per pixel. We also map just the 32-bit - * framebuffer at 0x0400 (TCX_USER_RAM_COMPAT), for compatibility - * with the cg8 driver. - */ -#define TCX_CG8OVERLAY (256 * 1024) -#define TCX_SIZE_DFB32 (1152 * 900 * 4) /* max size of the framebuffer */ -#endif - /* * Match a tcx. */
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Jun 17 14:25:17 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c Log Message: fix a few 8bit tcx issues: - set ROP when clearing the screen, tcx actually uses it - deal with possible 2MB VRAM tcx while there, consistently use aprint_* in tcxattach() To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.49 src/sys/dev/sbus/tcx.c:1.50 --- src/sys/dev/sbus/tcx.c:1.49 Tue Jun 17 10:47:27 2014 +++ src/sys/dev/sbus/tcx.c Tue Jun 17 14:25:17 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.49 2014/06/17 10:47:27 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.50 2014/06/17 14:25:17 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.49 2014/06/17 10:47:27 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.50 2014/06/17 14:25:17 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -86,18 +86,19 @@ struct tcx_softc { bus_space_handle_t sc_bt; /* Brooktree registers */ bus_space_handle_t sc_thc; /* THC registers */ - uint8_t *sc_fbaddr; /* framebuffer */ - uint64_t *sc_rblit; /* blitspace */ - uint64_t *sc_rstip; /* stipple space */ - - short sc_8bit; /* true if 8-bit hardware */ - short sc_blanked; /* true if blanked */ - u_char sc_cmap_red[256]; - u_char sc_cmap_green[256]; - u_char sc_cmap_blue[256]; - int sc_mode, sc_bg; - int sc_cursor_x, sc_cursor_y; - int sc_hotspot_x, sc_hotspot_y; + uint8_t *sc_fbaddr; /* framebuffer */ + uint64_t *sc_rblit; /* blitspace */ + uint64_t *sc_rstip; /* stipple space */ + + short sc_8bit; /* true if 8-bit hardware */ + short sc_blanked; /* true if blanked */ + uint32_t sc_fbsize; /* size of the 8bit fb */ + u_char sc_cmap_red[256]; + u_char sc_cmap_green[256]; + u_char sc_cmap_blue[256]; + int sc_mode, sc_bg; + int sc_cursor_x, sc_cursor_y; + int sc_hotspot_x, sc_hotspot_y; struct vcons_data vd; }; @@ -138,6 +139,15 @@ struct wsscreen_list tcx_screenlist = { #define TCX_CTL_24_LEVEL 0x0300 /* 24 bits, ignores color map */ #define TCX_CTL_PIXELMASK 0x00FF /* mask for index/level */ +/* + * differences between S24 and tcx, as far as this driver is concerned: + * - S24 has 4MB VRAM, 24bit + 2bit control planes, no expansion possible + * - tcx has 1MB VRAM, 8bit, no control planes, may have a VSIMM toat bumps + * VRAM to 2MB + * - tcx can apply ROPs to STIP operations, unlike S24 + * - tcx has a Bt458 DAC, just like CG6. S24 has an ATT 20C567 + */ + /* autoconfiguration driver */ static void tcxattach(device_t, device_t, void *); static int tcxmatch(device_t, cfdata_t, void *); @@ -223,7 +233,7 @@ tcxattach(device_t parent, device_t self struct wsemuldisplaydev_attach_args aa; struct rasops_info *ri; unsigned long defattr; - int node, ramsize; + int node; struct fbdevice *fb = sc-sc_fb; bus_space_handle_t bh; int isconsole, i, j; @@ -251,17 +261,23 @@ tcxattach(device_t parent, device_t self fb-fb_type.fb_depth = 8; fb_setsize_obp(fb, fb-fb_type.fb_depth, 1152, 900, node); + /* + * actual FB size ( of the 8bit region ) + * no need to restrict userland mappings to the visible VRAM + */ if (sc-sc_8bit) { - printf( (8-bit only TCX)\n); - ramsize = 1024 * 1024; + aprint_normal( (8-bit only TCX)\n); + /* at least the SS4 can have 2MB with a VSIMM */ + sc-sc_fbsize = 0x10 * prom_getpropint(node, vram, 1); } else { - printf( (S24)\n); - ramsize = 4 * 1024 * 1024; + aprint_normal( (S24)\n); + /* all S24 I know of have 4MB, non-expandable */ + sc-sc_fbsize = 0x10; } fb-fb_type.fb_cmsize = 256; - fb-fb_type.fb_size = ramsize; - printf(%s: %s, %d x %d, device_xname(self), OBPNAME, + fb-fb_type.fb_size = sc-sc_fbsize; /* later code assumes 8bit */ + aprint_normal_dev(self, %s, %d x %d\n, OBPNAME, fb-fb_type.fb_width, fb-fb_type.fb_height); @@ -289,7 +305,8 @@ tcxattach(device_t parent, device_t self sc-sc_physaddr[TCX_REG_THC].oa_base, 0x1000, BUS_SPACE_MAP_LINEAR, sc-sc_thc) != 0) { - printf(tcxattach: cannot map thc registers\n); + aprint_error_dev(self, + tcxattach: cannot map thc registers\n); return; } @@ -298,7 +315,7 @@ tcxattach(device_t parent, device_t self sc-sc_physaddr[TCX_REG_CMAP].oa_base, 0x1000, BUS_SPACE_MAP_LINEAR, sc-sc_bt) != 0) { - printf(tcxattach: cannot map bt registers\n); + aprint_error_dev(self, tcxattach: cannot map DAC registers\n); return; } @@ -306,10 +323,10 @@ tcxattach(device_t parent, device_t self if (sbus_bus_map(sa-sa_bustag, sc-sc_physaddr[TCX_REG_DFB8].oa_space, sc-sc_physaddr[TCX_REG_DFB8].oa_base, - 1024 * 1024, + sc-sc_fbsize, BUS_SPACE_MAP_LINEAR, bh)
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Jun 18 04:54:09 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c Log Message: 8bit tcx doesn't implement a hardware cursor, so don't pretend it does. Also, avoid poking the hw cursor registers in that case. Real hardware doesn't care but qemu does. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.50 src/sys/dev/sbus/tcx.c:1.51 --- src/sys/dev/sbus/tcx.c:1.50 Tue Jun 17 14:25:17 2014 +++ src/sys/dev/sbus/tcx.c Wed Jun 18 04:54:09 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.50 2014/06/17 14:25:17 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.51 2014/06/18 04:54:09 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.50 2014/06/17 14:25:17 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.51 2014/06/18 04:54:09 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -378,7 +378,9 @@ tcxattach(device_t parent, device_t self } tcx_loadcmap(sc, 0, 256); - tcx_set_cursor(sc); + if (!sc-sc_8bit) + tcx_set_cursor(sc); + /* enable video */ confreg = bus_space_read_4(sa-sa_bustag, sc-sc_thc, THC_MISC); confreg |= THC_MISC_VIDEN; @@ -755,8 +757,12 @@ tcx_ioctl(void *v, void *vs, u_long cmd, tcx_clearscreen(sc, 3); } } + return 0; + case WSDISPLAYIO_GCURPOS: - { + if (sc-sc_8bit) { +return EOPNOTSUPP; + } else { struct wsdisplay_curpos *cp = (void *)data; cp-x = sc-sc_cursor_x; @@ -765,7 +771,9 @@ tcx_ioctl(void *v, void *vs, u_long cmd, return 0; case WSDISPLAYIO_SCURPOS: - { + if (sc-sc_8bit) { +return EOPNOTSUPP; + } else { struct wsdisplay_curpos *cp = (void *)data; sc-sc_cursor_x = cp-x; @@ -775,7 +783,9 @@ tcx_ioctl(void *v, void *vs, u_long cmd, return 0; case WSDISPLAYIO_GCURMAX: - { + if (sc-sc_8bit) { +return EOPNOTSUPP; + } else { struct wsdisplay_curpos *cp = (void *)data; cp-x = 32; @@ -784,7 +794,9 @@ tcx_ioctl(void *v, void *vs, u_long cmd, return 0; case WSDISPLAYIO_SCURSOR: - { + if (sc-sc_8bit) { +return EOPNOTSUPP; + } else { struct wsdisplay_cursor *cursor = (void *)data; return tcx_do_cursor(sc, cursor); @@ -1074,6 +1086,10 @@ tcx_putchar(void *cookie, int row, int c static int tcx_do_cursor(struct tcx_softc *sc, struct wsdisplay_cursor *cur) { + if (sc-sc_8bit) { + /* hw cursor is not implemented on tcx */ + return -1; + } if (cur-which WSDISPLAY_CURSOR_DOCUR) { if (cur-enable) {
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: martin Date: Tue May 13 05:30:38 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c Log Message: Do not attach if the STIP register is way too small (this happens in qemu due to buggy emulation and causes crashes). To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.47 src/sys/dev/sbus/tcx.c:1.48 --- src/sys/dev/sbus/tcx.c:1.47 Fri May 9 11:51:49 2014 +++ src/sys/dev/sbus/tcx.c Tue May 13 05:30:38 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.47 2014/05/09 11:51:49 jdc Exp $ */ +/* $NetBSD: tcx.c,v 1.48 2014/05/13 05:30:38 martin Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.47 2014/05/09 11:51:49 jdc Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.48 2014/05/13 05:30:38 martin Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -273,9 +273,6 @@ tcxattach(device_t parent, device_t self if (sc-sc_8bit) { printf( (8-bit only TCX)\n); ramsize = 1024 * 1024; - /* XXX - fix THC and TEC offsets */ - sc-sc_physaddr[TCX_REG_TEC].oa_base += 0x1000; - sc-sc_physaddr[TCX_REG_THC].oa_base += 0x1000; } else { printf( (S24)\n); ramsize = 4 * 1024 * 1024; @@ -289,12 +286,19 @@ tcxattach(device_t parent, device_t self fb-fb_type.fb_type = FBTYPE_TCXCOLOR; - if (sa-sa_nreg != TCX_NREG) { - printf(%s: only %d register sets\n, - device_xname(self), sa-sa_nreg); + aprint_error(\n); + aprint_error_dev(self, only %d register sets\n, + sa-sa_nreg); + return; + } + if (sa-sa_reg[TCX_REG_STIP].oa_size 0x1000) { + aprint_error(\n); + aprint_error_dev(self, STIP register too small (0x%x)\n, + sa-sa_reg[TCX_REG_STIP].oa_size); return; } + memcpy(sc-sc_physaddr, sa-sa_reg, sa-sa_nreg * sizeof(struct openprom_addr));
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: jdc Date: Fri May 9 11:51:49 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c Log Message: Cosmetic fix: s/8bit/8-bit/ and new line for 8-bit only TCX's. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.46 src/sys/dev/sbus/tcx.c:1.47 --- src/sys/dev/sbus/tcx.c:1.46 Tue Apr 29 11:16:25 2014 +++ src/sys/dev/sbus/tcx.c Fri May 9 11:51:49 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.46 2014/04/29 11:16:25 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.47 2014/05/09 11:51:49 jdc Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.46 2014/04/29 11:16:25 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.47 2014/05/09 11:51:49 jdc Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -271,7 +271,7 @@ tcxattach(device_t parent, device_t self fb_setsize_obp(fb, fb-fb_type.fb_depth, 1152, 900, node); if (sc-sc_8bit) { - printf( (8bit only TCX)); + printf( (8-bit only TCX)\n); ramsize = 1024 * 1024; /* XXX - fix THC and TEC offsets */ sc-sc_physaddr[TCX_REG_TEC].oa_base += 0x1000;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Apr 29 11:16:25 UTC 2014 Modified Files: src/sys/dev/sbus: tcx.c Log Message: return a match score 1 to beat out genfb if present To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.45 src/sys/dev/sbus/tcx.c:1.46 --- src/sys/dev/sbus/tcx.c:1.45 Sun Mar 16 05:20:29 2014 +++ src/sys/dev/sbus/tcx.c Tue Apr 29 11:16:25 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.45 2014/03/16 05:20:29 dholland Exp $ */ +/* $NetBSD: tcx.c,v 1.46 2014/04/29 11:16:25 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.45 2014/03/16 05:20:29 dholland Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.46 2014/04/29 11:16:25 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -226,7 +226,9 @@ tcxmatch(device_t parent, cfdata_t cf, v { struct sbus_attach_args *sa = aux; - return (strcmp(sa-sa_name, OBPNAME) == 0); + if (strcmp(sa-sa_name, OBPNAME) == 0) + return 100; /* beat genfb */ + return 0; } /*
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Nov 19 10:49:00 UTC 2013 Modified Files: src/sys/dev/sbus: p9100.c Log Message: get rid of junk variable To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/sbus/p9100.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/dev/sbus/p9100.c diff -u src/sys/dev/sbus/p9100.c:1.59 src/sys/dev/sbus/p9100.c:1.60 --- src/sys/dev/sbus/p9100.c:1.59 Sat Oct 27 17:18:37 2012 +++ src/sys/dev/sbus/p9100.c Tue Nov 19 10:49:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.59 2012/10/27 17:18:37 chs Exp $ */ +/* $NetBSD: p9100.c,v 1.60 2013/11/19 10:49:00 macallan Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.59 2012/10/27 17:18:37 chs Exp $); +__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.60 2013/11/19 10:49:00 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -114,7 +114,6 @@ struct p9100_softc { #ifdef PNOZZ_USE_LATCH bus_space_handle_t sc_fb_memh; /* bus space handle */ #endif - volatile uint32_t sc_junk; uint32_t sc_mono_width; /* for setup_mono */ uint32_t sc_width; @@ -262,9 +261,8 @@ struct wsdisplay_accessops p9100_accesso #ifdef PNOZZ_USE_LATCH #define PNOZZ_LATCH(sc, off) if(sc-sc_last_offset != (off 0xff80)) { \ - sc-sc_junk = bus_space_read_4(sc-sc_bustag, sc-sc_fb_memh, \ - off); \ - sc-sc_last_offset = off 0xff80; } + (void)bus_space_read_4(sc-sc_bustag, sc-sc_fb_memh, off); \ + sc-sc_last_offset = off 0xff80; } #else #define PNOZZ_LATCH(a, b) #endif @@ -791,7 +789,7 @@ p9100_bitblt(void *cookie, int xs, int y p9100_ctl_write_4(sc, ABS_XY2, dst sc-sc_depthshift); p9100_ctl_write_4(sc, ABS_XY3, dstw sc-sc_depthshift); - sc-sc_junk = p9100_ctl_read_4(sc, COMMAND_BLIT); + (void)p9100_ctl_read_4(sc, COMMAND_BLIT); } /* solid rectangle fill */ @@ -813,7 +811,7 @@ p9100_rectfill(void *cookie, int xs, int p9100_ctl_write_4(sc, COORD_INDEX, 0); p9100_ctl_write_4(sc, RECT_RTW_XY, src); p9100_ctl_write_4(sc, RECT_RTW_XY, srcw); - sc-sc_junk = p9100_ctl_read_4(sc, COMMAND_QUAD); + (void)p9100_ctl_read_4(sc, COMMAND_QUAD); } /* setup for mono-colour expansion */ @@ -892,7 +890,7 @@ static uint8_t p9100_ramdac_read(struct p9100_softc *sc, bus_size_t off) { - sc-sc_junk = p9100_ctl_read_4(sc, PWRUP_CNFG); + (void)p9100_ctl_read_4(sc, PWRUP_CNFG); return ((bus_space_read_4(sc-sc_bustag, sc-sc_ctl_memh, off) 16) 0xff); } @@ -901,7 +899,7 @@ static void p9100_ramdac_write(struct p9100_softc *sc, bus_size_t off, uint8_t v) { - sc-sc_junk = p9100_ctl_read_4(sc, PWRUP_CNFG); + (void)p9100_ctl_read_4(sc, PWRUP_CNFG); bus_space_write_4(sc-sc_bustag, sc-sc_ctl_memh, off, ((uint32_t)v) 16); }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: martin Date: Sun Sep 15 14:04:04 UTC 2013 Modified Files: src/sys/dev/sbus: spif.c Log Message: Remove unused variables To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/sbus/spif.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/dev/sbus/spif.c diff -u src/sys/dev/sbus/spif.c:1.28 src/sys/dev/sbus/spif.c:1.29 --- src/sys/dev/sbus/spif.c:1.28 Mon Jul 18 00:58:52 2011 +++ src/sys/dev/sbus/spif.c Sun Sep 15 14:04:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: spif.c,v 1.28 2011/07/18 00:58:52 mrg Exp $ */ +/* $NetBSD: spif.c,v 1.29 2013/09/15 14:04:04 martin Exp $ */ /* $OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $ */ /* @@ -41,7 +41,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: spif.c,v 1.28 2011/07/18 00:58:52 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: spif.c,v 1.29 2013/09/15 14:04:04 martin Exp $); #include spif.h #if NSPIF 0 @@ -742,7 +742,7 @@ int spif_stcintr_rx(struct spif_softc *sc, int *needsoftp) { struct stty_port *sp; - uint8_t channel, *ptr, cnt, rcsr; + uint8_t channel, *ptr, cnt; int i; channel = CD180_GSCR_CHANNEL(STC_READ(sc, STC_GSCR1)); @@ -751,7 +751,7 @@ spif_stcintr_rx(struct spif_softc *sc, i cnt = STC_READ(sc, STC_RDCR); for (i = 0; i cnt; i++) { *ptr++ = 0; - rcsr = STC_READ(sc, STC_RCSR); + (void)STC_READ(sc, STC_RCSR); *ptr++ = STC_READ(sc, STC_RDR); if (ptr == sp-sp_rend) ptr = sp-sp_rbuf; @@ -877,7 +877,7 @@ spif_softintr(void *vsc) { struct spif_softc *sc = (struct spif_softc *)vsc; struct stty_softc *stc = sc-sc_ttys; - int r = 0, i, data, s, flags; + int i, data, s, flags; uint8_t stat, msvr; struct stty_port *sp; struct tty *tp; @@ -904,7 +904,6 @@ spif_softintr(void *vsc) data |= TTY_PE; (*tp-t_linesw-l_rint)(data, tp); -r = 1; } s = splhigh(); @@ -922,13 +921,11 @@ spif_softintr(void *vsc) sp-sp_carrier = msvr CD180_MSVR_CD; (*tp-t_linesw-l_modem)(tp, sp-sp_carrier); -r = 1; } if (ISSET(flags, STTYF_RING_OVERFLOW)) { log(LOG_WARNING, %s-%x: ring overflow\n, device_xname(stc-sc_dev), i); -r = 1; } if (ISSET(flags, STTYF_DONE)) { @@ -936,7 +933,6 @@ spif_softintr(void *vsc) sp-sp_txp - tp-t_outq.c_cf); CLR(tp-t_state, TS_BUSY); (*tp-t_linesw-l_start)(tp); -r = 1; } } }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: martin Date: Thu Sep 12 19:54:51 UTC 2013 Modified Files: src/sys/dev/sbus: esp_sbus.c Log Message: Remove unused variable To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/sbus/esp_sbus.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/dev/sbus/esp_sbus.c diff -u src/sys/dev/sbus/esp_sbus.c:1.51 src/sys/dev/sbus/esp_sbus.c:1.52 --- src/sys/dev/sbus/esp_sbus.c:1.51 Thu Sep 17 16:28:12 2009 +++ src/sys/dev/sbus/esp_sbus.c Thu Sep 12 19:54:51 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: esp_sbus.c,v 1.51 2009/09/17 16:28:12 tsutsui Exp $ */ +/* $NetBSD: esp_sbus.c,v 1.52 2013/09/12 19:54:51 martin Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: esp_sbus.c,v 1.51 2009/09/17 16:28:12 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: esp_sbus.c,v 1.52 2013/09/12 19:54:51 martin Exp $); #include sys/param.h #include sys/systm.h @@ -408,7 +408,6 @@ void espattach(struct esp_softc *esc, struct ncr53c9x_glue *gluep) { struct ncr53c9x_softc *sc = esc-sc_ncr53c9x; - void *icookie; unsigned int uid = 0; /* @@ -512,7 +511,7 @@ espattach(struct esp_softc *esc, struct } /* Establish interrupt channel */ - icookie = bus_intr_establish(esc-sc_bustag, esc-sc_pri, IPL_BIO, + bus_intr_establish(esc-sc_bustag, esc-sc_pri, IPL_BIO, ncr53c9x_intr, sc); /* register interrupt stats */
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: msaitoh Date: Sun Jun 9 09:23:35 UTC 2013 Modified Files: src/sys/dev/sbus: be.c Log Message: Don't return but break in MII_TICK when the interface isn't doing autonegotiaton or the link is up to update the status. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/dev/sbus/be.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.79 src/sys/dev/sbus/be.c:1.80 --- src/sys/dev/sbus/be.c:1.79 Sun Jul 22 14:33:05 2012 +++ src/sys/dev/sbus/be.c Sun Jun 9 09:23:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.79 2012/07/22 14:33:05 matt Exp $ */ +/* $NetBSD: be.c,v 1.80 2013/06/09 09:23:35 msaitoh Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be.c,v 1.79 2012/07/22 14:33:05 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: be.c,v 1.80 2013/06/09 09:23:35 msaitoh Exp $); #include opt_ddb.h #include opt_inet.h @@ -1516,14 +1516,14 @@ be_intphy_service(struct be_softc *sc, s if (IFM_INST(ife-ifm_media) != sc-sc_mii_inst) return 0; - /* Only used for automatic media selection */ - if (IFM_SUBTYPE(ife-ifm_media) != IFM_AUTO) - return 0; - /* Is the interface even up? */ if ((mii-mii_ifp-if_flags IFF_UP) == 0) return 0; + /* Only used for automatic media selection */ + if (IFM_SUBTYPE(ife-ifm_media) != IFM_AUTO) + break; + /* * Check link status; if we don't have a link, try another * speed. We can't detect duplex mode, so half-duplex is @@ -1555,7 +1555,7 @@ be_intphy_service(struct be_softc *sc, s device_xname(self), (bmcr BMCR_S100) ? 100 : 10); } - return 0; + break; } if ((sc-sc_mii_flags MIIF_DOINGAUTO) == 0) {
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Oct 23 11:53:18 UTC 2012 Modified Files: src/sys/dev/sbus: agten.c Log Message: support anti-aliased fonts To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sbus/agten.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/dev/sbus/agten.c diff -u src/sys/dev/sbus/agten.c:1.29 src/sys/dev/sbus/agten.c:1.30 --- src/sys/dev/sbus/agten.c:1.29 Sat Oct 20 13:52:11 2012 +++ src/sys/dev/sbus/agten.c Tue Oct 23 11:53:18 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: agten.c,v 1.29 2012/10/20 13:52:11 macallan Exp $ */ +/* $NetBSD: agten.c,v 1.30 2012/10/23 11:53:18 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.29 2012/10/20 13:52:11 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.30 2012/10/23 11:53:18 macallan Exp $); /* * a driver for the Fujitsu AG-10e SBus framebuffer @@ -136,6 +136,7 @@ static int agten_getcmap(struct agten_s static int agten_putpalreg(struct agten_softc *, uint8_t, uint8_t, uint8_t, uint8_t); static void agten_init(struct agten_softc *); +static void agten_init_cmap(struct agten_softc *, struct rasops_info *); static void agten_gfx(struct agten_softc *); static void agten_set_video(struct agten_softc *, int); static int agten_get_video(struct agten_softc *); @@ -360,6 +361,7 @@ agten_attach(device_t parent, device_t d } /* Initialize the default color map. */ + agten_init_cmap(sc, ri); aa.console = console; aa.scrdata = sc-sc_screenlist; @@ -434,6 +436,8 @@ agten_ioctl(void *v, void *vs, u_long cm sc-sc_mode = new_mode; if(new_mode == WSDISPLAYIO_MODE_EMUL) { agten_init(sc); + agten_init_cmap(sc, + ms-scr_ri); vcons_redraw_screen(ms); } else { agten_gfx(sc); @@ -501,7 +505,7 @@ agten_init_screen(void *cookie, struct v ri-ri_width = sc-sc_width; ri-ri_height = sc-sc_height; ri-ri_stride = sc-sc_stride; - ri-ri_flg = RI_CENTER | RI_FULLCLEAR; + ri-ri_flg = RI_CENTER | RI_FULLCLEAR | RI_8BIT_IS_RGB | RI_ENABLE_ALPHA; ri-ri_bits = (char *)sc-sc_fb.fb_pixels; @@ -610,19 +614,10 @@ agten_putpalreg(struct agten_softc *sc, static void agten_init(struct agten_softc *sc) { - int i, j; + int i; uint32_t src, srcw; volatile uint32_t junk; - /* first we set up the colour map */ - j = 0; - for (i = 0; i 256; i++) { - - agten_putpalreg(sc, i, rasops_cmap[j], rasops_cmap[j + 1], - rasops_cmap[j + 2]); - j += 3; - } - /* then we set up a linear LUT for 24bit colour */ agten_write_idx(sc, IBM561_CMAP_TABLE + 256); for (i = 0; i 256; i++) { @@ -695,6 +690,21 @@ agten_init(struct agten_softc *sc) } static void +agten_init_cmap(struct agten_softc *sc, struct rasops_info *ri) +{ + int i, j; + uint8_t cmap[768]; + + rasops_get_cmap(ri, cmap, 768); + j = 0; + for (i = 0; i 256; i++) { + + agten_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]); + j += 3; + } +} + +static void agten_gfx(struct agten_softc *sc) { /* enable overlay transparency on colour 0x00 */
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Sat Oct 20 13:52:11 UTC 2012 Modified Files: src/sys/dev/sbus: agten.c files.sbus Log Message: - only sync the drawing engine when we're about to access video memory - use the blitter to draw the cursor - use the glyphcache to minimize vram access - about 15% to 20% speedup To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/sbus/agten.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/sbus/files.sbus Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sbus/agten.c diff -u src/sys/dev/sbus/agten.c:1.28 src/sys/dev/sbus/agten.c:1.29 --- src/sys/dev/sbus/agten.c:1.28 Wed Jan 11 16:08:57 2012 +++ src/sys/dev/sbus/agten.c Sat Oct 20 13:52:11 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: agten.c,v 1.28 2012/01/11 16:08:57 macallan Exp $ */ +/* $NetBSD: agten.c,v 1.29 2012/10/20 13:52:11 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,14 +27,14 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.28 2012/01/11 16:08:57 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.29 2012/10/20 13:52:11 macallan Exp $); /* * a driver for the Fujitsu AG-10e SBus framebuffer * * this thing is Frankenstein's Monster among graphics boards. * it contains three graphics chips: - * a GLint - 24bit stuff, double-buffered + * a GLint 300SX - 24bit stuff, double-buffered * an Imagine 128 which provides an 8bit overlay * a Weitek P9100 which provides WIDs * so here we need to mess only with the P9100 and the I128 - for X we just @@ -68,6 +68,7 @@ __KERNEL_RCSID(0, $NetBSD: agten.c,v 1. #include dev/wsfont/wsfont.h #include dev/wscons/wsdisplay_vconsvar.h +#include dev/wscons/wsdisplay_glyphcachevar.h #include dev/sbus/p9100reg.h #include dev/ic/ibm561reg.h @@ -119,7 +120,11 @@ struct agten_softc { int sc_mode; uint32_t sc_bg; + + void (*sc_putchar)(void *, int, int, u_int, long); + struct vcons_data vd; + glyphcache sc_gc; }; CFATTACH_DECL_NEW(agten, sizeof(struct agten_softc), @@ -135,6 +140,11 @@ static void agten_gfx(struct agten_softc static void agten_set_video(struct agten_softc *, int); static int agten_get_video(struct agten_softc *); +static void agten_bitblt(void *, int, int, int, int, int, int, int); +static void agten_rectfill(void *, int, int, int, int, long); + +static void agten_putchar(void *, int, int, u_int, long); +static void agten_cursor(void *, int, int, int); static void agten_copycols(void *, int, int, int, int); static void agten_erasecols(void *, int, int, int, long); static void agten_copyrows(void *, int, int, int); @@ -236,6 +246,7 @@ agten_attach(device_t parent, device_t d sc-sc_fb_is_open = 0; sc-sc_video = -1; sc-sc_bustag = sa-sa_bustag; + sc-sc_putchar = NULL; sc-sc_width = prom_getpropint(node, ffb_width, 1152); sc-sc_height = prom_getpropint(node, ffb_height, 900); @@ -297,6 +308,15 @@ agten_attach(device_t parent, device_t d ri = sc-sc_console_screen.scr_ri; + sc-sc_gc.gc_bitblt = agten_bitblt; + sc-sc_gc.gc_rectfill = agten_rectfill; + sc-sc_gc.gc_blitcookie = sc; + sc-sc_gc.gc_rop = CR_COPY; + +#if defined(AGTEN_DEBUG) + sc-sc_height -= 200; +#endif + if (console) { vcons_init_screen(sc-vd, sc-sc_console_screen, 1, defattr); @@ -306,6 +326,14 @@ agten_attach(device_t parent, device_t d sc-sc_defaultscreen_descr.capabilities = ri-ri_caps; sc-sc_defaultscreen_descr.nrows = ri-ri_rows; sc-sc_defaultscreen_descr.ncols = ri-ri_cols; + glyphcache_init(sc-sc_gc, + sc-sc_height + 5, + (0x40 / sc-sc_stride) - sc-sc_height - 5, + sc-sc_width, + ri-ri_font-fontwidth, + ri-ri_font-fontheight, + defattr); + wsdisplay_cnattach(sc-sc_defaultscreen_descr, ri, 0, 0, defattr); i128_rectfill(sc-sc_bustag, sc-sc_i128_regh, 0, 0, @@ -317,6 +345,18 @@ agten_attach(device_t parent, device_t d * since we're not the console we can postpone the rest * until someone actually allocates a screen for us */ + if (sc-sc_console_screen.scr_ri.ri_rows == 0) { + /* do some minimal setup to avoid weirdnesses later */ + vcons_init_screen(sc-vd, sc-sc_console_screen, 1, + defattr); + } + glyphcache_init(sc-sc_gc, + sc-sc_height + 5, + (0x40 / sc-sc_stride) - sc-sc_height - 5, + sc-sc_width, + ri-ri_font-fontwidth, + ri-ri_font-fontheight, + defattr); } /* Initialize the default color map. */ @@ -470,12 +510,16 @@ agten_init_screen(void *cookie, struct v } rasops_init(ri, 0, 0); + sc-sc_putchar = ri-ri_ops.putchar; + ri-ri_caps = WSSCREEN_WSCOLORS; rasops_reconfig(ri, sc-sc_height / ri-ri_font-fontheight, sc-sc_width / ri-ri_font-fontwidth); ri-ri_hw = scr; + ri-ri_ops.putchar = agten_putchar; + ri-ri_ops.cursor= agten_cursor; ri-ri_ops.copyrows = agten_copyrows; ri-ri_ops.eraserows =
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Fri Oct 5 01:19:03 UTC 2012 Modified Files: src/sys/dev/sbus: p9100.c Log Message: get rid of gc_attr allocattr() To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/dev/sbus/p9100.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/dev/sbus/p9100.c diff -u src/sys/dev/sbus/p9100.c:1.57 src/sys/dev/sbus/p9100.c:1.58 --- src/sys/dev/sbus/p9100.c:1.57 Fri Sep 21 01:07:44 2012 +++ src/sys/dev/sbus/p9100.c Fri Oct 5 01:19:03 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.57 2012/09/21 01:07:44 macallan Exp $ */ +/* $NetBSD: p9100.c,v 1.58 2012/10/05 01:19:03 macallan Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.57 2012/09/21 01:07:44 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.58 2012/10/05 01:19:03 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -217,9 +217,6 @@ static void p9100_eraserows(void *, int, static void p9100_putchar(void *, int, int, u_int, long); static void p9100_putchar_aa(void *, int, int, u_int, long); static void p9100_cursor(void *, int, int, int); -#if 0 -static int p9100_allocattr(void *, int, int, int, long *); -#endif static int p9100_putcmap(struct p9100_softc *, struct wsdisplay_cmap *); static int p9100_getcmap(struct p9100_softc *, struct wsdisplay_cmap *); @@ -1389,8 +1386,6 @@ p9100_init_screen(void *cookie, struct v ri-ri_ops.erasecols = p9100_erasecols; if (FONT_IS_ALPHA(ri-ri_font)) { ri-ri_ops.putchar = p9100_putchar_aa; - if (0) ri-ri_ops.allocattr(ri, WS_DEFAULT_FG, WS_DEFAULT_BG, - 0, sc-sc_gc.gc_attr); } else ri-ri_ops.putchar = p9100_putchar; } @@ -1531,27 +1526,6 @@ p9100_eraserows(void *cookie, int row, i #if 0 static int -p9100_allocattr(void *cookie, int fg, int bg, int flags, long *attrp) -{ - if ((fg == 0) (bg == 0)) - { - fg = WS_DEFAULT_FG; - bg = WS_DEFAULT_BG; - } - - *attrp = (fg 0xff) 24 | (bg 0xff) 16 | (flags 0xff); - - if (flags WSATTR_REVERSE) { - *attrp = (bg 0xff) 24 | (fg 0xff) 16 | - (flags 0xff) 8; - } else - *attrp = (fg 0xff) 24 | (bg 0xff) 16 | - (flags 0xff) 8; - - return 0; -} - -static int p9100_load_font(void *v, void *cookie, struct wsdisplay_font *data) {
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Fri Sep 21 01:07:45 UTC 2012 Modified Files: src/sys/dev/sbus: files.sbus p9100.c p9100reg.h Log Message: support anti-aliased fonts, glyph caching etc. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/sbus/files.sbus cvs rdiff -u -r1.56 -r1.57 src/sys/dev/sbus/p9100.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/sbus/p9100reg.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/dev/sbus/files.sbus diff -u src/sys/dev/sbus/files.sbus:1.37 src/sys/dev/sbus/files.sbus:1.38 --- src/sys/dev/sbus/files.sbus:1.37 Wed Aug 18 21:11:50 2010 +++ src/sys/dev/sbus/files.sbus Fri Sep 21 01:07:44 2012 @@ -1,4 +1,4 @@ -# $NetBSD: files.sbus,v 1.37 2010/08/18 21:11:50 macallan Exp $ +# $NetBSD: files.sbus,v 1.38 2012/09/21 01:07:44 macallan Exp $ # # Config file and device description for machine-independent SBUS code. # Included by ports that need it. @@ -127,7 +127,7 @@ file dev/sbus/zx.c zx defflag opt_pnozz.h PNOZZ_DEBUG defflag opt_pnozz.h PNOZZ_EMUL_CG3 defflag opt_pnozz.h PNOZZ_USE_LATCH -device pnozz: fb, rasops8, bt_dac, wsemuldisplaydev, vcons +device pnozz: fb, rasops8, bt_dac, wsemuldisplaydev, vcons, glyphcache attach pnozz at sbus file dev/sbus/p9100.c pnozz needs-flag Index: src/sys/dev/sbus/p9100.c diff -u src/sys/dev/sbus/p9100.c:1.56 src/sys/dev/sbus/p9100.c:1.57 --- src/sys/dev/sbus/p9100.c:1.56 Wed Jan 11 16:08:57 2012 +++ src/sys/dev/sbus/p9100.c Fri Sep 21 01:07:44 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.56 2012/01/11 16:08:57 macallan Exp $ */ +/* $NetBSD: p9100.c,v 1.57 2012/09/21 01:07:44 macallan Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.56 2012/01/11 16:08:57 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.57 2012/09/21 01:07:44 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -68,6 +68,7 @@ __KERNEL_RCSID(0, $NetBSD: p9100.c,v 1. #include dev/rasops/rasops.h #include dev/wscons/wsdisplay_vconsvar.h +#include dev/wscons/wsdisplay_glyphcachevar.h #include opt_wsemul.h #include rasops_glue.h @@ -132,6 +133,7 @@ struct p9100_softc { volatile uint32_t sc_last_offset; struct vcons_data vd; uint8_t sc_dac_power; + glyphcache sc_gc; }; @@ -167,6 +169,7 @@ CFATTACH_DECL_NEW(pnozz, sizeof(struct p p9100_sbus_match, p9100_sbus_attach, NULL, NULL); static dev_type_open(p9100open); +static dev_type_close(p9100close); static dev_type_ioctl(p9100ioctl); static dev_type_mmap(p9100mmap); @@ -177,7 +180,7 @@ const struct cdevsw pnozz_cdevsw = { /* frame buffer generic driver */ static struct fbdriver p9100fbdriver = { - p9100unblank, p9100open, nullclose, p9100ioctl, nopoll, + p9100unblank, p9100open, p9100close, p9100ioctl, nopoll, p9100mmap, nokqfilter }; @@ -197,7 +200,7 @@ static int p9100_set_depth(struct p9100_ #if NWSDISPLAY 0 static void p9100_sync(struct p9100_softc *); -static void p9100_bitblt(void *, int, int, int, int, int, int, uint32_t); +static void p9100_bitblt(void *, int, int, int, int, int, int, int); static void p9100_rectfill(void *, int, int, int, int, uint32_t); static void p9100_clearscreen(struct p9100_softc *); @@ -212,8 +215,11 @@ static void p9100_copyrows(void *, int, static void p9100_eraserows(void *, int, int, long); /*static int p9100_mapchar(void *, int, u_int *);*/ static void p9100_putchar(void *, int, int, u_int, long); +static void p9100_putchar_aa(void *, int, int, u_int, long); static void p9100_cursor(void *, int, int, int); +#if 0 static int p9100_allocattr(void *, int, int, int, long *); +#endif static int p9100_putcmap(struct p9100_softc *, struct wsdisplay_cmap *); static int p9100_getcmap(struct p9100_softc *, struct wsdisplay_cmap *); @@ -292,7 +298,7 @@ p9100_sbus_attach(device_t parent, devic int isconsole; int node = sa-sa_node; int i, j; - uint8_t ver; + uint8_t ver, cmap[768]; #if NWSDISPLAY 0 struct wsemuldisplaydev_attach_args aa; @@ -412,18 +418,6 @@ p9100_sbus_attach(device_t parent, devic if ((1 fb-fb_type.fb_depth) != fb-fb_type.fb_cmsize) printf(, %d entry colormap, fb-fb_type.fb_cmsize); - /* Initialize the default color map. */ - j = 0; - for (i = 0; i 256; i++) { - sc-sc_cmap.cm_map[i][0] = rasops_cmap[j]; - j++; - sc-sc_cmap.cm_map[i][1] = rasops_cmap[j]; - j++; - sc-sc_cmap.cm_map[i][2] = rasops_cmap[j]; - j++; - } - p9100loadcmap(sc, 0, 256); - /* make sure we are not blanked */ if (isconsole) p9100_set_video(sc, 1); @@ -448,12 +442,35 @@ p9100_sbus_attach(device_t parent, devic #if NWSDISPLAY 0 wsfont_init(); +#ifdef PNOZZ_DEBUG + /* make the glyph cache visible */ + sc-sc_height -= 100; +#endif + + sc-sc_gc.gc_bitblt = p9100_bitblt; + sc-sc_gc.gc_blitcookie = sc; + sc-sc_gc.gc_rop = ROP_SRC; +
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: jdc Date: Fri Jun 22 11:03:57 UTC 2012 Modified Files: src/sys/dev/sbus: qe.c Log Message: Fix fallout from revision 1.68, and call ether_ioctl() in the default path. Patch from John D. Baker in PR port-sparc/46572. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/dev/sbus/qe.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/dev/sbus/qe.c diff -u src/sys/dev/sbus/qe.c:1.60 src/sys/dev/sbus/qe.c:1.61 --- src/sys/dev/sbus/qe.c:1.60 Thu Feb 2 19:43:06 2012 +++ src/sys/dev/sbus/qe.c Fri Jun 22 11:03:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: qe.c,v 1.60 2012/02/02 19:43:06 tls Exp $ */ +/* $NetBSD: qe.c,v 1.61 2012/06/22 11:03:57 jdc Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: qe.c,v 1.60 2012/02/02 19:43:06 tls Exp $); +__KERNEL_RCSID(0, $NetBSD: qe.c,v 1.61 2012/06/22 11:03:57 jdc Exp $); #define QEDEBUG @@ -956,7 +956,7 @@ qeioctl(struct ifnet *ifp, u_long cmd, v break; default: - error = EINVAL; + error = ether_ioctl(ifp, cmd, data); break; }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Jan 11 16:08:57 UTC 2012 Modified Files: src/sys/dev/sbus: agten.c cgtwelve.c p9100.c tcx.c zx.c Log Message: use rasops_init(0, 0) To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sbus/agten.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/sbus/cgtwelve.c cvs rdiff -u -r1.55 -r1.56 src/sys/dev/sbus/p9100.c cvs rdiff -u -r1.43 -r1.44 src/sys/dev/sbus/tcx.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/sbus/zx.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/dev/sbus/agten.c diff -u src/sys/dev/sbus/agten.c:1.27 src/sys/dev/sbus/agten.c:1.28 --- src/sys/dev/sbus/agten.c:1.27 Mon Nov 15 05:59:57 2010 +++ src/sys/dev/sbus/agten.c Wed Jan 11 16:08:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: agten.c,v 1.27 2010/11/15 05:59:57 uebayasi Exp $ */ +/* $NetBSD: agten.c,v 1.28 2012/01/11 16:08:57 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.27 2010/11/15 05:59:57 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.28 2012/01/11 16:08:57 macallan Exp $); /* * a driver for the Fujitsu AG-10e SBus framebuffer @@ -469,7 +469,7 @@ agten_init_screen(void *cookie, struct v ri-ri_flg |= RI_CLEAR; } - rasops_init(ri, sc-sc_height / 8, sc-sc_width / 8); + rasops_init(ri, 0, 0); ri-ri_caps = WSSCREEN_WSCOLORS; rasops_reconfig(ri, sc-sc_height / ri-ri_font-fontheight, Index: src/sys/dev/sbus/cgtwelve.c diff -u src/sys/dev/sbus/cgtwelve.c:1.4 src/sys/dev/sbus/cgtwelve.c:1.5 --- src/sys/dev/sbus/cgtwelve.c:1.4 Wed Aug 18 21:11:50 2010 +++ src/sys/dev/sbus/cgtwelve.c Wed Jan 11 16:08:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cgtwelve.c,v 1.4 2010/08/18 21:11:50 macallan Exp $ */ +/* $NetBSD: cgtwelve.c,v 1.5 2012/01/11 16:08:57 macallan Exp $ */ /*- * Copyright (c) 2010 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the Sun CG12 / Matrox SG3 graphics board */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.4 2010/08/18 21:11:50 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.5 2012/01/11 16:08:57 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -486,7 +486,7 @@ cgtwelve_init_screen(void *cookie, struc ri-ri_bits = sc-sc_shadow; } - rasops_init(ri, ri-ri_height / 8, ri-ri_width / 8); + rasops_init(ri, 0, 0); #ifdef CG12_COLOR ri-ri_caps = WSSCREEN_REVERSE | WSSCREEN_WSCOLORS; #else Index: src/sys/dev/sbus/p9100.c diff -u src/sys/dev/sbus/p9100.c:1.55 src/sys/dev/sbus/p9100.c:1.56 --- src/sys/dev/sbus/p9100.c:1.55 Tue May 4 05:10:25 2010 +++ src/sys/dev/sbus/p9100.c Wed Jan 11 16:08:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.55 2010/05/04 05:10:25 macallan Exp $ */ +/* $NetBSD: p9100.c,v 1.56 2012/01/11 16:08:57 macallan Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.55 2010/05/04 05:10:25 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.56 2012/01/11 16:08:57 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -1231,7 +1231,7 @@ p9100_init_screen(void *cookie, struct v DPRINTF(addr: %08lx\n,(ulong)ri-ri_bits); #endif - rasops_init(ri, sc-sc_height/8, sc-sc_width/8); + rasops_init(ri, 0, 0); ri-ri_caps = WSSCREEN_WSCOLORS; rasops_reconfig(ri, sc-sc_height / ri-ri_font-fontheight, sc-sc_width / ri-ri_font-fontwidth); Index: src/sys/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.43 src/sys/dev/sbus/tcx.c:1.44 --- src/sys/dev/sbus/tcx.c:1.43 Tue May 4 05:10:25 2010 +++ src/sys/dev/sbus/tcx.c Wed Jan 11 16:08:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.43 2010/05/04 05:10:25 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.44 2012/01/11 16:08:57 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.43 2010/05/04 05:10:25 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.44 2012/01/11 16:08:57 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -821,7 +821,7 @@ tcx_init_screen(void *cookie, struct vco ri-ri_bits = sc-sc_fbaddr; - rasops_init(ri, ri-ri_height/8, ri-ri_width/8); + rasops_init(ri, 0, 0); ri-ri_caps = WSSCREEN_WSCOLORS; rasops_reconfig(ri, ri-ri_height / ri-ri_font-fontheight, ri-ri_width / ri-ri_font-fontwidth); Index: src/sys/dev/sbus/zx.c diff -u src/sys/dev/sbus/zx.c:1.38 src/sys/dev/sbus/zx.c:1.39 --- src/sys/dev/sbus/zx.c:1.38 Thu Dec 9 04:35:36 2010 +++ src/sys/dev/sbus/zx.c Wed Jan 11 16:08:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: zx.c,v 1.38 2010/12/09 04:35:36 uebayasi Exp $ */ +/* $NetBSD: zx.c,v 1.39 2012/01/11 16:08:57 macallan Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -45,7
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: dyoung Date: Tue Jul 26 22:22:41 UTC 2011 Modified Files: src/sys/dev/sbus: stp4020.c Log Message: Don't set the iobase and iosize members of pcmciabus_attach_args because they're not used in any meaningful way. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/dev/sbus/stp4020.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/dev/sbus/stp4020.c diff -u src/sys/dev/sbus/stp4020.c:1.65 src/sys/dev/sbus/stp4020.c:1.66 --- src/sys/dev/sbus/stp4020.c:1.65 Mon Jul 18 00:58:52 2011 +++ src/sys/dev/sbus/stp4020.c Tue Jul 26 22:22:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: stp4020.c,v 1.65 2011/07/18 00:58:52 mrg Exp $ */ +/* $NetBSD: stp4020.c,v 1.66 2011/07/26 22:22:41 dyoung Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: stp4020.c,v 1.65 2011/07/18 00:58:52 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: stp4020.c,v 1.66 2011/07/26 22:22:41 dyoung Exp $); #include sys/param.h #include sys/systm.h @@ -512,8 +512,6 @@ paa.paa_busname = pcmcia; paa.pct = (pcmcia_chipset_tag_t)h-sc-sc_pct; paa.pch = (pcmcia_chipset_handle_t)h; - paa.iobase = 0; - paa.iosize = STP4020_WINDOW_SIZE; h-pcmcia = config_found(h-sc-sc_dev, paa, stp4020print);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: mrg Date: Sat Jul 2 13:21:30 UTC 2011 Modified Files: src/sys/dev/sbus: spif.c Log Message: avoid some uninitialised variable warnings from GCC 4.5. i'm pretty sure they can't happen in practise, but i can see why GCC isn't sure. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sbus/spif.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/dev/sbus/spif.c diff -u src/sys/dev/sbus/spif.c:1.26 src/sys/dev/sbus/spif.c:1.27 --- src/sys/dev/sbus/spif.c:1.26 Sun Apr 24 16:27:01 2011 +++ src/sys/dev/sbus/spif.c Sat Jul 2 13:21:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: spif.c,v 1.26 2011/04/24 16:27:01 rmind Exp $ */ +/* $NetBSD: spif.c,v 1.27 2011/07/02 13:21:30 mrg Exp $ */ /* $OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $ */ /* @@ -41,7 +41,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: spif.c,v 1.26 2011/04/24 16:27:01 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: spif.c,v 1.27 2011/07/02 13:21:30 mrg Exp $); #include spif.h #if NSPIF 0 @@ -539,7 +539,7 @@ SPIF_CARD(tp-t_dev)); struct stty_port *sp = st-sc_port[SPIF_PORT(tp-t_dev)]; struct spif_softc *sc = sp-sp_sc; - uint8_t rbprl, rbprh, tbprl, tbprh; + uint8_t rbprl = 0, rbprh = 0, tbprl = 0, tbprh = 0; int s, opt; if (t-c_ospeed
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Mar 9 05:40:11 UTC 2011 Modified Files: src/sys/dev/sbus: dbri.c Log Message: change dbri's DMA segment size to a power of two value - the ship allows segments up to 0x1fff bytes but even rounded to 32bit this seems to confuse the rest of the audio code these days TODO: we don't need to interrupt at every single segment either way, with this mpg123 doesn't produce semi-random funny noises anymore To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/sbus/dbri.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.32 src/sys/dev/sbus/dbri.c:1.33 --- src/sys/dev/sbus/dbri.c:1.32 Tue Jan 11 00:49:50 2011 +++ src/sys/dev/sbus/dbri.c Wed Mar 9 05:40:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.32 2011/01/11 00:49:50 macallan Exp $ */ +/* $NetBSD: dbri.c,v 1.33 2011/03/09 05:40:11 macallan Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.32 2011/01/11 00:49:50 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.33 2011/03/09 05:40:11 macallan Exp $); #include audio.h #if NAUDIO 0 @@ -1729,8 +1729,12 @@ const audio_params_t *param) { - /* DBRI DMA segment size, rounded down to 32bit alignment */ - return 0x1ffc; + /* + * DBRI DMA segment size can be up to 0x1fff, sixes that are not powers + * of two seem to confuse the upper audio layer so we're going with + * 0x1000 here + */ + return 0x1000; } static int @@ -1946,7 +1950,7 @@ dbri_round_buffersize(void *hdl, int dir, size_t bufsize) { #ifdef DBRI_BIG_BUFFER - return 16*0x1ffc; /* use ~128KB buffer */ + return 0x2; /* use 128KB buffer */ #else return bufsize; #endif
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Jan 11 00:49:50 UTC 2011 Modified Files: src/sys/dev/sbus: dbri.c dbrivar.h Log Message: use config_finalize_register() instead of config_interrupts() to detect the codec and attach audio. For some reason we run into a locking panic with config_interrupts(). Tested on my SS20 To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/sbus/dbri.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/sbus/dbrivar.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.31 src/sys/dev/sbus/dbri.c:1.32 --- src/sys/dev/sbus/dbri.c:1.31 Wed Feb 24 22:38:08 2010 +++ src/sys/dev/sbus/dbri.c Tue Jan 11 00:49:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.31 2010/02/24 22:38:08 dyoung Exp $ */ +/* $NetBSD: dbri.c,v 1.32 2011/01/11 00:49:50 macallan Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.31 2010/02/24 22:38:08 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.32 2011/01/11 00:49:50 macallan Exp $); #include audio.h #if NAUDIO 0 @@ -96,7 +96,7 @@ static void dbri_attach_sbus(device_t, device_t, void *); static int dbri_match_sbus(device_t, cfdata_t, void *); -static void dbri_config_interrupts(device_t); +static int dbri_config_interrupts(device_t); /* interrupt handler */ static int dbri_intr(void *); @@ -378,7 +378,8 @@ sc-sc_refcount = 0; sc-sc_playing = 0; sc-sc_recording = 0; - config_interrupts(self, dbri_config_interrupts); + sc-sc_init_done = 0; + config_finalize_register(self, dbri_config_interrupts); return; } @@ -441,16 +442,21 @@ mmcodec_setgain(sc, 0); } -static void +static int dbri_config_interrupts(device_t dev) { struct dbri_softc *sc = device_private(dev); + if (sc-sc_init_done != 0) + return 0; + + sc-sc_init_done = 1; + dbri_init(sc); if (mmcodec_init(sc) == -1) { printf(%s: no codec detected, aborting\n, device_xname(dev)); - return; + return 0; } /* Attach ourselves to the high level audio interface */ @@ -458,7 +464,7 @@ /* power down until open() */ dbri_set_power(sc, 0); - return; + return 0; } static int Index: src/sys/dev/sbus/dbrivar.h diff -u src/sys/dev/sbus/dbrivar.h:1.11 src/sys/dev/sbus/dbrivar.h:1.12 --- src/sys/dev/sbus/dbrivar.h:1.11 Thu Sep 17 16:28:12 2009 +++ src/sys/dev/sbus/dbrivar.h Tue Jan 11 00:49:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dbrivar.h,v 1.11 2009/09/17 16:28:12 tsutsui Exp $ */ +/* $NetBSD: dbrivar.h,v 1.12 2011/01/11 00:49:50 macallan Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -124,6 +124,7 @@ bus_dma_segment_t sc_dmaseg; int sc_have_powerctl; + int sc_init_done; int sc_powerstate; /* DBRI's powered up or not */ int sc_pmgrstate; /* PWR_RESUME etc. */ int sc_burst; /* DVMA burst size in effect */
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: uebayasi Date: Thu Dec 9 04:35:37 UTC 2010 Modified Files: src/sys/dev/sbus: zx.c Log Message: Fix DEBUG build. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/sbus/zx.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/dev/sbus/zx.c diff -u src/sys/dev/sbus/zx.c:1.37 src/sys/dev/sbus/zx.c:1.38 --- src/sys/dev/sbus/zx.c:1.37 Sat Nov 13 13:52:10 2010 +++ src/sys/dev/sbus/zx.c Thu Dec 9 04:35:36 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: zx.c,v 1.37 2010/11/13 13:52:10 uebayasi Exp $ */ +/* $NetBSD: zx.c,v 1.38 2010/12/09 04:35:36 uebayasi Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: zx.c,v 1.37 2010/11/13 13:52:10 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: zx.c,v 1.38 2010/12/09 04:35:36 uebayasi Exp $); #include sys/param.h #include sys/systm.h @@ -57,6 +57,11 @@ #include sys/conf.h #include sys/syslog.h #include sys/buf.h +#ifdef DEBUG +/* for log(9) in zxioctl() */ +#include sys/lwp.h +#include sys/proc.h +#endif #include sys/bus.h #include machine/autoconf.h
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: uebayasi Date: Mon Nov 15 05:59:57 UTC 2010 Modified Files: src/sys/dev/sbus: agten.c Log Message: This doesn't use uvm(9) API. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sbus/agten.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/dev/sbus/agten.c diff -u src/sys/dev/sbus/agten.c:1.26 src/sys/dev/sbus/agten.c:1.27 --- src/sys/dev/sbus/agten.c:1.26 Sun Nov 14 03:49:53 2010 +++ src/sys/dev/sbus/agten.c Mon Nov 15 05:59:57 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: agten.c,v 1.26 2010/11/14 03:49:53 uebayasi Exp $ */ +/* $NetBSD: agten.c,v 1.27 2010/11/15 05:59:57 uebayasi Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.26 2010/11/14 03:49:53 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.27 2010/11/15 05:59:57 uebayasi Exp $); /* * a driver for the Fujitsu AG-10e SBus framebuffer @@ -52,8 +52,6 @@ #include sys/systm.h #include sys/conf.h -#include uvm/uvm_extern.h - #include dev/sun/fbio.h #include dev/sun/fbvar.h #include dev/sun/btreg.h
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Sep 14 18:28:18 UTC 2010 Modified Files: src/sys/dev/sbus: cgthree_sbus.c Log Message: always make sure we can access the framebuffer - having more than one wsdisplay is perfectly reasonable these days To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sbus/cgthree_sbus.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/dev/sbus/cgthree_sbus.c diff -u src/sys/dev/sbus/cgthree_sbus.c:1.29 src/sys/dev/sbus/cgthree_sbus.c:1.30 --- src/sys/dev/sbus/cgthree_sbus.c:1.29 Fri Sep 18 16:43:19 2009 +++ src/sys/dev/sbus/cgthree_sbus.c Tue Sep 14 18:28:18 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: cgthree_sbus.c,v 1.29 2009/09/18 16:43:19 tsutsui Exp $ */ +/* $NetBSD: cgthree_sbus.c,v 1.30 2010/09/14 18:28:18 macallan Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cgthree_sbus.c,v 1.29 2009/09/18 16:43:19 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: cgthree_sbus.c,v 1.30 2010/09/14 18:28:18 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -155,8 +155,7 @@ /* * When the ROM has mapped in a cgthree display, the address * maps only the video RAM, so in any case we have to map the - * registers ourselves. We only need the video RAM if we are - * going to print characters via rconsole. + * registers ourselves. */ if (sbus_bus_map(sa-sa_bustag, sa-sa_slot, @@ -175,7 +174,7 @@ if (sa-sa_npromvaddrs != 0) fb-fb_pixels = (void *)(u_long)sa-sa_promvaddrs[0]; - if (isconsole fb-fb_pixels == NULL) { + if (fb-fb_pixels == NULL) { int ramsize = fb-fb_type.fb_height * fb-fb_linebytes; if (sbus_bus_map(sa-sa_bustag, sa-sa_slot,
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Aug 18 21:11:50 UTC 2010 Modified Files: src/sys/dev/sbus: cgtwelve.c files.sbus Log Message: - add support for running the console in 8 bit colour - make shadow fb optional - use VCONS_DONT_READ if there's no shadow fb To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sbus/cgtwelve.c cvs rdiff -u -r1.36 -r1.37 src/sys/dev/sbus/files.sbus Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sbus/cgtwelve.c diff -u src/sys/dev/sbus/cgtwelve.c:1.3 src/sys/dev/sbus/cgtwelve.c:1.4 --- src/sys/dev/sbus/cgtwelve.c:1.3 Wed Apr 14 04:37:11 2010 +++ src/sys/dev/sbus/cgtwelve.c Wed Aug 18 21:11:50 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: cgtwelve.c,v 1.3 2010/04/14 04:37:11 macallan Exp $ */ +/* $NetBSD: cgtwelve.c,v 1.4 2010/08/18 21:11:50 macallan Exp $ */ /*- * Copyright (c) 2010 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the Sun CG12 / Matrox SG3 graphics board */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.3 2010/04/14 04:37:11 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.4 2010/08/18 21:11:50 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -54,6 +54,7 @@ #include dev/wscons/wsdisplay_vconsvar.h #include dev/sbus/cgtwelvereg.h +#include dev/ic/bt462reg.h #include opt_wsemul.h #include opt_cgtwelve.h @@ -127,6 +128,8 @@ NULL, /* scroll */ }; +extern const u_char rasops_cmap[768]; + static int cgtwelve_match(device_t parent, cfdata_t cf, void *aux) { @@ -161,9 +164,13 @@ /* read geometry information from the device tree */ sc-sc_width = prom_getpropint(sa-sa_node, width, 1152); sc-sc_height = prom_getpropint(sa-sa_node, height, 900); +#ifdef CG12_COLOR + sc-sc_stride = sc-sc_width; +#else sc-sc_stride = (sc-sc_width + 7) 3; - +#endif sc-sc_fbsize = sc-sc_height * sc-sc_stride; + sc-sc_fbaddr = (void *)prom_getpropint(sa-sa_node, address, 0); if (sc-sc_fbaddr == NULL) { if (sbus_bus_map(sa-sa_bustag, @@ -179,7 +186,6 @@ aprint_normal_dev(self, %d x %d\n, sc-sc_width, sc-sc_height); - if (sbus_bus_map(sa-sa_bustag, sa-sa_slot, sa-sa_offset + CG12_OFF_REGISTERS, @@ -211,9 +217,17 @@ } sc-sc_int = bus_space_vaddr(sa-sa_bustag, bh); +#ifdef CG12_COLOR + cgtwelve_setup(sc, 8); +#else cgtwelve_setup(sc, 1); - +#endif +#ifdef CG12_SHADOW sc-sc_shadow = kmem_alloc(sc-sc_fbsize, KM_SLEEP); +#else + sc-sc_shadow = NULL; +#endif + isconsole = fb_is_console(node); sc-sc_mode = WSDISPLAYIO_MODE_EMUL; @@ -243,70 +257,18 @@ aa.accesscookie = sc-vd; config_found(self, aa, wsemuldisplaydevprint); -#if 0 +#ifdef CG12_DEBUG { - bus_space_handle_r bh = sc-sc_regh; - int i, j; - - bus_space_write_4(sa-sa_bustag, bh, CG12_EIC_RESET, 0); - - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_PLN_RDMSK_HOST, CG12_PLN_RD_ENABLE); - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_PLN_WRMSK_HOST, CG12_PLN_WR_ENABLE); - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_PLN_SL_HOST, CG12_PLN_SL_ENABLE); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_HPAGE, CG12_HPAGE_ENABLE); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_HACCESS, CG12_HACCESS_ENABLE); - memset(sc-sc_fbaddr, 0, 0x1); - - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_PLN_RDMSK_LOC, 0x); - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_PLN_WRMSK_LOC, 0x); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_LACCESS, CG12_HACCESS_24BIT); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_LPAGE, CG12_HPAGE_24BIT); - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_PLN_SL_LOCAL0, CG12_PLN_SL_24BIT); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_DWG_CTL, DWGCTL_BITBLT | 0x00f3); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_F_XLEFT, 10); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_F_XRIGHT, 1010); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_Y_DST, 10); - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_COLOUR0, 0x); -#if 1 - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_LENGTH | 0x1000, 800); -#endif - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_PLN_RDMSK_HOST, CG12_PLN_RD_OVERLAY); - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_PLN_WRMSK_HOST, CG12_PLN_WR_OVERLAY); - bus_space_write_4(sa-sa_bustag, bh, - CG12DPU_PLN_SL_HOST, CG12_PLN_SL_OVERLAY); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_HPAGE, CG12_HPAGE_OVERLAY); - bus_space_write_4(sa-sa_bustag, bh, - CG12APU_HACCESS, CG12_HACCESS_OVERLAY); - - for (i = 0x100; i 0x300; i += 32) { - printf(%04x:, i); - for (j = 0; j 32; j += 4) { -printf( %08x, bus_space_read_4(sa-sa_bustag, -bh, i + j)); - } - printf(\n); + int i; + for (i = 0; i 0x10; i++) { + bus_space_write_4(sc-sc_tag, sc-sc_regh, +
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue May 4 05:10:25 UTC 2010 Modified Files: src/sys/dev/sbus: p9100.c tcx.c zx.c Log Message: use box drawing font if needed To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/dev/sbus/p9100.c cvs rdiff -u -r1.42 -r1.43 src/sys/dev/sbus/tcx.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/sbus/zx.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/dev/sbus/p9100.c diff -u src/sys/dev/sbus/p9100.c:1.54 src/sys/dev/sbus/p9100.c:1.55 --- src/sys/dev/sbus/p9100.c:1.54 Mon Mar 1 05:42:08 2010 +++ src/sys/dev/sbus/p9100.c Tue May 4 05:10:25 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $ */ +/* $NetBSD: p9100.c,v 1.55 2010/05/04 05:10:25 macallan Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.55 2010/05/04 05:10:25 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -1085,6 +1085,7 @@ p9100_putchar(void *cookie, int row, int col, u_int c, long attr) { struct rasops_info *ri = cookie; + struct wsdisplay_font *font = PICK_FONT(ri, c); struct vcons_screen *scr = ri-ri_hw; struct p9100_softc *sc = scr-scr_cookie; @@ -1092,10 +1093,10 @@ uint8_t *data; int x, y, wi, he; - wi = ri-ri_font-fontwidth; - he = ri-ri_font-fontheight; + wi = font-fontwidth; + he = font-fontheight; - if (!CHAR_IN_FONT(c, ri-ri_font)) + if (!CHAR_IN_FONT(c, font)) return; bg = (u_char)ri-ri_devcmap[(attr 16) 0xff]; @@ -1106,15 +1107,15 @@ if (c == 0x20) { p9100_rectfill(sc, x, y, wi, he, bg); } else { - uc = c-ri-ri_font-firstchar; - data = (uint8_t *)ri-ri_font-data + uc * + uc = c - font-firstchar; + data = (uint8_t *)font-data + uc * ri-ri_fontscale; p9100_setup_mono(sc, x, y, wi, 1, fg, bg); for (i = 0; i he; i++) { - p9100_feed_line(sc, ri-ri_font-stride, + p9100_feed_line(sc, font-stride, data); - data += ri-ri_font-stride; + data += font-stride; } } } Index: src/sys/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.42 src/sys/dev/sbus/tcx.c:1.43 --- src/sys/dev/sbus/tcx.c:1.42 Thu Sep 17 16:39:48 2009 +++ src/sys/dev/sbus/tcx.c Tue May 4 05:10:25 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.42 2009/09/17 16:39:48 tsutsui Exp $ */ +/* $NetBSD: tcx.c,v 1.43 2010/05/04 05:10:25 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.42 2009/09/17 16:39:48 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.43 2010/05/04 05:10:25 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -931,6 +931,7 @@ tcx_putchar(void *cookie, int row, int col, u_int c, long attr) { struct rasops_info *ri = cookie; + struct wsdisplay_font *font = PICK_FONT(ri, c); struct vcons_screen *scr = ri-ri_hw; struct tcx_softc *sc = scr-scr_cookie; uint64_t bg, fg, temp, mask; @@ -939,18 +940,17 @@ uint8_t *cdata; uint16_t *wdata; - addr = ri-ri_xorigin + - col * ri-ri_font-fontwidth + - (ri-ri_yorigin + row * ri-ri_font-fontheight) * ri-ri_width; + addr = ri-ri_xorigin + col * font-fontwidth + + (ri-ri_yorigin + row * font-fontheight) * ri-ri_width; /* check if the character is crossing a 32 pixel boundary */ if ((addr 0xe0) == - ((addr + ri-ri_font-fontwidth - 1) 0xe0)) { + ((addr + font-fontwidth - 1) 0xe0)) { /* phew, not split */ shift = addr 0x1f; addr = 0xe0; - fmask = 0x (32 - ri-ri_font-fontwidth); - fmask = fmask (32 - ri-ri_font-fontwidth - shift); + fmask = 0x (32 - font-fontwidth); + fmask = fmask (32 - font-fontwidth - shift); mask = fmask; bg = 0x3000LL | ((uint64_t)ri-ri_devcmap[(attr 16) 0xff] @@ -959,12 +959,12 @@ temp = 0x3000LL | ((uint64_t)ri-ri_devcmap[(attr 24) 0xff] 0xff) 32; - uc = c - ri-ri_font-firstchar; - cdata = (uint8_t *)ri-ri_font-data + uc * ri-ri_fontscale; + uc = c - font-firstchar; + cdata = (uint8_t *)font-data + uc * ri-ri_fontscale; - if (ri-ri_font-fontwidth 9) { + if (font-fontwidth 9) { /* byte by byte */ - for (i = 0; i ri-ri_font-fontheight; i++) { + for (i = 0; i font-fontheight; i++) { sc-sc_rstip[addr] = bg; if (*cdata != 0) { if (shift 24) { @@ -979,10 +979,10 @@ cdata++; addr += ri-ri_width; } - } else if (ri-ri_font-fontwidth 17) { + } else if (font-fontwidth 17) { /* short by short */ wdata = (uint16_t *)cdata; - for (i = 0; i ri-ri_font-fontheight; i++) { + for (i = 0; i font-fontheight; i++) { sc-sc_rstip[addr] = bg; if
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Apr 14 04:37:11 UTC 2010 Modified Files: src/sys/dev/sbus: cgtwelve.c cgtwelvereg.h Log Message: add the missing bits to allow X to run in 24bit with the wsfb driver still no hardware acceleration though To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/sbus/cgtwelve.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sbus/cgtwelvereg.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/dev/sbus/cgtwelve.c diff -u src/sys/dev/sbus/cgtwelve.c:1.2 src/sys/dev/sbus/cgtwelve.c:1.3 --- src/sys/dev/sbus/cgtwelve.c:1.2 Thu Apr 8 16:49:34 2010 +++ src/sys/dev/sbus/cgtwelve.c Wed Apr 14 04:37:11 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: cgtwelve.c,v 1.2 2010/04/08 16:49:34 macallan Exp $ */ +/* $NetBSD: cgtwelve.c,v 1.3 2010/04/14 04:37:11 macallan Exp $ */ /*- * Copyright (c) 2010 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the Sun CG12 / Matrox SG3 graphics board */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.2 2010/04/08 16:49:34 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.3 2010/04/14 04:37:11 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -62,8 +62,12 @@ struct cgtwelve_softc { device_t sc_dev; bus_space_tag_t sc_tag; + bus_space_handle_t sc_regh; + bus_addr_t sc_paddr; void *sc_fbaddr; void *sc_shadow; + uint8_t *sc_wids; + void *sc_int; int sc_width; int sc_height; int sc_stride; @@ -79,6 +83,15 @@ static paddr_t cgtwelve_mmap(void *, void *, off_t, int); static void cgtwelve_init_screen(void *, struct vcons_screen *, int, long *); +static void cgtwelve_write_wid(struct cgtwelve_softc *, int, uint8_t); +static void cgtwelve_select_ovl(struct cgtwelve_softc *, int); +#define CG12_SEL_OVL 0 +#define CG12_SEL_ENABLE 1 +#define CG12_SEL_8BIT 2 +#define CG12_SEL_24BIT 3 +#define CG12_SEL_WID 4 +static void cgtwelve_write_dac(struct cgtwelve_softc *, int, int, int, int); +static void cgtwelve_setup(struct cgtwelve_softc *, int); CFATTACH_DECL_NEW(cgtwelve, sizeof(struct cgtwelve_softc), cgtwelve_match, cgtwelve_attach, NULL, NULL); @@ -143,6 +156,8 @@ sc-sc_dev = self; sc-sc_tag = sa-sa_bustag; + sc-sc_paddr = sbus_bus_addr(sa-sa_bustag, sa-sa_slot, sa-sa_offset); + /* read geometry information from the device tree */ sc-sc_width = prom_getpropint(sa-sa_node, width, 1152); sc-sc_height = prom_getpropint(sa-sa_node, height, 900); @@ -164,6 +179,40 @@ aprint_normal_dev(self, %d x %d\n, sc-sc_width, sc-sc_height); + + if (sbus_bus_map(sa-sa_bustag, + sa-sa_slot, + sa-sa_offset + CG12_OFF_REGISTERS, + 0xc, 0, sc-sc_regh) != 0) { + aprint_error(%s: couldn't map registers\n, + device_xname(sc-sc_dev)); + return; + } + + if (sbus_bus_map(sa-sa_bustag, + sa-sa_slot, + sa-sa_offset + CG12_OFF_WID, 0x10, + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, + bh) != 0) { + aprint_error(%s: couldn't map WID\n, + device_xname(sc-sc_dev)); + return; + } + sc-sc_wids = bus_space_vaddr(sa-sa_bustag, bh); + + if (sbus_bus_map(sa-sa_bustag, + sa-sa_slot, + sa-sa_offset + CG12_OFF_INTEN, 0x40, + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, + bh) != 0) { + aprint_error(%s: couldn't map colour fb\n, + device_xname(sc-sc_dev)); + return; + } + sc-sc_int = bus_space_vaddr(sa-sa_bustag, bh); + + cgtwelve_setup(sc, 1); + sc-sc_shadow = kmem_alloc(sc-sc_fbsize, KM_SLEEP); isconsole = fb_is_console(node); @@ -176,8 +225,6 @@ vcons_init_screen(sc-vd, cgtwelve_console_screen, 1, defattr); cgtwelve_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; - memset(sc-sc_fbaddr, 0, sc-sc_fbsize); - ri = cgtwelve_console_screen.scr_ri; cgtwelve_defscreendesc.nrows = ri-ri_rows; @@ -196,11 +243,9 @@ aa.accesscookie = sc-vd; config_found(self, aa, wsemuldisplaydevprint); -#if 0 - if (sbus_bus_map(sa-sa_bustag, - sa-sa_slot, - sa-sa_offset + CG12_OFF_REGISTERS, - 0xc, 0, bh) == 0) { +#if 0 + { + bus_space_handle_r bh = sc-sc_regh; int i, j; bus_space_write_4(sa-sa_bustag, bh, CG12_EIC_RESET, 0); @@ -260,12 +305,157 @@ } printf(\n); } - bus_space_unmap(sa-sa_bustag, bh, 0xc); } panic(poof); #endif } +/* 0 - overlay plane, 1 - enable plane, 2 - 8bit fb, 3 - 24bit fb, 4 - WIDs */ +static void +cgtwelve_select_ovl(struct cgtwelve_softc *sc, int which) +{ + switch(which) { + case 0: + bus_space_write_4(sc-sc_tag, sc-sc_regh, + CG12DPU_PLN_RDMSK_HOST, CG12_PLN_RD_OVERLAY); + bus_space_write_4(sc-sc_tag, sc-sc_regh, + CG12DPU_PLN_WRMSK_HOST, CG12_PLN_WR_OVERLAY); + bus_space_write_4(sc-sc_tag, sc-sc_regh, + CG12DPU_PLN_SL_HOST, CG12_PLN_SL_OVERLAY); + bus_space_write_4(sc-sc_tag, sc-sc_regh, + CG12APU_HPAGE, CG12_HPAGE_OVERLAY); + bus_space_write_4(sc-sc_tag, sc-sc_regh, +
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Thu Apr 8 16:49:34 UTC 2010 Modified Files: src/sys/dev/sbus: cgtwelve.c Log Message: use a shadow framebuffer To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sbus/cgtwelve.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/dev/sbus/cgtwelve.c diff -u src/sys/dev/sbus/cgtwelve.c:1.1 src/sys/dev/sbus/cgtwelve.c:1.2 --- src/sys/dev/sbus/cgtwelve.c:1.1 Wed Mar 24 00:33:06 2010 +++ src/sys/dev/sbus/cgtwelve.c Thu Apr 8 16:49:34 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: cgtwelve.c,v 1.1 2010/03/24 00:33:06 macallan Exp $ */ +/* $NetBSD: cgtwelve.c,v 1.2 2010/04/08 16:49:34 macallan Exp $ */ /*- * Copyright (c) 2010 Michael Lorenz @@ -29,7 +29,7 @@ /* a console driver for the Sun CG12 / Matrox SG3 graphics board */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.1 2010/03/24 00:33:06 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.2 2010/04/08 16:49:34 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -37,6 +37,7 @@ #include sys/device.h #include sys/ioctl.h #include sys/conf.h +#include sys/kmem.h #include sys/bus.h #include machine/autoconf.h @@ -62,6 +63,7 @@ device_t sc_dev; bus_space_tag_t sc_tag; void *sc_fbaddr; + void *sc_shadow; int sc_width; int sc_height; int sc_stride; @@ -162,6 +164,7 @@ aprint_normal_dev(self, %d x %d\n, sc-sc_width, sc-sc_height); + sc-sc_shadow = kmem_alloc(sc-sc_fbsize, KM_SLEEP); isconsole = fb_is_console(node); sc-sc_mode = WSDISPLAYIO_MODE_EMUL; @@ -193,7 +196,74 @@ aa.accesscookie = sc-vd; config_found(self, aa, wsemuldisplaydevprint); - +#if 0 + if (sbus_bus_map(sa-sa_bustag, + sa-sa_slot, + sa-sa_offset + CG12_OFF_REGISTERS, + 0xc, 0, bh) == 0) { + int i, j; + + bus_space_write_4(sa-sa_bustag, bh, CG12_EIC_RESET, 0); + + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_PLN_RDMSK_HOST, CG12_PLN_RD_ENABLE); + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_PLN_WRMSK_HOST, CG12_PLN_WR_ENABLE); + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_PLN_SL_HOST, CG12_PLN_SL_ENABLE); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_HPAGE, CG12_HPAGE_ENABLE); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_HACCESS, CG12_HACCESS_ENABLE); + memset(sc-sc_fbaddr, 0, 0x1); + + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_PLN_RDMSK_LOC, 0x); + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_PLN_WRMSK_LOC, 0x); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_LACCESS, CG12_HACCESS_24BIT); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_LPAGE, CG12_HPAGE_24BIT); + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_PLN_SL_LOCAL0, CG12_PLN_SL_24BIT); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_DWG_CTL, DWGCTL_BITBLT | 0x00f3); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_F_XLEFT, 10); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_F_XRIGHT, 1010); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_Y_DST, 10); + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_COLOUR0, 0x); +#if 1 + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_LENGTH | 0x1000, 800); +#endif + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_PLN_RDMSK_HOST, CG12_PLN_RD_OVERLAY); + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_PLN_WRMSK_HOST, CG12_PLN_WR_OVERLAY); + bus_space_write_4(sa-sa_bustag, bh, + CG12DPU_PLN_SL_HOST, CG12_PLN_SL_OVERLAY); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_HPAGE, CG12_HPAGE_OVERLAY); + bus_space_write_4(sa-sa_bustag, bh, + CG12APU_HACCESS, CG12_HACCESS_OVERLAY); + + for (i = 0x100; i 0x300; i += 32) { + printf(%04x:, i); + for (j = 0; j 32; j += 4) { +printf( %08x, bus_space_read_4(sa-sa_bustag, +bh, i + j)); + } + printf(\n); + } + bus_space_unmap(sa-sa_bustag, bh, 0xc); + } + panic(poof); +#endif } @@ -210,7 +280,12 @@ ri-ri_stride = sc-sc_stride; ri-ri_flg = RI_CENTER; - ri-ri_bits = sc-sc_fbaddr; + if (sc-sc_shadow == NULL) { + ri-ri_bits = sc-sc_fbaddr; + } else { + ri-ri_hwbits = sc-sc_fbaddr; + ri-ri_bits = sc-sc_shadow; + } rasops_init(ri, ri-ri_height/8, ri-ri_width/8); ri-ri_caps = WSSCREEN_REVERSE;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Mar 24 00:33:06 UTC 2010 Modified Files: src/sys/dev/sbus: files.sbus Added Files: src/sys/dev/sbus: cgtwelve.c cgtwelvereg.h Log Message: first stab at a driver for the cg12 / matrox cg3 for now it uses the same monochrome overlay as OBP, otherwise it's got the usual wsdisplay / vcons goodies TODO: - fill in mmap and ioctl methods so we can at least run X in monochrome - figure out where the 24bit buffer is ( and maybe if there's an 8 bit buffer ) - see if we can do any acceleration - find the DAC registers To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/sbus/cgtwelve.c \ src/sys/dev/sbus/cgtwelvereg.h cvs rdiff -u -r1.35 -r1.36 src/sys/dev/sbus/files.sbus Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sbus/files.sbus diff -u src/sys/dev/sbus/files.sbus:1.35 src/sys/dev/sbus/files.sbus:1.36 --- src/sys/dev/sbus/files.sbus:1.35 Mon Mar 1 05:42:08 2010 +++ src/sys/dev/sbus/files.sbus Wed Mar 24 00:33:06 2010 @@ -1,4 +1,4 @@ -# $NetBSD: files.sbus,v 1.35 2010/03/01 05:42:08 macallan Exp $ +# $NetBSD: files.sbus,v 1.36 2010/03/24 00:33:06 macallan Exp $ # # Config file and device description for machine-independent SBUS code. # Included by ports that need it. @@ -148,3 +148,9 @@ attach agten at sbus file dev/sbus/agten.c agten needs-flag file dev/ic/i128.c agten + +# Sun CG12 / Matrox SG3 +defflag opt_cgtwelve.h CG12_DEBUG +device cgtwelve: fb, rasops1, rasops8, wsemuldisplaydev, vcons +attach cgtwelve at sbus +file dev/sbus/cgtwelve.c cgtwelve Added files: Index: src/sys/dev/sbus/cgtwelve.c diff -u /dev/null src/sys/dev/sbus/cgtwelve.c:1.1 --- /dev/null Wed Mar 24 00:33:06 2010 +++ src/sys/dev/sbus/cgtwelve.c Wed Mar 24 00:33:06 2010 @@ -0,0 +1,250 @@ +/* $NetBSD: cgtwelve.c,v 1.1 2010/03/24 00:33:06 macallan Exp $ */ + +/*- + * Copyright (c) 2010 Michael Lorenz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* a console driver for the Sun CG12 / Matrox SG3 graphics board */ + +#include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: cgtwelve.c,v 1.1 2010/03/24 00:33:06 macallan Exp $); + +#include sys/param.h +#include sys/systm.h +#include sys/buf.h +#include sys/device.h +#include sys/ioctl.h +#include sys/conf.h + +#include sys/bus.h +#include machine/autoconf.h + +#include dev/sbus/sbusvar.h +#include dev/sun/fbio.h +#include dev/sun/fbvar.h + +#include dev/wscons/wsdisplayvar.h +#include dev/wscons/wsconsio.h +#include dev/wsfont/wsfont.h +#include dev/rasops/rasops.h + +#include dev/wscons/wsdisplay_vconsvar.h + +#include dev/sbus/cgtwelvereg.h + +#include opt_wsemul.h +#include opt_cgtwelve.h + + +struct cgtwelve_softc { + device_t sc_dev; + bus_space_tag_t sc_tag; + void *sc_fbaddr; + int sc_width; + int sc_height; + int sc_stride; + int sc_fbsize; + int sc_mode; + struct vcons_data vd; +}; + +static int cgtwelve_match(device_t, cfdata_t, void *); +static void cgtwelve_attach(device_t, device_t, void *); +static int cgtwelve_ioctl(void *, void *, u_long, void *, int, + struct lwp*); +static paddr_t cgtwelve_mmap(void *, void *, off_t, int); +static void cgtwelve_init_screen(void *, struct vcons_screen *, int, + long *); + +CFATTACH_DECL_NEW(cgtwelve, sizeof(struct cgtwelve_softc), +cgtwelve_match, cgtwelve_attach, NULL, NULL); + +struct wsscreen_descr cgtwelve_defscreendesc = { + default, + 0, 0, + NULL, + 8, 16, + 0, +}; + +static struct vcons_screen cgtwelve_console_screen; + +const struct wsscreen_descr *_cgtwelve_scrlist[] = { + cgtwelve_defscreendesc, + /* XXX other
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Thu Feb 18 02:21:39 UTC 2010 Modified Files: src/sys/dev/sbus: dbri.c Log Message: Abort setup when we find no audio codec to avoid crashing later on with ISDN-only cards. Should fix PR41055 To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sbus/dbri.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.29 src/sys/dev/sbus/dbri.c:1.30 --- src/sys/dev/sbus/dbri.c:1.29 Thu Jan 14 02:20:07 2010 +++ src/sys/dev/sbus/dbri.c Thu Feb 18 02:21:38 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.29 2010/01/14 02:20:07 macallan Exp $ */ +/* $NetBSD: dbri.c,v 1.30 2010/02/18 02:21:38 macallan Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.29 2010/01/14 02:20:07 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.30 2010/02/18 02:21:38 macallan Exp $); #include audio.h #if NAUDIO 0 @@ -447,8 +447,12 @@ struct dbri_softc *sc = device_private(dev); dbri_init(sc); - mmcodec_init(sc); - + if (mmcodec_init(sc) == -1) { + printf(%s: no codec detected, aborting\n, + device_xname(dev)); + return; + } + /* Attach ourselves to the high level audio interface */ audio_attach_mi(dbri_hw_if, sc, sc-sc_dev);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Fri Jan 29 23:50:01 UTC 2010 Modified Files: src/sys/dev/sbus: agten.c Log Message: avoid using PAGE_SIZE directly so sparc/GENERIC builds again To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sbus/agten.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/dev/sbus/agten.c diff -u src/sys/dev/sbus/agten.c:1.23 src/sys/dev/sbus/agten.c:1.24 --- src/sys/dev/sbus/agten.c:1.23 Wed Jan 27 21:02:22 2010 +++ src/sys/dev/sbus/agten.c Fri Jan 29 23:50:01 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: agten.c,v 1.23 2010/01/27 21:02:22 macallan Exp $ */ +/* $NetBSD: agten.c,v 1.24 2010/01/29 23:50:01 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.23 2010/01/27 21:02:22 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.24 2010/01/29 23:50:01 macallan Exp $); /* * a driver for the Fujitsu AG-10e SBus framebuffer @@ -74,7 +74,7 @@ #include dev/ic/i128reg.h #include dev/ic/i128var.h -#include machine/vmparam.h +#include uvm/uvm_extern.h #include opt_agten.h #include ioconf.h @@ -248,7 +248,7 @@ sc-sc_i128_fbsz = prom_getpropint(node, i128_fb_size, -1); if (sbus_bus_map(sc-sc_bustag, sa-sa_reg[0].oa_space, sa-sa_reg[0].oa_base + reg, - (sc-sc_stride * sc-sc_height + PAGE_MASK) ~PAGE_MASK, + round_page(sc-sc_stride * sc-sc_height), BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, sc-sc_i128_fbh) != 0) {
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: dyoung Date: Fri Jan 8 20:01:21 UTC 2010 Modified Files: src/sys/dev/sbus: dbri.c p9100.c Log Message: Expand PMF_FN_* macros. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sbus/dbri.c cvs rdiff -u -r1.50 -r1.51 src/sys/dev/sbus/p9100.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.27 src/sys/dev/sbus/dbri.c:1.28 --- src/sys/dev/sbus/dbri.c:1.27 Sat Jan 2 04:12:07 2010 +++ src/sys/dev/sbus/dbri.c Fri Jan 8 20:01:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.27 2010/01/02 04:12:07 tsutsui Exp $ */ +/* $NetBSD: dbri.c,v 1.28 2010/01/08 20:01:21 dyoung Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.27 2010/01/02 04:12:07 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.28 2010/01/08 20:01:21 dyoung Exp $); #include audio.h #if NAUDIO 0 @@ -162,8 +162,8 @@ static paddr_t dbri_mappage(void *, void *, off_t, int); static void dbri_set_power(struct dbri_softc *, int); static void dbri_bring_up(struct dbri_softc *); -static bool dbri_suspend(device_t PMF_FN_PROTO); -static bool dbri_resume(device_t PMF_FN_PROTO); +static bool dbri_suspend(device_t, pmf_qual_t); +static bool dbri_resume(device_t, pmf_qual_t); /* stupid support routines */ static uint32_t reverse_bytes(uint32_t, int); @@ -2173,7 +2173,7 @@ } static bool -dbri_suspend(device_t self PMF_FN_ARGS) +dbri_suspend(device_t self, pmf_qual_t qual) { struct dbri_softc *sc = device_private(self); @@ -2182,7 +2182,7 @@ } static bool -dbri_resume(device_t self PMF_FN_ARGS) +dbri_resume(device_t self, pmf_qual_t qual) { struct dbri_softc *sc = device_private(self); Index: src/sys/dev/sbus/p9100.c diff -u src/sys/dev/sbus/p9100.c:1.50 src/sys/dev/sbus/p9100.c:1.51 --- src/sys/dev/sbus/p9100.c:1.50 Sat Sep 19 11:58:06 2009 +++ src/sys/dev/sbus/p9100.c Fri Jan 8 20:01:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.50 2009/09/19 11:58:06 tsutsui Exp $ */ +/* $NetBSD: p9100.c,v 1.51 2010/01/08 20:01:21 dyoung Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.50 2009/09/19 11:58:06 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.51 2010/01/08 20:01:21 dyoung Exp $); #include sys/param.h #include sys/systm.h @@ -236,8 +236,8 @@ #endif /* power management stuff */ -static bool p9100_suspend(device_t PMF_FN_PROTO); -static bool p9100_resume(device_t PMF_FN_PROTO); +static bool p9100_suspend(device_t, pmf_qual_t); +static bool p9100_resume(device_t, pmf_qual_t); #if NTCTRL 0 static void p9100_set_extvga(void *, int); @@ -925,7 +925,7 @@ } static bool -p9100_suspend(device_t dev PMF_FN_ARGS) +p9100_suspend(device_t dev, pmf_qual_t qual) { struct p9100_softc *sc = device_private(dev); @@ -946,7 +946,7 @@ } static bool -p9100_resume(device_t dev PMF_FN_ARGS) +p9100_resume(device_t dev, pmf_qual_t qual) { struct p9100_softc *sc = device_private(dev);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: christos Date: Sat Jan 2 01:43:42 UTC 2010 Modified Files: src/sys/dev/sbus: dbri.c Log Message: convert to pmf To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sbus/dbri.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.25 src/sys/dev/sbus/dbri.c:1.26 --- src/sys/dev/sbus/dbri.c:1.25 Sun Sep 20 04:24:04 2009 +++ src/sys/dev/sbus/dbri.c Fri Jan 1 20:43:42 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.25 2009/09/20 08:24:04 tsutsui Exp $ */ +/* $NetBSD: dbri.c,v 1.26 2010/01/02 01:43:42 christos Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.25 2009/09/20 08:24:04 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.26 2010/01/02 01:43:42 christos Exp $); #include audio.h #if NAUDIO 0 @@ -162,7 +162,9 @@ static paddr_t dbri_mappage(void *, void *, off_t, int); static void dbri_set_power(struct dbri_softc *, int); static void dbri_bring_up(struct dbri_softc *); -static void dbri_powerhook(int, void *); +static void dbri_sus(int, void *); +static bool dbri_suspend(device_t PMF_FN_PROTO); +static bool dbri_resume(device_t PMF_FN_PROTO); /* stupid support routines */ static uint32_t reverse_bytes(uint32_t, int); @@ -294,7 +296,10 @@ sc-sc_have_powerctl = 1; sc-sc_powerstate = 0; dbri_set_power(sc, 1); - powerhook_establish(device_xname(self), dbri_powerhook, sc); + if (!pmf_device_register(self, dbri_suspend, dbri_resume)) { + aprint_error_dev(self, + cannot set power mgmt handler\n); + } } else { /* we can't control power so we're always up */ sc-sc_have_powerctl = 0; @@ -374,7 +379,6 @@ sc-sc_refcount = 0; sc-sc_playing = 0; sc-sc_recording = 0; - sc-sc_pmgrstate = PWR_RESUME; config_interrupts(self, dbri_config_interrupts); return; @@ -2169,45 +2173,38 @@ sc-sc_recording = 0; } -static void -dbri_powerhook(int why, void *cookie) +static bool +dbri_suspend(device_t self PMF_FN_ARGS) { - struct dbri_softc *sc = cookie; + struct dbri_softc *sc = device_private(self); - if (why == sc-sc_pmgrstate) - return; + dbri_set_power(sc, 0); + return true; +} - switch(why) - { - case PWR_SUSPEND: - dbri_set_power(sc, 0); - break; - case PWR_RESUME: - if (sc-sc_powerstate != 0) -break; - aprint_verbose(resume: %d\n, sc-sc_refcount); - sc-sc_pmgrstate = PWR_RESUME; - if (sc-sc_playing) { -volatile uint32_t *cmd; -int s; - -dbri_bring_up(sc); -s = splsched(); -cmd = dbri_command_lock(sc); -*(cmd++) = DBRI_CMD(DBRI_COMMAND_SDP, -0, sc-sc_pipe[4].sdp | -DBRI_SDP_VALID_POINTER | -DBRI_SDP_EVERY | DBRI_SDP_CLEAR); -*(cmd++) = sc-sc_dmabase + -dbri_dma_off(xmit, 0); -dbri_command_send(sc, cmd); -splx(s); - } - break; - default: - return; +static bool +dbri_resume(device_t self PMF_FN_ARGS) +{ + if (sc-sc_powerstate != 0) + break; + aprint_verbose(resume: %d\n, sc-sc_refcount); + if (sc-sc_playing) { + volatile uint32_t *cmd; + int s; + + dbri_bring_up(sc); + s = splsched(); + cmd = dbri_command_lock(sc); + *(cmd++) = DBRI_CMD(DBRI_COMMAND_SDP, + 0, sc-sc_pipe[4].sdp | + DBRI_SDP_VALID_POINTER | + DBRI_SDP_EVERY | DBRI_SDP_CLEAR); + *(cmd++) = sc-sc_dmabase + + dbri_dma_off(xmit, 0); + dbri_command_send(sc, cmd); + splx(s); } - sc-sc_pmgrstate = why; + return true; } #endif /* NAUDIO 0 */
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Sat Jan 2 04:12:07 UTC 2010 Modified Files: src/sys/dev/sbus: dbri.c Log Message: Fix botches in mechanical changes to make this compile: dbri.c:165: warning: 'dbri_sus' declared 'static' but never defined dbri.c: In function 'dbri_resume': dbri.c:2188: error: 'sc' undeclared dbri.c:2189: error: break statement not within loop or switch To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sbus/dbri.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.26 src/sys/dev/sbus/dbri.c:1.27 --- src/sys/dev/sbus/dbri.c:1.26 Sat Jan 2 01:43:42 2010 +++ src/sys/dev/sbus/dbri.c Sat Jan 2 04:12:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.26 2010/01/02 01:43:42 christos Exp $ */ +/* $NetBSD: dbri.c,v 1.27 2010/01/02 04:12:07 tsutsui Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.26 2010/01/02 01:43:42 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.27 2010/01/02 04:12:07 tsutsui Exp $); #include audio.h #if NAUDIO 0 @@ -162,7 +162,6 @@ static paddr_t dbri_mappage(void *, void *, off_t, int); static void dbri_set_power(struct dbri_softc *, int); static void dbri_bring_up(struct dbri_softc *); -static void dbri_sus(int, void *); static bool dbri_suspend(device_t PMF_FN_PROTO); static bool dbri_resume(device_t PMF_FN_PROTO); @@ -2185,8 +2184,10 @@ static bool dbri_resume(device_t self PMF_FN_ARGS) { + struct dbri_softc *sc = device_private(self); + if (sc-sc_powerstate != 0) - break; + return true; aprint_verbose(resume: %d\n, sc-sc_refcount); if (sc-sc_playing) { volatile uint32_t *cmd;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Tue Sep 22 13:13:46 UTC 2009 Modified Files: src/sys/dev/sbus: be.c qe.c Log Message: Remove some more unnecessary casts. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/dev/sbus/be.c cvs rdiff -u -r1.55 -r1.56 src/sys/dev/sbus/qe.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.74 src/sys/dev/sbus/be.c:1.75 --- src/sys/dev/sbus/be.c:1.74 Fri Sep 18 14:40:49 2009 +++ src/sys/dev/sbus/be.c Tue Sep 22 13:13:46 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.74 2009/09/18 14:40:49 tsutsui Exp $ */ +/* $NetBSD: be.c,v 1.75 2009/09/22 13:13:46 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be.c,v 1.74 2009/09/18 14:40:49 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: be.c,v 1.75 2009/09/22 13:13:46 tsutsui Exp $); #include opt_ddb.h #include opt_inet.h @@ -473,7 +473,7 @@ { struct mbuf *n; int len, tlen = 0, boff = 0; - void *bp; + uint8_t *bp; bp = sc-sc_rb.rb_txbuf + (idx % sc-sc_rb.rb_ntbuf) * BE_PKT_BUF_SZ; @@ -483,7 +483,7 @@ MFREE(m, n); continue; } - memcpy((char *)bp + boff, mtod(m, void *), len); + memcpy(bp + boff, mtod(m, void *), len); boff += len; tlen += len; MFREE(m, n); @@ -504,7 +504,7 @@ struct mbuf *m; struct mbuf *top, **mp; int len, pad, boff = 0; - void *bp; + uint8_t *bp; bp = sc-sc_rb.rb_rxbuf + (idx % sc-sc_rb.rb_nrbuf) * BE_PKT_BUF_SZ; @@ -535,7 +535,7 @@ len = MCLBYTES; } m-m_len = len = min(totlen, len); - memcpy(mtod(m, void *), (char *)bp + boff, len); + memcpy(mtod(m, void *), bp + boff, len); boff += len; totlen -= len; *mp = m; Index: src/sys/dev/sbus/qe.c diff -u src/sys/dev/sbus/qe.c:1.55 src/sys/dev/sbus/qe.c:1.56 --- src/sys/dev/sbus/qe.c:1.55 Sat Sep 19 11:53:42 2009 +++ src/sys/dev/sbus/qe.c Tue Sep 22 13:13:46 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: qe.c,v 1.55 2009/09/19 11:53:42 tsutsui Exp $ */ +/* $NetBSD: qe.c,v 1.56 2009/09/22 13:13:46 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: qe.c,v 1.55 2009/09/19 11:53:42 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: qe.c,v 1.56 2009/09/22 13:13:46 tsutsui Exp $); #define QEDEBUG @@ -332,7 +332,7 @@ struct mbuf *m; struct mbuf *top, **mp; int len, pad, boff = 0; - void *bp; + uint8_t *bp; bp = sc-sc_rb.rb_rxbuf + (idx % sc-sc_rb.rb_nrbuf) * QE_PKT_BUF_SZ; @@ -362,7 +362,7 @@ len = MCLBYTES; } m-m_len = len = min(totlen, len); - memcpy(mtod(m, void *), (char *)bp + boff, len); + memcpy(mtod(m, void *), bp + boff, len); boff += len; totlen -= len; *mp = m; @@ -381,7 +381,7 @@ { struct mbuf *n; int len, tlen = 0, boff = 0; - void *bp; + uint8_t *bp; bp = sc-sc_rb.rb_txbuf + (idx % sc-sc_rb.rb_ntbuf) * QE_PKT_BUF_SZ; @@ -391,7 +391,7 @@ MFREE(m, n); continue; } - memcpy((char *)bp + boff, mtod(m, void *), len); + memcpy(bp + boff, mtod(m, void *), len); boff += len; tlen += len; MFREE(m, n);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Sun Sep 20 08:24:04 UTC 2009 Modified Files: src/sys/dev/sbus: dbri.c Log Message: u_intNN_t - uintNN_t To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/sbus/dbri.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/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.24 src/sys/dev/sbus/dbri.c:1.25 --- src/sys/dev/sbus/dbri.c:1.24 Thu Sep 17 16:28:12 2009 +++ src/sys/dev/sbus/dbri.c Sun Sep 20 08:24:04 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.24 2009/09/17 16:28:12 tsutsui Exp $ */ +/* $NetBSD: dbri.c,v 1.25 2009/09/20 08:24:04 tsutsui Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.24 2009/09/17 16:28:12 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.25 2009/09/20 08:24:04 tsutsui Exp $); #include audio.h #if NAUDIO 0 @@ -105,8 +105,8 @@ /* supporting subroutines */ static int dbri_init(struct dbri_softc *); static int dbri_reset(struct dbri_softc *); -static volatile u_int32_t *dbri_command_lock(struct dbri_softc *); -static void dbri_command_send(struct dbri_softc *, volatile u_int32_t *); +static volatile uint32_t *dbri_command_lock(struct dbri_softc *); +static void dbri_command_send(struct dbri_softc *, volatile uint32_t *); static void dbri_process_interrupt_buffer(struct dbri_softc *); static void dbri_process_interrupt(struct dbri_softc *, int32_t); @@ -125,8 +125,8 @@ static void pipe_setup(struct dbri_softc *, int, int); static void pipe_reset(struct dbri_softc *, int); static void pipe_receive_fixed(struct dbri_softc *, int, -volatile u_int32_t *); -static void pipe_transmit_fixed(struct dbri_softc *, int, u_int32_t); +volatile uint32_t *); +static void pipe_transmit_fixed(struct dbri_softc *, int, uint32_t); static void pipe_ts_link(struct dbri_softc *, int, enum io, int, int, int); static int pipe_active(struct dbri_softc *, int); @@ -165,7 +165,7 @@ static void dbri_powerhook(int, void *); /* stupid support routines */ -static u_int32_t reverse_bytes(u_int32_t, int); +static uint32_t reverse_bytes(uint32_t, int); struct audio_device dbri_device = { CS4215, @@ -465,7 +465,7 @@ /* clear interrupt */ x = bus_space_read_4(iot, ioh, DBRI_REG1); if (x (DBRI_MRR | DBRI_MLE | DBRI_LBG | DBRI_MBE)) { - u_int32_t tmp; + uint32_t tmp; if (x DBRI_MRR) aprint_debug_dev(sc-sc_dev, @@ -513,8 +513,8 @@ { bus_space_tag_t iot = sc-sc_iot; bus_space_handle_t ioh = sc-sc_ioh; - u_int32_t reg; - volatile u_int32_t *cmd; + uint32_t reg; + volatile uint32_t *cmd; bus_addr_t dmaaddr; int n; @@ -523,7 +523,7 @@ cmd = dbri_command_lock(sc); /* XXX: Initialize interrupt ring buffer */ - sc-sc_dma-intr[0] = (u_int32_t)sc-sc_dmabase + dbri_dma_off(intr, 0); + sc-sc_dma-intr[0] = (uint32_t)sc-sc_dmabase + dbri_dma_off(intr, 0); sc-sc_irqp = 1; /* Initialize pipes */ @@ -543,7 +543,7 @@ bus_space_write_4(iot, ioh, DBRI_REG0, reg); /* setup interrupt queue */ - dmaaddr = (u_int32_t)sc-sc_dmabase + dbri_dma_off(intr, 0); + dmaaddr = (uint32_t)sc-sc_dmabase + dbri_dma_off(intr, 0); *(cmd++) = DBRI_CMD(DBRI_COMMAND_IIQ, 0, 0); *(cmd++) = dmaaddr; @@ -570,7 +570,7 @@ return (0); } -static volatile u_int32_t * +static volatile uint32_t * dbri_command_lock(struct dbri_softc *sc) { @@ -583,7 +583,7 @@ } static void -dbri_command_send(struct dbri_softc *sc, volatile u_int32_t *cmd) +dbri_command_send(struct dbri_softc *sc, volatile uint32_t *cmd) { bus_space_handle_t ioh = sc-sc_ioh; bus_space_tag_t iot = sc-sc_iot; @@ -714,7 +714,7 @@ } case DBRI_INTR_UNDR: { - volatile u_int32_t *cmd; + volatile uint32_t *cmd; int td = sc-sc_pipe[channel].desc; DPRINTF(%s: DBRI_INTR_UNDR\n, device_xname(sc-sc_dev)); @@ -753,7 +753,7 @@ { bus_space_handle_t ioh = sc-sc_ioh; bus_space_tag_t iot = sc-sc_iot; - u_int32_t reg2; + uint32_t reg2; int bail; reg2 = bus_space_read_4(iot, ioh, DBRI_REG2); @@ -822,7 +822,7 @@ { bus_space_tag_t iot = sc-sc_iot; bus_space_handle_t ioh = sc-sc_ioh; - u_int32_t tmp; + uint32_t tmp; int data_width; tmp = bus_space_read_4(iot, ioh, DBRI_REG0); @@ -955,8 +955,8 @@ { bus_space_tag_t iot = sc-sc_iot; bus_space_handle_t ioh = sc-sc_ioh; - u_int32_t val; - u_int32_t tmp; + uint32_t val; + uint32_t tmp; int bail = 0; #if DBRI_SPIN int i; @@ -1055,7 +1055,7 @@ static void chi_reset(struct dbri_softc *sc, enum ms ms, int bpf) { - volatile u_int32_t *cmd; + volatile uint32_t *cmd; int val; int clockrate, divisor; @@ -1146,7 +1146,7 @@ struct dbri_desc *dd; int sdp; int desc; - volatile u_int32_t *cmd; + volatile uint32_t *cmd; if (pipe 0 || pipe = DBRI_PIPE_MAX) { aprint_error_dev(sc-sc_dev, illegal pipe number %d\n,
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Sat Sep 19 11:55:10 UTC 2009 Modified Files: src/sys/dev/sbus: zx.c zxvar.h Log Message: u_intNN_t - uintNN_t To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/sbus/zx.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/sbus/zxvar.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/dev/sbus/zx.c diff -u src/sys/dev/sbus/zx.c:1.32 src/sys/dev/sbus/zx.c:1.33 --- src/sys/dev/sbus/zx.c:1.32 Thu Sep 17 16:39:48 2009 +++ src/sys/dev/sbus/zx.c Sat Sep 19 11:55:09 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: zx.c,v 1.32 2009/09/17 16:39:48 tsutsui Exp $ */ +/* $NetBSD: zx.c,v 1.33 2009/09/19 11:55:09 tsutsui Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: zx.c,v 1.32 2009/09/17 16:39:48 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: zx.c,v 1.33 2009/09/19 11:55:09 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -235,7 +235,7 @@ return; } fb-fb_pixels = (void *)bus_space_vaddr(bt, bh); - sc-sc_pixels = (u_int32_t *)fb-fb_pixels; + sc-sc_pixels = (uint32_t *)fb-fb_pixels; if (sbus_bus_map(bt, sa-sa_slot, sa-sa_offset + ZX_OFF_LC_SS0_USR, PAGE_SIZE, BUS_SPACE_MAP_LINEAR, bh) != 0) { @@ -766,7 +766,7 @@ static void zx_cursor_color(struct zx_softc *sc) { - u_int8_t tmp; + uint8_t tmp; bus_space_write_4(sc-sc_bt, sc-sc_bhzcu, zcu_type, 0x50); @@ -991,8 +991,8 @@ struct vcons_screen *scr = ri-ri_hw; struct zx_softc *sc = scr-scr_cookie; struct wsdisplay_font *font; - volatile u_int32_t *dp; - u_int8_t *fb; + volatile uint32_t *dp; + uint8_t *fb; int fs, i, ul; uint32_t fg, bg; @@ -1011,10 +1011,10 @@ font = ri-ri_font; - dp = (volatile u_int32_t *)sc-sc_pixels + + dp = (volatile uint32_t *)sc-sc_pixels + ((row * font-fontheight + ri-ri_yorigin) 11) + (col * font-fontwidth + ri-ri_xorigin); - fb = (u_int8_t *)font-data + (uc - font-firstchar) * + fb = (uint8_t *)font-data + (uc - font-firstchar) * ri-ri_fontscale; fs = font-stride; @@ -1035,7 +1035,7 @@ } } else { for (i = font-fontheight; i != 0; i--, dp += 2048) { - *dp = *((u_int16_t *)fb) 16; + *dp = *((uint16_t *)fb) 16; fb += fs; } } Index: src/sys/dev/sbus/zxvar.h diff -u src/sys/dev/sbus/zxvar.h:1.5 src/sys/dev/sbus/zxvar.h:1.6 --- src/sys/dev/sbus/zxvar.h:1.5 Thu Sep 17 16:28:13 2009 +++ src/sys/dev/sbus/zxvar.h Sat Sep 19 11:55:09 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: zxvar.h,v 1.5 2009/09/17 16:28:13 tsutsui Exp $ */ +/* $NetBSD: zxvar.h,v 1.6 2009/09/19 11:55:09 tsutsui Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -90,8 +90,8 @@ bus_space_handle_t sc_bhzcu; int sc_flags; - u_int8_t *sc_cmap; - u_int32_t *sc_pixels; + uint8_t *sc_cmap; + uint32_t *sc_pixels; bus_addr_t sc_paddr; int sc_shiftx; int sc_shifty; @@ -99,8 +99,8 @@ struct fbcurpos sc_curpos; struct fbcurpos sc_curhot; struct fbcurpos sc_cursize; - u_int8_t sc_curcmap[8]; - u_int32_t sc_curbits[2][32]; + uint8_t sc_curcmap[8]; + uint32_t sc_curbits[2][32]; #if NWSDISPLAY 0 uint32_t sc_width;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Sat Sep 19 11:58:06 UTC 2009 Modified Files: src/sys/dev/sbus: p9100.c spif.c stp4020.c Log Message: u_intNN_t - uintNN_t To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/sbus/p9100.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/sbus/spif.c cvs rdiff -u -r1.63 -r1.64 src/sys/dev/sbus/stp4020.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/dev/sbus/p9100.c diff -u src/sys/dev/sbus/p9100.c:1.49 src/sys/dev/sbus/p9100.c:1.50 --- src/sys/dev/sbus/p9100.c:1.49 Thu Sep 17 16:39:48 2009 +++ src/sys/dev/sbus/p9100.c Sat Sep 19 11:58:06 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.49 2009/09/17 16:39:48 tsutsui Exp $ */ +/* $NetBSD: p9100.c,v 1.50 2009/09/19 11:58:06 tsutsui Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.49 2009/09/17 16:39:48 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.50 2009/09/19 11:58:06 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -904,7 +904,7 @@ static void p9100_set_video(struct p9100_softc *sc, int enable) { - u_int32_t v = p9100_ctl_read_4(sc, SCRN_RPNT_CTL_1); + uint32_t v = p9100_ctl_read_4(sc, SCRN_RPNT_CTL_1); if (enable) v |= VIDEO_ENABLED; Index: src/sys/dev/sbus/spif.c diff -u src/sys/dev/sbus/spif.c:1.24 src/sys/dev/sbus/spif.c:1.25 --- src/sys/dev/sbus/spif.c:1.24 Thu Sep 17 16:39:48 2009 +++ src/sys/dev/sbus/spif.c Sat Sep 19 11:58:06 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: spif.c,v 1.24 2009/09/17 16:39:48 tsutsui Exp $ */ +/* $NetBSD: spif.c,v 1.25 2009/09/19 11:58:06 tsutsui Exp $ */ /* $OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $ */ /* @@ -41,7 +41,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: spif.c,v 1.24 2009/09/17 16:39:48 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: spif.c,v 1.25 2009/09/19 11:58:06 tsutsui Exp $); #include spif.h #if NSPIF 0 @@ -539,7 +539,7 @@ SPIF_CARD(tp-t_dev)); struct stty_port *sp = st-sc_port[SPIF_PORT(tp-t_dev)]; struct spif_softc *sc = sp-sp_sc; - u_int8_t rbprl, rbprh, tbprl, tbprh; + uint8_t rbprl, rbprh, tbprl, tbprh; int s, opt; if (t-c_ospeed @@ -714,7 +714,7 @@ spif_stcintr_rxexception(struct spif_softc *sc, int *needsoftp) { struct stty_port *sp; - u_int8_t channel, *ptr; + uint8_t channel, *ptr; channel = CD180_GSCR_CHANNEL(STC_READ(sc, STC_GSCR1)); sp = sc-sc_ttys-sc_port[channel]; @@ -739,7 +739,7 @@ spif_stcintr_rx(struct spif_softc *sc, int *needsoftp) { struct stty_port *sp; - u_int8_t channel, *ptr, cnt, rcsr; + uint8_t channel, *ptr, cnt, rcsr; int i; channel = CD180_GSCR_CHANNEL(STC_READ(sc, STC_GSCR1)); @@ -772,7 +772,7 @@ spif_stcintr_tx(struct spif_softc *sc, int *needsoftp) { struct stty_port *sp; - u_int8_t channel, ch; + uint8_t channel, ch; int cnt = 0; channel = CD180_GSCR_CHANNEL(STC_READ(sc, STC_GSCR1)); @@ -823,7 +823,7 @@ spif_stcintr_mx(struct spif_softc *sc, int *needsoftp) { struct stty_port *sp; - u_int8_t channel, mcr; + uint8_t channel, mcr; channel = CD180_GSCR_CHANNEL(STC_READ(sc, STC_GSCR1)); sp = sc-sc_ttys-sc_port[channel]; @@ -842,7 +842,7 @@ { struct spif_softc *sc = (struct spif_softc *)vsc; int needsoft = 0, r = 0, i; - u_int8_t ar; + uint8_t ar; for (i = 0; i 8; i++) { ar = ISTC_READ(sc, STC_RRAR) CD180_GSVR_IMASK; @@ -875,7 +875,7 @@ struct spif_softc *sc = (struct spif_softc *)vsc; struct stty_softc *stc = sc-sc_ttys; int r = 0, i, data, s, flags; - u_int8_t stat, msvr; + uint8_t stat, msvr; struct stty_port *sp; struct tty *tp; @@ -940,7 +940,7 @@ } void -stty_write_ccr(struct spif_softc *sc, u_int8_t val) +stty_write_ccr(struct spif_softc *sc, uint8_t val) { int tries = 10; @@ -952,9 +952,9 @@ } int -stty_compute_baud(speed_t speed, int clock, u_int8_t *bprlp, u_int8_t *bprhp) +stty_compute_baud(speed_t speed, int clock, uint8_t *bprlp, uint8_t *bprhp) { - u_int32_t rate; + uint32_t rate; rate = (2 * clock) / (16 * speed); if (rate 1) Index: src/sys/dev/sbus/stp4020.c diff -u src/sys/dev/sbus/stp4020.c:1.63 src/sys/dev/sbus/stp4020.c:1.64 --- src/sys/dev/sbus/stp4020.c:1.63 Fri Sep 18 12:23:16 2009 +++ src/sys/dev/sbus/stp4020.c Sat Sep 19 11:58:06 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: stp4020.c,v 1.63 2009/09/18 12:23:16 tsutsui Exp $ */ +/* $NetBSD: stp4020.c,v 1.64 2009/09/19 11:58:06 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: stp4020.c,v 1.63 2009/09/18 12:23:16 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: stp4020.c,v 1.64 2009/09/19 11:58:06 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -241,62 +241,62 @@ #ifndef SUN4U /* XXX - move to SBUS machdep function? */ -static u_int16_t
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Fri Sep 18 12:23:16 UTC 2009 Modified Files: src/sys/dev/sbus: be.c bwtwo_sbus.c cgthree_sbus.c cs4231_sbus.c genfb_sbus.c if_en.c qe.c qec.c sio16.c stp4020.c xbox.c Log Message: - use device_private(), proper types and variables for device_t/softc - remove unnecessary casts against void pointer XXX: many inconsistent use of aprint_*(9) and printf(9) To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/sbus/be.c cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sbus/bwtwo_sbus.c \ src/sys/dev/sbus/if_en.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sbus/cgthree_sbus.c cvs rdiff -u -r1.46 -r1.47 src/sys/dev/sbus/cs4231_sbus.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/sbus/genfb_sbus.c cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sbus/qe.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/sbus/qec.c cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sbus/sio16.c cvs rdiff -u -r1.62 -r1.63 src/sys/dev/sbus/stp4020.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/sbus/xbox.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.66 src/sys/dev/sbus/be.c:1.67 --- src/sys/dev/sbus/be.c:1.66 Thu Sep 17 16:28:12 2009 +++ src/sys/dev/sbus/be.c Fri Sep 18 12:23:16 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.66 2009/09/17 16:28:12 tsutsui Exp $ */ +/* $NetBSD: be.c,v 1.67 2009/09/18 12:23:16 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be.c,v 1.66 2009/09/17 16:28:12 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: be.c,v 1.67 2009/09/18 12:23:16 tsutsui Exp $); #include opt_ddb.h #include opt_inet.h @@ -219,8 +219,8 @@ beattach(device_t parent, device_t self, void *aux) { struct sbus_attach_args *sa = aux; - struct qec_softc *qec = (struct qec_softc *)parent; - struct be_softc *sc = (struct be_softc *)self; + struct qec_softc *qec = device_private(parent); + struct be_softc *sc = device_private(self); struct ifnet *ifp = sc-sc_ethercom.ec_if; struct mii_data *mii = sc-sc_mii; struct mii_softc *child; @@ -368,7 +368,7 @@ if ((v MGMT_PAL_EXT_MDIO) != 0) { - mii_attach(sc-sc_dev, mii, 0x, BE_PHY_EXTERNAL, + mii_attach(self, mii, 0x, BE_PHY_EXTERNAL, MII_OFFSET_ANY, 0); child = LIST_FIRST(mii-mii_phys); @@ -386,14 +386,16 @@ */ #ifdef DIAGNOSTIC if (LIST_NEXT(child, mii_list) != NULL) { -aprint_error_dev(sc-sc_dev, spurious MII device %s attached\n, - device_xname(child-mii_dev)); +aprint_error_dev(self, +spurious MII device %s attached\n, +device_xname(child-mii_dev)); } #endif if (child-mii_phy != BE_PHY_EXTERNAL || child-mii_inst 0) { -aprint_error_dev(sc-sc_dev, cannot accommodate MII device %s -at phy %d, instance %d\n, +aprint_error_dev(self, +cannot accommodate MII device %s + at phy %d, instance %d\n, device_xname(child-mii_dev), child-mii_phy, child-mii_inst); } else { @@ -446,11 +448,11 @@ ifmedia_set(sc-sc_media, IFM_MAKEWORD(IFM_ETHER,IFM_AUTO,0,instance)); } else - be_mii_writereg((void *)sc, + be_mii_writereg(self, BE_PHY_INTERNAL, MII_BMCR, BMCR_ISO); } - memcpy(ifp-if_xname, device_xname(sc-sc_dev), IFNAMSIZ); + memcpy(ifp-if_xname, device_xname(self), IFNAMSIZ); ifp-if_softc = sc; ifp-if_start = bestart; ifp-if_ioctl = beioctl; @@ -603,7 +605,7 @@ void bestart(struct ifnet *ifp) { - struct be_softc *sc = (struct be_softc *)ifp-if_softc; + struct be_softc *sc = ifp-if_softc; struct qec_xd *txd = sc-sc_rb.rb_txd; struct mbuf *m; unsigned int bix, len; @@ -710,9 +712,9 @@ } int -beintr(void *v) +beintr(void *arg) { - struct be_softc *sc = (struct be_softc *)v; + struct be_softc *sc = arg; bus_space_tag_t t = sc-sc_bustag; u_int32_t whyq, whyb, whyc; int r = 0; @@ -743,6 +745,7 @@ int beqint(struct be_softc *sc, u_int32_t why) { + device_t self = sc-sc_dev; int r = 0, rst = 0; if (why BE_CR_STAT_TXIRQ) @@ -753,19 +756,19 @@ if (why BE_CR_STAT_BERROR) { r |= 1; rst = 1; - aprint_error_dev(sc-sc_dev, bigmac error\n); + aprint_error_dev(self, bigmac error\n); } if (why BE_CR_STAT_TXDERR) { r |= 1; rst = 1; - aprint_error_dev(sc-sc_dev, bogus tx descriptor\n); + aprint_error_dev(self, bogus tx descriptor\n); } if (why (BE_CR_STAT_TXLERR | BE_CR_STAT_TXPERR | BE_CR_STAT_TXSERR)) { r |= 1; rst = 1; - aprint_error_dev(sc-sc_dev, tx DMA error ( ); + aprint_error_dev(self, tx DMA error ( ); if (why BE_CR_STAT_TXLERR) printf(Late ); if (why BE_CR_STAT_TXPERR) @@ -778,19 +781,19 @@ if (why BE_CR_STAT_RXDROP) { r |= 1; rst = 1; - aprint_error_dev(sc-sc_dev, out of rx descriptors\n); + aprint_error_dev(self, out of rx descriptors\n); }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Fri Sep 18 12:59:47 UTC 2009 Modified Files: src/sys/dev/sbus: qec.c Log Message: - wrap a long line - ANSIfy To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/sbus/qec.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/dev/sbus/qec.c diff -u src/sys/dev/sbus/qec.c:1.46 src/sys/dev/sbus/qec.c:1.47 --- src/sys/dev/sbus/qec.c:1.46 Fri Sep 18 12:23:16 2009 +++ src/sys/dev/sbus/qec.c Fri Sep 18 12:59:47 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: qec.c,v 1.46 2009/09/18 12:23:16 tsutsui Exp $ */ +/* $NetBSD: qec.c,v 1.47 2009/09/18 12:59:47 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: qec.c,v 1.46 2009/09/18 12:23:16 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: qec.c,v 1.47 2009/09/18 12:59:47 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -212,7 +212,8 @@ } int -qec_bus_map(bus_space_tag_t t, bus_addr_t ba, bus_size_t size, int flags, vaddr_t va, bus_space_handle_t *hp) +qec_bus_map(bus_space_tag_t t, bus_addr_t ba, bus_size_t size, int flags, +vaddr_t va, bus_space_handle_t *hp) /* va: Ignored */ { int error; @@ -225,13 +226,9 @@ } void * -qec_intr_establish(t, pri, level, handler, arg, fastvec) - bus_space_tag_t t; - int pri; - int level; - int (*handler)(void *); - void *arg; - void (*fastvec)(void); /* ignored */ +qec_intr_establish(bus_space_tag_t t, int pri, int level, +int (*handler)(void *), void *arg, void (*fastvec)(void)) + /* (*fastvec)(void): ignored */ { struct qec_softc *sc = t-cookie;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Fri Sep 18 13:48:54 UTC 2009 Modified Files: src/sys/dev/sbus: be.c Log Message: Split device_t/softc. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/sbus/be.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.68 src/sys/dev/sbus/be.c:1.69 --- src/sys/dev/sbus/be.c:1.68 Fri Sep 18 13:45:20 2009 +++ src/sys/dev/sbus/be.c Fri Sep 18 13:48:54 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.68 2009/09/18 13:45:20 tsutsui Exp $ */ +/* $NetBSD: be.c,v 1.69 2009/09/18 13:48:54 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be.c,v 1.68 2009/09/18 13:45:20 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: be.c,v 1.69 2009/09/18 13:48:54 tsutsui Exp $); #include opt_ddb.h #include opt_inet.h @@ -114,7 +114,7 @@ #include dev/sbus/bereg.h struct be_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_bustag; /* bus DMA tags */ bus_dma_tag_t sc_dmatag; bus_dmamap_t sc_dmamap; @@ -205,7 +205,7 @@ int be_intphy_service(struct be_softc *, struct mii_data *, int); -CFATTACH_DECL(be, sizeof(struct be_softc), +CFATTACH_DECL_NEW(be, sizeof(struct be_softc), bematch, beattach, NULL, NULL); int @@ -233,6 +233,8 @@ int rseg, error; u_int32_t v; + sc-sc_dev = self; + if (sa-sa_nreg 3) { printf(%s: only %d register sets\n, device_xname(self), sa-sa_nreg); @@ -715,7 +717,7 @@ { struct be_softc *sc = ifp-if_softc; - log(LOG_ERR, %s: device timeout\n, device_xname(sc-sc_dev)); + log(LOG_ERR, %s: device timeout\n, device_xname(sc-sc_dev)); ++sc-sc_ethercom.ec_if.if_oerrors; bereset(sc); @@ -755,7 +757,7 @@ int beqint(struct be_softc *sc, u_int32_t why) { - device_t self = sc-sc_dev; + device_t self = sc-sc_dev; int r = 0, rst = 0; if (why BE_CR_STAT_TXIRQ) @@ -833,7 +835,7 @@ int beeint(struct be_softc *sc, u_int32_t why) { - device_t self = sc-sc_dev; + device_t self = sc-sc_dev; int r = 0, rst = 0; if (why BE_BR_STAT_RFIFOVF) { @@ -1384,7 +1386,7 @@ int be_mii_reset(struct be_softc *sc, int phy) { - device_t self = sc-sc_dev; + device_t self = sc-sc_dev; int n; be_mii_writereg(self, phy, MII_BMCR, @@ -1485,7 +1487,7 @@ be_intphy_service(struct be_softc *sc, struct mii_data *mii, int cmd) { struct ifmedia_entry *ife = mii-mii_media.ifm_cur; - device_t self = sc-sc_dev; + device_t self = sc-sc_dev; int bmcr, bmsr; int error; @@ -1639,7 +1641,7 @@ be_intphy_status(struct be_softc *sc) { struct mii_data *mii = sc-sc_mii; - device_t self = sc-sc_dev; + device_t self = sc-sc_dev; int media_active, media_status; int bmcr, bmsr;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Fri Sep 18 14:09:42 UTC 2009 Modified Files: src/sys/dev/sbus: be.c qe.c qec.c qecvar.h Log Message: Use uint8_t pointers for TX/RX buffers to avoid extra pointer casts. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/dev/sbus/be.c cvs rdiff -u -r1.53 -r1.54 src/sys/dev/sbus/qe.c cvs rdiff -u -r1.47 -r1.48 src/sys/dev/sbus/qec.c cvs rdiff -u -r1.12 -r1.13 src/sys/dev/sbus/qecvar.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.70 src/sys/dev/sbus/be.c:1.71 --- src/sys/dev/sbus/be.c:1.70 Fri Sep 18 14:00:44 2009 +++ src/sys/dev/sbus/be.c Fri Sep 18 14:09:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.70 2009/09/18 14:00:44 tsutsui Exp $ */ +/* $NetBSD: be.c,v 1.71 2009/09/18 14:09:42 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be.c,v 1.70 2009/09/18 14:00:44 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: be.c,v 1.71 2009/09/18 14:09:42 tsutsui Exp $); #include opt_ddb.h #include opt_inet.h @@ -483,7 +483,7 @@ int len, tlen = 0, boff = 0; void *bp; - bp = (char *)sc-sc_rb.rb_txbuf + (idx % sc-sc_rb.rb_ntbuf) * BE_PKT_BUF_SZ; + bp = sc-sc_rb.rb_txbuf + (idx % sc-sc_rb.rb_ntbuf) * BE_PKT_BUF_SZ; for (; m; m = n) { len = m-m_len; @@ -514,7 +514,7 @@ int len, pad, boff = 0; void *bp; - bp = (char *)sc-sc_rb.rb_rxbuf + (idx % sc-sc_rb.rb_nrbuf) * BE_PKT_BUF_SZ; + bp = sc-sc_rb.rb_rxbuf + (idx % sc-sc_rb.rb_nrbuf) * BE_PKT_BUF_SZ; MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) Index: src/sys/dev/sbus/qe.c diff -u src/sys/dev/sbus/qe.c:1.53 src/sys/dev/sbus/qe.c:1.54 --- src/sys/dev/sbus/qe.c:1.53 Fri Sep 18 12:23:16 2009 +++ src/sys/dev/sbus/qe.c Fri Sep 18 14:09:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: qe.c,v 1.53 2009/09/18 12:23:16 tsutsui Exp $ */ +/* $NetBSD: qe.c,v 1.54 2009/09/18 14:09:42 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: qe.c,v 1.53 2009/09/18 12:23:16 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: qe.c,v 1.54 2009/09/18 14:09:42 tsutsui Exp $); #define QEDEBUG @@ -334,7 +334,7 @@ int len, pad, boff = 0; void *bp; - bp = (char *)sc-sc_rb.rb_rxbuf + (idx % sc-sc_rb.rb_nrbuf) * QE_PKT_BUF_SZ; + bp = sc-sc_rb.rb_rxbuf + (idx % sc-sc_rb.rb_nrbuf) * QE_PKT_BUF_SZ; MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) @@ -383,7 +383,7 @@ int len, tlen = 0, boff = 0; void *bp; - bp = (char *)sc-sc_rb.rb_txbuf + (idx % sc-sc_rb.rb_ntbuf) * QE_PKT_BUF_SZ; + bp = sc-sc_rb.rb_txbuf + (idx % sc-sc_rb.rb_ntbuf) * QE_PKT_BUF_SZ; for (; m; m = n) { len = m-m_len; Index: src/sys/dev/sbus/qec.c diff -u src/sys/dev/sbus/qec.c:1.47 src/sys/dev/sbus/qec.c:1.48 --- src/sys/dev/sbus/qec.c:1.47 Fri Sep 18 12:59:47 2009 +++ src/sys/dev/sbus/qec.c Fri Sep 18 14:09:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: qec.c,v 1.47 2009/09/18 12:59:47 tsutsui Exp $ */ +/* $NetBSD: qec.c,v 1.48 2009/09/18 14:09:42 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: qec.c,v 1.47 2009/09/18 12:59:47 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: qec.c,v 1.48 2009/09/18 14:09:42 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -300,10 +300,10 @@ { bus_addr_t txbufdma, rxbufdma; bus_addr_t dma; - void *p; + uint8_t *p; unsigned int ntbuf, nrbuf, i; - p = qr-rb_membase; + p = qr-rb_membase; dma = qr-rb_dmabase; ntbuf = qr-rb_ntbuf; @@ -314,7 +314,7 @@ */ qr-rb_txd = (struct qec_xd *)p; qr-rb_txddma = dma; - p = (char *)p + QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd); + p += QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd); dma += QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd); /* @@ -322,7 +322,7 @@ */ qr-rb_rxd = (struct qec_xd *)p; qr-rb_rxddma = dma; - p = (char *)p + QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd); + p += QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd); dma += QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd); @@ -331,7 +331,7 @@ */ qr-rb_txbuf = p; txbufdma = dma; - p = (char *)p + ntbuf * pktbufsz; + p += ntbuf * pktbufsz; dma += ntbuf * pktbufsz; /* @@ -339,7 +339,7 @@ */ qr-rb_rxbuf = p; rxbufdma = dma; - p = (char *)p + nrbuf * pktbufsz; + p += nrbuf * pktbufsz; dma += nrbuf * pktbufsz; /* Index: src/sys/dev/sbus/qecvar.h diff -u src/sys/dev/sbus/qecvar.h:1.12 src/sys/dev/sbus/qecvar.h:1.13 --- src/sys/dev/sbus/qecvar.h:1.12 Thu Sep 17 16:28:12 2009 +++ src/sys/dev/sbus/qecvar.h Fri Sep 18 14:09:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: qecvar.h,v 1.12 2009/09/17 16:28:12 tsutsui Exp $ */ +/* $NetBSD: qecvar.h,v 1.13 2009/09/18 14:09:42 tsutsui Exp $ */ /*- * Copyright
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Fri Sep 18 14:14:06 UTC 2009 Modified Files: src/sys/dev/sbus: be.c Log Message: Make local functions static. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/dev/sbus/be.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.71 src/sys/dev/sbus/be.c:1.72 --- src/sys/dev/sbus/be.c:1.71 Fri Sep 18 14:09:42 2009 +++ src/sys/dev/sbus/be.c Fri Sep 18 14:14:06 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.71 2009/09/18 14:09:42 tsutsui Exp $ */ +/* $NetBSD: be.c,v 1.72 2009/09/18 14:14:06 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be.c,v 1.71 2009/09/18 14:09:42 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: be.c,v 1.72 2009/09/18 14:14:06 tsutsui Exp $); #include opt_ddb.h #include opt_inet.h @@ -158,34 +158,34 @@ #endif }; -int bematch(device_t, cfdata_t, void *); -void beattach(device_t, device_t, void *); +static int bematch(device_t, cfdata_t, void *); +static void beattach(device_t, device_t, void *); -int beinit(struct ifnet *); -void bestart(struct ifnet *); -void bestop(struct ifnet *, int); -void bewatchdog(struct ifnet *); -int beioctl(struct ifnet *, u_long, void *); -void bereset(struct be_softc *); -void behwreset(struct be_softc *); - -int beintr(void *); -int berint(struct be_softc *); -int betint(struct be_softc *); -int beqint(struct be_softc *, u_int32_t); -int beeint(struct be_softc *, u_int32_t); +static int beinit(struct ifnet *); +static void bestart(struct ifnet *); +static void bestop(struct ifnet *, int); +static void bewatchdog(struct ifnet *); +static int beioctl(struct ifnet *, u_long, void *); +static void bereset(struct be_softc *); +static void behwreset(struct be_softc *); + +static int beintr(void *); +static int berint(struct be_softc *); +static int betint(struct be_softc *); +static int beqint(struct be_softc *, u_int32_t); +static int beeint(struct be_softc *, u_int32_t); static void be_read(struct be_softc *, int, int); static int be_put(struct be_softc *, int, struct mbuf *); static struct mbuf *be_get(struct be_softc *, int, int); -void be_pal_gate(struct be_softc *, int); +static void be_pal_gate(struct be_softc *, int); /* ifmedia callbacks */ -void be_ifmedia_sts(struct ifnet *, struct ifmediareq *); -int be_ifmedia_upd(struct ifnet *); +static void be_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static int be_ifmedia_upd(struct ifnet *); -void be_mcreset(struct be_softc *); +static void be_mcreset(struct be_softc *); /* MII methods callbacks */ static int be_mii_readreg(device_t, int, int); @@ -199,10 +199,12 @@ static int be_tcvr_read_bit(struct be_softc *, int); static void be_tcvr_write_bit(struct be_softc *, int, int); -void be_tick(void *); -void be_intphy_auto(struct be_softc *); -void be_intphy_status(struct be_softc *); -int be_intphy_service(struct be_softc *, struct mii_data *, int); +static void be_tick(void *); +#if 0 +static void be_intphy_auto(struct be_softc *); +#endif +static void be_intphy_status(struct be_softc *); +static int be_intphy_service(struct be_softc *, struct mii_data *, int); CFATTACH_DECL_NEW(be, sizeof(struct be_softc),
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Fri Sep 18 14:00:44 UTC 2009 Modified Files: src/sys/dev/sbus: be.c Log Message: Adjust attach messages. To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/dev/sbus/be.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.69 src/sys/dev/sbus/be.c:1.70 --- src/sys/dev/sbus/be.c:1.69 Fri Sep 18 13:48:54 2009 +++ src/sys/dev/sbus/be.c Fri Sep 18 14:00:44 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.69 2009/09/18 13:48:54 tsutsui Exp $ */ +/* $NetBSD: be.c,v 1.70 2009/09/18 14:00:44 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be.c,v 1.69 2009/09/18 13:48:54 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: be.c,v 1.70 2009/09/18 14:00:44 tsutsui Exp $); #include opt_ddb.h #include opt_inet.h @@ -236,8 +236,7 @@ sc-sc_dev = self; if (sa-sa_nreg 3) { - printf(%s: only %d register sets\n, - device_xname(self), sa-sa_nreg); + printf(: only %d register sets\n, sa-sa_nreg); return; } @@ -247,7 +246,7 @@ sa-sa_reg[0].oa_base), (bus_size_t)sa-sa_reg[0].oa_size, 0, sc-sc_cr) != 0) { - printf(beattach: cannot map registers\n); + printf(: cannot map registers\n); return; } @@ -257,7 +256,7 @@ sa-sa_reg[1].oa_base), (bus_size_t)sa-sa_reg[1].oa_size, 0, sc-sc_br) != 0) { - printf(beattach: cannot map registers\n); + printf(: cannot map registers\n); return; } @@ -267,7 +266,7 @@ sa-sa_reg[2].oa_base), (bus_size_t)sa-sa_reg[2].oa_size, 0, sc-sc_tr) != 0) { - printf(beattach: cannot map registers\n); + printf(: cannot map registers\n); return; } @@ -276,7 +275,7 @@ sc-sc_qr = qec-sc_regs; sc-sc_rev = prom_getpropint(node, board-version, -1); - printf( rev %x, sc-sc_rev); + printf(: rev %x,, sc-sc_rev); callout_init(sc-sc_tick_ch, 0);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Fri Sep 18 14:35:11 UTC 2009 Modified Files: src/sys/dev/sbus: be.c Log Message: Misc KNF. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/dev/sbus/be.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.72 src/sys/dev/sbus/be.c:1.73 --- src/sys/dev/sbus/be.c:1.72 Fri Sep 18 14:14:06 2009 +++ src/sys/dev/sbus/be.c Fri Sep 18 14:35:11 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.72 2009/09/18 14:14:06 tsutsui Exp $ */ +/* $NetBSD: be.c,v 1.73 2009/09/18 14:35:11 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be.c,v 1.72 2009/09/18 14:14:06 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: be.c,v 1.73 2009/09/18 14:35:11 tsutsui Exp $); #include opt_ddb.h #include opt_inet.h @@ -152,7 +152,7 @@ struct qec_ring sc_rb; /* Packet Ring Buffer */ /* MAC address */ - u_int8_t sc_enaddr[6]; + uint8_t sc_enaddr[ETHER_ADDR_LEN]; #ifdef BEDEBUG int sc_debug; #endif @@ -172,8 +172,8 @@ static int beintr(void *); static int berint(struct be_softc *); static int betint(struct be_softc *); -static int beqint(struct be_softc *, u_int32_t); -static int beeint(struct be_softc *, u_int32_t); +static int beqint(struct be_softc *, uint32_t); +static int beeint(struct be_softc *, uint32_t); static void be_read(struct be_softc *, int, int); static int be_put(struct be_softc *, int, struct mbuf *); @@ -194,7 +194,7 @@ /* MII helpers */ static void be_mii_sync(struct be_softc *); -static void be_mii_sendbits(struct be_softc *, int, u_int32_t, int); +static void be_mii_sendbits(struct be_softc *, int, uint32_t, int); static int be_mii_reset(struct be_softc *, int); static int be_tcvr_read_bit(struct be_softc *, int); static void be_tcvr_write_bit(struct be_softc *, int, int); @@ -215,7 +215,7 @@ { struct sbus_attach_args *sa = aux; - return (strcmp(cf-cf_name, sa-sa_name) == 0); + return strcmp(cf-cf_name, sa-sa_name) == 0; } void @@ -233,7 +233,7 @@ bus_size_t size; int instance; int rseg, error; - u_int32_t v; + uint32_t v; sc-sc_dev = self; @@ -243,31 +243,25 @@ } if (bus_space_map(sa-sa_bustag, - (bus_addr_t)BUS_ADDR( -sa-sa_reg[0].oa_space, -sa-sa_reg[0].oa_base), - (bus_size_t)sa-sa_reg[0].oa_size, - 0, sc-sc_cr) != 0) { + (bus_addr_t)BUS_ADDR(sa-sa_reg[0].oa_space, sa-sa_reg[0].oa_base), + (bus_size_t)sa-sa_reg[0].oa_size, + 0, sc-sc_cr) != 0) { printf(: cannot map registers\n); return; } if (bus_space_map(sa-sa_bustag, - (bus_addr_t)BUS_ADDR( -sa-sa_reg[1].oa_space, -sa-sa_reg[1].oa_base), - (bus_size_t)sa-sa_reg[1].oa_size, - 0, sc-sc_br) != 0) { + (bus_addr_t)BUS_ADDR(sa-sa_reg[1].oa_space, sa-sa_reg[1].oa_base), + (bus_size_t)sa-sa_reg[1].oa_size, + 0, sc-sc_br) != 0) { printf(: cannot map registers\n); return; } if (bus_space_map(sa-sa_bustag, - (bus_addr_t)BUS_ADDR( -sa-sa_reg[2].oa_space, -sa-sa_reg[2].oa_base), - (bus_size_t)sa-sa_reg[2].oa_size, - 0, sc-sc_tr) != 0) { + (bus_addr_t)BUS_ADDR(sa-sa_reg[2].oa_space, sa-sa_reg[2].oa_base), + (bus_size_t)sa-sa_reg[2].oa_size, + 0, sc-sc_tr) != 0) { printf(: cannot map registers\n); return; } @@ -295,7 +289,7 @@ /* Establish interrupt handler */ if (sa-sa_nintr) (void)bus_intr_establish(sa-sa_bustag, sa-sa_pri, IPL_NET, - beintr, sc); + beintr, sc); prom_getether(node, sc-sc_enaddr); printf( address %s\n, ether_sprintf(sc-sc_enaddr)); @@ -308,42 +302,38 @@ sc-sc_rb.rb_ntbuf = QEC_XD_RING_MAXSIZE; sc-sc_rb.rb_nrbuf = QEC_XD_RING_MAXSIZE; - size = QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd) + - QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd) + - sc-sc_rb.rb_ntbuf * BE_PKT_BUF_SZ + - sc-sc_rb.rb_nrbuf * BE_PKT_BUF_SZ; + size = + QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd) + + QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd) + + sc-sc_rb.rb_ntbuf * BE_PKT_BUF_SZ + + sc-sc_rb.rb_nrbuf * BE_PKT_BUF_SZ; /* Get a DMA handle */ if ((error = bus_dmamap_create(dmatag, size, 1, size, 0, -BUS_DMA_NOWAIT, sc-sc_dmamap)) != 0) { + BUS_DMA_NOWAIT, sc-sc_dmamap)) != 0) { aprint_error_dev(self, DMA map create error %d\n, error); return; } /* Allocate DMA buffer */ if ((error = bus_dmamem_alloc(sa-sa_dmatag, size, 0, 0, - seg, 1, rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(self, DMA buffer alloc error %d\n, - error); + seg, 1, rseg, BUS_DMA_NOWAIT)) != 0) { + aprint_error_dev(self, DMA buffer alloc error %d\n, error); return; } /* Map DMA memory in CPU addressable space */ if ((error = bus_dmamem_map(sa-sa_dmatag, seg, rseg, size, - sc-sc_rb.rb_membase, -
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Fri Sep 18 14:40:49 UTC 2009 Modified Files: src/sys/dev/sbus: be.c Log Message: Use the common ether_crc32_le() function for multicast hash. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/dev/sbus/be.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/dev/sbus/be.c diff -u src/sys/dev/sbus/be.c:1.73 src/sys/dev/sbus/be.c:1.74 --- src/sys/dev/sbus/be.c:1.73 Fri Sep 18 14:35:11 2009 +++ src/sys/dev/sbus/be.c Fri Sep 18 14:40:49 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.73 2009/09/18 14:35:11 tsutsui Exp $ */ +/* $NetBSD: be.c,v 1.74 2009/09/18 14:40:49 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: be.c,v 1.73 2009/09/18 14:35:11 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: be.c,v 1.74 2009/09/18 14:40:49 tsutsui Exp $); #include opt_ddb.h #include opt_inet.h @@ -1151,11 +1151,9 @@ struct ifnet *ifp = sc-sc_ethercom.ec_if; bus_space_tag_t t = sc-sc_bustag; bus_space_handle_t br = sc-sc_br; + uint32_t v; uint32_t crc; uint16_t hash[4]; - uint8_t octet; - uint32_t v; - int i, j; struct ether_multi *enm; struct ether_multistep step; @@ -1191,23 +1189,10 @@ goto chipit; } - crc = 0x; - - for (i = 0; i ETHER_ADDR_LEN; i++) { - octet = enm-enm_addrlo[i]; - - for (j = 0; j 8; j++) { -if ((crc 1) ^ (octet 1)) { - crc = 1; - crc ^= MC_POLY_LE; -} -else - crc = 1; -octet = 1; - } - } - + crc = ether_crc32_le(enm-enm_addrlo, ETHER_ADDR_LEN); + /* Just want the 6 most significant bits. */ crc = 26; + hash[crc 4] |= 1 (crc 0xf); ETHER_NEXT_MULTI(step, enm); }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Sat Sep 19 03:49:23 UTC 2009 Modified Files: src/sys/dev/sbus: bwtwo_sbus.c Log Message: Make bwtwo(4) match prior to genfb(4). Required by bwtwo(4) on TME emulating SS2. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sbus/bwtwo_sbus.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/dev/sbus/bwtwo_sbus.c diff -u src/sys/dev/sbus/bwtwo_sbus.c:1.27 src/sys/dev/sbus/bwtwo_sbus.c:1.28 --- src/sys/dev/sbus/bwtwo_sbus.c:1.27 Fri Sep 18 12:23:16 2009 +++ src/sys/dev/sbus/bwtwo_sbus.c Sat Sep 19 03:49:22 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: bwtwo_sbus.c,v 1.27 2009/09/18 12:23:16 tsutsui Exp $ */ +/* $NetBSD: bwtwo_sbus.c,v 1.28 2009/09/19 03:49:22 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -79,7 +79,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bwtwo_sbus.c,v 1.27 2009/09/18 12:23:16 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: bwtwo_sbus.c,v 1.28 2009/09/19 03:49:22 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -120,7 +120,10 @@ { struct sbus_attach_args *sa = aux; - return (strcmp(cf-cf_name, sa-sa_name) == 0); + if (strcmp(cf-cf_name, sa-sa_name) == 0) + return 100; /* beat genfb(4) */ + + return 0; }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Sat Sep 19 04:48:18 UTC 2009 Modified Files: src/sys/dev/sbus: qec.c qecvar.h Log Message: Split device_t/softc. Tested on: --- qec0 at sbus0 slot 3 offset 0x2: 128K memory be0 at qec0 slot 0 offset 0x0 level 4 (ipl 7): rev 1, address 00:80:17:xx:xx:xx To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/sbus/qec.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/sbus/qecvar.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/dev/sbus/qec.c diff -u src/sys/dev/sbus/qec.c:1.48 src/sys/dev/sbus/qec.c:1.49 --- src/sys/dev/sbus/qec.c:1.48 Fri Sep 18 14:09:42 2009 +++ src/sys/dev/sbus/qec.c Sat Sep 19 04:48:18 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: qec.c,v 1.48 2009/09/18 14:09:42 tsutsui Exp $ */ +/* $NetBSD: qec.c,v 1.49 2009/09/19 04:48:18 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: qec.c,v 1.48 2009/09/18 14:09:42 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: qec.c,v 1.49 2009/09/19 04:48:18 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -67,7 +67,7 @@ void *, /*arg*/ void (*)(void)); /*optional fast trap handler*/ -CFATTACH_DECL(qec, sizeof(struct qec_softc), +CFATTACH_DECL_NEW(qec, sizeof(struct qec_softc), qecmatch, qecattach, NULL, NULL); int @@ -106,6 +106,7 @@ bus_space_handle_t bh; int error; + sc-sc_dev = self; sc-sc_bustag = sa-sa_bustag; sc-sc_dmatag = sa-sa_dmatag; node = sa-sa_node; @@ -239,7 +240,7 @@ */ if (sc-sc_intr == NULL) { printf(%s: warning: no interrupts\n, -device_xname(sc-sc_dev)); +device_xname(sc-sc_dev)); return (NULL); } pri = sc-sc_intr-oi_pri; Index: src/sys/dev/sbus/qecvar.h diff -u src/sys/dev/sbus/qecvar.h:1.13 src/sys/dev/sbus/qecvar.h:1.14 --- src/sys/dev/sbus/qecvar.h:1.13 Fri Sep 18 14:09:42 2009 +++ src/sys/dev/sbus/qecvar.h Sat Sep 19 04:48:18 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: qecvar.h,v 1.13 2009/09/18 14:09:42 tsutsui Exp $ */ +/* $NetBSD: qecvar.h,v 1.14 2009/09/19 04:48:18 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ struct qec_softc { - struct device sc_dev; /* us as a device */ + device_t sc_dev; /* us as a device */ bus_space_tag_t sc_bustag; /* bus DMA tags */ bus_dma_tag_t sc_dmatag; struct openprom_intr *sc_intr; /* interrupt info */
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Thu Sep 17 17:51:53 UTC 2009 Modified Files: src/sys/dev/sbus: lebuffer.c lebuffervar.h Log Message: Split device_t/softc. Tested on: lebuffer0 at sbus0 slot 3 offset 0x4: 128K memory To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sbus/lebuffer.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/sbus/lebuffervar.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/dev/sbus/lebuffer.c diff -u src/sys/dev/sbus/lebuffer.c:1.34 src/sys/dev/sbus/lebuffer.c:1.35 --- src/sys/dev/sbus/lebuffer.c:1.34 Thu Sep 17 16:28:12 2009 +++ src/sys/dev/sbus/lebuffer.c Thu Sep 17 17:51:52 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: lebuffer.c,v 1.34 2009/09/17 16:28:12 tsutsui Exp $ */ +/* $NetBSD: lebuffer.c,v 1.35 2009/09/17 17:51:52 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: lebuffer.c,v 1.34 2009/09/17 16:28:12 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: lebuffer.c,v 1.35 2009/09/17 17:51:52 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -50,7 +50,7 @@ int lebufmatch(device_t, cfdata_t, void *); void lebufattach(device_t, device_t, void *); -CFATTACH_DECL(lebuffer, sizeof(struct lebuf_softc), +CFATTACH_DECL_NEW(lebuffer, sizeof(struct lebuf_softc), lebufmatch, lebufattach, NULL, NULL); int @@ -76,7 +76,7 @@ lebufattach(device_t parent, device_t self, void *aux) { struct sbus_attach_args *sa = aux; - struct lebuf_softc *sc = (void *)self; + struct lebuf_softc *sc = device_private(self); struct sbus_softc *sbsc = device_private(parent); int node; int sbusburst; @@ -84,6 +84,8 @@ bus_dma_tag_t dt = sa-sa_dmatag; bus_space_handle_t bh; + sc-sc_dev = self; + if (sbus_bus_map(bt, sa-sa_slot, sa-sa_offset, sa-sa_size, BUS_SPACE_MAP_LINEAR, bh) != 0) { aprint_error_dev(self, attach: cannot map registers\n); @@ -122,7 +124,7 @@ struct sbus_attach_args sax; sbus_setup_attach_args(sbsc, bt, dt, node, sax); - (void)config_found(sc-sc_dev, (void *)sax, lebufprint); + (void)config_found(self, (void *)sax, lebufprint); sbus_destroy_attach_args(sax); } } Index: src/sys/dev/sbus/lebuffervar.h diff -u src/sys/dev/sbus/lebuffervar.h:1.7 src/sys/dev/sbus/lebuffervar.h:1.8 --- src/sys/dev/sbus/lebuffervar.h:1.7 Thu Sep 17 16:28:12 2009 +++ src/sys/dev/sbus/lebuffervar.h Thu Sep 17 17:51:52 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: lebuffervar.h,v 1.7 2009/09/17 16:28:12 tsutsui Exp $ */ +/* $NetBSD: lebuffervar.h,v 1.8 2009/09/17 17:51:52 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ struct lebuf_softc { - struct device sc_dev; /* us as a device */ + device_t sc_dev; /* us as a device */ u_int sc_rev; /* revision */ int sc_node; /* PROM node ID */ int sc_burst; /* DVMA burst size in effect */
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Thu Sep 17 17:53:35 UTC 2009 Modified Files: src/sys/dev/sbus: lebuffer.c Log Message: Fix a message format in error path. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/sbus/lebuffer.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/dev/sbus/lebuffer.c diff -u src/sys/dev/sbus/lebuffer.c:1.35 src/sys/dev/sbus/lebuffer.c:1.36 --- src/sys/dev/sbus/lebuffer.c:1.35 Thu Sep 17 17:51:52 2009 +++ src/sys/dev/sbus/lebuffer.c Thu Sep 17 17:53:35 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: lebuffer.c,v 1.35 2009/09/17 17:51:52 tsutsui Exp $ */ +/* $NetBSD: lebuffer.c,v 1.36 2009/09/17 17:53:35 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: lebuffer.c,v 1.35 2009/09/17 17:51:52 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: lebuffer.c,v 1.36 2009/09/17 17:53:35 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -88,7 +88,7 @@ if (sbus_bus_map(bt, sa-sa_slot, sa-sa_offset, sa-sa_size, BUS_SPACE_MAP_LINEAR, bh) != 0) { - aprint_error_dev(self, attach: cannot map registers\n); + aprint_error(: cannot map registers\n); return; }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Wed Sep 16 11:17:19 UTC 2009 Modified Files: src/sys/dev/sbus: if_le.c Log Message: Rewrite code which looks for an unallocated lebuffer and pairs it with possible orphaned this le at sbus one on old PROMs not using homegrown struct sbusdev but common cfdriver_t and device_t structures. Now nothing refers struct sbusdev registered by sbus_establish(). Tested an SBus le/esp combo card on SS1+. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/sbus/if_le.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/dev/sbus/if_le.c diff -u src/sys/dev/sbus/if_le.c:1.37 src/sys/dev/sbus/if_le.c:1.38 --- src/sys/dev/sbus/if_le.c:1.37 Tue Sep 8 18:15:17 2009 +++ src/sys/dev/sbus/if_le.c Wed Sep 16 11:17:19 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.37 2009/09/08 18:15:17 tsutsui Exp $ */ +/* $NetBSD: if_le.c,v 1.38 2009/09/16 11:17:19 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_le.c,v 1.37 2009/09/08 18:15:17 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: if_le.c,v 1.38 2009/09/16 11:17:19 tsutsui Exp $); #include opt_inet.h #include bpfilter.h @@ -147,10 +147,9 @@ { struct le_softc *lesc = device_private(self); struct lance_softc *sc = lesc-sc_am7990.lsc; - struct sbus_softc *sbsc = device_private(parent); struct sbus_attach_args *sa = aux; bus_dma_tag_t dmatag; - struct sbusdev *sd; + cfdriver_t lebufcd; sc-sc_dev = self; lesc-sc_bustag = sa-sa_bustag; @@ -171,26 +170,51 @@ * a pre-historic ROM that doesn't establish le=lebuffer * parent-child relationships. */ - for (sd = sbsc-sc_sbdev; sd != NULL; sd = sd-sd_bchain) { - - struct lebuf_softc *lebuf = device_private(sd-sd_dev); - - if (strncmp(lebuffer, device_xname(sd-sd_dev), 8) != 0) - continue; - - if (lebuf-attached != 0) - continue; - - sc-sc_mem = lebuf-sc_buffer; - sc-sc_memsize = lebuf-sc_bufsiz; - sc-sc_addr = 0; /* Lance view is offset by buffer location */ - lebuf-attached = 1; - - /* That old black magic... */ - sc-sc_conf3 = prom_getpropint(sa-sa_node, - busmaster-regval, - LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON); - break; + lebufcd = config_cfdriver_lookup(lebuffer); + if (lebufcd != NULL) { + int unit; + + /* Check all possible lebuffer units */ + for (unit = 0; unit lebufcd-cd_ndevs; unit++) { + device_t lebufdev; + struct lebuf_softc *lebufsc; + + /* Check if unit is valid */ + lebufdev = device_lookup(lebufcd, unit); + if (lebufdev == NULL) +continue; + + /* Check if we have a common sbus parent */ + if (parent != device_parent(lebufdev)) +continue; + lebufsc = device_private(lebufdev); + + /* + * Check if this lebuffer unit is attached + * but unused by its child, if_le_lebuffer. + * XXX: this won't work if lebuffer is configured + * but not le at lebuffer? + */ + if (lebufsc-sc_buffer == 0 || lebufsc-attached != 0) +continue; + + /* Assume this lebuffer is my pair */ + sc-sc_mem = lebufsc-sc_buffer; + sc-sc_memsize = lebufsc-sc_bufsiz; + + /* Lance view is offset by buffer location */ + sc-sc_addr = 0; + + /* Denote it */ + aprint_normal( (%s), device_xname(lebufdev)); + lebufsc-attached = 1; + + /* That old black magic... */ + sc-sc_conf3 = prom_getpropint(sa-sa_node, + busmaster-regval, + LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON); + break; + } } lesc-sc_sd.sd_reset = le_sbus_reset;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Wed Sep 16 13:05:07 UTC 2009 Modified Files: src/sys/dev/sbus: cgthree_sbus.c Log Message: Make cgthree(4) match prior to genfb(4). Required by cgthree(4) on SS1+. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sbus/cgthree_sbus.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/dev/sbus/cgthree_sbus.c diff -u src/sys/dev/sbus/cgthree_sbus.c:1.25 src/sys/dev/sbus/cgthree_sbus.c:1.26 --- src/sys/dev/sbus/cgthree_sbus.c:1.25 Tue May 12 14:43:59 2009 +++ src/sys/dev/sbus/cgthree_sbus.c Wed Sep 16 13:05:07 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cgthree_sbus.c,v 1.25 2009/05/12 14:43:59 cegger Exp $ */ +/* $NetBSD: cgthree_sbus.c,v 1.26 2009/09/16 13:05:07 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cgthree_sbus.c,v 1.25 2009/05/12 14:43:59 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: cgthree_sbus.c,v 1.26 2009/09/16 13:05:07 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -125,7 +125,10 @@ { struct sbus_attach_args *sa = aux; - return (strcmp(cf-cf_name, sa-sa_name) == 0); + if (strcmp(cf-cf_name, sa-sa_name) == 0) + return 100; /* beat genfb(4) */ + + return 0; } /*
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Tue Sep 8 18:15:17 UTC 2009 Modified Files: src/sys/dev/sbus: esp_sbus.c if_hme_sbus.c if_le.c if_le_lebuffer.c if_le_ledma.c Log Message: Fix botch on device_t/softc split caused by awful casts around registration of (*sd_reset)(device_t) in struct sbusdev via sbus_establish(). XXX: (*sd_reset)() in struct sbusdev seems called from only sbusreset(), XXX: but there is no function which calls sbusreset()??? To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/sbus/esp_sbus.c cvs rdiff -u -r1.31 -r1.32 src/sys/dev/sbus/if_hme_sbus.c \ src/sys/dev/sbus/if_le_ledma.c cvs rdiff -u -r1.36 -r1.37 src/sys/dev/sbus/if_le.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/sbus/if_le_lebuffer.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/dev/sbus/esp_sbus.c diff -u src/sys/dev/sbus/esp_sbus.c:1.48 src/sys/dev/sbus/esp_sbus.c:1.49 --- src/sys/dev/sbus/esp_sbus.c:1.48 Tue May 12 14:43:59 2009 +++ src/sys/dev/sbus/esp_sbus.c Tue Sep 8 18:15:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: esp_sbus.c,v 1.48 2009/05/12 14:43:59 cegger Exp $ */ +/* $NetBSD: esp_sbus.c,v 1.49 2009/09/08 18:15:17 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: esp_sbus.c,v 1.48 2009/05/12 14:43:59 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: esp_sbus.c,v 1.49 2009/09/08 18:15:17 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -101,6 +101,8 @@ static void esp_dma_stop(struct ncr53c9x_softc *); static int esp_dma_isactive(struct ncr53c9x_softc *); +static void esp_sbus_reset(device_t); + #ifdef DDB static void esp_init_ddb_cmds(void); #endif @@ -287,7 +289,7 @@ esc-sc_pri = sa-sa_pri; /* add me to the sbus structures */ - esc-sc_sd.sd_reset = (void *)ncr53c9x_reset; + esc-sc_sd.sd_reset = esp_sbus_reset; sbus_establish(esc-sc_sd, self); espattach(esc, esp_sbus_glue); @@ -347,7 +349,7 @@ esc-sc_pri = sa-sa_pri; /* add me to the sbus structures */ - esc-sc_sd.sd_reset = (void *)ncr53c9x_reset; + esc-sc_sd.sd_reset = esp_sbus_reset; sbus_establish(esc-sc_sd, self); if (strcmp(ptscII, sa-sa_name) == 0) { @@ -407,7 +409,7 @@ esc-sc_pri = sa-sa_pri; /* Assume SBus is grandparent */ - esc-sc_sd.sd_reset = (void *)ncr53c9x_reset; + esc-sc_sd.sd_reset = esp_sbus_reset; sbus_establish(esc-sc_sd, parent); espattach(esc, esp_sbus_glue); @@ -700,6 +702,15 @@ return DMA_ISACTIVE(esc-sc_dma); } +void +esp_sbus_reset(device_t self) +{ + struct esp_softc *esc = device_private(self); + struct ncr53c9x_softc *sc = esc-sc_ncr53c9x; + + ncr53c9x_reset(sc); +} + #ifdef DDB #include machine/db_machdep.h #include ddb/db_output.h Index: src/sys/dev/sbus/if_hme_sbus.c diff -u src/sys/dev/sbus/if_hme_sbus.c:1.31 src/sys/dev/sbus/if_hme_sbus.c:1.32 --- src/sys/dev/sbus/if_hme_sbus.c:1.31 Sun May 17 01:33:24 2009 +++ src/sys/dev/sbus/if_hme_sbus.c Tue Sep 8 18:15:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: if_hme_sbus.c,v 1.31 2009/05/17 01:33:24 tsutsui Exp $ */ +/* $NetBSD: if_hme_sbus.c,v 1.32 2009/09/08 18:15:17 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_hme_sbus.c,v 1.31 2009/05/17 01:33:24 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: if_hme_sbus.c,v 1.32 2009/09/08 18:15:17 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -66,6 +66,8 @@ int hmematch_sbus(device_t, cfdata_t, void *); void hmeattach_sbus(device_t, device_t, void *); +static void hme_sbus_reset(device_t); + CFATTACH_DECL_NEW(hme_sbus, sizeof(struct hmesbus_softc), hmematch_sbus, hmeattach_sbus, NULL, NULL); @@ -157,7 +159,7 @@ return; } - sd-sd_reset = (void *)hme_reset; + sd-sd_reset = hme_sbus_reset; sbus_establish(sd, self); prom_getether(node, sc-sc_enaddr); @@ -190,3 +192,12 @@ (void)bus_intr_establish(sa-sa_bustag, sa-sa_pri, IPL_NET, hme_intr, sc); } + +void +hme_sbus_reset(device_t self) +{ + struct hmesbus_softc *hsc = device_private(self); + struct hme_softc *sc = hsc-hsc_hme; + + hme_reset(sc); +} Index: src/sys/dev/sbus/if_le_ledma.c diff -u src/sys/dev/sbus/if_le_ledma.c:1.31 src/sys/dev/sbus/if_le_ledma.c:1.32 --- src/sys/dev/sbus/if_le_ledma.c:1.31 Sun Apr 12 11:10:28 2009 +++ src/sys/dev/sbus/if_le_ledma.c Tue Sep 8 18:15:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_ledma.c,v 1.31 2009/04/12 11:10:28 tsutsui Exp $ */ +/* $NetBSD: if_le_ledma.c,v 1.32 2009/09/08 18:15:17 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_le_ledma.c,v 1.31 2009/04/12 11:10:28 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: if_le_ledma.c,v 1.32 2009/09/08 18:15:17 tsutsui Exp $);
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: tsutsui Date: Tue Sep 8 18:31:36 UTC 2009 Modified Files: src/sys/dev/sbus: esp_sbus.c if_le_lebuffer.c if_le_ledma.c Log Message: sbus_establish() should take device_t self for the device itself, not device_t parent even if sbus is grandparent of the device, otherwise (*sd_reset)() callbacks will be called with an wrong device_t. Even in such case, sbus_establish() looks for an sbus though device tree. XXX: (*sd_reset)() isn't called anyway, and these stuff seems really bogus. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/sbus/esp_sbus.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sbus/if_le_lebuffer.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/sbus/if_le_ledma.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/dev/sbus/esp_sbus.c diff -u src/sys/dev/sbus/esp_sbus.c:1.49 src/sys/dev/sbus/esp_sbus.c:1.50 --- src/sys/dev/sbus/esp_sbus.c:1.49 Tue Sep 8 18:15:17 2009 +++ src/sys/dev/sbus/esp_sbus.c Tue Sep 8 18:31:36 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: esp_sbus.c,v 1.49 2009/09/08 18:15:17 tsutsui Exp $ */ +/* $NetBSD: esp_sbus.c,v 1.50 2009/09/08 18:31:36 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: esp_sbus.c,v 1.49 2009/09/08 18:15:17 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: esp_sbus.c,v 1.50 2009/09/08 18:31:36 tsutsui Exp $); #include sys/param.h #include sys/systm.h @@ -408,9 +408,9 @@ esc-sc_pri = sa-sa_pri; - /* Assume SBus is grandparent */ + /* SBus is grandparent, but sbus_establish() looks for it properly */ esc-sc_sd.sd_reset = esp_sbus_reset; - sbus_establish(esc-sc_sd, parent); + sbus_establish(esc-sc_sd, self); espattach(esc, esp_sbus_glue); } Index: src/sys/dev/sbus/if_le_lebuffer.c diff -u src/sys/dev/sbus/if_le_lebuffer.c:1.25 src/sys/dev/sbus/if_le_lebuffer.c:1.26 --- src/sys/dev/sbus/if_le_lebuffer.c:1.25 Tue Sep 8 18:15:17 2009 +++ src/sys/dev/sbus/if_le_lebuffer.c Tue Sep 8 18:31:36 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_lebuffer.c,v 1.25 2009/09/08 18:15:17 tsutsui Exp $ */ +/* $NetBSD: if_le_lebuffer.c,v 1.26 2009/09/08 18:31:36 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_le_lebuffer.c,v 1.25 2009/09/08 18:15:17 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: if_le_lebuffer.c,v 1.26 2009/09/08 18:31:36 tsutsui Exp $); #include opt_inet.h #include bpfilter.h @@ -175,9 +175,9 @@ sc-sc_conf3 = prom_getpropint(sa-sa_node, busmaster-regval, LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON); - /* Assume SBus is grandparent */ + /* SBus is grandparent, but sbus_establish() looks for it properly */ lesc-sc_sd.sd_reset = le_lebuffer_reset; - sbus_establish(lesc-sc_sd, parent); + sbus_establish(lesc-sc_sd, self); sc-sc_supmedia = lemedia; sc-sc_nsupmedia = NLEMEDIA; Index: src/sys/dev/sbus/if_le_ledma.c diff -u src/sys/dev/sbus/if_le_ledma.c:1.32 src/sys/dev/sbus/if_le_ledma.c:1.33 --- src/sys/dev/sbus/if_le_ledma.c:1.32 Tue Sep 8 18:15:17 2009 +++ src/sys/dev/sbus/if_le_ledma.c Tue Sep 8 18:31:36 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_ledma.c,v 1.32 2009/09/08 18:15:17 tsutsui Exp $ */ +/* $NetBSD: if_le_ledma.c,v 1.33 2009/09/08 18:31:36 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_le_ledma.c,v 1.32 2009/09/08 18:15:17 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: if_le_ledma.c,v 1.33 2009/09/08 18:31:36 tsutsui Exp $); #include opt_inet.h #include bpfilter.h @@ -391,9 +391,9 @@ sc-sc_conf3 = LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON; lesc-sc_lostcount = 0; - /* Assume SBus is grandparent */ + /* SBus is grandparent, but sbus_establish looks for it properly */ lesc-sc_sd.sd_reset = le_ledma_reset; - sbus_establish(lesc-sc_sd, parent); + sbus_establish(lesc-sc_sd, self); sc-sc_mediachange = lemediachange; sc-sc_mediastatus = lemediastatus;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Aug 26 22:36:07 UTC 2009 Modified Files: src/sys/dev/sbus: tcx.c Log Message: adjust some mmap ranges so X can work, also use FBTYPE_TCXCOLOR To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.39 src/sys/dev/sbus/tcx.c:1.40 --- src/sys/dev/sbus/tcx.c:1.39 Thu Aug 20 02:29:16 2009 +++ src/sys/dev/sbus/tcx.c Wed Aug 26 22:36:07 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.39 2009/08/20 02:29:16 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.40 2009/08/26 22:36:07 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.39 2009/08/20 02:29:16 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.40 2009/08/26 22:36:07 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -273,11 +273,11 @@ fb-fb_type.fb_cmsize = 256; fb-fb_type.fb_size = ramsize; - printf(: %s, %d x %d, OBPNAME, + printf(%s: %s, %d x %d, device_xname(self), OBPNAME, fb-fb_type.fb_width, fb-fb_type.fb_height); - fb-fb_type.fb_type = FBTYPE_SUNTCX; + fb-fb_type.fb_type = FBTYPE_TCXCOLOR; if (sa-sa_nreg != TCX_NREG) { @@ -619,7 +619,7 @@ { TCX_USER_RBLIT, 1, TCX_REG_RBLIT }, { TCX_USER_TEC, 1, TCX_REG_TEC }, { TCX_USER_BTREGS, 8192 /* XXX */, TCX_REG_CMAP }, - { TCX_USER_THC, 0x1000, TCX_REG_THC }, + { TCX_USER_THC, 0x2000, TCX_REG_THC }, { TCX_USER_DHC, 1, TCX_REG_DHC }, { TCX_USER_ALT, 1, TCX_REG_ALT }, { TCX_USER_ROM, 65536, TCX_REG_ROM }, @@ -645,8 +645,10 @@ for (; mo mo_end; mo++) { if ((u_int)off mo-mo_uaddr) continue; + u = off - mo-mo_uaddr; sz = mo-mo_size; + if (sz == 0) { sz = sc-sc_fb.fb_type.fb_size; /* @@ -664,6 +666,9 @@ sz *= 4; } } + if (sz == 1) + sz = rr[mo-mo_bank].oa_size; + if (u sz) { return (bus_space_mmap(sc-sc_bustag, BUS_ADDR(rr[mo-mo_bank].oa_space,
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Aug 19 20:51:47 UTC 2009 Modified Files: src/sys/dev/sbus: tcx.c Log Message: clear the screen and initialize it with the right WID to bypass the LUT on 24bit boards when switching to WSDISPLAYIO_MODE_FB Now 24bit X with wsfb looks right. TODO: - hardware cursor - acceleration To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.35 src/sys/dev/sbus/tcx.c:1.36 --- src/sys/dev/sbus/tcx.c:1.35 Wed Aug 19 03:45:51 2009 +++ src/sys/dev/sbus/tcx.c Wed Aug 19 20:51:47 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: tcx.c,v 1.35 2009/08/19 03:45:51 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.36 2009/08/19 20:51:47 macallan Exp $ */ /* - * Copyright (c) 1996,1998 The NetBSD Foundation, Inc. + * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.35 2009/08/19 03:45:51 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.36 2009/08/19 20:51:47 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -174,7 +174,7 @@ static paddr_t tcx_mmap(void *, void *, off_t, int); static void tcx_init_screen(void *, struct vcons_screen *, int, long *); -static void tcx_clearscreen(struct tcx_softc *); +static void tcx_clearscreen(struct tcx_softc *, int); static void tcx_copyrows(void *, int, int, int); static void tcx_eraserows(void *, int, int, long); static void tcx_putchar(void *, int, int, u_int, long); @@ -380,7 +380,7 @@ tcx_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; sc-sc_bg = (defattr 16) 0xff; - tcx_clearscreen(sc); + tcx_clearscreen(sc, 0); ri = tcx_console_screen.scr_ri; @@ -502,9 +502,6 @@ bus_space_write_4(sc-sc_bustag, sc-sc_bt, DAC_CONTROL_1, 0); } -/* - * Load a subset of the current (new) colormap into the color DAC. - */ static void tcx_loadcmap(struct tcx_softc *sc, int start, int ncolors) { @@ -726,9 +723,10 @@ if (new_mode == WSDISPLAYIO_MODE_EMUL) { tcx_loadcmap(sc, 0, 256); - tcx_clearscreen(sc); + tcx_clearscreen(sc, 0); vcons_redraw_screen(ms); - } + } else if (!sc-sc_8bit) + tcx_clearscreen(sc, 3); } } } @@ -792,13 +790,17 @@ } static void -tcx_clearscreen(struct tcx_softc *sc) +tcx_clearscreen(struct tcx_softc *sc, int spc) { uint64_t bg = ((uint64_t)sc-sc_bg 32) | 0xLL; + uint64_t spc64; int i; + spc64 = spc 3; + spc64 = spc64 56; + for (i = 0; i 1024 * 1024; i += 32) - sc-sc_rstip[i] = bg; + sc-sc_rstip[i] = bg | spc64; } static void
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Thu Aug 20 00:59:28 UTC 2009 Modified Files: src/sys/dev/sbus: tcx.c Log Message: add support for a hardware cursor via wsdisplay To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.36 src/sys/dev/sbus/tcx.c:1.37 --- src/sys/dev/sbus/tcx.c:1.36 Wed Aug 19 20:51:47 2009 +++ src/sys/dev/sbus/tcx.c Thu Aug 20 00:59:28 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.36 2009/08/19 20:51:47 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.37 2009/08/20 00:59:28 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.36 2009/08/19 20:51:47 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.37 2009/08/20 00:59:28 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -101,6 +101,8 @@ u_char sc_cmap_green[256]; u_char sc_cmap_blue[256]; int sc_mode, sc_bg; + int sc_cursor_x, sc_cursor_y; + int sc_hotspot_x, sc_hotspot_y; struct vcons_data vd; }; @@ -179,6 +181,8 @@ static void tcx_eraserows(void *, int, int, long); static void tcx_putchar(void *, int, int, u_int, long); static void tcx_set_video(struct tcx_softc *, int); +static int tcx_do_cursor(struct tcx_softc *, struct wsdisplay_cursor *); +static void tcx_set_cursor(struct tcx_softc *); struct wsdisplay_accessops tcx_accessops = { tcx_ioctl, @@ -238,6 +242,11 @@ sc-sc_bustag = sa-sa_bustag; node = sa-sa_node; + sc-sc_cursor_x = 0x7fff; + sc-sc_cursor_y = 0x7fff; + sc-sc_hotspot_x = 0; + sc-sc_hotspot_y = 0; + fb-fb_driver = tcx_fbdriver; fb-fb_device = sc-sc_dev; /* Mask out invalid flags from the user. */ @@ -357,6 +366,7 @@ } tcx_loadcmap(sc, 0, 256); + tcx_set_cursor(sc); /* enable video */ confreg = bus_space_read_4(sa-sa_bustag, sc-sc_thc, THC_MISC); confreg |= THC_MISC_VIDEN; @@ -495,11 +505,11 @@ static void tcx_reset(struct tcx_softc *sc) { + uint32_t reg; - /* Disable cursor in Brooktree DAC. */ - bus_space_write_4(sc-sc_bustag, sc-sc_bt, DAC_ADDRESS, - DAC_C1_CONTROL_0); - bus_space_write_4(sc-sc_bustag, sc-sc_bt, DAC_CONTROL_1, 0); + reg = bus_space_read_4(sc-sc_bustag, sc-sc_thc, THC_MISC); + reg |= THC_MISC_CURSRES; + bus_space_write_4(sc-sc_bustag, sc-sc_thc, THC_MISC, reg); } static void @@ -729,6 +739,40 @@ tcx_clearscreen(sc, 3); } } + case WSDISPLAYIO_GCURPOS: + { +struct wsdisplay_curpos *cp = (void *)data; + +cp-x = sc-sc_cursor_x; +cp-y = sc-sc_cursor_y; + } + return 0; + + case WSDISPLAYIO_SCURPOS: + { +struct wsdisplay_curpos *cp = (void *)data; + +sc-sc_cursor_x = cp-x; +sc-sc_cursor_y = cp-y; +tcx_set_cursor(sc); + } + return 0; + + case WSDISPLAYIO_GCURMAX: + { +struct wsdisplay_curpos *cp = (void *)data; + +cp-x = 32; +cp-y = 32; + } + return 0; + + case WSDISPLAYIO_SCURSOR: + { +struct wsdisplay_cursor *cursor = (void *)data; + +return tcx_do_cursor(sc, cursor); + } } return EPASSTHROUGH; } @@ -1008,3 +1052,90 @@ } } +static int +tcx_do_cursor(struct tcx_softc *sc, struct wsdisplay_cursor *cur) +{ + if (cur-which WSDISPLAY_CURSOR_DOCUR) { + + if (cur-enable) { + tcx_set_cursor(sc); + } else { + /* move the cursor out of sight */ + bus_space_write_4(sc-sc_bustag, sc-sc_thc, + THC_CURSOR_POS, 0x7fff7fff); + } + } + if (cur-which WSDISPLAY_CURSOR_DOHOT) { + + sc-sc_hotspot_x = cur-hot.x; + sc-sc_hotspot_y = cur-hot.y; + tcx_set_cursor(sc); + } + if (cur-which WSDISPLAY_CURSOR_DOPOS) { + + sc-sc_cursor_x = cur-pos.x; + sc-sc_cursor_y = cur-pos.y; + tcx_set_cursor(sc); + } + if (cur-which WSDISPLAY_CURSOR_DOCMAP) { +#if 0 + int i; + + for (i = 0; i cur-cmap.count; i++) { + bus_space_write_4(sc-sc_bustag, sc-sc_bt, DAC_ADDRESS, + (cur-cmap.index + i + 2) 24); + bus_space_write_4(sc-sc_bustag, sc-sc_bt, + DAC_CURSOR_LUT, cur-cmap.red[i] 24); + bus_space_write_4(sc-sc_bustag, sc-sc_bt, + DAC_CURSOR_LUT, cur-cmap.green[i] 24); + bus_space_write_4(sc-sc_bustag, sc-sc_bt, + DAC_CURSOR_LUT, cur-cmap.blue[i] 24); + } +#endif + } + if (cur-which WSDISPLAY_CURSOR_DOSHAPE) { +#if 1 + int i; + uint32_t temp, poof; + + for (i = 0; i 128; i += 4) { + memcpy(temp, cur-mask[i], 4); + printf(%08x - , temp); + poof = ((temp 0x80808080) 7) | + ((temp 0x40404040) 5) | + ((temp 0x20202020) 3) | + ((temp 0x10101010) 1) | + ((temp 0x08080808) 1) | + ((temp 0x04040404) 3) | + ((temp 0x02020202) 5) | + ((temp 0x01010101) 7); + printf(%08x\n, poof); + bus_space_write_4(sc-sc_bustag, sc-sc_thc, +
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Thu Aug 20 02:01:55 UTC 2009 Modified Files: src/sys/dev/sbus: tcx.c Log Message: use vcons_replay_msgbuf() To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.37 src/sys/dev/sbus/tcx.c:1.38 --- src/sys/dev/sbus/tcx.c:1.37 Thu Aug 20 00:59:28 2009 +++ src/sys/dev/sbus/tcx.c Thu Aug 20 02:01:55 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.37 2009/08/20 00:59:28 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.38 2009/08/20 02:01:55 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.37 2009/08/20 00:59:28 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.38 2009/08/20 02:01:55 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -403,6 +403,8 @@ wsdisplay_cnattach(tcx_defscreendesc, ri, 0, 0, defattr); } + vcons_replay_msgbuf(tcx_console_screen); + aa.console = isconsole; aa.scrdata = tcx_screenlist; aa.accessops = tcx_accessops; @@ -1079,6 +1081,10 @@ } if (cur-which WSDISPLAY_CURSOR_DOCMAP) { #if 0 + /* + * apparently we're not writing in the right register here - if we do + * this the screen goes all funky + */ int i; for (i = 0; i cur-cmap.count; i++) { @@ -1094,7 +1100,6 @@ #endif } if (cur-which WSDISPLAY_CURSOR_DOSHAPE) { -#if 1 int i; uint32_t temp, poof; @@ -1125,7 +1130,6 @@ THC_CURSOR_0 + i, poof); } } -#endif return 0; }
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Thu Aug 20 02:29:17 UTC 2009 Modified Files: src/sys/dev/sbus: agten.c p9100.c tcx.c Log Message: call vcons_replay_msgbuf() if we're the console To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/sbus/agten.c cvs rdiff -u -r1.46 -r1.47 src/sys/dev/sbus/p9100.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/sbus/tcx.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/dev/sbus/agten.c diff -u src/sys/dev/sbus/agten.c:1.19 src/sys/dev/sbus/agten.c:1.20 --- src/sys/dev/sbus/agten.c:1.19 Tue May 26 03:32:51 2009 +++ src/sys/dev/sbus/agten.c Thu Aug 20 02:29:16 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: agten.c,v 1.19 2009/05/26 03:32:51 macallan Exp $ */ +/* $NetBSD: agten.c,v 1.20 2009/08/20 02:29:16 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.19 2009/05/26 03:32:51 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: agten.c,v 1.20 2009/08/20 02:29:16 macallan Exp $); /* * a driver for the Fujitsu AG-10e SBus framebuffer @@ -314,6 +314,7 @@ i128_rectfill(sc-sc_bustag, sc-sc_i128_regh, 0, 0, sc-sc_width, sc-sc_height, ri-ri_devcmap[(defattr 16) 0xff]); + vcons_replay_msgbuf(sc-sc_console_screen); } else { /* * since we're not the console we can postpone the rest Index: src/sys/dev/sbus/p9100.c diff -u src/sys/dev/sbus/p9100.c:1.46 src/sys/dev/sbus/p9100.c:1.47 --- src/sys/dev/sbus/p9100.c:1.46 Wed Jun 3 16:25:22 2009 +++ src/sys/dev/sbus/p9100.c Thu Aug 20 02:29:16 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.46 2009/06/03 16:25:22 macallan Exp $ */ +/* $NetBSD: p9100.c,v 1.47 2009/08/20 02:29:16 macallan Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.46 2009/06/03 16:25:22 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.47 2009/08/20 02:29:16 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -460,6 +460,7 @@ if(isconsole) { wsdisplay_cnattach(p9100_defscreendesc, ri, 0, 0, defattr); + vcons_replay_msgbuf(p9100_console_screen); } aa.console = isconsole; @@ -1083,7 +1084,7 @@ int fg, bg, uc, i; uint8_t *data; - int x, y, wi,he; + int x, y, wi, he; wi = ri-ri_font-fontwidth; he = ri-ri_font-fontheight; Index: src/sys/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.38 src/sys/dev/sbus/tcx.c:1.39 --- src/sys/dev/sbus/tcx.c:1.38 Thu Aug 20 02:01:55 2009 +++ src/sys/dev/sbus/tcx.c Thu Aug 20 02:29:16 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.38 2009/08/20 02:01:55 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.39 2009/08/20 02:29:16 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.38 2009/08/20 02:01:55 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.39 2009/08/20 02:29:16 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -401,10 +401,9 @@ if(isconsole) { wsdisplay_cnattach(tcx_defscreendesc, ri, 0, 0, defattr); + vcons_replay_msgbuf(tcx_console_screen); } - vcons_replay_msgbuf(tcx_console_screen); - aa.console = isconsole; aa.scrdata = tcx_screenlist; aa.accessops = tcx_accessops;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Aug 18 20:45:42 UTC 2009 Modified Files: src/sys/dev/sbus: tcx.c Log Message: device_t-ify To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.32 src/sys/dev/sbus/tcx.c:1.33 --- src/sys/dev/sbus/tcx.c:1.32 Thu Aug 6 18:26:03 2009 +++ src/sys/dev/sbus/tcx.c Tue Aug 18 20:45:42 2009 @@ -1,11 +1,11 @@ -/* $NetBSD: tcx.c,v 1.32 2009/08/06 18:26:03 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.33 2009/08/18 20:45:42 macallan Exp $ */ /* * Copyright (c) 1996,1998 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation - * by Paul Kranenburg. + * by Paul Kranenburg and Michael Lorenz. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.32 2009/08/06 18:26:03 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.33 2009/08/18 20:45:42 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -83,7 +83,7 @@ /* per-display variables */ struct tcx_softc { - struct device sc_dev; /* base device */ + device_t sc_dev; /* base device */ struct sbusdev sc_sd; /* sbus device */ struct fbdevice sc_fb; /* frame buffer device */ bus_space_tag_t sc_bustag; @@ -146,7 +146,7 @@ static int tcxmatch(device_t, cfdata_t, void *); static void tcx_unblank(device_t); -CFATTACH_DECL(tcx, sizeof(struct tcx_softc), +CFATTACH_DECL_NEW(tcx, sizeof(struct tcx_softc), tcxmatch, tcxattach, NULL, NULL); extern struct cfdriver tcx_cd; @@ -233,13 +233,14 @@ int isconsole, i, j; uint32_t confreg; + sc-sc_dev = self; sc-sc_bustag = sa-sa_bustag; node = sa-sa_node; fb-fb_driver = tcx_fbdriver; - fb-fb_device = sc-sc_dev; + fb-fb_device = sc-sc_dev; /* Mask out invalid flags from the user. */ - fb-fb_flags = device_cfdata(sc-sc_dev)-cf_flags FB_USERMASK; + fb-fb_flags = device_cfdata(sc-sc_dev)-cf_flags FB_USERMASK; /* * The onboard framebuffer on the SS4 supports only 8-bit mode; * it can be distinguished from the S24 card for the SS5 by the @@ -365,11 +366,7 @@ } else printf(\n); - bus_space_write_4(sa-sa_bustag, sc-sc_bt, DAC_ADDRESS, 0); - printf(DAC ID: %02x %02x\n, - bus_space_read_1(sa-sa_bustag, sc-sc_bt, DAC_CONTROL_1), - bus_space_read_1(sa-sa_bustag, sc-sc_bt, DAC_CONTROL_1)); - sbus_establish(sc-sc_sd, sc-sc_dev); + sbus_establish(sc-sc_sd, sc-sc_dev); fb_attach(sc-sc_fb, isconsole); sc-sc_mode = WSDISPLAYIO_MODE_EMUL; @@ -542,7 +539,7 @@ case FBIOSVIDEO: if (*(int *)data) - tcx_unblank(sc-sc_dev); + tcx_unblank(sc-sc_dev); else if (!sc-sc_blanked) { sc-sc_blanked = 1; //sc-sc_thc-thc_hcmisc = ~THC_MISC_VIDEN;
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Aug 19 03:35:33 UTC 2009 Modified Files: src/sys/dev/sbus: tcx.c Log Message: - some cosmetic fixes - add support for screen blanking via /dev/fb* - reimplement colour map ioctl()s for /dev/fb* - implement mmap and ioctl for wscons, map 8 or 24bit framebuffer depending on hardware With this X works with the wsfb driver in 24bit. TODO: - fix wsfb to use the right pixel format for S24 - implement wsdisplay colour map ioctl()s - add hardware cursor support for wscons and /dev/fb* To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.33 src/sys/dev/sbus/tcx.c:1.34 --- src/sys/dev/sbus/tcx.c:1.33 Tue Aug 18 20:45:42 2009 +++ src/sys/dev/sbus/tcx.c Wed Aug 19 03:35:32 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.33 2009/08/18 20:45:42 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.34 2009/08/19 03:35:32 macallan Exp $ */ /* * Copyright (c) 1996,1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.33 2009/08/18 20:45:42 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.34 2009/08/19 03:35:32 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -87,7 +87,7 @@ struct sbusdev sc_sd; /* sbus device */ struct fbdevice sc_fb; /* frame buffer device */ bus_space_tag_t sc_bustag; - struct openprom_addr sc_physadr[TCX_NREG];/* phys addr of h/w */ + struct openprom_addr sc_physaddr[TCX_NREG];/* phys addr of h/w */ bus_space_handle_t sc_bt; /* Brooktree registers */ bus_space_handle_t sc_thc; /* THC registers */ @@ -251,11 +251,11 @@ fb_setsize_obp(fb, fb-fb_type.fb_depth, 1152, 900, node); if (sc-sc_8bit) { - printf( {8bit only TCX)); + printf( (8bit only TCX)); ramsize = 1024 * 1024; /* XXX - fix THC and TEC offsets */ - sc-sc_physadr[TCX_REG_TEC].oa_base += 0x1000; - sc-sc_physadr[TCX_REG_THC].oa_base += 0x1000; + sc-sc_physaddr[TCX_REG_TEC].oa_base += 0x1000; + sc-sc_physaddr[TCX_REG_THC].oa_base += 0x1000; } else { printf( (S24)\n); ramsize = 4 * 1024 * 1024; @@ -275,13 +275,13 @@ device_xname(self), sa-sa_nreg); return; } - memcpy(sc-sc_physadr, sa-sa_reg, + memcpy(sc-sc_physaddr, sa-sa_reg, sa-sa_nreg * sizeof(struct openprom_addr)); /* Map the register banks we care about */ if (sbus_bus_map(sa-sa_bustag, - sc-sc_physadr[TCX_REG_THC].oa_space, - sc-sc_physadr[TCX_REG_THC].oa_base, + sc-sc_physaddr[TCX_REG_THC].oa_space, + sc-sc_physaddr[TCX_REG_THC].oa_base, 0x1000, BUS_SPACE_MAP_LINEAR, sc-sc_thc) != 0) { printf(tcxattach: cannot map thc registers\n); @@ -289,8 +289,8 @@ } if (sbus_bus_map(sa-sa_bustag, - sc-sc_physadr[TCX_REG_CMAP].oa_space, - sc-sc_physadr[TCX_REG_CMAP].oa_base, + sc-sc_physaddr[TCX_REG_CMAP].oa_space, + sc-sc_physaddr[TCX_REG_CMAP].oa_base, 0x1000, BUS_SPACE_MAP_LINEAR, sc-sc_bt) != 0) { printf(tcxattach: cannot map bt registers\n); @@ -299,8 +299,8 @@ /* map the 8bit dumb FB for the console */ if (sbus_bus_map(sa-sa_bustag, - sc-sc_physadr[TCX_REG_DFB8].oa_space, - sc-sc_physadr[TCX_REG_DFB8].oa_base, + sc-sc_physaddr[TCX_REG_DFB8].oa_space, + sc-sc_physaddr[TCX_REG_DFB8].oa_base, 1024 * 1024, BUS_SPACE_MAP_LINEAR, bh) != 0) { @@ -311,8 +311,8 @@ /* RBLIT space */ if (sbus_bus_map(sa-sa_bustag, - sc-sc_physadr[TCX_REG_RBLIT].oa_space, - sc-sc_physadr[TCX_REG_RBLIT].oa_base, + sc-sc_physaddr[TCX_REG_RBLIT].oa_space, + sc-sc_physaddr[TCX_REG_RBLIT].oa_base, 8 * 1024 * 1024, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, bh) != 0) { @@ -323,8 +323,8 @@ /* RSTIP space */ if (sbus_bus_map(sa-sa_bustag, - sc-sc_physadr[TCX_REG_RSTIP].oa_space, - sc-sc_physadr[TCX_REG_RSTIP].oa_base, + sc-sc_physaddr[TCX_REG_RSTIP].oa_space, + sc-sc_physaddr[TCX_REG_RSTIP].oa_base, 8 * 1024 * 1024, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, bh) != 0) { @@ -405,46 +405,9 @@ tcx_loadcmap(sc, 0, 256); } -#ifdef TCX_CG8 -/* - * keep track of the number of opens, so we can switch to 24-bit mode - * when the device is first opened, and return to 8-bit mode on the - * last close. (stolen from cgfourteen driver...) There can only be - * one TCX per system, so we only need one flag. - */ -static int tcx_opens = 0; -#endif - int tcxopen(dev_t dev, int flags, int mode, struct lwp *l) { -#ifdef TCX_CG8 - int unit = minor(dev); - struct tcx_softc *sc; - int i, s, oldopens; - volatile ulong *cptr; - struct fbdevice *fb; - - sc = device_lookup_private(tcx_cd, unit); - if (!sc) - return (ENXIO); - if (!sc-sc_8bit) { - s = splhigh(); - oldopens = tcx_opens++; - splx(s); - if (oldopens == 0) { - /* - *
CVS commit: src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Wed Aug 19 03:45:51 UTC 2009 Modified Files: src/sys/dev/sbus: tcx.c Log Message: - more cosmetics - support screen blanking ioctl()s on both /dev/fb* and wsdisplay To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sbus/tcx.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/dev/sbus/tcx.c diff -u src/sys/dev/sbus/tcx.c:1.34 src/sys/dev/sbus/tcx.c:1.35 --- src/sys/dev/sbus/tcx.c:1.34 Wed Aug 19 03:35:32 2009 +++ src/sys/dev/sbus/tcx.c Wed Aug 19 03:45:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.34 2009/08/19 03:35:32 macallan Exp $ */ +/* $NetBSD: tcx.c,v 1.35 2009/08/19 03:45:51 macallan Exp $ */ /* * Copyright (c) 1996,1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.34 2009/08/19 03:35:32 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.35 2009/08/19 03:45:51 macallan Exp $); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -178,6 +178,7 @@ static void tcx_copyrows(void *, int, int, int); static void tcx_eraserows(void *, int, int, long); static void tcx_putchar(void *, int, int, u_int, long); +static void tcx_set_video(struct tcx_softc *, int); struct wsdisplay_accessops tcx_accessops = { tcx_ioctl, @@ -425,7 +426,6 @@ tcxioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l) { struct tcx_softc *sc = device_lookup_private(tcx_cd, minor(dev)); - //int error; switch (cmd) { @@ -476,20 +476,7 @@ break; case FBIOSVIDEO: - if (*(int *)data) - tcx_unblank(sc-sc_dev); - else if (!sc-sc_blanked) { - uint32_t reg; - sc-sc_blanked = 1; - reg = bus_space_read_4(sc-sc_bustag, sc-sc_thc, - THC_MISC); - reg = ~THC_MISC_VIDEN; - /* Put monitor in `power-saving mode' */ - reg |= THC_MISC_VSYNC_DISABLE; - reg |= THC_MISC_HSYNC_DISABLE; - bus_space_write_4(sc-sc_bustag, sc-sc_thc, THC_MISC, - reg); - } + tcx_set_video(sc, *(int *)data); break; default: @@ -552,6 +539,27 @@ } } +static void +tcx_set_video(struct tcx_softc *sc, int unblank) +{ + uint32_t reg; + if (unblank) { + sc-sc_blanked = 0; + reg = bus_space_read_4(sc-sc_bustag, sc-sc_thc, THC_MISC); + reg = ~THC_MISC_VSYNC_DISABLE; + reg = ~THC_MISC_HSYNC_DISABLE; + reg |= THC_MISC_VIDEN; + bus_space_write_4(sc-sc_bustag, sc-sc_thc, THC_MISC, reg); + } else { + sc-sc_blanked = 1; + reg = bus_space_read_4(sc-sc_bustag, sc-sc_thc, THC_MISC); + reg |= THC_MISC_VSYNC_DISABLE; + reg |= THC_MISC_HSYNC_DISABLE; + reg = ~THC_MISC_VIDEN; + bus_space_write_4(sc-sc_bustag, sc-sc_thc, THC_MISC, reg); + } +} + /* * Base addresses at which users can mmap() the various pieces of a tcx. */ @@ -674,17 +682,16 @@ *(u_int *)data = WSDISPLAY_TYPE_SUNTCX; return 0; -#if 0 case FBIOGVIDEO: case WSDISPLAYIO_GVIDEO: - *(int *)data = tcx_get_video(sc); + *(int *)data = !sc-sc_blanked; return 0; case WSDISPLAYIO_SVIDEO: case FBIOSVIDEO: tcx_set_video(sc, *(int *)data); return 0; -#endif + case WSDISPLAYIO_GINFO: wdf = (void *)data; wdf-height = ms-scr_ri.ri_height;