CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 2 15:59:30 UTC 2024 Modified Files: src/sys/arch/next68k/dev: nextdisplay.c nextdisplayvar.h Log Message: Add WSDISPLAY_GINFO, LINEBYTES, and SMODE ioctl(2)s and mmap(2) support. mlterm-wscons partially works (no 2 bpp support) with these APIs. XXX: Xorg server needs wsmouse support. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/dev/nextdisplay.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/dev/nextdisplayvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/nextdisplay.c diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.30 src/sys/arch/next68k/dev/nextdisplay.c:1.31 --- src/sys/arch/next68k/dev/nextdisplay.c:1.30 Sat Feb 11 02:34:15 2023 +++ src/sys/arch/next68k/dev/nextdisplay.c Fri Feb 2 15:59:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $ */ +/* $NetBSD: nextdisplay.c,v 1.31 2024/02/02 15:59:30 tsutsui Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.31 2024/02/02 15:59:30 tsutsui Exp $"); #include /* RCS ID & Copyright macro defns */ @@ -170,6 +170,7 @@ nextdisplay_init(struct nextdisplay_conf dc->dc_wid = 1120; dc->dc_ht = 832; dc->dc_depth = color ? 16 : 2; + dc->dc_cmsize = color ? 256 : 4; dc->dc_rowbytes = (turbo ? 1120 : 1152) * dc->dc_depth / 8; dc->dc_videobase = dc->dc_vaddr; @@ -259,6 +260,8 @@ nextdisplay_attach(device_t parent, devi INTR_ENABLE(NEXT_I_C16_VIDEO); } + sc->sc_mode = WSDISPLAYIO_MODE_EMUL; + /* initialize the raster */ waa.console = isconsole; waa.scrdata = iscolor ? @@ -294,6 +297,7 @@ nextdisplay_ioctl(void *v, void *vs, u_l { struct nextdisplay_softc *sc = v; struct nextdisplay_config *dc = sc->sc_dc; + int new_mode; switch (cmd) { case WSDISPLAYIO_GTYPE: @@ -309,6 +313,25 @@ nextdisplay_ioctl(void *v, void *vs, u_l return EPASSTHROUGH; case WSDISPLAYIO_GINFO: +#define wsd_fbip ((struct wsdisplay_fbinfo *)data) + wsd_fbip->height = dc->dc_ht; + wsd_fbip->width = dc->dc_wid; + wsd_fbip->depth = dc->dc_depth; + wsd_fbip->cmsize = dc->dc_cmsize; +#undef wsd_fbip +return 0; + + case WSDISPLAYIO_LINEBYTES: + *(u_int *)data = dc->dc_rowbytes; + return 0; + + case WSDISPLAYIO_SMODE: + new_mode = *(int *)data; + if (new_mode != sc->sc_mode) { + sc->sc_mode = new_mode; + } + return 0; + case WSDISPLAYIO_GETCMAP: case WSDISPLAYIO_PUTCMAP: case WSDISPLAYIO_GVIDEO: @@ -326,10 +349,18 @@ nextdisplay_ioctl(void *v, void *vs, u_l static paddr_t nextdisplay_mmap(void *v, void *vs, off_t offset, int prot) { + struct nextdisplay_softc *sc = v; + struct nextdisplay_config *dc = sc->sc_dc; + paddr_t cookie = -1; + + switch (sc->sc_mode) { + case WSDISPLAYIO_MODE_DUMBFB: + if (offset >= 0 && offset < dc->dc_size) + cookie = m68k_btop(dc->dc_paddr + offset); + break; + } - /* XXX */ - printf("nextdisplay_mmap: failed\n"); - return -1; + return cookie; } int Index: src/sys/arch/next68k/dev/nextdisplayvar.h diff -u src/sys/arch/next68k/dev/nextdisplayvar.h:1.6 src/sys/arch/next68k/dev/nextdisplayvar.h:1.7 --- src/sys/arch/next68k/dev/nextdisplayvar.h:1.6 Fri Feb 3 23:13:00 2023 +++ src/sys/arch/next68k/dev/nextdisplayvar.h Fri Feb 2 15:59:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nextdisplayvar.h,v 1.6 2023/02/03 23:13:00 tsutsui Exp $ */ +/* $NetBSD: nextdisplayvar.h,v 1.7 2024/02/02 15:59:30 tsutsui Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis * All rights reserved. @@ -54,6 +54,7 @@ struct nextdisplay_config { int dc_ht; /* height of frame buffer */ int dc_depth; /* depth of frame buffer */ int dc_rowbytes; /* bytes in fb scan line */ + int dc_cmsize; struct raster dc_raster; /* raster description */ struct rcons dc_rcons; /* raster blitter control info */ @@ -67,6 +68,7 @@ struct nextdisplay_softc { device_t sc_dev; struct nextdisplay_config *sc_dc; + int sc_mode; int nscreens; };
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 2 15:59:30 UTC 2024 Modified Files: src/sys/arch/next68k/dev: nextdisplay.c nextdisplayvar.h Log Message: Add WSDISPLAY_GINFO, LINEBYTES, and SMODE ioctl(2)s and mmap(2) support. mlterm-wscons partially works (no 2 bpp support) with these APIs. XXX: Xorg server needs wsmouse support. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/dev/nextdisplay.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/dev/nextdisplayvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: andvar Date: Fri Oct 20 11:38:25 UTC 2023 Modified Files: src/sys/arch/next68k/dev: zs_kgdb.c Log Message: make zs_kgdb.c build for next68k. kgdb_dev expects llx/d format specifier. change serial number print message to the same as sgimips. remove rr0 definition in zs_kgdb_txint, it is unused. Fixes also KGDB enabled build for next68k. Similar or partial changes likely required for few other ports. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/dev/zs_kgdb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: andvar Date: Fri Oct 20 11:38:25 UTC 2023 Modified Files: src/sys/arch/next68k/dev: zs_kgdb.c Log Message: make zs_kgdb.c build for next68k. kgdb_dev expects llx/d format specifier. change serial number print message to the same as sgimips. remove rr0 definition in zs_kgdb_txint, it is unused. Fixes also KGDB enabled build for next68k. Similar or partial changes likely required for few other ports. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/dev/zs_kgdb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/zs_kgdb.c diff -u src/sys/arch/next68k/dev/zs_kgdb.c:1.12 src/sys/arch/next68k/dev/zs_kgdb.c:1.13 --- src/sys/arch/next68k/dev/zs_kgdb.c:1.12 Mon Apr 28 20:23:30 2008 +++ src/sys/arch/next68k/dev/zs_kgdb.c Fri Oct 20 11:38:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: zs_kgdb.c,v 1.12 2008/04/28 20:23:30 martin Exp $ */ +/* $NetBSD: zs_kgdb.c,v 1.13 2023/10/20 11:38:25 andvar Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zs_kgdb.c,v 1.12 2008/04/28 20:23:30 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zs_kgdb.c,v 1.13 2023/10/20 11:38:25 andvar Exp $"); #include "opt_kgdb.h" @@ -134,14 +134,14 @@ zs_kgdb_init(void) int channel; extern const struct cdevsw zstty_cdevsw; - printf("zs_kgdb_init: kgdb_dev=0x%x\n", kgdb_dev); + printf("zs_kgdb_init: kgdb_dev=0x%llx\n", kgdb_dev); if (cdevsw_lookup(kgdb_dev) != _cdevsw) return; /* Note: (ttya,ttyb) on zs0, and (ttyc,ttyd) on zs2 */ channel = kgdb_dev & 1; - printf("zs_kgdb_init: attaching tty%c at %d baud\n", - 'a' + (kgdb_dev & 3), kgdb_rate); + printf("zs_kgdb_init: attaching to Serial(%lld) at %d baud\n", + (kgdb_dev & 3), kgdb_rate); /* Setup temporary chanstate. */ memset(, 0, sizeof(cs)); @@ -244,9 +244,6 @@ zs_kgdb_rxint(struct zs_chanstate *cs) static void zs_kgdb_txint(struct zs_chanstate *cs) { - int rr0; - - rr0 = zs_read_csr(cs); zs_write_csr(cs, ZSWR0_RESET_TXINT); }
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: dbj Date: Sat Jun 10 17:14:57 UTC 2023 Modified Files: src/sys/arch/next68k/dev: mb8795reg.h Log Message: gratuitous commit to fix spelling error To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/mb8795reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/mb8795reg.h diff -u src/sys/arch/next68k/dev/mb8795reg.h:1.4 src/sys/arch/next68k/dev/mb8795reg.h:1.5 --- src/sys/arch/next68k/dev/mb8795reg.h:1.4 Sat Apr 24 19:58:13 2010 +++ src/sys/arch/next68k/dev/mb8795reg.h Sat Jun 10 17:14:57 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: mb8795reg.h,v 1.4 2010/04/24 19:58:13 dbj Exp $ */ +/* $NetBSD: mb8795reg.h,v 1.5 2023/06/10 17:14:57 dbj Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -75,7 +75,7 @@ struct mb8795_regs { #define MB8795_TXMASK_BITS \ "\20\10READYIE\06TXRXIE\04UNDERFLOWIE\03COLLIE\02COLL16IE\01PARERRIE" -/* cummulative receiver status (address 2) */ +/* cumulative receiver status (address 2) */ #define MB8795_RXSTAT 2 #define MB8795_RXSTAT_OK 0x80 /* packet received is correct */
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: dbj Date: Sat Jun 10 17:14:57 UTC 2023 Modified Files: src/sys/arch/next68k/dev: mb8795reg.h Log Message: gratuitous commit to fix spelling error To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/mb8795reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Sat Feb 11 02:34:15 UTC 2023 Modified Files: src/sys/arch/next68k/dev: nextdisplay.c Log Message: NeXT Turbo Color doesn't have NEXT_P_C16_CMD_REG. Info from Andreas Grabher on port-next68k@. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/next68k/dev/nextdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/nextdisplay.c diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.29 src/sys/arch/next68k/dev/nextdisplay.c:1.30 --- src/sys/arch/next68k/dev/nextdisplay.c:1.29 Sat Feb 11 02:33:27 2023 +++ src/sys/arch/next68k/dev/nextdisplay.c Sat Feb 11 02:34:15 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nextdisplay.c,v 1.29 2023/02/11 02:33:27 tsutsui Exp $ */ +/* $NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.29 2023/02/11 02:33:27 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $"); #include /* RCS ID & Copyright macro defns */ @@ -246,7 +246,7 @@ nextdisplay_attach(device_t parent, devi printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht, sc->sc_dc->dc_depth); - if (iscolor) { + if (iscolor && !turbo) { #if 0 uint8_t x;
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Sat Feb 11 02:34:15 UTC 2023 Modified Files: src/sys/arch/next68k/dev: nextdisplay.c Log Message: NeXT Turbo Color doesn't have NEXT_P_C16_CMD_REG. Info from Andreas Grabher on port-next68k@. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/next68k/dev/nextdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:17:49 UTC 2023 Modified Files: src/sys/arch/next68k/dev: esp.c Log Message: Make local functions static. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/arch/next68k/dev/esp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:17:49 UTC 2023 Modified Files: src/sys/arch/next68k/dev: esp.c Log Message: Make local functions static. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/arch/next68k/dev/esp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/esp.c diff -u src/sys/arch/next68k/dev/esp.c:1.66 src/sys/arch/next68k/dev/esp.c:1.67 --- src/sys/arch/next68k/dev/esp.c:1.66 Fri Feb 3 23:16:07 2023 +++ src/sys/arch/next68k/dev/esp.c Fri Feb 3 23:17:49 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $ */ +/* $NetBSD: esp.c,v 1.67 2023/02/03 23:17:49 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.67 2023/02/03 23:17:49 tsutsui Exp $"); #include #include @@ -126,13 +126,13 @@ int esp_debug = 0; #define PRINTF(x) printf x; -int espmatch_intio(device_t, cfdata_t, void *); -void espattach_intio(device_t, device_t, void *); +static int espmatch_intio(device_t, cfdata_t, void *); +static void espattach_intio(device_t, device_t, void *); /* DMA callbacks */ -bus_dmamap_t esp_dmacb_continue(void *); -void esp_dmacb_completed(bus_dmamap_t, void *); -void esp_dmacb_shutdown(void *); +static bus_dmamap_t esp_dmacb_continue(void *); +static void esp_dmacb_completed(bus_dmamap_t, void *); +static void esp_dmacb_shutdown(void *); static void findchannel_defer(device_t); @@ -155,18 +155,20 @@ static int attached = 0; /* * Functions and the switch for the MI code. */ -uint8_t esp_read_reg(struct ncr53c9x_softc *, int); -void esp_write_reg(struct ncr53c9x_softc *, int, uint8_t); -int esp_dma_isintr(struct ncr53c9x_softc *); -void esp_dma_reset(struct ncr53c9x_softc *); -int esp_dma_intr(struct ncr53c9x_softc *); -int esp_dma_setup(struct ncr53c9x_softc *, uint8_t **, size_t *, int, - size_t *); -void esp_dma_go(struct ncr53c9x_softc *); -void esp_dma_stop(struct ncr53c9x_softc *); -int esp_dma_isactive(struct ncr53c9x_softc *); +static uint8_t esp_read_reg(struct ncr53c9x_softc *, int); +static void esp_write_reg(struct ncr53c9x_softc *, int, uint8_t); +static int esp_dma_isintr(struct ncr53c9x_softc *); +static void esp_dma_reset(struct ncr53c9x_softc *); +static int esp_dma_intr(struct ncr53c9x_softc *); +static int esp_dma_setup(struct ncr53c9x_softc *, uint8_t **, size_t *, int, +size_t *); +static void esp_dma_go(struct ncr53c9x_softc *); +static void esp_dma_stop(struct ncr53c9x_softc *); +static int esp_dma_isactive(struct ncr53c9x_softc *); -struct ncr53c9x_glue esp_glue = { +static int doze(volatile int); + +static struct ncr53c9x_glue esp_glue = { .gl_read_reg = esp_read_reg, .gl_write_reg = esp_write_reg, .gl_dma_isintr = esp_dma_isintr, @@ -215,7 +217,7 @@ esp_hex_dump(unsigned char *pkt, size_t } #endif -int +static int espmatch_intio(device_t parent, cfdata_t cf, void *aux) { struct intio_attach_args *ia = aux; @@ -286,7 +288,7 @@ findchannel_defer(device_t self) device_xname(esc->sc_dma->sc_dev)); } -void +static void espattach_intio(device_t parent, device_t self, void *aux) { struct esp_softc *esc = device_private(self); @@ -417,7 +419,7 @@ espattach_intio(device_t parent, device_ * Glue functions. */ -uint8_t +static uint8_t esp_read_reg(struct ncr53c9x_softc *sc, int reg) { struct esp_softc *esc = (struct esp_softc *)sc; @@ -425,7 +427,7 @@ esp_read_reg(struct ncr53c9x_softc *sc, return bus_space_read_1(esc->sc_bst, esc->sc_bsh, reg); } -void +static void esp_write_reg(struct ncr53c9x_softc *sc, int reg, uint8_t val) { struct esp_softc *esc = (struct esp_softc *)sc; @@ -436,8 +438,7 @@ esp_write_reg(struct ncr53c9x_softc *sc, volatile uint32_t save1; #define xADDR 0x0211a000 -int doze(volatile int); -int +static int doze(volatile int c) { #if 0 @@ -464,7 +465,7 @@ doze(volatile int c) return 0; } -int +static int esp_dma_isintr(struct ncr53c9x_softc *sc) { struct esp_softc *esc = (struct esp_softc *)sc; @@ -480,7 +481,7 @@ esp_dma_isintr(struct ncr53c9x_softc *sc } } -int +static int esp_dma_intr(struct ncr53c9x_softc *sc) { struct esp_softc *esc = (struct esp_softc *)sc; @@ -746,7 +747,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc) return r; } -void +static void esp_dma_reset(struct ncr53c9x_softc *sc) { struct esp_softc *esc = (struct esp_softc *)sc; @@ -808,7 +809,7 @@ esp_dma_reset(struct ncr53c9x_softc *sc) * (len may be > maxxfer) */ -int +static int esp_dma_setup(struct ncr53c9x_softc *sc, uint8_t **addr, size_t *len, int datain, size_t *dmasize) { @@ -1277,7 +1278,7 @@ esp_dma_print(struct ncr53c9x_softc *sc) } #endif -void +static void esp_dma_go(struct
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:16:07 UTC 2023 Modified Files: src/sys/arch/next68k/dev: esp.c espreg.h espvar.h Log Message: Misc cleanup. - use C99 designated initializer - misc KNF - TAB/space cleanup To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/arch/next68k/dev/esp.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/espreg.h cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/dev/espvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/esp.c diff -u src/sys/arch/next68k/dev/esp.c:1.65 src/sys/arch/next68k/dev/esp.c:1.66 --- src/sys/arch/next68k/dev/esp.c:1.65 Fri Jan 27 15:31:05 2023 +++ src/sys/arch/next68k/dev/esp.c Fri Feb 3 23:16:07 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $ */ +/* $NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $"); #include #include @@ -134,7 +134,7 @@ bus_dmamap_t esp_dmacb_continue(void *); void esp_dmacb_completed(bus_dmamap_t, void *); void esp_dmacb_shutdown(void *); -static void findchannel_defer(device_t); +static void findchannel_defer(device_t); #ifdef ESP_DEBUG char esp_dma_dump[5*1024] = ""; @@ -167,18 +167,23 @@ void esp_dma_stop(struct ncr53c9x_softc int esp_dma_isactive(struct ncr53c9x_softc *); struct ncr53c9x_glue esp_glue = { - esp_read_reg, - esp_write_reg, - esp_dma_isintr, - esp_dma_reset, - esp_dma_intr, - esp_dma_setup, - esp_dma_go, - esp_dma_stop, - esp_dma_isactive, - NULL, /* gl_clear_latched_intr */ + .gl_read_reg = esp_read_reg, + .gl_write_reg = esp_write_reg, + .gl_dma_isintr = esp_dma_isintr, + .gl_dma_reset = esp_dma_reset, + .gl_dma_intr = esp_dma_intr, + .gl_dma_setup = esp_dma_setup, + .gl_dma_go = esp_dma_go, + .gl_dma_stop = esp_dma_stop, + .gl_dma_isactive = esp_dma_isactive, + .gl_clear_latched_intr = NULL }; +#define nd_bsr4(reg) \ + bus_space_read_4(nsc->sc_bst, nsc->sc_bsh, (reg)) +#define nd_bsw4(reg, val) \ + bus_space_write_4(nsc->sc_bst, nsc->sc_bsh, (reg), (val)) + #ifdef ESP_DEBUG #define XCHR(x) hexdigits[(x) & 0xf] static void @@ -188,18 +193,22 @@ esp_hex_dump(unsigned char *pkt, size_t printf(" "); for(i = 0; i < len; i++) { - printf("%c%c ", XCHR(pkt[i]>>4), XCHR(pkt[i])); + printf("%c%c ", XCHR(pkt[i] >> 4), XCHR(pkt[i])); if ((i + 1) % 16 == 8) { printf(" "); } if ((i + 1) % 16 == 0) { printf(" %c", '|'); for(j = 0; j < 16; j++) { -printf("%c", pkt[i-15+j]>=32 && pkt[i-15+j]<127?pkt[i-15+j]:'.'); +printf("%c", pkt[i - 15 + j] >= 32 && +pkt[i - 15 + j] < 127 ? +pkt[i - 15 + j] : '.'); } - printf("%c\n%c%c%c%c%c%c%c%c ", '|', - XCHR((i+1)>>28),XCHR((i+1)>>24),XCHR((i+1)>>20),XCHR((i+1)>>16), - XCHR((i+1)>>12), XCHR((i+1)>>8), XCHR((i+1)>>4), XCHR(i+1)); + printf("%c\n%c%c%c%c%c%c%c%c ", '|', + XCHR((i + 1) >> 28), XCHR((i + 1) >> 24), + XCHR((i + 1) >> 20), XCHR((i + 1) >> 16), + XCHR((i + 1) >> 12), XCHR((i + 1) >> 8), + XCHR((i + 1) >> 4), XCHR(i + 1)); } } printf("\n"); @@ -226,10 +235,10 @@ findchannel_defer(device_t self) struct ncr53c9x_softc *sc = >sc_ncr53c9x; int error; - if (!esc->sc_dma) { + if (esc->sc_dma == NULL) { aprint_normal("%s", device_xname(sc->sc_dev)); esc->sc_dma = nextdma_findchannel("scsi"); - if (!esc->sc_dma) + if (esc->sc_dma == NULL) panic("%s: can't find DMA channel", device_xname(sc->sc_dev)); } @@ -240,23 +249,21 @@ findchannel_defer(device_t self) nextdma_setconf(esc->sc_dma, cb_arg, sc); error = bus_dmamap_create(esc->sc_dma->sc_dmat, - sc->sc_maxxfer, - sc->sc_maxxfer / PAGE_SIZE + 1, - sc->sc_maxxfer, - 0, BUS_DMA_ALLOCNOW, >sc_main_dmamap); - if (error) { + sc->sc_maxxfer, sc->sc_maxxfer / PAGE_SIZE + 1, sc->sc_maxxfer, + 0, BUS_DMA_ALLOCNOW, >sc_main_dmamap); + if (error != 0) { panic("%s: can't create main i/o DMA map, error = %d", - device_xname(sc->sc_dev), error); + device_xname(sc->sc_dev), error); } error = bus_dmamap_create(esc->sc_dma->sc_dmat, - ESP_DMA_TAILBUFSIZE, 1, ESP_DMA_TAILBUFSIZE, - 0, BUS_DMA_ALLOCNOW, >sc_tail_dmamap); - if (error) { + ESP_DMA_TAILBUFSIZE, 1, ESP_DMA_TAILBUFSIZE, + 0, BUS_DMA_ALLOCNOW, >sc_tail_dmamap); + if (error != 0) { panic("%s: can't create tail i/o DMA map, error = %d", - device_xname(sc->sc_dev), error); + device_xname(sc->sc_dev), error); } - + #if 0 /* Turn on target selection using the `DMA' method */ sc->sc_features |= NCR_F_DMASELECT; @@ -273,7 +280,7 @@ findchannel_defer(device_t self)
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:16:07 UTC 2023 Modified Files: src/sys/arch/next68k/dev: esp.c espreg.h espvar.h Log Message: Misc cleanup. - use C99 designated initializer - misc KNF - TAB/space cleanup To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/arch/next68k/dev/esp.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/espreg.h cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/dev/espvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:06:42 UTC 2023 Modified Files: src/sys/arch/next68k/dev: nextdma.c nextdmareg.h nextdmavar.h Log Message: Misc KNF and cosmetics. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/next68k/dev/nextdma.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/next68k/dev/nextdmareg.h cvs rdiff -u -r1.17 -r1.18 src/sys/arch/next68k/dev/nextdmavar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/nextdma.c diff -u src/sys/arch/next68k/dev/nextdma.c:1.50 src/sys/arch/next68k/dev/nextdma.c:1.51 --- src/sys/arch/next68k/dev/nextdma.c:1.50 Fri Mar 31 08:38:13 2017 +++ src/sys/arch/next68k/dev/nextdma.c Fri Feb 3 23:06:42 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nextdma.c,v 1.50 2017/03/31 08:38:13 msaitoh Exp $ */ +/* $NetBSD: nextdma.c,v 1.51 2023/02/03 23:06:42 tsutsui Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -25,11 +25,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nextdma.c,v 1.50 2017/03/31 08:38:13 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nextdma.c,v 1.51 2023/02/03 23:06:42 tsutsui Exp $"); #include #include -#include +#include #include #include #include @@ -168,14 +168,32 @@ CFATTACH_DECL_NEW(nextdma, sizeof(struct static struct nextdma_channel nextdma_channel[] = { #if NESP > 0 - { "scsi", NEXT_P_SCSI_CSR, DD_SIZE, NEXT_I_SCSI_DMA, _esp_intr }, + { + "scsi", + NEXT_P_SCSI_CSR, + DD_SIZE, + NEXT_I_SCSI_DMA, + _esp_intr + }, #endif #if NXE > 0 - { "enetx", NEXT_P_ENETX_CSR, DD_SIZE, NEXT_I_ENETX_DMA, _enet_intr }, - { "enetr", NEXT_P_ENETR_CSR, DD_SIZE, NEXT_I_ENETR_DMA, _enet_intr }, + { + "enetx", + NEXT_P_ENETX_CSR, + DD_SIZE, + NEXT_I_ENETX_DMA, + _enet_intr + }, + { + "enetr", + NEXT_P_ENETR_CSR, + DD_SIZE, + NEXT_I_ENETR_DMA, + _enet_intr + }, #endif }; -static int nnextdma_channels = (sizeof(nextdma_channel)/sizeof(nextdma_channel[0])); +static int nnextdma_channels = __arraycount(nextdma_channel); static int attached = 0; @@ -206,11 +224,11 @@ nextdma_match(device_t parent, cfdata_t struct intio_attach_args *ia = (struct intio_attach_args *)aux; if (attached >= nnextdma_channels) - return (0); + return 0; ia->ia_addr = (void *)nextdma_channel[attached].nd_base; - return (1); + return 1; } void @@ -229,22 +247,20 @@ nextdma_attach(device_t parent, device_t nsc->sc_bst = ia->ia_bst; if (bus_space_map(nsc->sc_bst, nsc->sc_chan->nd_base, - nsc->sc_chan->nd_size, 0, >sc_bsh)) { + nsc->sc_chan->nd_size, 0, >sc_bsh)) { panic("%s: can't map DMA registers for channel %s", - device_xname(self), nsc->sc_chan->nd_name); + device_xname(self), nsc->sc_chan->nd_name); } - nextdma_init (nsc); + nextdma_init(nsc); isrlink_autovec(nsc->sc_chan->nd_intrfunc, nsc, - NEXT_I_IPL(nsc->sc_chan->nd_intr), 10, NULL); + NEXT_I_IPL(nsc->sc_chan->nd_intr), 10, NULL); INTR_ENABLE(nsc->sc_chan->nd_intr); - printf (": channel %d (%s)\n", attached, + printf(": channel %d (%s)\n", attached, nsc->sc_chan->nd_name); attached++; - - return; } void @@ -257,7 +273,7 @@ nextdma_init(struct nextdma_softc *nsc) snprintb(sbuf, sizeof(sbuf), NEXT_INTR_BITS, NEXT_I_BIT(nsc->sc_chan->nd_intr)); printf("DMA init ipl (%ld) intr(%s)\n", - NEXT_I_IPL(nsc->sc_chan->nd_intr), sbuf); + NEXT_I_IPL(nsc->sc_chan->nd_intr), sbuf); } #endif @@ -267,8 +283,8 @@ nextdma_init(struct nextdma_softc *nsc) nsc->sc_stat.nd_idx_cont = 0; nsc->sc_stat.nd_exception = 0; - nd_bsw4 (DD_CSR, DMACSR_RESET | DMACSR_CLRCOMPLETE); - nd_bsw4 (DD_CSR, 0); + nd_bsw4(DD_CSR, DMACSR_RESET | DMACSR_CLRCOMPLETE); + nd_bsw4(DD_CSR, 0); #if 01 nextdma_setup_curr_regs(nsc); @@ -287,10 +303,10 @@ nextdma_init(struct nextdma_softc *nsc) */ state &= (DMACSR_COMPLETE | DMACSR_SUPDATE | DMACSR_ENABLE); #else - state &= (DMACSR_BUSEXC | DMACSR_COMPLETE | + state &= (DMACSR_BUSEXC | DMACSR_COMPLETE | DMACSR_SUPDATE | DMACSR_ENABLE); #endif - if (state) { + if (state != 0) { nextdma_print(nsc); panic("DMA did not reset"); } @@ -309,17 +325,19 @@ nextdma_reset(struct nextdma_softc *nsc) DPRINTF(("DMA reset\n")); #if (defined(ND_DEBUG)) - if (NEXTDMA_DEBUG > 1) nextdma_print(nsc); + if (NEXTDMA_DEBUG > 1) + nextdma_print(nsc); #endif - nd_bsw4 (DD_CSR, DMACSR_CLRCOMPLETE | DMACSR_RESET); + nd_bsw4(DD_CSR, DMACSR_CLRCOMPLETE | DMACSR_RESET); if ((stat->nd_map) || (stat->nd_map_cont)) { if (stat->nd_map_cont) { - DPRINTF(("DMA: resetting with non null continue map\n")); - if (nsc->sc_conf.nd_completed_cb) -(*nsc->sc_conf.nd_completed_cb) - (stat->nd_map_cont, nsc->sc_conf.nd_cb_arg); - + DPRINTF( + ("DMA: resetting with non null continue map\n")); + if (nsc->sc_conf.nd_completed_cb) +(*nsc->sc_conf.nd_completed_cb)( +
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:06:42 UTC 2023 Modified Files: src/sys/arch/next68k/dev: nextdma.c nextdmareg.h nextdmavar.h Log Message: Misc KNF and cosmetics. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/next68k/dev/nextdma.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/next68k/dev/nextdmareg.h cvs rdiff -u -r1.17 -r1.18 src/sys/arch/next68k/dev/nextdmavar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:04:36 UTC 2023 Modified Files: src/sys/arch/next68k/dev: mb8795var.h Log Message: Use proper C99 int types. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/dev/mb8795var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/mb8795var.h diff -u src/sys/arch/next68k/dev/mb8795var.h:1.15 src/sys/arch/next68k/dev/mb8795var.h:1.16 --- src/sys/arch/next68k/dev/mb8795var.h:1.15 Mon Apr 13 21:18:42 2015 +++ src/sys/arch/next68k/dev/mb8795var.h Fri Feb 3 23:04:35 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: mb8795var.h,v 1.15 2015/04/13 21:18:42 riastradh Exp $ */ +/* $NetBSD: mb8795var.h,v 1.16 2023/02/03 23:04:35 tsutsui Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -62,7 +62,7 @@ struct mb8795_softc { bus_space_handle_t sc_bmap_bsh; /* bus space handle */ - u_int8_t sc_enaddr[6]; + uint8_t sc_enaddr[6]; struct ifaltq sc_tx_snd;
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:04:36 UTC 2023 Modified Files: src/sys/arch/next68k/dev: mb8795var.h Log Message: Use proper C99 int types. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/dev/mb8795var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:02:56 UTC 2023 Modified Files: src/sys/arch/next68k/dev: if_xe.c Log Message: TAB/space cleanup. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/dev/if_xe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:02:56 UTC 2023 Modified Files: src/sys/arch/next68k/dev: if_xe.c Log Message: TAB/space cleanup. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/dev/if_xe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/if_xe.c diff -u src/sys/arch/next68k/dev/if_xe.c:1.27 src/sys/arch/next68k/dev/if_xe.c:1.28 --- src/sys/arch/next68k/dev/if_xe.c:1.27 Sat Nov 21 17:49:20 2020 +++ src/sys/arch/next68k/dev/if_xe.c Fri Feb 3 23:02:56 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $ */ +/* $NetBSD: if_xe.c,v 1.28 2023/02/03 23:02:56 tsutsui Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.28 2023/02/03 23:02:56 tsutsui Exp $"); #include "opt_inet.h" @@ -202,16 +202,17 @@ findchannel_defer(device_t self) xsc->sc_rx_completed_idx = 0; xsc->sc_rx_handled_idx = 0; - /* @@@ more next hacks + /* + * @@@ more next hacks * the 2000 covers at least a 1500 mtu + headers * + DMA_BEGINALIGNMENT+ DMA_ENDALIGNMENT */ xsc->sc_txbuf = kmem_alloc(2000, KM_SLEEP); xsc->sc_tx_mb_head = NULL; xsc->sc_tx_loaded = 0; - + mb8795_config(sc, xe_dma_medias, nxe_dma_medias, xe_dma_medias[0]); - + isrlink_autovec(xe_tint, sc, NEXT_I_IPL(NEXT_I_ENETX), 1, NULL); INTR_ENABLE(NEXT_I_ENETX); isrlink_autovec(xe_rint, sc, NEXT_I_IPL(NEXT_I_ENETR), 1, NULL); @@ -312,7 +313,7 @@ xe_dma_reset(struct mb8795_softc *sc) int i; DPRINTF(("xe DMA reset\n")); - + nextdma_reset(xsc->sc_rxdma); nextdma_reset(xsc->sc_txdma); @@ -346,7 +347,7 @@ xe_dma_rx_setup(struct mb8795_softc *sc) DPRINTF(("xe DMA rx setup\n")); for(i = 0; i < MB8795_NRXBUFS; i++) - xsc->sc_rx_mb_head[i] = + xsc->sc_rx_mb_head[i] = xe_dma_rxmap_load(sc, xsc->sc_rx_dmamap[i]); xsc->sc_rx_loaded_idx = 0; @@ -380,17 +381,17 @@ xe_dma_rx_mbuf(struct mb8795_softc *sc) map = xsc->sc_rx_dmamap[xsc->sc_rx_handled_idx]; m = xsc->sc_rx_mb_head[xsc->sc_rx_handled_idx]; - + m->m_len = map->dm_xfer_len; bus_dmamap_sync(xsc->sc_rxdma->sc_dmat, map, 0, map->dm_mapsize, BUS_DMASYNC_POSTREAD); - + bus_dmamap_unload(xsc->sc_rxdma->sc_dmat, map); - + /* Install a fresh mbuf for next packet */ - - xsc->sc_rx_mb_head[xsc->sc_rx_handled_idx] = + + xsc->sc_rx_mb_head[xsc->sc_rx_handled_idx] = xe_dma_rxmap_load(sc,map); /* Punt runt packets @@ -467,7 +468,7 @@ xe_dma_tx_mbuf(struct mb8795_softc *sc, buflen = ETHER_MIN_LEN - ETHER_CRC_LEN; } } - + error = bus_dmamap_load(xsc->sc_txdma->sc_dmat, xsc->sc_tx_dmamap, buf, buflen, NULL, BUS_DMA_NOWAIT); } @@ -503,7 +504,7 @@ xe_dma_tx_isactive(struct mb8795_softc * // -void +void xe_dma_tx_completed(bus_dmamap_t map, void *arg) { #if defined (XE_DEBUG) || defined (DIAGNOSTIC) @@ -527,7 +528,7 @@ xe_dma_tx_completed(bus_dmamap_t map, vo #endif } -void +void xe_dma_tx_shutdown(void *arg) { struct mb8795_softc *sc = arg; @@ -550,7 +551,7 @@ xe_dma_tx_shutdown(void *arg) bus_dmamap_unload(xsc->sc_txdma->sc_dmat, xsc->sc_tx_dmamap); m_freem(xsc->sc_tx_mb_head); xsc->sc_tx_mb_head = NULL; - + xsc->sc_tx_loaded--; } @@ -571,14 +572,14 @@ xe_dma_tx_shutdown(void *arg) #if 0 /* Enable ready interrupt */ - MB_WRITE_REG(sc, MB8795_TXMASK, + MB_WRITE_REG(sc, MB8795_TXMASK, MB_READ_REG(sc, MB8795_TXMASK) | MB8795_TXMASK_TXRXIE/* READYIE */); #endif } -void +void xe_dma_rx_completed(bus_dmamap_t map, void *arg) { struct mb8795_softc *sc = arg; @@ -588,11 +589,11 @@ xe_dma_rx_completed(bus_dmamap_t map, vo if (ifp->if_flags & IFF_RUNNING) { xsc->sc_rx_completed_idx++; xsc->sc_rx_completed_idx %= MB8795_NRXBUFS; - + DPRINTF(("%s: xe_dma_rx_completed(), " "sc->sc_rx_completed_idx = %d\n", device_xname(sc->sc_dev), xsc->sc_rx_completed_idx)); - + #if (defined(DIAGNOSTIC)) if (map != xsc->sc_rx_dmamap[xsc->sc_rx_completed_idx]) panic("%s: Unexpected rx dmamap completed", @@ -606,7 +607,7 @@ xe_dma_rx_completed(bus_dmamap_t map, vo #endif } -void +void xe_dma_rx_shutdown(void *arg) { struct mb8795_softc *sc = arg; @@ -616,7 +617,7 @@ xe_dma_rx_shutdown(void *arg) if (ifp->if_flags & IFF_RUNNING) { DPRINTF(("%s: xe_dma_rx_shutdown(), restarting.\n", device_xname(sc->sc_dev))); - + nextdma_start(xsc->sc_rxdma, DMACSR_SETREAD); if (turbo) MB_WRITE_REG(sc, MB8795_RXMODE, @@ -659,7 +660,7 @@ xe_dma_rxmap_load(struct mb8795_softc *s /* * Align buffer, @@@ next specific. - * perhaps should be using M_ALIGN here
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:00:33 UTC 2023 Modified Files: src/sys/arch/next68k/dev: mb8795.c Log Message: Add proper rnd_add_uint32(9) calls to next68k xe(4) driver. To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/dev/mb8795.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Feb 3 23:00:33 UTC 2023 Modified Files: src/sys/arch/next68k/dev: mb8795.c Log Message: Add proper rnd_add_uint32(9) calls to next68k xe(4) driver. To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/dev/mb8795.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/mb8795.c diff -u src/sys/arch/next68k/dev/mb8795.c:1.69 src/sys/arch/next68k/dev/mb8795.c:1.70 --- src/sys/arch/next68k/dev/mb8795.c:1.69 Sun Sep 18 13:00:18 2022 +++ src/sys/arch/next68k/dev/mb8795.c Fri Feb 3 23:00:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $ */ +/* $NetBSD: mb8795.c,v 1.70 2023/02/03 23:00:33 tsutsui Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.70 2023/02/03 23:00:33 tsutsui Exp $"); #include "opt_inet.h" @@ -348,6 +348,7 @@ mb8795_rint(struct mb8795_softc *sc) printf("rxmode = %s\n", sbuf); } #endif + rnd_add_uint32(>rnd_source, rxstat); return; } @@ -380,7 +381,7 @@ mb8795_tint(struct mb8795_softc *sc) /* printf ("Z"); */ mb8795_start_dma(sc); } - return; + goto out; } if (txstat & MB8795_TXSTAT_SHORTED) { @@ -414,6 +415,8 @@ mb8795_tint(struct mb8795_softc *sc) txmask & ~MB8795_TXMASK_READYIE); } #endif + out: + rnd_add_uint32(>rnd_source, txstat); return; }
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Jan 27 15:31:05 UTC 2023 Modified Files: src/sys/arch/next68k/dev: esp.c Log Message: next68k: Fix silent stall of next68k esp(4) SCSI. next68k esp(4) driver requires nextdma(4) interrupts at ipl 6 during ncr53c9x_intr() for esp(4) at ipl 3. It worked on netbsd-5 and prior, but on netbsd-5 splbio() was changed from ipl 3 to 6 for SMP support and on netbsd-6 ncr53c9x driver was changed to use mutex(9) instead of simple_lock(9), so nextdma interrupts were no longer raised during ncr53c9x interrupt handler. For now, just call mutex_exit(9) and mutex_enter(9) during waiting nextdma(4) interrupts in MD esp_dma_intr() handler. This could be wrong and the interrupt handler for nextdma should be reorganized, but it just works. Should be pulled up to netbsd-10 and netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/arch/next68k/dev/esp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/esp.c diff -u src/sys/arch/next68k/dev/esp.c:1.64 src/sys/arch/next68k/dev/esp.c:1.65 --- src/sys/arch/next68k/dev/esp.c:1.64 Fri Mar 31 08:38:13 2017 +++ src/sys/arch/next68k/dev/esp.c Fri Jan 27 15:31:05 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: esp.c,v 1.64 2017/03/31 08:38:13 msaitoh Exp $ */ +/* $NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.64 2017/03/31 08:38:13 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $"); #include #include @@ -509,6 +509,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc) } #endif + mutex_exit(>sc_lock); /* for nextdma intr */ while (!nextdma_finished(nsc)) { /* esp_dma_isactive(sc)) { */ NDTRACEIF (ndtrace_addc('w')); @@ -602,7 +603,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc) } out: - ; + mutex_enter(>sc_lock); /* for nextdma intr */ #ifdef ESP_DEBUG /* esp_dma_nest--; */
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: tsutsui Date: Fri Jan 27 15:31:05 UTC 2023 Modified Files: src/sys/arch/next68k/dev: esp.c Log Message: next68k: Fix silent stall of next68k esp(4) SCSI. next68k esp(4) driver requires nextdma(4) interrupts at ipl 6 during ncr53c9x_intr() for esp(4) at ipl 3. It worked on netbsd-5 and prior, but on netbsd-5 splbio() was changed from ipl 3 to 6 for SMP support and on netbsd-6 ncr53c9x driver was changed to use mutex(9) instead of simple_lock(9), so nextdma interrupts were no longer raised during ncr53c9x interrupt handler. For now, just call mutex_exit(9) and mutex_enter(9) during waiting nextdma(4) interrupts in MD esp_dma_intr() handler. This could be wrong and the interrupt handler for nextdma should be reorganized, but it just works. Should be pulled up to netbsd-10 and netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/arch/next68k/dev/esp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: thorpej Date: Sun Sep 18 13:00:18 UTC 2022 Modified Files: src/sys/arch/next68k/dev: mb8795.c Log Message: Eliminate use of IFF_OACTIVE. (It was not being used correctly here in any case.) To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/arch/next68k/dev/mb8795.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/next68k/dev/mb8795.c diff -u src/sys/arch/next68k/dev/mb8795.c:1.68 src/sys/arch/next68k/dev/mb8795.c:1.69 --- src/sys/arch/next68k/dev/mb8795.c:1.68 Thu Mar 17 08:08:03 2022 +++ src/sys/arch/next68k/dev/mb8795.c Sun Sep 18 13:00:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: mb8795.c,v 1.68 2022/03/17 08:08:03 andvar Exp $ */ +/* $NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.68 2022/03/17 08:08:03 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $"); #include "opt_inet.h" @@ -430,7 +430,7 @@ mb8795_reset(struct mb8795_softc *sc) DPRINTF (("%s: mb8795_reset()\n", device_xname(sc->sc_dev))); - sc->sc_ethercom.ec_if.if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + sc->sc_ethercom.ec_if.if_flags &= ~IFF_RUNNING; sc->sc_ethercom.ec_if.if_timer = 0; MBDMA_RESET(sc); @@ -526,7 +526,6 @@ mb8795_init(struct mb8795_softc *sc) MBDMA_TX_SETUP(sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; ifp->if_timer = 0; MBDMA_RX_GO(sc); @@ -674,19 +673,15 @@ mb8795_start(struct ifnet *ifp) #endif while (1) { - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) - != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0) return; #if 0 return; /* @@@ Turn off xmit for debugging */ #endif - ifp->if_flags |= IFF_OACTIVE; - IFQ_DEQUEUE(>if_snd, m); if (m == 0) { - ifp->if_flags &= ~IFF_OACTIVE; return; } @@ -698,8 +693,6 @@ mb8795_start(struct ifnet *ifp) if (!MBDMA_TX_ISACTIVE(sc)) mb8795_start_dma(sc); splx(s); - - ifp->if_flags &= ~IFF_OACTIVE; } }
CVS commit: src/sys/arch/next68k/dev
Module Name:src Committed By: thorpej Date: Sun Sep 18 13:00:18 UTC 2022 Modified Files: src/sys/arch/next68k/dev: mb8795.c Log Message: Eliminate use of IFF_OACTIVE. (It was not being used correctly here in any case.) To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/arch/next68k/dev/mb8795.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.