CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Wed Jul 17 08:28:22 UTC 2024 Modified Files: src/sys/dev/ic: stireg.h Log Message: moar bits these should probably go into their own header since they don't actually have anything to do with STI To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/stireg.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/ic/stireg.h diff -u src/sys/dev/ic/stireg.h:1.8 src/sys/dev/ic/stireg.h:1.9 --- src/sys/dev/ic/stireg.h:1.8 Wed Jul 17 07:06:21 2024 +++ src/sys/dev/ic/stireg.h Wed Jul 17 08:28:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: stireg.h,v 1.8 2024/07/17 07:06:21 macallan Exp $ */ +/* $NetBSD: stireg.h,v 1.9 2024/07/17 08:28:22 macallan Exp $ */ /* $OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $ */ @@ -641,6 +641,34 @@ STI_DEP(util); * NGLE register layout. * Based upon xc/programs/Xserver/hw/hp/ngle/dregs.h */ + +#define BA(F,C,S,A,J,B,I) \ + (((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I)) + /* FSSSAAAJ */ + +#define IBOvals(R,M,X,S,D,L,B,F) \ + (((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F)) + /* LSSDBBBF */ + +#define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */ +#define Otc04 2 /* Pixels in each longword transfer (4) */ +#define Otc32 5 /* Pixels in each longword transfer (32) */ +#define Ots08 3 /* Each pixel is size (8)d transfer (1) */ +#define OtsIndirect 6 /* Each bit goes through FG/BG color(8) */ +#define AddrLong 5 /* FB address is Long aligned (pixel) */ +#define BINovly 0x2 /* 8 bit overlay */ +#define BINapp0I 0x0 /* Application Buffer 0, Indexed */ +#define BINapp1I 0x1 /* Application Buffer 1, Indexed */ +#define BINapp0F8 0xa /* Application Buffer 0, Fractional 8-8-8 */ +#define BINattr 0xd /* Attribute Bitmap */ +#define RopSrc 0x3 +#define RopInv 0xc +#define BitmapExtent08 3 /* Each write hits ( 8) bits in depth */ +#define BitmapExtent32 5 /* Each write hits (32) bits in depth */ +#define DataDynamic 0 /* Data register reloaded by direct access */ +#define MaskDynamic 1 /* Mask register reloaded by direct access */ +#define MaskOtc 0 /* Mask contains Object Count valid bits */ + #define NGLE_REG_1 0x000118 /* Artist LUT blt ctrl */ #define NGLE_REG_28 0x000420 #define NGLE_REG_2 0x000480 /* LUT blt src? */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Wed Jul 17 08:28:22 UTC 2024 Modified Files: src/sys/dev/ic: stireg.h Log Message: moar bits these should probably go into their own header since they don't actually have anything to do with STI To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/stireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Wed Jul 17 07:06:22 UTC 2024 Modified Files: src/sys/dev/ic: stireg.h Log Message: document a few more registers & bits To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/stireg.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/ic/stireg.h diff -u src/sys/dev/ic/stireg.h:1.7 src/sys/dev/ic/stireg.h:1.8 --- src/sys/dev/ic/stireg.h:1.7 Mon Jul 15 10:30:42 2024 +++ src/sys/dev/ic/stireg.h Wed Jul 17 07:06:21 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: stireg.h,v 1.7 2024/07/15 10:30:42 macallan Exp $ */ +/* $NetBSD: stireg.h,v 1.8 2024/07/17 07:06:21 macallan Exp $ */ /* $OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $ */ @@ -641,9 +641,9 @@ STI_DEP(util); * NGLE register layout. * Based upon xc/programs/Xserver/hw/hp/ngle/dregs.h */ -#define NGLE_REG_1 0x000118 +#define NGLE_REG_1 0x000118 /* Artist LUT blt ctrl */ #define NGLE_REG_28 0x000420 -#define NGLE_REG_2 0x000480 +#define NGLE_REG_2 0x000480 /* LUT blt src? */ #define NGLE_REG_3 0x0004a0 /* palette index */ #define NGLE_REG_22 0x0005a0 #define NGLE_REG_23 0x0005c0 @@ -672,15 +672,25 @@ STI_DEP(util); #define NGLE_REG_34 0x28 /* # of fifo slots */ #define NGLE_REG_17 0x200100 /* cursor coordinates */ #define NGLE_REG_18 0x200104 /* cursor enable */ -#define NGLE_REG_26 0x200118 +#define NGLE_REG_26 0x200118 /* EG LUT blt ctrl */ #define NGLE_REG_19 0x200200 #define NGLE_REG_20 0x200208 /* cursor geometry */ #define NGLE_REG_21 0x200218 /* Artist misc video */ #define NGLE_REG_27 0x200308 /* Artist misc ctrl */ #define NGLE_REG_29 0x21 /* HCRX cursor coord & enable */ + #define HCRX_ENABLE_CURSOR 0x8000 #define NGLE_REG_30 0x210004 /* HCRX cursor address */ #define NGLE_REG_31 0x210008 /* HCRX cursor data */ -#define NGLE_REG_38 0x210020 /* colormap data */ +#define NGLE_REG_38 0x210020 /* HCRX LUT blt ctrl */ + /* EWOO TTLL */ + #define LBC_ENABLE 0x8000 + #define LBC_WAIT_BLANK 0x4000 + #define LBS_OFFSET_SHIFT 16 + #define LBC_TYPE_MASK 0xc000 + #define LBC_TYPE_CMAP 0 + #define LBC_TYPE_CURSOR 0x8000 + #define LBC_TYPE_OVERLAY 0xc000 + #define LBC_LENGTH_SHIFT 0 #define NGLE_REG_41 0x210024 #define NGLE_REG_42 0x210028 #define NGLE_REG_43 0x21002c @@ -688,8 +698,13 @@ STI_DEP(util); #define NGLE_REG_45 0x210034 #define NGLE_REG_32 0x21003c #define NGLE_REG_33 0x210040 /* HCRX misc video */ -#define NGLE_REG_39 0x210120 -#define NGLE_REG_40 0x210130 + #define HCRX_VIDEO_ENABLE 0x0A00 +#define NGLE_REG_39 0x210120 /* HCRX 'hyperbowl' mode 2 */ + #define HYPERBOWL_MODE2_8_24 15 +#define NGLE_REG_40 0x210130 /* HCRX 'hyperbowl' */ + #define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES 4 + #define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE 8 + #define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE 10 #define NGLE_BUFF0_CMAP0 0x1e02 #define NGLE_BUFF1_CMAP0 0x02001e02
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Wed Jul 17 07:06:22 UTC 2024 Modified Files: src/sys/dev/ic: stireg.h Log Message: document a few more registers & bits To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/stireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Mon Jul 15 10:30:42 UTC 2024 Modified Files: src/sys/dev/ic: stireg.h Log Message: annotate (some) registers if we know what they do fix a tpyo while there To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/stireg.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/ic/stireg.h diff -u src/sys/dev/ic/stireg.h:1.6 src/sys/dev/ic/stireg.h:1.7 --- src/sys/dev/ic/stireg.h:1.6 Wed Sep 9 11:56:53 2015 +++ src/sys/dev/ic/stireg.h Mon Jul 15 10:30:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: stireg.h,v 1.6 2015/09/09 11:56:53 skrll Exp $ */ +/* $NetBSD: stireg.h,v 1.7 2024/07/15 10:30:42 macallan Exp $ */ /* $OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $ */ @@ -649,16 +649,16 @@ STI_DEP(util); #define NGLE_REG_23 0x0005c0 #define NGLE_REG_4 0x000600 /* palette data */ #define NGLE_REG_5 0x0006a0 /* cursor data */ -#define NGLE_REG_6 0x000800 -#define NGLE_REG_7 0x000804 -#define NGLE_REG_24 0x000808 -#define NGLE_REG_8 0x000820 -#define NGLE_REG_73 0x000944 -#define NGLE_REG_9 0x000a04 -#define NGLE_REG_25 0x000b00 +#define NGLE_REG_6 0x000800 /* rectfill XY */ +#define NGLE_REG_7 0x000804 /* bitblt size WH */ +#define NGLE_REG_24 0x000808 /* bitblt src XY */ +#define NGLE_REG_8 0x000820 /* transfer data */ +#define NGLE_REG_37 0x000944 /* HCRX fast rect fill, size */ +#define NGLE_REG_9 0x000a04 /* rect fill size, start */ +#define NGLE_REG_25 0x000b00 /* bitblt dst XY, start */ #define NGLE_REG_RAMDAC 0x001000 -#define NGLE_REG_10 0x018000 -#define NGLE_REG_11 0x018004 /* dest coords */ +#define NGLE_REG_10 0x018000 /* buffer ctl */ +#define NGLE_REG_11 0x018004 /* dest bitmap access */ #define NGLE_REG_12 0x01800c /* control plane register */ #define NGLE_REG_35 0x018010 /* fg color */ #define NGLE_REG_36 0x018014
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Mon Jul 15 10:30:42 UTC 2024 Modified Files: src/sys/dev/ic: stireg.h Log Message: annotate (some) registers if we know what they do fix a tpyo while there To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/stireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Jul 14 09:38:42 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Improve and add new debug output To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Jul 14 09:38:42 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Improve and add new debug output To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.89 src/sys/dev/ic/dwc_gmac.c:1.90 --- src/sys/dev/ic/dwc_gmac.c:1.89 Sun Jul 14 09:31:55 2024 +++ src/sys/dev/ic/dwc_gmac.c Sun Jul 14 09:38:41 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.89 2024/07/14 09:31:55 skrll Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.90 2024/07/14 09:38:41 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.89 2024/07/14 09:31:55 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.90 2024/07/14 09:38:41 skrll Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -923,6 +923,10 @@ dwc_gmac_init_locked(struct ifnet *ifp) opmode |= GMAC_DMA_OP_RXSTOREFORWARD | GMAC_DMA_OP_TXSTOREFORWARD; } bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_OPMODE, opmode); +#ifdef DWC_GMAC_DEBUG + aprint_normal_dev(sc->sc_dev, + "setting DMA opmode register: %08x\n", opmode); +#endif sc->sc_stopping = false; @@ -1189,7 +1193,7 @@ dwc_gmac_tx_intr(struct dwc_gmac_softc * for (i = sc->sc_txq.t_next; sc->sc_txq.t_queued > 0; i = TX_NEXT(i)) { #ifdef DWC_GMAC_DEBUG aprint_normal_dev(sc->sc_dev, - "dwc_gmac_tx_intr: checking desc #%d (t_queued: %d)\n", + "%s: checking desc #%d (t_queued: %d)\n", __func__, i, sc->sc_txq.t_queued); #endif @@ -1217,8 +1221,8 @@ dwc_gmac_tx_intr(struct dwc_gmac_softc * #ifdef DWC_GMAC_DEBUG aprint_normal_dev(sc->sc_dev, - "dwc_gmac_tx_intr: done with packet at desc #%d, " - "freeing mbuf %p\n", i, data->td_m); + "%s: done with packet at desc #%d, freeing mbuf %p\n", + __func__, i, data->td_m); #endif m_freem(data->td_m); @@ -1247,6 +1251,10 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc * mutex_enter(>sc_rxq.r_mtx); for (i = sc->sc_rxq.r_cur; ; i = RX_NEXT(i)) { +#ifdef DWC_GMAC_DEBUG + aprint_normal_dev(sc->sc_dev, "%s: checking desc #%d\n", + __func__, i); +#endif bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, RX_DESC_OFFSET(i), sizeof(*desc), BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -1259,8 +1267,8 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc * if (sc->sc_descm->rx_has_error(desc)) { #ifdef DWC_GMAC_DEBUG aprint_normal_dev(sc->sc_dev, - "RX error: descriptor status %08x, skipping\n", - le32toh(desc->ddesc_status0)); + "%s: RX error: status %08x, skipping\n", + __func__, le32toh(desc->ddesc_status0)); #endif if_statinc(ifp, if_ierrors); goto skip; @@ -1270,8 +1278,8 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc * #ifdef DWC_GMAC_DEBUG aprint_normal_dev(sc->sc_dev, - "rx int: device is done with descriptor #%d, len: %d\n", - i, len); + "%s: device is done with descriptor #%d, len: %d\n", + __func__, i, len); #endif /* @@ -1317,6 +1325,11 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc * } physaddr = data->rd_map->dm_segs[0].ds_addr; +#ifdef DWC_GMAC_DEBUG + aprint_normal_dev(sc->sc_dev, + "%s: receiving packet at desc #%d, using mbuf %p\n", + __func__, i, data->rd_m); +#endif /* * New mbuf loaded, update RX ring and continue */ @@ -1626,19 +1639,19 @@ dwc_gmac_dump_dma(struct dwc_gmac_softc bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_RX_ADDR)); aprint_normal_dev(sc->sc_dev, "tx descriptors: %08x\n", bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_TX_ADDR)); - aprint_normal_dev(sc->sc_dev, "status: %08x\n", + aprint_normal_dev(sc->sc_dev, " status: %08x\n", bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_STATUS)); aprint_normal_dev(sc->sc_dev, "op mode: %08x\n", bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_OPMODE)); - aprint_normal_dev(sc->sc_dev, "int enable: %08x\n", + aprint_normal_dev(sc->sc_dev, "int en.: %08x\n", bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_INTENABLE)); - aprint_normal_dev(sc->sc_dev, "cur tx: %08x\n", + aprint_normal_dev(sc->sc_dev, " cur tx: %08x\n", bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_CUR_TX_DESC)); - aprint_normal_dev(sc->sc_dev, "cur rx: %08x\n", + aprint_normal_dev(sc->sc_dev, " cur rx: %08x\n", bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_CUR_RX_DESC)); - aprint_normal_dev(sc->sc_dev, "cur tx buffer: %08x\n", + aprint_normal_dev(sc->sc_dev, "cur txb: %08x\n", bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_CUR_TX_BUFADDR)); - aprint_normal_dev(sc->sc_dev, "cur rx buffer: %08x\n", + aprint_normal_dev(sc->sc_dev, "cur rxb: %08x\n",
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Jul 14 09:31:55 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Fix some bus_dmamap_sync calls. - ensure new descriptors are written before handing ownership of the first in the list to the device. - ensure descriptors are sync'ed before dumping them in dwc_gmac_dump_[rt]x_desc - don't sync the TX packet buffer twice (and not after we've passed ownership of its TX descriptor) Change some variable names to better reflect what they are while I'm here. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.88 src/sys/dev/ic/dwc_gmac.c:1.89 --- src/sys/dev/ic/dwc_gmac.c:1.88 Fri Jul 5 04:31:51 2024 +++ src/sys/dev/ic/dwc_gmac.c Sun Jul 14 09:31:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.88 2024/07/05 04:31:51 rin Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.89 2024/07/14 09:31:55 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.88 2024/07/05 04:31:51 rin Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.89 2024/07/14 09:31:55 skrll Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -473,11 +473,11 @@ dwc_gmac_alloc_rx_ring(struct dwc_gmac_s { struct dwc_gmac_rx_data *data; bus_addr_t physaddr; - const size_t descsize = AWGE_RX_RING_COUNT * sizeof(*ring->r_desc); + const size_t rxringsz = AWGE_RX_RING_COUNT * sizeof(*ring->r_desc); int error, i, next; ring->r_cur = ring->r_next = 0; - memset(ring->r_desc, 0, descsize); + memset(ring->r_desc, 0, rxringsz); /* * Pre-allocate Rx buffers and populate Rx ring. @@ -537,7 +537,8 @@ dwc_gmac_alloc_rx_ring(struct dwc_gmac_s sc->sc_descm->rx_set_owned_by_dev(desc); } - bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, 0, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, + RX_DESC_OFFSET(0), AWGE_RX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc), BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_RX_ADDR, @@ -581,12 +582,12 @@ dwc_gmac_reset_rx_ring(struct dwc_gmac_s static int dwc_gmac_alloc_dma_rings(struct dwc_gmac_softc *sc) { - const size_t descsize = AWGE_TOTAL_RING_COUNT * + const size_t ringsize = AWGE_TOTAL_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc); int error, nsegs; void *rings; - error = bus_dmamap_create(sc->sc_dmat, descsize, 1, descsize, 0, + error = bus_dmamap_create(sc->sc_dmat, ringsize, 1, ringsize, 0, BUS_DMA_NOWAIT, >sc_dma_ring_map); if (error != 0) { aprint_error_dev(sc->sc_dev, @@ -595,7 +596,7 @@ dwc_gmac_alloc_dma_rings(struct dwc_gmac goto fail; } - error = bus_dmamem_alloc(sc->sc_dmat, descsize, PAGE_SIZE, 0, + error = bus_dmamem_alloc(sc->sc_dmat, ringsize, PAGE_SIZE, 0, >sc_dma_ring_seg, 1, , BUS_DMA_NOWAIT |BUS_DMA_COHERENT); if (error != 0) { aprint_error_dev(sc->sc_dev, @@ -604,7 +605,7 @@ dwc_gmac_alloc_dma_rings(struct dwc_gmac } error = bus_dmamem_map(sc->sc_dmat, >sc_dma_ring_seg, nsegs, - descsize, , BUS_DMA_NOWAIT | BUS_DMA_COHERENT); + ringsize, , BUS_DMA_NOWAIT | BUS_DMA_COHERENT); if (error != 0) { aprint_error_dev(sc->sc_dev, "could not allocate DMA memory\n"); @@ -612,7 +613,7 @@ dwc_gmac_alloc_dma_rings(struct dwc_gmac } error = bus_dmamap_load(sc->sc_dmat, sc->sc_dma_ring_map, rings, - descsize, NULL, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); + ringsize, NULL, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); if (error != 0) { aprint_error_dev(sc->sc_dev, "could not load desc DMA map\n"); @@ -683,7 +684,7 @@ dwc_gmac_alloc_tx_ring(struct dwc_gmac_s bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, TX_DESC_OFFSET(0), AWGE_TX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc), - BUS_DMASYNC_POSTWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); for (i = 0; i < AWGE_TX_RING_COUNT; i++) { error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, @@ -700,6 +701,10 @@ dwc_gmac_alloc_tx_ring(struct dwc_gmac_s ring->t_physaddr + sizeof(struct dwc_gmac_dev_dmadesc) * TX_NEXT(i)); } + bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, + TX_DESC_OFFSET(0), + AWGE_TX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc), + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return 0; @@ -1088,15 +1093,17 @@ dwc_gmac_queue(struct dwc_gmac_softc *sc data->td_m = m0; data->td_active = map; + /* sync the packet buffer */ bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize, BUS_DMASYNC_PREWRITE); + /* sync the new descriptors - ownership not transferred yet */ + dwc_gmac_txdesc_sync(sc, first, sc->sc_txq.t_cur, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* Pass first
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Jul 14 09:31:55 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Fix some bus_dmamap_sync calls. - ensure new descriptors are written before handing ownership of the first in the list to the device. - ensure descriptors are sync'ed before dumping them in dwc_gmac_dump_[rt]x_desc - don't sync the TX packet buffer twice (and not after we've passed ownership of its TX descriptor) Change some variable names to better reflect what they are while I'm here. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Wed Jul 3 13:08:36 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: fix HXRC colour map handling With this we can run X in 8bit with correct colours. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/sti.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/ic/sti.c diff -u src/sys/dev/ic/sti.c:1.36 src/sys/dev/ic/sti.c:1.37 --- src/sys/dev/ic/sti.c:1.36 Tue Jun 25 11:52:11 2024 +++ src/sys/dev/ic/sti.c Wed Jul 3 13:08:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $ */ +/* $NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $ */ /* $OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $ */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $"); #include "wsdisplay.h" @@ -133,6 +133,7 @@ void ngle_artist_setupfb(struct sti_scre void ngle_elk_setupfb(struct sti_screen *); void ngle_timber_setupfb(struct sti_screen *); int ngle_putcmap(struct sti_screen *, u_int, u_int); +int ngle_hcrx_putcmap(struct sti_screen *, u_int, u_int); #endif #define STI_ENABLE_ROM(sc) \ @@ -685,7 +686,7 @@ sti_screen_setup(struct sti_screen *scr, case STI_DD_HCRX: scr->setupfb = ngle_elk_setupfb; - scr->putcmap = ngle_putcmap; + scr->putcmap = ngle_hcrx_putcmap; if (scr->scr_bpp > 8) { scr->reg12_value = NGLE_BUFF1_CMAP3; @@ -694,7 +695,7 @@ sti_screen_setup(struct sti_screen *scr, scr->reg12_value = NGLE_BUFF1_CMAP0; scr->reg10_value = 0x13602000; } - scr->cmap_finish_register = NGLE_REG_1; + scr->cmap_finish_register = NGLE_REG_38; break; case STI_DD_GRX: @@ -1649,6 +1650,7 @@ ngle_putcmap(struct sti_screen *scr, u_i r++, g++, b++; } + bus_space_write_stream_4(memt, memh, NGLE_REG_2, 0x400); bus_space_write_stream_4(memt, memh, scr->cmap_finish_register, cmap_finish); @@ -1658,6 +1660,49 @@ ngle_putcmap(struct sti_screen *scr, u_i return 0; } +int +ngle_hcrx_putcmap(struct sti_screen *scr, u_int idx, u_int count) +{ + struct sti_rom *rom = scr->scr_rom; + bus_space_tag_t memt = rom->memt; + bus_space_handle_t memh = rom->regh[2]; + uint8_t *r, *g, *b; + uint32_t cmap_finish; + + if (scr->scr_bpp > 8) + cmap_finish = 0x8100; + else + cmap_finish = 0x82000100; + + r = scr->scr_rcmap + idx; + g = scr->scr_gcmap + idx; + b = scr->scr_bcmap + idx; + + ngle_setup_hw(memt, memh); + bus_space_write_stream_4(memt, memh, NGLE_REG_10, 0xbbe0f000); + bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x03000300); + bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0x); + + while (count-- != 0) { + ngle_setup_hw(memt, memh); + bus_space_write_stream_4(memt, memh, NGLE_REG_3, + 0x400 | (idx << 2)); + bus_space_write_stream_4(memt, memh, NGLE_REG_4, + (*r << 16) | (*g << 8) | *b); + + idx++; + r++, g++, b++; + } + + + bus_space_write_stream_4(memt, memh, NGLE_REG_2, 0x400); + bus_space_write_stream_4(memt, memh, NGLE_REG_38, cmap_finish); + ngle_setup_fb(memt, memh, scr->reg10_value); + + + return 0; +} + void ngle_setup_hw(bus_space_tag_t memt, bus_space_handle_t memh) {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Wed Jul 3 13:08:36 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: fix HXRC colour map handling With this we can run X in 8bit with correct colours. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/sti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Tue Jun 25 11:52:12 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: first step to HCRX support this gets us an 8bit framebuffer with wrong colours, as opposed to X just erroring out To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/sti.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/ic/sti.c diff -u src/sys/dev/ic/sti.c:1.35 src/sys/dev/ic/sti.c:1.36 --- src/sys/dev/ic/sti.c:1.35 Tue Feb 13 13:17:51 2024 +++ src/sys/dev/ic/sti.c Tue Jun 25 11:52:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $ */ +/* $NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $ */ /* $OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $ */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $"); #include "wsdisplay.h" @@ -683,12 +683,25 @@ sti_screen_setup(struct sti_screen *scr, } break; + case STI_DD_HCRX: + scr->setupfb = ngle_elk_setupfb; + scr->putcmap = ngle_putcmap; + + if (scr->scr_bpp > 8) { + scr->reg12_value = NGLE_BUFF1_CMAP3; + scr->reg10_value = 0xBBA0A000; + } else { + scr->reg12_value = NGLE_BUFF1_CMAP0; + scr->reg10_value = 0x13602000; + } + scr->cmap_finish_register = NGLE_REG_1; + break; + case STI_DD_GRX: case STI_DD_CRX24: case STI_DD_EVRX: case STI_DD_3X2V: case STI_DD_DUAL_CRX: - case STI_DD_HCRX: case STI_DD_LEGO: case STI_DD_SUMMIT: case STI_DD_PINNACLE:
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Tue Jun 25 11:52:12 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: first step to HCRX support this gets us an 8bit framebuffer with wrong colours, as opposed to X just erroring out To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/sti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Jun 16 17:11:12 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Misc whitespace To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Jun 16 17:11:12 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Misc whitespace To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.86 src/sys/dev/ic/dwc_gmac.c:1.87 --- src/sys/dev/ic/dwc_gmac.c:1.86 Thu Mar 14 16:43:00 2024 +++ src/sys/dev/ic/dwc_gmac.c Sun Jun 16 17:11:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.86 2024/03/14 16:43:00 jakllsch Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.87 2024/06/16 17:11:11 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.86 2024/03/14 16:43:00 jakllsch Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.87 2024/06/16 17:11:11 skrll Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -655,7 +655,6 @@ dwc_gmac_free_rx_ring(struct dwc_gmac_so if (ring->r_desc == NULL) return; - for (i = 0; i < AWGE_RX_RING_COUNT; i++) { data = >r_data[i]; @@ -700,7 +699,7 @@ dwc_gmac_alloc_tx_ring(struct dwc_gmac_s } ring->t_desc[i].ddesc_next = htole32( ring->t_physaddr + sizeof(struct dwc_gmac_dev_dmadesc) - *TX_NEXT(i)); + * TX_NEXT(i)); } return 0; @@ -1674,9 +1673,9 @@ static void dwc_dump_status(struct dwc_gmac_softc *sc) { uint32_t status = bus_space_read_4(sc->sc_bst, sc->sc_bsh, - AWIN_GMAC_MAC_INTR); + AWIN_GMAC_MAC_INTR); uint32_t dma_status = bus_space_read_4(sc->sc_bst, sc->sc_bsh, - AWIN_GMAC_DMA_STATUS); + AWIN_GMAC_DMA_STATUS); char buf[200]; /* print interrupt state */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Tue May 21 08:04:20 UTC 2024 Modified Files: src/sys/dev/ic: ne2000.c Log Message: nix extra whitespace. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/dev/ic/ne2000.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/ic/ne2000.c diff -u src/sys/dev/ic/ne2000.c:1.78 src/sys/dev/ic/ne2000.c:1.79 --- src/sys/dev/ic/ne2000.c:1.78 Tue May 21 07:29:40 2024 +++ src/sys/dev/ic/ne2000.c Tue May 21 08:04:20 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ne2000.c,v 1.78 2024/05/21 07:29:40 andvar Exp $ */ +/* $NetBSD: ne2000.c,v 1.79 2024/05/21 08:04:20 andvar Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.78 2024/05/21 07:29:40 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.79 2024/05/21 08:04:20 andvar Exp $"); #include "rtl80x9.h" @@ -373,7 +373,7 @@ ne2000_detect(bus_space_tag_t nict, bus_ /* * Generic probe routine for testing for the existence of a DS8390. - * Must be performed after the NIC has just been reset. This + * Must be performed after the NIC has just been reset. This * works by looking at certain register values that are guaranteed * to be initialized a certain way after power-up or reset. *
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Tue May 21 08:04:20 UTC 2024 Modified Files: src/sys/dev/ic: ne2000.c Log Message: nix extra whitespace. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/dev/ic/ne2000.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Tue May 21 07:29:40 UTC 2024 Modified Files: src/sys/dev/ic: mx98905.c ne2000.c Log Message: s/amout/amount/ in comments. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/mx98905.c cvs rdiff -u -r1.77 -r1.78 src/sys/dev/ic/ne2000.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/ic/mx98905.c diff -u src/sys/dev/ic/mx98905.c:1.17 src/sys/dev/ic/mx98905.c:1.18 --- src/sys/dev/ic/mx98905.c:1.17 Tue Aug 1 20:52:43 2023 +++ src/sys/dev/ic/mx98905.c Tue May 21 07:29:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: mx98905.c,v 1.17 2023/08/01 20:52:43 andvar Exp $ */ +/* $NetBSD: mx98905.c,v 1.18 2024/05/21 07:29:40 andvar Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: mx98905.c,v 1.17 2023/08/01 20:52:43 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mx98905.c,v 1.18 2024/05/21 07:29:40 andvar Exp $"); #include #include @@ -282,7 +282,7 @@ mx98905_write_mbuf(struct dp8390_softc * } /* - * Given a source and destination address, copy 'amout' of a packet from + * Given a source and destination address, copy 'amount' of a packet from * the ring buffer into a linear destination buffer. Takes into account * ring-wrap. */ Index: src/sys/dev/ic/ne2000.c diff -u src/sys/dev/ic/ne2000.c:1.77 src/sys/dev/ic/ne2000.c:1.78 --- src/sys/dev/ic/ne2000.c:1.77 Fri Aug 20 20:25:28 2021 +++ src/sys/dev/ic/ne2000.c Tue May 21 07:29:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ne2000.c,v 1.77 2021/08/20 20:25:28 andvar Exp $ */ +/* $NetBSD: ne2000.c,v 1.78 2024/05/21 07:29:40 andvar Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.77 2021/08/20 20:25:28 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.78 2024/05/21 07:29:40 andvar Exp $"); #include "rtl80x9.h" @@ -716,7 +716,7 @@ ne2000_write_mbuf(struct dp8390_softc *s } /* - * Given a source and destination address, copy 'amout' of a packet from + * Given a source and destination address, copy 'amount' of a packet from * the ring buffer into a linear destination buffer. Takes into account * ring-wrap. */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Tue May 21 07:29:40 UTC 2024 Modified Files: src/sys/dev/ic: mx98905.c ne2000.c Log Message: s/amout/amount/ in comments. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/mx98905.c cvs rdiff -u -r1.77 -r1.78 src/sys/dev/ic/ne2000.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Tue May 14 13:41:15 UTC 2024 Modified Files: src/sys/dev/ic: tpm.c Log Message: tpm(4): device_printf needs \n. Observed in PR 58255. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/tpm.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/ic/tpm.c diff -u src/sys/dev/ic/tpm.c:1.28 src/sys/dev/ic/tpm.c:1.29 --- src/sys/dev/ic/tpm.c:1.28 Tue Jul 4 01:02:26 2023 +++ src/sys/dev/ic/tpm.c Tue May 14 13:41:15 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tpm.c,v 1.28 2023/07/04 01:02:26 riastradh Exp $ */ +/* $NetBSD: tpm.c,v 1.29 2024/05/14 13:41:15 riastradh Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.28 2023/07/04 01:02:26 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.29 2024/05/14 13:41:15 riastradh Exp $"); #include #include @@ -150,7 +150,7 @@ tpm12_suspend(struct tpm_softc *sc) */ error = (*sc->sc_intf->start)(sc, UIO_WRITE); if (error) { - device_printf(sc->sc_dev, "start write failed: %d", error); + device_printf(sc->sc_dev, "start write failed: %d\n", error); goto out; } @@ -158,8 +158,8 @@ tpm12_suspend(struct tpm_softc *sc) error = (*sc->sc_intf->write)(sc, , sizeof(command)); if (error) { - device_printf(sc->sc_dev, "write TPM_ORD_SaveState failed: %d", - error); + device_printf(sc->sc_dev, "write TPM_ORD_SaveState failed:" + " %d\n", error); goto out; } @@ -167,7 +167,7 @@ tpm12_suspend(struct tpm_softc *sc) error = (*sc->sc_intf->end)(sc, UIO_WRITE, 0); if (error) { - device_printf(sc->sc_dev, "end write failed: %d", error); + device_printf(sc->sc_dev, "end write failed: %d\n", error); goto out; } @@ -177,7 +177,7 @@ tpm12_suspend(struct tpm_softc *sc) */ error = (*sc->sc_intf->start)(sc, UIO_READ); if (error) { - device_printf(sc->sc_dev, "start read failed: %d", error); + device_printf(sc->sc_dev, "start read failed: %d\n", error); goto out; } @@ -186,11 +186,11 @@ tpm12_suspend(struct tpm_softc *sc) error = (*sc->sc_intf->read)(sc, , sizeof(response), , 0); if (error) { - device_printf(sc->sc_dev, "read failed: %d", error); + device_printf(sc->sc_dev, "read failed: %d\n", error); goto out; } if (nread != sizeof(response)) { - device_printf(sc->sc_dev, "short header read: %zu", nread); + device_printf(sc->sc_dev, "short header read: %zu\n", nread); goto out; } @@ -198,7 +198,7 @@ tpm12_suspend(struct tpm_softc *sc) error = (*sc->sc_intf->end)(sc, UIO_READ, 0); if (error) { - device_printf(sc->sc_dev, "end read failed: %d", error); + device_printf(sc->sc_dev, "end read failed: %d\n", error); goto out; } @@ -209,7 +209,8 @@ tpm12_suspend(struct tpm_softc *sc) be32toh(response.length) != sizeof(response) || be32toh(response.code) != 0) { device_printf(sc->sc_dev, - "TPM_ORD_SaveState failed: tag=0x%x length=0x%x code=0x%x", + "TPM_ORD_SaveState failed:" + " tag=0x%x length=0x%x code=0x%x\n", be16toh(response.tag), be32toh(response.length), be32toh(response.code)); @@ -248,7 +249,7 @@ tpm20_suspend(struct tpm_softc *sc) */ error = (*sc->sc_intf->start)(sc, UIO_WRITE); if (error) { - device_printf(sc->sc_dev, "start write failed: %d", error); + device_printf(sc->sc_dev, "start write failed: %d\n", error); goto out; } @@ -256,8 +257,8 @@ tpm20_suspend(struct tpm_softc *sc) error = (*sc->sc_intf->write)(sc, , sizeof(command)); if (error) { - device_printf(sc->sc_dev, "write TPM_ORD_SaveState failed: %d", - error); + device_printf(sc->sc_dev, "write TPM_ORD_SaveState failed:" + " %d\n", error); goto out; } @@ -265,7 +266,7 @@ tpm20_suspend(struct tpm_softc *sc) error = (*sc->sc_intf->end)(sc, UIO_WRITE, 0); if (error) { - device_printf(sc->sc_dev, "end write failed: %d", error); + device_printf(sc->sc_dev, "end write failed: %d\n", error); goto out; } @@ -275,7 +276,7 @@ tpm20_suspend(struct tpm_softc *sc) */ error = (*sc->sc_intf->start)(sc, UIO_READ); if (error) { - device_printf(sc->sc_dev, "start read failed: %d", error); + device_printf(sc->sc_dev, "start read failed: %d\n", error); goto out; } @@ -284,11 +285,11 @@ tpm20_suspend(struct tpm_softc *sc) error = (*sc->sc_intf->read)(sc, , sizeof(response), , 0); if (error) { - device_printf(sc->sc_dev, "read failed: %d", error); + device_printf(sc->sc_dev, "read failed: %d\n", error); goto out; } if (nread != sizeof(response)) { - device_printf(sc->sc_dev, "short header read: %zu", nread); + device_printf(sc->sc_dev, "short header read: %zu\n", nread); goto out; } @@ -296,7 +297,7 @@ tpm20_suspend(struct tpm_softc *sc) error = (*sc->sc_intf->end)(sc, UIO_READ, 0); if (error) { -
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Tue May 14 13:41:15 UTC 2024 Modified Files: src/sys/dev/ic: tpm.c Log Message: tpm(4): device_printf needs \n. Observed in PR 58255. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/tpm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sat Apr 6 13:42:18 UTC 2024 Modified Files: src/sys/dev/ic: qemufwcfg.c Log Message: Add RISC-V support To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/qemufwcfg.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/ic/qemufwcfg.c diff -u src/sys/dev/ic/qemufwcfg.c:1.2 src/sys/dev/ic/qemufwcfg.c:1.3 --- src/sys/dev/ic/qemufwcfg.c:1.2 Mon Sep 3 16:29:31 2018 +++ src/sys/dev/ic/qemufwcfg.c Sat Apr 6 13:42:18 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: qemufwcfg.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $ */ +/* $NetBSD: qemufwcfg.c,v 1.3 2024/04/06 13:42:18 skrll Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: qemufwcfg.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: qemufwcfg.c,v 1.3 2024/04/06 13:42:18 skrll Exp $"); #include #include @@ -52,6 +52,11 @@ __KERNEL_RCSID(0, "$NetBSD: qemufwcfg.c, #define FWCFG_SEL_SWAP htobe16 #define FWCFG_DATA_REG 0x00 #define FWCFG_DMA_ADDR 0x10 +#elif defined(__riscv) +#define FWCFG_SEL_REG 0x08 +#define FWCFG_SEL_SWAP htobe16 +#define FWCFG_DATA_REG 0x00 +#define FWCFG_DMA_ADDR 0x10 #else #error driver does not support this architecture #endif
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sat Apr 6 13:42:18 UTC 2024 Modified Files: src/sys/dev/ic: qemufwcfg.c Log Message: Add RISC-V support To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/qemufwcfg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Sat Mar 16 18:17:39 UTC 2024 Modified Files: src/sys/dev/ic: lan9118reg.h Log Message: s/Broardcast/Broadcast/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/lan9118reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Sat Mar 16 18:17:39 UTC 2024 Modified Files: src/sys/dev/ic: lan9118reg.h Log Message: s/Broardcast/Broadcast/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/lan9118reg.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/ic/lan9118reg.h diff -u src/sys/dev/ic/lan9118reg.h:1.3 src/sys/dev/ic/lan9118reg.h:1.4 --- src/sys/dev/ic/lan9118reg.h:1.3 Mon Sep 27 12:29:03 2010 +++ src/sys/dev/ic/lan9118reg.h Sat Mar 16 18:17:39 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lan9118reg.h,v 1.3 2010/09/27 12:29:03 kiyohara Exp $ */ +/* $NetBSD: lan9118reg.h,v 1.4 2024/03/16 18:17:39 andvar Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -206,7 +206,7 @@ #define LAN9118_MAC_CR_HO (1 << 15) /* Hash Only Filtering mode */ #define LAN9118_MAC_CR_HPFILT (1 << 13) /* Hash/Perfect Flt Mode */ #define LAN9118_MAC_CR_LCOLL (1 << 12) /* Late Collision Control */ -#define LAN9118_MAC_CR_BCAST (1 << 11) /* Disable Broardcast Frms */ +#define LAN9118_MAC_CR_BCAST (1 << 11) /* Disable Broadcast Frms */ #define LAN9118_MAC_CR_DISRTY (1 << 10) /* Disable Retry */ #define LAN9118_MAC_CR_PADSTR (1 << 8) /* Automatic Pad String */ #define LAN9118_MAC_CR_BOLMT (1 << 7) /* BackOff Limit */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jakllsch Date: Thu Mar 14 16:43:00 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Use ether_crc32_be() instead of having a local bitrev32() function to munge ether_crc32_le() output when programming multicast filter. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jakllsch Date: Thu Mar 14 16:43:00 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Use ether_crc32_be() instead of having a local bitrev32() function to munge ether_crc32_le() output when programming multicast filter. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.85 src/sys/dev/ic/dwc_gmac.c:1.86 --- src/sys/dev/ic/dwc_gmac.c:1.85 Sun Mar 3 10:09:42 2024 +++ src/sys/dev/ic/dwc_gmac.c Thu Mar 14 16:43:00 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.85 2024/03/03 10:09:42 skrll Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.86 2024/03/14 16:43:00 jakllsch Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.85 2024/03/03 10:09:42 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.86 2024/03/14 16:43:00 jakllsch Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -98,7 +98,6 @@ static void dwc_gmac_tx_intr(struct dwc_ static void dwc_gmac_rx_intr(struct dwc_gmac_softc *); static void dwc_gmac_setmulti(struct dwc_gmac_softc *); static int dwc_gmac_ifflags_cb(struct ethercom *); -static uint32_t bitrev32(uint32_t); static void dwc_gmac_desc_set_owned_by_dev(struct dwc_gmac_dev_dmadesc *); static int dwc_gmac_desc_is_owned_by_dev(struct dwc_gmac_dev_dmadesc *); static void dwc_gmac_desc_std_set_len(struct dwc_gmac_dev_dmadesc *, int); @@ -1346,20 +1345,6 @@ skip: mutex_exit(>sc_rxq.r_mtx); } -/* - * Reverse order of bits - http://aggregate.org/MAGIC/#Bit%20Reversal - */ -static uint32_t -bitrev32(uint32_t x) -{ - x = (((x & 0x) >> 1) | ((x & 0x) << 1)); - x = (((x & 0x) >> 2) | ((x & 0x) << 2)); - x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); - x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); - - return (x >> 16) | (x << 16); -} - static void dwc_gmac_setmulti(struct dwc_gmac_softc *sc) { @@ -1398,9 +1383,7 @@ dwc_gmac_setmulti(struct dwc_gmac_softc goto special_filter; } - h = bitrev32( - ~ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN) - ) >> 26; + h = ~ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26; hashes[h >> 5] |= (1 << (h & 0x1f)); mcnt++;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Mon Mar 11 21:10:46 UTC 2024 Modified Files: src/sys/dev/ic: nvme.c Log Message: nvme(4): Disestablish admin q interrupt while suspended. And re-establish on resume. Fixes nvmectl(8) after a suspend/resume cycle on some systems. Adapted from a patch by mrg@. PR kern/58025 To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/nvme.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/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.68 src/sys/dev/ic/nvme.c:1.69 --- src/sys/dev/ic/nvme.c:1.68 Sun Mar 10 04:49:22 2024 +++ src/sys/dev/ic/nvme.c Mon Mar 11 21:10:46 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $ */ +/* $NetBSD: nvme.c,v 1.69 2024/03/11 21:10:46 riastradh Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.69 2024/03/11 21:10:46 riastradh Exp $"); #include #include @@ -575,7 +575,6 @@ nvme_detach(struct nvme_softc *sc, int f return error; /* from now on we are committed to detach, following will never fail */ - sc->sc_intr_disestablish(sc, NVME_ADMIN_Q); for (i = 0; i < sc->sc_nq; i++) nvme_q_free(sc, sc->sc_q[i]); kmem_free(sc->sc_q, sizeof(*sc->sc_q) * sc->sc_nq); @@ -603,6 +602,11 @@ nvme_resume(struct nvme_softc *sc) } nvme_q_reset(sc, sc->sc_admin_q); + if (sc->sc_intr_establish(sc, NVME_ADMIN_Q, sc->sc_admin_q)) { + error = EIO; + device_printf(sc->sc_dev, "unable to establish admin q\n"); + goto disable; + } error = nvme_enable(sc, ffs(sc->sc_mps) - 1); if (error) { @@ -651,6 +655,8 @@ nvme_shutdown(struct nvme_softc *sc) if (disabled) goto disable; + sc->sc_intr_disestablish(sc, NVME_ADMIN_Q); + cc = nvme_read4(sc, NVME_CC); CLR(cc, NVME_CC_SHN_MASK); SET(cc, NVME_CC_SHN(NVME_CC_SHN_NORMAL));
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Mon Mar 11 21:10:46 UTC 2024 Modified Files: src/sys/dev/ic: nvme.c Log Message: nvme(4): Disestablish admin q interrupt while suspended. And re-establish on resume. Fixes nvmectl(8) after a suspend/resume cycle on some systems. Adapted from a patch by mrg@. PR kern/58025 To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: rillig Date: Sun Mar 10 17:16:26 UTC 2024 Modified Files: src/sys/dev/ic: lsi64854reg.h Log Message: lsi64854reg: fix snprintb formats DDMACSR_BITS and PDMACSR_BITS To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/lsi64854reg.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/ic/lsi64854reg.h diff -u src/sys/dev/ic/lsi64854reg.h:1.6 src/sys/dev/ic/lsi64854reg.h:1.7 --- src/sys/dev/ic/lsi64854reg.h:1.6 Mon Apr 28 20:23:50 2008 +++ src/sys/dev/ic/lsi64854reg.h Sun Mar 10 17:16:26 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lsi64854reg.h,v 1.6 2008/04/28 20:23:50 martin Exp $ */ +/* $NetBSD: lsi64854reg.h,v 1.7 2024/03/10 17:16:26 rillig Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -125,7 +125,7 @@ #define DDMACSR_BITS "\177\020"\ "b\00INT\0b\01ERR\0f\02\02DRAINING\0b\04IEN\0" \ "b\06SLVERR\0b\07RST\0b\10WRITE\0b\11ENDMA\0" \ - "b\15ENCNT\0b\16TC\0\b\20DSBL_CSR_DRN\0" \ + "b\15ENCNT\0b\16TC\0b\20DSBL_CSR_DRN\0" \ "b\21DSBL_SCSI_DRN\0f\22\2BURST\0b\25TWOCYCLE\0" \ "b\26FASTER\0b\27TCIDIS\0b\30ENNXT\0b\031DMAON\0" \ "b\32ALOADED\0b\33NALOADED\0" @@ -192,5 +192,5 @@ #define PDMACSR_BITS "\177\020"\ "b\00INT\0b\01ERR\0f\02\02DRAINING\0b\04IEN\0" \ "b\06SLVERR\0b\07RST\0b\10WRITE\0b\11ENDMA\0" \ - "b\15ENCNT\0b\16TC\0\b\24DIAG\0b\27TCIDIS\0" \ + "b\15ENCNT\0b\16TC\0b\24DIAG\0b\27TCIDIS\0" \ "b\30ENNXT\0b\031DMAON\0b\32ALOADED\0b\33NALOADED\0"
CVS commit: src/sys/dev/ic
Module Name:src Committed By: rillig Date: Sun Mar 10 17:16:26 UTC 2024 Modified Files: src/sys/dev/ic: lsi64854reg.h Log Message: lsi64854reg: fix snprintb formats DDMACSR_BITS and PDMACSR_BITS To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/lsi64854reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: mrg Date: Sun Mar 10 04:49:22 UTC 2024 Modified Files: src/sys/dev/ic: nvme.c Log Message: nvme(4): don't write to INTMC register if in intx mode this matches the handling of INTMS, both of which have the same restrictions on access in MSI-X mode. ideally, this register should be written to with a full set of values for MSI (upto 32 bits), but trying to force MSI mode for my test machine makes the system unstable. tested with samsung SM981 256GB, samsung 980 PRO 1TB, and intel 760p 250G. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/nvme.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/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.67 src/sys/dev/ic/nvme.c:1.68 --- src/sys/dev/ic/nvme.c:1.67 Tue Sep 13 10:14:20 2022 +++ src/sys/dev/ic/nvme.c Sun Mar 10 04:49:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.67 2022/09/13 10:14:20 riastradh Exp $ */ +/* $NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.67 2022/09/13 10:14:20 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $"); #include #include @@ -620,7 +620,8 @@ nvme_resume(struct nvme_softc *sc) } } - nvme_write4(sc, NVME_INTMC, 1); + if (!sc->sc_use_mq) + nvme_write4(sc, NVME_INTMC, 1); return 0; @@ -2023,6 +2024,8 @@ nvme_intr(void *xsc) { struct nvme_softc *sc = xsc; + KASSERT(!sc->sc_use_mq); + /* * INTx is level triggered, controller deasserts the interrupt only * when we advance command queue head via write to the doorbell. @@ -2043,6 +2046,8 @@ nvme_softintr_intx(void *xq) struct nvme_queue *q = xq; struct nvme_softc *sc = q->q_sc; + KASSERT(!sc->sc_use_mq); + nvme_q_complete(sc, sc->sc_admin_q); if (sc->sc_q != NULL) nvme_q_complete(sc, sc->sc_q[0]);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: mrg Date: Sun Mar 10 04:49:22 UTC 2024 Modified Files: src/sys/dev/ic: nvme.c Log Message: nvme(4): don't write to INTMC register if in intx mode this matches the handling of INTMS, both of which have the same restrictions on access in MSI-X mode. ideally, this register should be written to with a full set of values for MSI (upto 32 bits), but trying to force MSI mode for my test machine makes the system unstable. tested with samsung SM981 256GB, samsung 980 PRO 1TB, and intel 760p 250G. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: thorpej Date: Wed Mar 6 02:31:44 UTC 2024 Modified Files: src/sys/dev/ic: mc146818.c mc146818var.h Log Message: Expose mc146818_{get,set}time_ymdhms() and allow a front-end to override these function pointers in the TODR handle, allowing the front-end to wrap mc146818_{get,set}time_ymdhms() with special handling, if needed. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mc146818.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/mc146818var.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/ic/mc146818.c diff -u src/sys/dev/ic/mc146818.c:1.20 src/sys/dev/ic/mc146818.c:1.21 --- src/sys/dev/ic/mc146818.c:1.20 Wed Jan 1 19:24:03 2020 +++ src/sys/dev/ic/mc146818.c Wed Mar 6 02:31:44 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: mc146818.c,v 1.20 2020/01/01 19:24:03 thorpej Exp $ */ +/* $NetBSD: mc146818.c,v 1.21 2024/03/06 02:31:44 thorpej Exp $ */ /*- * Copyright (c) 2003 Izumi Tsutsui. All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mc146818.c,v 1.20 2020/01/01 19:24:03 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mc146818.c,v 1.21 2024/03/06 02:31:44 thorpej Exp $"); #include #include @@ -43,9 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: mc146818.c,v #include #include -int mc146818_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *); -int mc146818_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *); - void mc146818_attach(struct mc146818_softc *sc) { @@ -61,11 +58,14 @@ mc146818_attach(struct mc146818_softc *s handle = >sc_handle; handle->cookie = sc; - handle->todr_gettime = NULL; - handle->todr_settime = NULL; - handle->todr_gettime_ymdhms = mc146818_gettime_ymdhms; - handle->todr_settime_ymdhms = mc146818_settime_ymdhms; - handle->todr_setwen = NULL; + KASSERT(handle->todr_gettime == NULL); + KASSERT(handle->todr_settime == NULL); + if (handle->todr_gettime_ymdhms == NULL) { + handle->todr_gettime_ymdhms = mc146818_gettime_ymdhms; + } + if (handle->todr_settime_ymdhms == NULL) { + handle->todr_settime_ymdhms = mc146818_settime_ymdhms; + } todr_attach(handle); } @@ -103,7 +103,7 @@ mc146818_gettime_ymdhms(todr_chip_handle dt->dt_wday = FROMREG((*sc->sc_mcread)(sc, MC_DOW)); dt->dt_day = FROMREG((*sc->sc_mcread)(sc, MC_DOM)); dt->dt_mon = FROMREG((*sc->sc_mcread)(sc, MC_MONTH)); - year = FROMREG((*sc->sc_mcread)(sc, MC_YEAR)); + year= FROMREG((*sc->sc_mcread)(sc, MC_YEAR)); if (sc->sc_getcent) { cent = (*sc->sc_getcent)(sc); year += cent * 100; Index: src/sys/dev/ic/mc146818var.h diff -u src/sys/dev/ic/mc146818var.h:1.7 src/sys/dev/ic/mc146818var.h:1.8 --- src/sys/dev/ic/mc146818var.h:1.7 Wed May 14 13:29:29 2008 +++ src/sys/dev/ic/mc146818var.h Wed Mar 6 02:31:44 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: mc146818var.h,v 1.7 2008/05/14 13:29:29 tsutsui Exp $ */ +/* $NetBSD: mc146818var.h,v 1.8 2024/03/06 02:31:44 thorpej Exp $ */ /*- * Copyright (c) 2003 Izumi Tsutsui. All rights reserved. @@ -24,6 +24,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _DEV_IC_MC146818VAR_H_ +#define _DEV_IC_MC146818VAR_H_ + struct mc146818_softc { device_t sc_dev; @@ -45,4 +48,8 @@ struct mc146818_softc { void (*sc_setcent)(struct mc146818_softc *, u_int); }; -void mc146818_attach(struct mc146818_softc *); +void mc146818_attach(struct mc146818_softc *); +int mc146818_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *); +int mc146818_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *); + +#endif /* _DEV_IC_MC146818VAR_H_ */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: thorpej Date: Wed Mar 6 02:31:44 UTC 2024 Modified Files: src/sys/dev/ic: mc146818.c mc146818var.h Log Message: Expose mc146818_{get,set}time_ymdhms() and allow a front-end to override these function pointers in the TODR handle, allowing the front-end to wrap mc146818_{get,set}time_ymdhms() with special handling, if needed. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mc146818.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/mc146818var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Mar 3 10:09:42 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Reorder the bus_dmamap_sync sync operations BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD to BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE for consistency. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.84 src/sys/dev/ic/dwc_gmac.c:1.85 --- src/sys/dev/ic/dwc_gmac.c:1.84 Sun Mar 3 10:02:11 2024 +++ src/sys/dev/ic/dwc_gmac.c Sun Mar 3 10:09:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.84 2024/03/03 10:02:11 skrll Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.85 2024/03/03 10:09:42 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.84 2024/03/03 10:02:11 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.85 2024/03/03 10:09:42 skrll Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -540,7 +540,7 @@ dwc_gmac_alloc_rx_ring(struct dwc_gmac_s bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, 0, AWGE_RX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc), - BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_RX_ADDR, ring->r_physaddr);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Mar 3 10:09:42 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Reorder the bus_dmamap_sync sync operations BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD to BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE for consistency. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Mar 3 10:02:11 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: More KNF (whitespace around binary operators) To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.83 src/sys/dev/ic/dwc_gmac.c:1.84 --- src/sys/dev/ic/dwc_gmac.c:1.83 Tue Feb 27 08:28:56 2024 +++ src/sys/dev/ic/dwc_gmac.c Sun Mar 3 10:02:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.83 2024/02/27 08:28:56 skrll Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.84 2024/03/03 10:02:11 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.83 2024/02/27 08:28:56 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.84 2024/03/03 10:02:11 skrll Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -718,20 +718,20 @@ dwc_gmac_txdesc_sync(struct dwc_gmac_sof if (end > start) { bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, TX_DESC_OFFSET(start), - TX_DESC_OFFSET(end)-TX_DESC_OFFSET(start), + TX_DESC_OFFSET(end) - TX_DESC_OFFSET(start), ops); return; } /* sync from 'start' to end of ring */ bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, TX_DESC_OFFSET(start), - TX_DESC_OFFSET(AWGE_TX_RING_COUNT)-TX_DESC_OFFSET(start), + TX_DESC_OFFSET(AWGE_TX_RING_COUNT) - TX_DESC_OFFSET(start), ops); if (TX_DESC_OFFSET(end) - TX_DESC_OFFSET(0) > 0) { /* sync from start of ring to 'end' */ bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, TX_DESC_OFFSET(0), - TX_DESC_OFFSET(end)-TX_DESC_OFFSET(0), + TX_DESC_OFFSET(end) - TX_DESC_OFFSET(0), ops); } }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Mar 3 10:02:11 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: More KNF (whitespace around binary operators) To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Thu Feb 29 22:02:41 UTC 2024 Modified Files: src/sys/dev/ic: mpc106reg.h Log Message: Fix couple typos in comments. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/mpc106reg.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/ic/mpc106reg.h diff -u src/sys/dev/ic/mpc106reg.h:1.4 src/sys/dev/ic/mpc106reg.h:1.5 --- src/sys/dev/ic/mpc106reg.h:1.4 Mon Apr 28 20:23:50 2008 +++ src/sys/dev/ic/mpc106reg.h Thu Feb 29 22:02:41 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: mpc106reg.h,v 1.4 2008/04/28 20:23:50 martin Exp $ */ +/* $NetBSD: mpc106reg.h,v 1.5 2024/02/29 22:02:41 andvar Exp $ */ /*- * Copyright (c) 2001,2007 The NetBSD Foundation, Inc. @@ -86,7 +86,7 @@ /* must be read with MPC106_PICR1_EXT_L2_EN : * L2_EN L2_MP Meaning * 0 00 Uniprocessor/none - * 0 01 internal conrol/write-through + * 0 01 internal control/write-through * 0 10 internal control/write-back * 0 11 Multiproc/none * 1 00 Uniprocessor/external L2 @@ -185,7 +185,7 @@ #define MPC106_MCRR2_EXT_ECM_ECC_EN __BIT(18) /* ext. ECM ECC enable */ #define MPC106_MCRR2_ECC_EN __BIT(17) /* ECC enable */ #define MPC106_MCRR2_EDO __BIT(16) /* EDO enable */ -#define MPC106_MCRR2_REFINT __BITS(15,2) /* refreash interval */ +#define MPC106_MCRR2_REFINT __BITS(15,2) /* refresh interval */ #define MPC106_MCRR2_BUFMODE __BIT(1) /* buffer mode */ #define MPC106_MCRR2_RMW_PAR __BIT(0) /* RMW parity enable */ #define MPC106_MCCR3 0xf8 /* Memory control configuration 3 */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Thu Feb 29 22:02:41 UTC 2024 Modified Files: src/sys/dev/ic: mpc106reg.h Log Message: Fix couple typos in comments. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/mpc106reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Feb 27 08:33:07 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac_var.h Log Message: Use __BIT. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/dwc_gmac_var.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/ic/dwc_gmac_var.h diff -u src/sys/dev/ic/dwc_gmac_var.h:1.18 src/sys/dev/ic/dwc_gmac_var.h:1.19 --- src/sys/dev/ic/dwc_gmac_var.h:1.18 Sun Feb 11 12:25:20 2024 +++ src/sys/dev/ic/dwc_gmac_var.h Tue Feb 27 08:33:06 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac_var.h,v 1.18 2024/02/11 12:25:20 skrll Exp $ */ +/* $NetBSD: dwc_gmac_var.h,v 1.19 2024/02/27 08:33:06 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -108,7 +108,7 @@ struct dwc_gmac_softc { bus_space_handle_t sc_bsh; bus_dma_tag_t sc_dmat; uint32_t sc_flags; -#define DWC_GMAC_FORCE_THRESH_DMA_MODE 0x01 /* force DMA to use threshold mode */ +#define DWC_GMAC_FORCE_THRESH_DMA_MODE __BIT(0)/* force DMA to use threshold mode */ struct ethercom sc_ec; struct mii_data sc_mii; kmutex_t sc_mdio_lock;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Feb 27 08:33:07 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac_var.h Log Message: Use __BIT. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/dwc_gmac_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Feb 27 08:28:56 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Enforce the device 32 bit DMA limitation via bus_dmatag_subregion if bus can address more than 4GB. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.82 src/sys/dev/ic/dwc_gmac.c:1.83 --- src/sys/dev/ic/dwc_gmac.c:1.82 Tue Feb 27 08:25:38 2024 +++ src/sys/dev/ic/dwc_gmac.c Tue Feb 27 08:28:56 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.82 2024/02/27 08:25:38 skrll Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.83 2024/02/27 08:28:56 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.82 2024/02/27 08:25:38 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.83 2024/02/27 08:28:56 skrll Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -245,6 +245,17 @@ dwc_gmac_attach(struct dwc_gmac_softc *s aprint_normal_dev(sc->sc_dev, "HW feature mask: %x\n", hwft); } + + if (sizeof(bus_addr_t) > 4) { + int error = bus_dmatag_subregion(sc->sc_dmat, 0, __MASK(32), + >sc_dmat, BUS_DMA_WAITOK); + if (error != 0) { + aprint_error_dev(sc->sc_dev, + "failed to create DMA subregion\n"); + return ENOMEM; + } + } + if (hwft & GMAC_DMA_FEAT_ENHANCED_DESC) { aprint_normal_dev(sc->sc_dev, "Using enhanced descriptor format\n");
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Feb 27 08:28:56 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Enforce the device 32 bit DMA limitation via bus_dmatag_subregion if bus can address more than 4GB. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Feb 27 08:25:38 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: KNF - spaces around binary operators. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.81 src/sys/dev/ic/dwc_gmac.c:1.82 --- src/sys/dev/ic/dwc_gmac.c:1.81 Sun Feb 11 12:28:20 2024 +++ src/sys/dev/ic/dwc_gmac.c Tue Feb 27 08:25:38 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.81 2024/02/11 12:28:20 skrll Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.82 2024/02/27 08:25:38 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.81 2024/02/11 12:28:20 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.82 2024/02/27 08:25:38 skrll Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -147,12 +147,12 @@ static const struct dwc_gmac_desc_method }; -#define TX_DESC_OFFSET(N) ((AWGE_RX_RING_COUNT+(N)) \ -*sizeof(struct dwc_gmac_dev_dmadesc)) -#define TX_NEXT(N) (((N)+1) & (AWGE_TX_RING_COUNT-1)) +#define TX_DESC_OFFSET(N) ((AWGE_RX_RING_COUNT + (N)) \ +* sizeof(struct dwc_gmac_dev_dmadesc)) +#define TX_NEXT(N) (((N) + 1) & (AWGE_TX_RING_COUNT - 1)) -#define RX_DESC_OFFSET(N) ((N)*sizeof(struct dwc_gmac_dev_dmadesc)) -#define RX_NEXT(N) (((N)+1) & (AWGE_RX_RING_COUNT-1)) +#define RX_DESC_OFFSET(N) ((N) * sizeof(struct dwc_gmac_dev_dmadesc)) +#define RX_NEXT(N) (((N) + 1) & (AWGE_RX_RING_COUNT - 1)) @@ -528,7 +528,7 @@ dwc_gmac_alloc_rx_ring(struct dwc_gmac_s } bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, 0, - AWGE_RX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc), + AWGE_RX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc), BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_RX_ADDR, ring->r_physaddr); @@ -558,7 +558,7 @@ dwc_gmac_reset_rx_ring(struct dwc_gmac_s } bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, 0, - AWGE_RX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc), + AWGE_RX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc), BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); ring->r_cur = ring->r_next = 0; @@ -616,7 +616,7 @@ dwc_gmac_alloc_dma_rings(struct dwc_gmac /* and next rings to the TX side */ sc->sc_txq.t_desc = sc->sc_rxq.r_desc + AWGE_RX_RING_COUNT; sc->sc_txq.t_physaddr = sc->sc_rxq.r_physaddr + - AWGE_RX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc); + AWGE_RX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc); return 0; @@ -652,7 +652,7 @@ dwc_gmac_free_rx_ring(struct dwc_gmac_so if (data->rd_map != NULL) { bus_dmamap_sync(sc->sc_dmat, data->rd_map, 0, AWGE_RX_RING_COUNT -*sizeof(struct dwc_gmac_dev_dmadesc), +* sizeof(struct dwc_gmac_dev_dmadesc), BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->sc_dmat, data->rd_map); bus_dmamap_destroy(sc->sc_dmat, data->rd_map); @@ -671,10 +671,10 @@ dwc_gmac_alloc_tx_ring(struct dwc_gmac_s ring->t_queued = 0; ring->t_cur = ring->t_next = 0; - memset(ring->t_desc, 0, AWGE_TX_RING_COUNT*sizeof(*ring->t_desc)); + memset(ring->t_desc, 0, AWGE_TX_RING_COUNT * sizeof(*ring->t_desc)); bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, TX_DESC_OFFSET(0), - AWGE_TX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc), + AWGE_TX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc), BUS_DMASYNC_POSTWRITE); for (i = 0; i < AWGE_TX_RING_COUNT; i++) { @@ -747,7 +747,7 @@ dwc_gmac_reset_tx_ring(struct dwc_gmac_s bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, TX_DESC_OFFSET(0), - AWGE_TX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc), + AWGE_TX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc), BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_TX_ADDR, sc->sc_txq.t_physaddr); @@ -1179,11 +1179,11 @@ dwc_gmac_tx_intr(struct dwc_gmac_softc * #endif /* - * i+1 does not need to be a valid descriptor, + * i + 1 does not need to be a valid descriptor, * this is just a special notion to just sync * a single tx descriptor (i) */ - dwc_gmac_txdesc_sync(sc, i, i+1, + dwc_gmac_txdesc_sync(sc, i, i + 1, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); desc = >sc_txq.t_desc[i]; @@ -1651,7 +1651,7 @@ dwc_gmac_dump_tx_desc(struct dwc_gmac_so aprint_normal("#%d (%08lx): status: %08x cntl: %08x " "data: %08x next: %08x\n", i, sc->sc_txq.t_physaddr + - i*sizeof(struct dwc_gmac_dev_dmadesc), + i * sizeof(struct dwc_gmac_dev_dmadesc), le32toh(desc->ddesc_status0), le32toh(desc->ddesc_cntl1), le32toh(desc->ddesc_data), le32toh(desc->ddesc_next)); } @@
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Feb 27 08:25:38 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: KNF - spaces around binary operators. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Feb 27 08:21:24 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac_reg.h Log Message: Remove unused "SHIFT" defines. The "MASK" versions exist. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/dwc_gmac_reg.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/ic/dwc_gmac_reg.h diff -u src/sys/dev/ic/dwc_gmac_reg.h:1.21 src/sys/dev/ic/dwc_gmac_reg.h:1.22 --- src/sys/dev/ic/dwc_gmac_reg.h:1.21 Wed May 11 14:58:01 2022 +++ src/sys/dev/ic/dwc_gmac_reg.h Tue Feb 27 08:21:24 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac_reg.h,v 1.21 2022/05/11 14:58:01 andvar Exp $ */ +/* $NetBSD: dwc_gmac_reg.h,v 1.22 2024/02/27 08:21:24 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -133,9 +133,7 @@ #define AWIN_GMAC_DMA_CUR_RX_BUFADDR 0x1054 #define AWIN_GMAC_DMA_HWFEATURES 0x1058 /* not always implemented? */ -#define GMAC_MII_PHY_SHIFT 11 #define GMAC_MII_PHY_MASK __BITS(15,11) -#define GMAC_MII_REG_SHIFT 6 #define GMAC_MII_REG_MASK __BITS(10,6) #define GMAC_MII_BUSY __BIT(0) @@ -221,7 +219,6 @@ struct dwc_gmac_dev_dmadesc { /* for RX descriptors */ #define DDESC_STATUS_DAFILTERFAIL __BIT(30) #define DDESC_STATUS_FRMLENMSK __BITS(29,16) -#define DDESC_STATUS_FRMLENSHIFT 16 #define DDESC_STATUS_RXERROR __BIT(15) #define DDESC_STATUS_RXTRUNCATED __BIT(14) #define DDESC_STATUS_SAFILTERFAIL __BIT(13)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Feb 27 08:21:24 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac_reg.h Log Message: Remove unused "SHIFT" defines. The "MASK" versions exist. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/dwc_gmac_reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Mon Feb 19 14:54:04 UTC 2024 Modified Files: src/sys/dev/ic: ciss.c Log Message: ciss(4): Fix panic when the number of logical drive is zero. Currently, this drives requires at least one logical drive. If there is no any logical volume, don't attach the driver. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/dev/ic/ciss.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/ic/ciss.c diff -u src/sys/dev/ic/ciss.c:1.55 src/sys/dev/ic/ciss.c:1.56 --- src/sys/dev/ic/ciss.c:1.55 Thu Aug 17 14:19:50 2023 +++ src/sys/dev/ic/ciss.c Mon Feb 19 14:54:04 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ciss.c,v 1.55 2023/08/17 14:19:50 andvar Exp $ */ +/* $NetBSD: ciss.c,v 1.56 2024/02/19 14:54:04 msaitoh Exp $ */ /* $OpenBSD: ciss.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.55 2023/08/17 14:19:50 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.56 2024/02/19 14:54:04 msaitoh Exp $"); #include "bio.h" @@ -427,6 +427,14 @@ ciss_attach(struct ciss_softc *sc) mutex_exit(>sc_mutex_scratch); + if (sc->maxunits == 0) { + bus_dmamem_free(sc->sc_dmat, sc->cmdseg, 1); + bus_dmamap_destroy(sc->sc_dmat, sc->cmdmap); + aprint_error_dev(sc->sc_dev, + "No any LD. This driver can't attach.\n"); + return -1; + } + callout_init(>sc_hb, 0); callout_setfunc(>sc_hb, ciss_heartbeat, sc); callout_schedule(>sc_hb, hz * 3);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Mon Feb 19 14:54:04 UTC 2024 Modified Files: src/sys/dev/ic: ciss.c Log Message: ciss(4): Fix panic when the number of logical drive is zero. Currently, this drives requires at least one logical drive. If there is no any logical volume, don't attach the driver. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/dev/ic/ciss.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Tue Feb 13 13:17:51 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: in sti_screen_setup() don't bother looking for fonts if STI_FBMODE is requested To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/sti.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/ic/sti.c diff -u src/sys/dev/ic/sti.c:1.34 src/sys/dev/ic/sti.c:1.35 --- src/sys/dev/ic/sti.c:1.34 Thu Feb 1 06:50:36 2024 +++ src/sys/dev/ic/sti.c Tue Feb 13 13:17:51 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sti.c,v 1.34 2024/02/01 06:50:36 skrll Exp $ */ +/* $NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $ */ /* $OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $ */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.34 2024/02/01 06:50:36 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $"); #include "wsdisplay.h" @@ -556,6 +556,12 @@ sti_screen_setup(struct sti_screen *scr, scr->owidth = cfg.owidth; memcpy(scr->name, cfg.name, sizeof(scr->name)); + if (flags & STI_FBMODE) { + /* we're done here */ + sti_init(scr, STI_FBMODE); + return 0; + } + if ((error = sti_init(scr, STI_TEXTMODE | flags))) { aprint_error(": cannot initialize (%d)\n", error); goto fail;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Tue Feb 13 13:17:51 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: in sti_screen_setup() don't bother looking for fonts if STI_FBMODE is requested To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/sti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Feb 11 12:28:20 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Fix spello in debug output To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.80 src/sys/dev/ic/dwc_gmac.c:1.81 --- src/sys/dev/ic/dwc_gmac.c:1.80 Wed Dec 20 18:09:19 2023 +++ src/sys/dev/ic/dwc_gmac.c Sun Feb 11 12:28:20 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.80 2023/12/20 18:09:19 skrll Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.81 2024/02/11 12:28:20 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.80 2023/12/20 18:09:19 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.81 2024/02/11 12:28:20 skrll Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -1052,7 +1052,7 @@ dwc_gmac_queue(struct dwc_gmac_softc *sc desc->ddesc_data = htole32(map->dm_segs[i].ds_addr); #ifdef DWC_GMAC_DEBUG - aprint_normal_dev(sc->sc_dev, "enqueing desc #%d data %08lx " + aprint_normal_dev(sc->sc_dev, "enqueuing desc #%d data %08lx " "len %lu\n", sc->sc_txq.t_cur, (unsigned long)map->dm_segs[i].ds_addr, (unsigned long)map->dm_segs[i].ds_len);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Feb 11 12:28:20 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Fix spello in debug output To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Feb 11 12:25:20 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac_var.h Log Message: Fix a comment. arm32 stopped using 8K pages a long time ago. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/dwc_gmac_var.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/ic/dwc_gmac_var.h diff -u src/sys/dev/ic/dwc_gmac_var.h:1.17 src/sys/dev/ic/dwc_gmac_var.h:1.18 --- src/sys/dev/ic/dwc_gmac_var.h:1.17 Sun Sep 18 18:26:53 2022 +++ src/sys/dev/ic/dwc_gmac_var.h Sun Feb 11 12:25:20 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac_var.h,v 1.17 2022/09/18 18:26:53 thorpej Exp $ */ +/* $NetBSD: dwc_gmac_var.h,v 1.18 2024/02/11 12:25:20 skrll Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -45,12 +45,9 @@ #endif /* - * We could use 1024 DMA descriptors to fill up an 8k page (each is 16 byte). - * However, on TX we probably will not need that many, and on RX we allocate - * a full mbuf cluster for each, so secondary memory consumption will grow - * rapidly. - * So currently we waste half a page of dma memory and consume 512k Byte of - * RAM for mbuf clusters. + * Rx and Tx Ring counts that map into single 4K page with 16byte descriptor + * size. For Rx a full mbuf cluster is allocated for each which consumes + * around 512k Byte of RAM for mbuf clusters. * XXX Maybe fine-tune later, or reconsider unsharing of RX/TX dmamap. */ #define AWGE_RX_RING_COUNT 256
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Feb 11 12:25:20 UTC 2024 Modified Files: src/sys/dev/ic: dwc_gmac_var.h Log Message: Fix a comment. arm32 stopped using 8K pages a long time ago. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/dwc_gmac_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sat Feb 10 15:55:00 UTC 2024 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: Fix an error message by removing an extra 'x' To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/dwc_eqos.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/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.35 src/sys/dev/ic/dwc_eqos.c:1.36 --- src/sys/dev/ic/dwc_eqos.c:1.35 Sun Dec 24 16:12:55 2023 +++ src/sys/dev/ic/dwc_eqos.c Sat Feb 10 15:55:00 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.35 2023/12/24 16:12:55 skrll Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.36 2024/02/10 15:55:00 skrll Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.35 2023/12/24 16:12:55 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.36 2024/02/10 15:55:00 skrll Exp $"); #include #include @@ -1467,7 +1467,7 @@ eqos_attach(struct eqos_softc *sc) snpsver = ver & GMAC_MAC_VERSION_SNPSVER_MASK; if ((snpsver < 0x51) || (snpsver > 0x52)) { - aprint_error(": EQOS version 0x%02xx not supported\n", + aprint_error(": EQOS version 0x%02x not supported\n", snpsver); return ENXIO; }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sat Feb 10 15:55:00 UTC 2024 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: Fix an error message by removing an extra 'x' To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/dwc_eqos.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Feb 9 16:57:11 UTC 2024 Modified Files: src/sys/dev/ic: dwc_mmc.c Log Message: Fix a typo in a comment To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/dwc_mmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Feb 9 16:57:11 UTC 2024 Modified Files: src/sys/dev/ic: dwc_mmc.c Log Message: Fix a typo in a comment To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/dwc_mmc.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/ic/dwc_mmc.c diff -u src/sys/dev/ic/dwc_mmc.c:1.29 src/sys/dev/ic/dwc_mmc.c:1.30 --- src/sys/dev/ic/dwc_mmc.c:1.29 Sun Jan 9 15:03:43 2022 +++ src/sys/dev/ic/dwc_mmc.c Fri Feb 9 16:57:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_mmc.c,v 1.29 2022/01/09 15:03:43 jmcneill Exp $ */ +/* $NetBSD: dwc_mmc.c,v 1.30 2024/02/09 16:57:11 skrll Exp $ */ /*- * Copyright (c) 2014-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.29 2022/01/09 15:03:43 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.30 2024/02/09 16:57:11 skrll Exp $"); #include #include @@ -477,7 +477,7 @@ dwc_mmc_dma_prepare(struct dwc_mmc_softc uint32_t val; /* - * If the command includs a dma map use it, otherwise we need to + * If the command includes a dma map use it, otherwise we need to * bounce. This can happen for SDIO IO_RW_EXTENDED (CMD53) commands. */ if (cmd->c_dmamap) {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Feb 9 16:56:23 UTC 2024 Modified Files: src/sys/dev/ic: dw_hdmi.c dwiic.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/dw_hdmi.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwiic.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/ic/dw_hdmi.c diff -u src/sys/dev/ic/dw_hdmi.c:1.11 src/sys/dev/ic/dw_hdmi.c:1.12 --- src/sys/dev/ic/dw_hdmi.c:1.11 Mon Dec 11 13:29:03 2023 +++ src/sys/dev/ic/dw_hdmi.c Fri Feb 9 16:56:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $ */ +/* $NetBSD: dw_hdmi.c,v 1.12 2024/02/09 16:56:23 skrll Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.12 2024/02/09 16:56:23 skrll Exp $"); #include #include @@ -531,7 +531,7 @@ dwhdmi_audio_init(struct dwhdmi_softc *s val &= ~HDMI_AUD_CONF0_I2S_IN_EN; val |= __SHIFTIN(1, HDMI_AUD_CONF0_I2S_IN_EN); /* XXX 2ch */ dwhdmi_write(sc, HDMI_AUD_CONF0, val); - + val = __SHIFTIN(16, HDMI_AUD_CONF1_I2S_WIDTH); dwhdmi_write(sc, HDMI_AUD_CONF1, val); Index: src/sys/dev/ic/dwiic.c diff -u src/sys/dev/ic/dwiic.c:1.9 src/sys/dev/ic/dwiic.c:1.10 --- src/sys/dev/ic/dwiic.c:1.9 Wed Oct 19 22:34:10 2022 +++ src/sys/dev/ic/dwiic.c Fri Feb 9 16:56:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwiic.c,v 1.9 2022/10/19 22:34:10 riastradh Exp $ */ +/* $NetBSD: dwiic.c,v 1.10 2024/02/09 16:56:23 skrll Exp $ */ /* $OpenBSD: dwiic.c,v 1.4 2018/05/23 22:08:00 kettenis Exp $ */ @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwiic.c,v 1.9 2022/10/19 22:34:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwiic.c,v 1.10 2024/02/09 16:56:23 skrll Exp $"); #include @@ -163,7 +163,7 @@ dwiic_attach(struct dwiic_softc *sc) } /* fetch timing parameters */ - if (sc->ss_hcnt == 0) + if (sc->ss_hcnt == 0) sc->ss_hcnt = dwiic_read(sc, DW_IC_SS_SCL_HCNT); if (sc->ss_lcnt == 0) sc->ss_lcnt = dwiic_read(sc, DW_IC_SS_SCL_LCNT);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Feb 9 16:56:23 UTC 2024 Modified Files: src/sys/dev/ic: dw_hdmi.c dwiic.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/dw_hdmi.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwiic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Fri Feb 2 22:43:12 UTC 2024 Modified Files: src/sys/dev/ic: aac_tables.h Log Message: s/maintenace/maintenance/ in command status code description. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/aac_tables.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/ic/aac_tables.h diff -u src/sys/dev/ic/aac_tables.h:1.5 src/sys/dev/ic/aac_tables.h:1.6 --- src/sys/dev/ic/aac_tables.h:1.5 Tue Jun 5 04:04:14 2007 +++ src/sys/dev/ic/aac_tables.h Fri Feb 2 22:43:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: aac_tables.h,v 1.5 2007/06/05 04:04:14 briggs Exp $ */ +/* $NetBSD: aac_tables.h,v 1.6 2024/02/02 22:43:12 andvar Exp $ */ /*- * Copyright (c) 2000 Michael Smith @@ -73,7 +73,7 @@ const struct aac_code_lookup aac_command { "bad type",10007 }, { "jukebox",10008 }, { "not mounted", 10009 }, - { "in maintenace mode", 10010 }, + { "in maintenance mode", 10010 }, { "stale ACL",10011 }, { NULL, 0 }, { "unknown command status", 0 }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Fri Feb 2 22:43:12 UTC 2024 Modified Files: src/sys/dev/ic: aac_tables.h Log Message: s/maintenace/maintenance/ in command status code description. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/aac_tables.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Fri Feb 2 22:23:54 UTC 2024 Modified Files: src/sys/dev/ic: dp8390var.h Log Message: s/tranceiver/transceiver/ in comment and definition. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/dp8390var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: andvar Date: Fri Feb 2 22:23:54 UTC 2024 Modified Files: src/sys/dev/ic: dp8390var.h Log Message: s/tranceiver/transceiver/ in comment and definition. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/dp8390var.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/ic/dp8390var.h diff -u src/sys/dev/ic/dp8390var.h:1.36 src/sys/dev/ic/dp8390var.h:1.37 --- src/sys/dev/ic/dp8390var.h:1.36 Mon Aug 9 20:49:10 2021 +++ src/sys/dev/ic/dp8390var.h Fri Feb 2 22:23:53 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dp8390var.h,v 1.36 2021/08/09 20:49:10 andvar Exp $ */ +/* $NetBSD: dp8390var.h,v 1.37 2024/02/02 22:23:53 andvar Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -110,9 +110,9 @@ struct dp8390_softc { * Compile-time config flags */ /* - * This sets the default for enabling/disabling the tranceiver. + * This sets the default for enabling/disabling the transceiver. */ -#define DP8390_DISABLE_TRANCEIVER 0x0001 +#define DP8390_DISABLE_TRANSCEIVER 0x0001 /* * This forces the board to be used in 8/16-bit mode even if it autoconfigs
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Thu Feb 1 06:50:36 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ic/sti.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/ic/sti.c diff -u src/sys/dev/ic/sti.c:1.33 src/sys/dev/ic/sti.c:1.34 --- src/sys/dev/ic/sti.c:1.33 Thu Feb 1 02:41:56 2024 +++ src/sys/dev/ic/sti.c Thu Feb 1 06:50:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sti.c,v 1.33 2024/02/01 02:41:56 gutteridge Exp $ */ +/* $NetBSD: sti.c,v 1.34 2024/02/01 06:50:36 skrll Exp $ */ /* $OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $ */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.33 2024/02/01 02:41:56 gutteridge Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.34 2024/02/01 06:50:36 skrll Exp $"); #include "wsdisplay.h" @@ -933,8 +933,8 @@ sti_init(struct sti_screen *scr, int mod a.in.text_planes = 1; } else { a.flags.flags |= STI_INITF_TEXT | STI_INITF_NTEXT; - /* - * Request as many text planes as STI will allow. + /* + * Request as many text planes as STI will allow. * The reason to do this - when switching to framebuffer mode * for X we need access to all planes. In theory STI should do * just that when we request access to both text and non-text
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Thu Feb 1 06:50:36 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ic/sti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: gutteridge Date: Thu Feb 1 02:41:56 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: sti.c: fix a typo in a comment To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/sti.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/ic/sti.c diff -u src/sys/dev/ic/sti.c:1.32 src/sys/dev/ic/sti.c:1.33 --- src/sys/dev/ic/sti.c:1.32 Wed Jan 31 08:15:00 2024 +++ src/sys/dev/ic/sti.c Thu Feb 1 02:41:56 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sti.c,v 1.32 2024/01/31 08:15:00 macallan Exp $ */ +/* $NetBSD: sti.c,v 1.33 2024/02/01 02:41:56 gutteridge Exp $ */ /* $OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $ */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.32 2024/01/31 08:15:00 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.33 2024/02/01 02:41:56 gutteridge Exp $"); #include "wsdisplay.h" @@ -934,7 +934,7 @@ sti_init(struct sti_screen *scr, int mod } else { a.flags.flags |= STI_INITF_TEXT | STI_INITF_NTEXT; /* - * Request as many text palnes as STI will allow. + * Request as many text planes as STI will allow. * The reason to do this - when switching to framebuffer mode * for X we need access to all planes. In theory STI should do * just that when we request access to both text and non-text
CVS commit: src/sys/dev/ic
Module Name:src Committed By: gutteridge Date: Thu Feb 1 02:41:56 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: sti.c: fix a typo in a comment To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/sti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Wed Jan 31 08:15:00 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: Make this work properly on PCI Visualize EG: - use bus_space_*_stream() for all register accesses in order to avoid byte order conversion on PCI devices - when switching to framebuffer mode, request as many text planes as STI allows - request access to both text and non-text planes in fb mode With this and the bus_space commit a few days ago I have usable X on my C360 and a PCI Visualize EG. This needs testing on quite literally everything else. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/sti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Wed Jan 31 08:15:00 UTC 2024 Modified Files: src/sys/dev/ic: sti.c Log Message: Make this work properly on PCI Visualize EG: - use bus_space_*_stream() for all register accesses in order to avoid byte order conversion on PCI devices - when switching to framebuffer mode, request as many text planes as STI allows - request access to both text and non-text planes in fb mode With this and the bus_space commit a few days ago I have usable X on my C360 and a PCI Visualize EG. This needs testing on quite literally everything else. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/sti.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/ic/sti.c diff -u src/sys/dev/ic/sti.c:1.31 src/sys/dev/ic/sti.c:1.32 --- src/sys/dev/ic/sti.c:1.31 Sat Aug 7 16:19:12 2021 +++ src/sys/dev/ic/sti.c Wed Jan 31 08:15:00 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sti.c,v 1.31 2021/08/07 16:19:12 thorpej Exp $ */ +/* $NetBSD: sti.c,v 1.32 2024/01/31 08:15:00 macallan Exp $ */ /* $OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $ */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.31 2021/08/07 16:19:12 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.32 2024/01/31 08:15:00 macallan Exp $"); #include "wsdisplay.h" @@ -926,17 +926,30 @@ sti_init(struct sti_screen *scr, int mod KASSERT(rom != NULL); memset(, 0, sizeof(a)); - a.flags.flags = STI_INITF_WAIT | STI_INITF_EBET; + a.flags.flags = STI_INITF_WAIT | STI_INITF_PBET | STI_INITF_PBETI; if ((mode & STI_TEXTMODE) != 0) { a.flags.flags |= STI_INITF_TEXT | STI_INITF_CMB | STI_INITF_PBET | STI_INITF_PBETI | STI_INITF_ICMT; + a.in.text_planes = 1; } else { - a.flags.flags |= STI_INITF_NTEXT; + a.flags.flags |= STI_INITF_TEXT | STI_INITF_NTEXT; + /* + * Request as many text palnes as STI will allow. + * The reason to do this - when switching to framebuffer mode + * for X we need access to all planes. In theory STI should do + * just that when we request access to both text and non-text + * planes as above. + * In reality though, at least on my PCI Visualize EG, some + * planes and/or colour registers remain inaccessible if we + * request only one text plane. + * Clearly we're missing a register write or two here, but so + * far I haven't found it. + */ + a.in.text_planes = 3; } if ((mode & STI_CLEARSCR) != 0) a.flags.flags |= STI_INITF_CLEAR; - a.in.text_planes = 1; a.in.ext_in = DPRINTF(("%s: init,%p(%x, %p, %p, %p)\n", @@ -1060,7 +1073,7 @@ sti_ioctl(void *v, void *vs, u_long cmd, break; case WSDISPLAYIO_MODE_DUMBFB: if (scr->scr_wsmode != WSDISPLAYIO_MODE_DUMBFB) { -sti_init(scr, 0); +ret = sti_init(scr, 0); if (scr->setupfb != NULL) scr->setupfb(scr); else @@ -1487,7 +1500,7 @@ void ngle_setup_attr_planes(struct sti_s void ngle_setup_bt458(struct sti_screen *scr); #define ngle_bt458_write(memt, memh, r, v) \ - bus_space_write_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24) + bus_space_write_stream_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24) void ngle_artist_setupfb(struct sti_screen *scr) @@ -1504,10 +1517,10 @@ ngle_artist_setupfb(struct sti_screen *s ngle_setup_attr_planes(scr); ngle_setup_hw(memt, memh); - bus_space_write_4(memt, memh, NGLE_REG_21, - bus_space_read_4(memt, memh, NGLE_REG_21) | 0x0a00); - bus_space_write_4(memt, memh, NGLE_REG_27, - bus_space_read_4(memt, memh, NGLE_REG_27) | 0x0080); + bus_space_write_stream_4(memt, memh, NGLE_REG_21, + bus_space_read_stream_4(memt, memh, NGLE_REG_21) | 0x0a00); + bus_space_write_stream_4(memt, memh, NGLE_REG_27, + bus_space_read_stream_4(memt, memh, NGLE_REG_27) | 0x0080); } void @@ -1566,19 +1579,19 @@ ngle_setup_attr_planes(struct sti_screen bus_space_handle_t memh = rom->regh[2]; ngle_setup_hw(memt, memh); - bus_space_write_4(memt, memh, NGLE_REG_11, 0x2ea0d000); - bus_space_write_4(memt, memh, NGLE_REG_14, 0x23000302); - bus_space_write_4(memt, memh, NGLE_REG_12, scr->reg12_value); - bus_space_write_4(memt, memh, NGLE_REG_8, 0x); + bus_space_write_stream_4(memt, memh, NGLE_REG_11, 0x2ea0d000); + bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x23000302); + bus_space_write_stream_4(memt, memh, NGLE_REG_12, scr->reg12_value); + bus_space_write_stream_4(memt, memh, NGLE_REG_8, 0x); - bus_space_write_4(memt, memh, NGLE_REG_6, 0x); - bus_space_write_4(memt, memh, NGLE_REG_9, + bus_space_write_stream_4(memt, memh, NGLE_REG_6, 0x); + bus_space_write_stream_4(memt, memh, NGLE_REG_9, (scr->scr_cfg.scr_width << 16) | scr->scr_cfg.scr_height); - bus_space_write_4(memt, memh, NGLE_REG_6, 0x0500); - bus_space_write_4(memt, memh, NGLE_REG_9, 0x00040001); + bus_space_write_stream_4(memt,
CVS commit: src/sys/dev/ic
Module Name:src Committed By: gutteridge Date: Sun Dec 31 21:32:43 UTC 2023 Modified Files: src/sys/dev/ic: bwfm.c Log Message: bwfm.c: KNF a comment (spaces->tabs) To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/bwfm.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/ic/bwfm.c diff -u src/sys/dev/ic/bwfm.c:1.35 src/sys/dev/ic/bwfm.c:1.36 --- src/sys/dev/ic/bwfm.c:1.35 Tue Aug 1 07:04:15 2023 +++ src/sys/dev/ic/bwfm.c Sun Dec 31 21:32:43 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: bwfm.c,v 1.35 2023/08/01 07:04:15 mrg Exp $ */ +/* $NetBSD: bwfm.c,v 1.36 2023/12/31 21:32:43 gutteridge Exp $ */ /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation @@ -632,11 +632,10 @@ bwfm_init(struct ifnet *ifp) return EIO; } -/* - * Use CAM (constantly awake) when we are running as AP - * otherwise use fast power saving. - */ - + /* + * Use CAM (constantly awake) when we are running as AP + * otherwise use fast power saving. + */ if (ic->ic_flags & IEEE80211_F_PMGTON) { sc->sc_pm = BWFM_PM_FAST_PS; #ifndef IEEE80211_STA_ONLY
CVS commit: src/sys/dev/ic
Module Name:src Committed By: gutteridge Date: Sun Dec 31 21:32:43 UTC 2023 Modified Files: src/sys/dev/ic: bwfm.c Log Message: bwfm.c: KNF a comment (spaces->tabs) To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/bwfm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: isaki Date: Sun Dec 31 03:19:22 UTC 2023 Modified Files: src/sys/dev/ic: rtl80x9.c Log Message: ne(4): Write CR0 properly. Writing 0b000 to RD2-0 in CR0 appears harmless, but it is "not allowed" by the RTL8019AS (and several NE2000 derived) datasheets. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/rtl80x9.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/ic/rtl80x9.c diff -u src/sys/dev/ic/rtl80x9.c:1.18 src/sys/dev/ic/rtl80x9.c:1.19 --- src/sys/dev/ic/rtl80x9.c:1.18 Thu Apr 25 10:44:52 2019 +++ src/sys/dev/ic/rtl80x9.c Sun Dec 31 03:19:22 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rtl80x9.c,v 1.18 2019/04/25 10:44:52 msaitoh Exp $ */ +/* $NetBSD: rtl80x9.c,v 1.19 2023/12/31 03:19:22 isaki Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtl80x9.c,v 1.18 2019/04/25 10:44:52 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtl80x9.c,v 1.19 2023/12/31 03:19:22 isaki Exp $"); #include #include @@ -170,7 +170,8 @@ rtl80x9_media_init(struct dp8390_softc * aprint_normal_dev(sc->sc_dev, "10base2, 10baseT, 10baseT-FDX, auto, default "); - bus_space_write_1(sc->sc_regt, sc->sc_regh, ED_P0_CR, ED_CR_PAGE_3); + bus_space_write_1(sc->sc_regt, sc->sc_regh, ED_P0_CR, + sc->cr_proto | ED_CR_PAGE_3); conf2 = bus_space_read_1(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG2); conf3 = bus_space_read_1(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG3); @@ -201,7 +202,8 @@ rtl80x9_media_init(struct dp8390_softc * break; } - bus_space_write_1(sc->sc_regt, sc->sc_regh, ED_P0_CR, ED_CR_PAGE_0); + bus_space_write_1(sc->sc_regt, sc->sc_regh, ED_P0_CR, + sc->cr_proto | ED_CR_PAGE_0); ifmedia_init(>sc_media, 0, dp8390_mediachange, dp8390_mediastatus); for (i = 0; i < rtl80x9_nmedia; i++)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: isaki Date: Sun Dec 31 03:19:22 UTC 2023 Modified Files: src/sys/dev/ic: rtl80x9.c Log Message: ne(4): Write CR0 properly. Writing 0b000 to RD2-0 in CR0 appears harmless, but it is "not allowed" by the RTL8019AS (and several NE2000 derived) datasheets. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/rtl80x9.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: mlelstv Date: Mon Dec 11 13:29:03 UTC 2023 Modified Files: src/sys/dev/ic: dw_hdmi.c Log Message: Output is always 16bit, the internal audio data type may differ. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/dw_hdmi.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/ic/dw_hdmi.c diff -u src/sys/dev/ic/dw_hdmi.c:1.10 src/sys/dev/ic/dw_hdmi.c:1.11 --- src/sys/dev/ic/dw_hdmi.c:1.10 Fri Mar 25 23:16:04 2022 +++ src/sys/dev/ic/dw_hdmi.c Mon Dec 11 13:29:03 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $ */ +/* $NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $"); #include #include @@ -729,7 +729,7 @@ dwhdmi_audio_swvol_codec(audio_filter_ar { struct dwhdmi_softc * const sc = arg->context; const aint_t *src; - aint_t *dst; + int16_t *dst; u_int sample_count; u_int i;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: mlelstv Date: Mon Dec 11 13:29:03 UTC 2023 Modified Files: src/sys/dev/ic: dw_hdmi.c Log Message: Output is always 16bit, the internal audio data type may differ. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/dw_hdmi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: mlelstv Date: Mon Dec 11 13:28:15 UTC 2023 Modified Files: src/sys/dev/ic: anx_dp.c Log Message: Output is always 16bit, the internal audio data type may differ. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/anx_dp.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/ic/anx_dp.c diff -u src/sys/dev/ic/anx_dp.c:1.5 src/sys/dev/ic/anx_dp.c:1.6 --- src/sys/dev/ic/anx_dp.c:1.5 Sun Dec 19 12:43:37 2021 +++ src/sys/dev/ic/anx_dp.c Mon Dec 11 13:28:15 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: anx_dp.c,v 1.5 2021/12/19 12:43:37 riastradh Exp $ */ +/* $NetBSD: anx_dp.c,v 1.6 2023/12/11 13:28:15 mlelstv Exp $ */ /*- * Copyright (c) 2019 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.5 2021/12/19 12:43:37 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.6 2023/12/11 13:28:15 mlelstv Exp $"); #include #include @@ -791,7 +791,7 @@ anxdp_audio_swvol_codec(audio_filter_arg { struct anxdp_softc * const sc = arg->context; const aint_t *src; - aint_t *dst; + int16_t *dst; u_int sample_count; u_int i;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: mlelstv Date: Mon Dec 11 13:28:15 UTC 2023 Modified Files: src/sys/dev/ic: anx_dp.c Log Message: Output is always 16bit, the internal audio data type may differ. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/anx_dp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Mon Nov 13 15:08:06 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos_reg.h Log Message: eqos(4): Extend bitwidth of SYSBUS_MODE_{RD,WR}_OSR_LMT to 4bits. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwc_eqos_reg.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/ic/dwc_eqos_reg.h diff -u src/sys/dev/ic/dwc_eqos_reg.h:1.9 src/sys/dev/ic/dwc_eqos_reg.h:1.10 --- src/sys/dev/ic/dwc_eqos_reg.h:1.9 Mon Nov 13 15:07:19 2023 +++ src/sys/dev/ic/dwc_eqos_reg.h Mon Nov 13 15:08:06 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos_reg.h,v 1.9 2023/11/13 15:07:19 msaitoh Exp $ */ +/* $NetBSD: dwc_eqos_reg.h,v 1.10 2023/11/13 15:08:06 msaitoh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -229,9 +229,9 @@ #define GMAC_DMA_MODE_SWR (1U << 0) #define GMAC_DMA_SYSBUS_MODE 0x1004 #define GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_SHIFT 24 -#define GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_MASK (0x3U << GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_SHIFT) +#define GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_MASK (0xfU << GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_SHIFT) #define GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_SHIFT 16 -#define GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_MASK (0x7U << GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_SHIFT) +#define GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_MASK (0xfU << GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_SHIFT) #define GMAC_DMA_SYSBUS_MODE_MB (1U << 14) #define GMAC_DMA_SYSBUS_MODE_EAME (1U << 11) #define GMAC_DMA_SYSBUS_MODE_BLEN16 (1U << 3)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Mon Nov 13 15:08:06 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos_reg.h Log Message: eqos(4): Extend bitwidth of SYSBUS_MODE_{RD,WR}_OSR_LMT to 4bits. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwc_eqos_reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Mon Nov 13 15:07:19 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c dwc_eqos_reg.h Log Message: eqos(4): Set bit 31 when writing MAC_ADDRESS0_HIGH register. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ic/dwc_eqos.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dwc_eqos_reg.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/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.33 src/sys/dev/ic/dwc_eqos.c:1.34 --- src/sys/dev/ic/dwc_eqos.c:1.33 Thu Nov 2 13:50:14 2023 +++ src/sys/dev/ic/dwc_eqos.c Mon Nov 13 15:07:19 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.33 2023/11/02 13:50:14 riastradh Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.34 2023/11/13 15:07:19 msaitoh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -38,7 +38,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.33 2023/11/02 13:50:14 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.34 2023/11/13 15:07:19 msaitoh Exp $"); #include #include @@ -545,7 +545,7 @@ eqos_setup_rxfilter(struct eqos_softc *s /* Write our unicast address */ eaddr = CLLADDR(ifp->if_sadl); - val = eaddr[4] | (eaddr[5] << 8); + val = eaddr[4] | (eaddr[5] << 8) | GMAC_MAC_ADDRESS0_HIGH_AE; WR4(sc, GMAC_MAC_ADDRESS0_HIGH, val); val = eaddr[0] | (eaddr[1] << 8) | (eaddr[2] << 16) | (eaddr[3] << 24); Index: src/sys/dev/ic/dwc_eqos_reg.h diff -u src/sys/dev/ic/dwc_eqos_reg.h:1.8 src/sys/dev/ic/dwc_eqos_reg.h:1.9 --- src/sys/dev/ic/dwc_eqos_reg.h:1.8 Thu Oct 26 18:02:50 2023 +++ src/sys/dev/ic/dwc_eqos_reg.h Mon Nov 13 15:07:19 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos_reg.h,v 1.8 2023/10/26 18:02:50 msaitoh Exp $ */ +/* $NetBSD: dwc_eqos_reg.h,v 1.9 2023/11/13 15:07:19 msaitoh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -120,6 +120,7 @@ #define GMAC_MAC_MDIO_DATA 0x0204 #define GMAC_MAC_CSR_SW_CTRL 0x0230 #define GMAC_MAC_ADDRESS0_HIGH 0x0300 +#define GMAC_MAC_ADDRESS0_HIGH_AE (1U << 31) #define GMAC_MAC_ADDRESS0_LOW 0x0304 #define GMAC_MMC_CONTROL 0x0700 #define GMAC_MMC_CONTROL_UCDBC (1U << 8)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Mon Nov 13 15:07:19 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c dwc_eqos_reg.h Log Message: eqos(4): Set bit 31 when writing MAC_ADDRESS0_HIGH register. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ic/dwc_eqos.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dwc_eqos_reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Thu Nov 2 13:50:14 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: eqos(4): Fix multicast filter updates. 1. Don't touch the obsolete IFF_ALLMULTI. 2. Set ETHER_F_ALLMULTI if we're accepting all multicast addresses. 3. If any multicast entry range is not a single address, accept all multicast addresses. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/dwc_eqos.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/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.32 src/sys/dev/ic/dwc_eqos.c:1.33 --- src/sys/dev/ic/dwc_eqos.c:1.32 Thu Nov 2 13:50:02 2023 +++ src/sys/dev/ic/dwc_eqos.c Thu Nov 2 13:50:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.32 2023/11/02 13:50:02 riastradh Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.33 2023/11/02 13:50:14 riastradh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -38,7 +38,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.32 2023/11/02 13:50:02 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.33 2023/11/02 13:50:14 riastradh Exp $"); #include #include @@ -509,17 +509,29 @@ eqos_setup_rxfilter(struct eqos_softc *s GMAC_MAC_PACKET_FILTER_PCF_MASK); hash[0] = hash[1] = ~0U; + ETHER_LOCK(ec); if (sc->sc_promisc) { + ec->ec_flags |= ETHER_F_ALLMULTI; pfil |= GMAC_MAC_PACKET_FILTER_PR | GMAC_MAC_PACKET_FILTER_PCF_ALL; - } else if (sc->sc_allmulti) { - pfil |= GMAC_MAC_PACKET_FILTER_PM; } else { - hash[0] = hash[1] = 0; pfil |= GMAC_MAC_PACKET_FILTER_HMC; - ETHER_LOCK(ec); + hash[0] = hash[1] = 0; + ec->ec_flags &= ~ETHER_F_ALLMULTI; ETHER_FIRST_MULTI(step, ec, enm); while (enm != NULL) { + if (memcmp(enm->enm_addrlo, enm->enm_addrhi, +ETHER_ADDR_LEN) != 0) { +ec->ec_flags |= ETHER_F_ALLMULTI; +pfil &= ~GMAC_MAC_PACKET_FILTER_HMC; +pfil |= GMAC_MAC_PACKET_FILTER_PM; +/* + * Shouldn't matter if we clear HMC but + * let's avoid using different values. + */ +hash[0] = hash[1] = 0x; +break; + } crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN); crc &= 0x7f; crc = eqos_bitrev32(~crc) >> 26; @@ -528,8 +540,8 @@ eqos_setup_rxfilter(struct eqos_softc *s hash[hashreg] |= (1 << hashbit); ETHER_NEXT_MULTI(step, enm); } - ETHER_UNLOCK(ec); } + ETHER_UNLOCK(ec); /* Write our unicast address */ eaddr = CLLADDR(ifp->if_sadl); @@ -618,7 +630,6 @@ eqos_init_locked(struct eqos_softc *sc) /* Setup RX filter */ sc->sc_promisc = ifp->if_flags & IFF_PROMISC; - sc->sc_allmulti = ifp->if_flags & IFF_ALLMULTI; /* XXX */ eqos_setup_rxfilter(sc); WR4(sc, GMAC_MAC_1US_TIC_COUNTER, (sc->sc_csr_clock / 100) - 1);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Thu Nov 2 13:50:14 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: eqos(4): Fix multicast filter updates. 1. Don't touch the obsolete IFF_ALLMULTI. 2. Set ETHER_F_ALLMULTI if we're accepting all multicast addresses. 3. If any multicast entry range is not a single address, accept all multicast addresses. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/dwc_eqos.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Thu Nov 2 13:50:02 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c dwc_eqos_var.h Log Message: eqos(4): Fix locking around multicast filter updates. - Can't touch if_flags without IFNET_LOCK. - Can't take IFNET_LOCK in SIOCADDMULTI/SIOCDELMULTI path. Instead, cache IFF_PROMISC and IFF_ALLMULTI on if_init under a lock we can take in this path. XXX Is IFF_ALLMULTI relevant any more? Hasn't it been moved to ethercom flags? XXX Should not take sc_lock around if_init/stop -- IFNET_LOCK is enough. Should narrow scope of sc_lock to be just tick/mii/multi stuff. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/dwc_eqos.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dwc_eqos_var.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/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.31 src/sys/dev/ic/dwc_eqos.c:1.32 --- src/sys/dev/ic/dwc_eqos.c:1.31 Thu Nov 2 13:49:49 2023 +++ src/sys/dev/ic/dwc_eqos.c Thu Nov 2 13:50:02 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.32 2023/11/02 13:50:02 riastradh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -38,7 +38,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.32 2023/11/02 13:50:02 riastradh Exp $"); #include #include @@ -509,10 +509,10 @@ eqos_setup_rxfilter(struct eqos_softc *s GMAC_MAC_PACKET_FILTER_PCF_MASK); hash[0] = hash[1] = ~0U; - if ((ifp->if_flags & IFF_PROMISC) != 0) { + if (sc->sc_promisc) { pfil |= GMAC_MAC_PACKET_FILTER_PR | GMAC_MAC_PACKET_FILTER_PCF_ALL; - } else if ((ifp->if_flags & IFF_ALLMULTI) != 0) { + } else if (sc->sc_allmulti) { pfil |= GMAC_MAC_PACKET_FILTER_PM; } else { hash[0] = hash[1] = 0; @@ -617,6 +617,8 @@ eqos_init_locked(struct eqos_softc *sc) eqos_init_rings(sc, 0); /* Setup RX filter */ + sc->sc_promisc = ifp->if_flags & IFF_PROMISC; + sc->sc_allmulti = ifp->if_flags & IFF_ALLMULTI; /* XXX */ eqos_setup_rxfilter(sc); WR4(sc, GMAC_MAC_1US_TIC_COUNTER, (sc->sc_csr_clock / 100) - 1); @@ -1232,9 +1234,10 @@ eqos_ioctl(struct ifnet *ifp, u_long cmd error = (*ifp->if_init)(ifp); else if (cmd != SIOCADDMULTI && cmd != SIOCDELMULTI) ; - else if ((ifp->if_flags & IFF_RUNNING) != 0) { + else { EQOS_LOCK(sc); - eqos_setup_rxfilter(sc); + if (sc->sc_running) +eqos_setup_rxfilter(sc); EQOS_UNLOCK(sc); } break; Index: src/sys/dev/ic/dwc_eqos_var.h diff -u src/sys/dev/ic/dwc_eqos_var.h:1.8 src/sys/dev/ic/dwc_eqos_var.h:1.9 --- src/sys/dev/ic/dwc_eqos_var.h:1.8 Thu Nov 2 13:49:49 2023 +++ src/sys/dev/ic/dwc_eqos_var.h Thu Nov 2 13:50:02 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos_var.h,v 1.8 2023/11/02 13:49:49 riastradh Exp $ */ +/* $NetBSD: dwc_eqos_var.h,v 1.9 2023/11/02 13:50:02 riastradh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -72,6 +72,8 @@ struct eqos_softc { kmutex_t sc_txlock; bool sc_running; bool sc_txrunning; + bool sc_promisc; + bool sc_allmulti; struct eqos_ring sc_tx; struct eqos_ring sc_rx;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Thu Nov 2 13:50:02 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c dwc_eqos_var.h Log Message: eqos(4): Fix locking around multicast filter updates. - Can't touch if_flags without IFNET_LOCK. - Can't take IFNET_LOCK in SIOCADDMULTI/SIOCDELMULTI path. Instead, cache IFF_PROMISC and IFF_ALLMULTI on if_init under a lock we can take in this path. XXX Is IFF_ALLMULTI relevant any more? Hasn't it been moved to ethercom flags? XXX Should not take sc_lock around if_init/stop -- IFNET_LOCK is enough. Should narrow scope of sc_lock to be just tick/mii/multi stuff. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/dwc_eqos.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dwc_eqos_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Thu Nov 2 13:49:49 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c dwc_eqos_var.h Log Message: eqos(4): Don't touch if_flags in tx path. Can't touch this without IFNET_LOCK. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/dwc_eqos.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/dwc_eqos_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Thu Nov 2 13:49:49 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c dwc_eqos_var.h Log Message: eqos(4): Don't touch if_flags in tx path. Can't touch this without IFNET_LOCK. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/dwc_eqos.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/dwc_eqos_var.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/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.30 src/sys/dev/ic/dwc_eqos.c:1.31 --- src/sys/dev/ic/dwc_eqos.c:1.30 Thu Nov 2 13:49:37 2023 +++ src/sys/dev/ic/dwc_eqos.c Thu Nov 2 13:49:49 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -38,7 +38,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $"); #include #include @@ -698,6 +698,9 @@ eqos_init_locked(struct eqos_softc *sc) /* Enable interrupts */ eqos_enable_intr(sc); + EQOS_ASSERT_TXLOCKED(sc); + sc->sc_txrunning = true; + sc->sc_running = true; ifp->if_flags |= IFF_RUNNING; @@ -731,6 +734,10 @@ eqos_stop_locked(struct eqos_softc *sc, EQOS_ASSERT_LOCKED(sc); + EQOS_TXLOCK(sc); + sc->sc_txrunning = false; + EQOS_TXUNLOCK(sc); + sc->sc_running = false; callout_halt(>sc_stat_ch, >sc_lock); @@ -1010,7 +1017,7 @@ eqos_start_locked(struct eqos_softc *sc) EQOS_ASSERT_TXLOCKED(sc); - if ((ifp->if_flags & IFF_RUNNING) == 0) + if (!sc->sc_txrunning) return; for (cnt = 0, start = sc->sc_tx.cur; ; cnt++) { Index: src/sys/dev/ic/dwc_eqos_var.h diff -u src/sys/dev/ic/dwc_eqos_var.h:1.7 src/sys/dev/ic/dwc_eqos_var.h:1.8 --- src/sys/dev/ic/dwc_eqos_var.h:1.7 Thu Nov 2 13:49:37 2023 +++ src/sys/dev/ic/dwc_eqos_var.h Thu Nov 2 13:49:49 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos_var.h,v 1.7 2023/11/02 13:49:37 riastradh Exp $ */ +/* $NetBSD: dwc_eqos_var.h,v 1.8 2023/11/02 13:49:49 riastradh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -71,6 +71,7 @@ struct eqos_softc { kmutex_t sc_lock; kmutex_t sc_txlock; bool sc_running; + bool sc_txrunning; struct eqos_ring sc_tx; struct eqos_ring sc_rx;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Thu Nov 2 13:49:37 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c dwc_eqos_var.h Log Message: eqos(4): Wait for callout to halt and make sure it stays halted. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/dwc_eqos.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/dwc_eqos_var.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/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.29 src/sys/dev/ic/dwc_eqos.c:1.30 --- src/sys/dev/ic/dwc_eqos.c:1.29 Thu Nov 2 02:32:41 2023 +++ src/sys/dev/ic/dwc_eqos.c Thu Nov 2 13:49:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.29 2023/11/02 02:32:41 msaitoh Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -38,7 +38,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.29 2023/11/02 02:32:41 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $"); #include #include @@ -468,7 +468,8 @@ eqos_tick(void *softc) EQOS_LOCK(sc); mii_tick(mii); - callout_schedule(>sc_stat_ch, hz); + if (sc->sc_running) + callout_schedule(>sc_stat_ch, hz); EQOS_UNLOCK(sc); #ifndef EQOS_MPSAFE @@ -697,6 +698,7 @@ eqos_init_locked(struct eqos_softc *sc) /* Enable interrupts */ eqos_enable_intr(sc); + sc->sc_running = true; ifp->if_flags |= IFF_RUNNING; mii_mediachg(mii); @@ -729,7 +731,8 @@ eqos_stop_locked(struct eqos_softc *sc, EQOS_ASSERT_LOCKED(sc); - callout_stop(>sc_stat_ch); + sc->sc_running = false; + callout_halt(>sc_stat_ch, >sc_lock); mii_down(>sc_mii); Index: src/sys/dev/ic/dwc_eqos_var.h diff -u src/sys/dev/ic/dwc_eqos_var.h:1.6 src/sys/dev/ic/dwc_eqos_var.h:1.7 --- src/sys/dev/ic/dwc_eqos_var.h:1.6 Thu Oct 26 18:02:50 2023 +++ src/sys/dev/ic/dwc_eqos_var.h Thu Nov 2 13:49:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos_var.h,v 1.6 2023/10/26 18:02:50 msaitoh Exp $ */ +/* $NetBSD: dwc_eqos_var.h,v 1.7 2023/11/02 13:49:37 riastradh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -70,6 +70,7 @@ struct eqos_softc { callout_t sc_stat_ch; kmutex_t sc_lock; kmutex_t sc_txlock; + bool sc_running; struct eqos_ring sc_tx; struct eqos_ring sc_rx;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Thu Nov 2 13:49:37 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c dwc_eqos_var.h Log Message: eqos(4): Wait for callout to halt and make sure it stays halted. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/dwc_eqos.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/dwc_eqos_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Thu Nov 2 02:32:41 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: eqos(4): Fix typo in comment. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/dwc_eqos.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/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.28 src/sys/dev/ic/dwc_eqos.c:1.29 --- src/sys/dev/ic/dwc_eqos.c:1.28 Sun Oct 29 14:55:16 2023 +++ src/sys/dev/ic/dwc_eqos.c Thu Nov 2 02:32:41 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.28 2023/10/29 14:55:16 msaitoh Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.29 2023/11/02 02:32:41 msaitoh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -38,7 +38,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.28 2023/10/29 14:55:16 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.29 2023/11/02 02:32:41 msaitoh Exp $"); #include #include @@ -75,7 +75,7 @@ CTASSERT(MCLBYTES >= EQOS_RXDMA_SIZE); #define EDEB_INTR (1U << 1) #define EDEB_RXRING (1U << 2) #define EDEB_TXRING (1U << 3) -unsigned int eqos_debug; /* Default vaule */ +unsigned int eqos_debug; /* Default value */ #define DPRINTF(FLAG, FORMAT, ...) \ if (sc->sc_debug & FLAG) \ device_printf(sc->sc_dev, "%s: " FORMAT, \
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Thu Nov 2 02:32:41 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: eqos(4): Fix typo in comment. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/dwc_eqos.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Sun Oct 29 14:55:16 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: eqos(4): Set flow control correctly. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/dwc_eqos.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/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.27 src/sys/dev/ic/dwc_eqos.c:1.28 --- src/sys/dev/ic/dwc_eqos.c:1.27 Thu Oct 26 18:02:50 2023 +++ src/sys/dev/ic/dwc_eqos.c Sun Oct 29 14:55:16 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.27 2023/10/26 18:02:50 msaitoh Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.28 2023/10/29 14:55:16 msaitoh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -38,7 +38,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.27 2023/10/26 18:02:50 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.28 2023/10/29 14:55:16 msaitoh Exp $"); #include #include @@ -203,7 +203,7 @@ eqos_update_link(struct eqos_softc *sc) { struct mii_data * const mii = >sc_mii; uint64_t baudrate; - uint32_t conf; + uint32_t conf, flow; baudrate = ifmedia_baudrate(mii->mii_media_active); @@ -227,13 +227,28 @@ eqos_update_link(struct eqos_softc *sc) break; } + /* Set duplex. */ if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { conf |= GMAC_MAC_CONFIGURATION_DM; } else { conf &= ~GMAC_MAC_CONFIGURATION_DM; } - WR4(sc, GMAC_MAC_CONFIGURATION, conf); + + /* Set TX flow control. */ + if (mii->mii_media_active & IFM_ETH_TXPAUSE) { + flow = GMAC_MAC_Q0_TX_FLOW_CTRL_TFE; + flow |= 0xU << GMAC_MAC_Q0_TX_FLOW_CTRL_PT_SHIFT; + } else + flow = 0; + WR4(sc, GMAC_MAC_Q0_TX_FLOW_CTRL, flow); + + /* Set RX flow control. */ + if (mii->mii_media_active & IFM_ETH_RXPAUSE) + flow = GMAC_MAC_RX_FLOW_CTRL_RFE; + else + flow = 0; + WR4(sc, GMAC_MAC_RX_FLOW_CTRL, flow); } static void @@ -658,14 +673,12 @@ eqos_init_locked(struct eqos_softc *sc) val |= __SHIFTIN(rqs, GMAC_MTL_RXQ0_OPERATION_MODE_RQS); WR4(sc, GMAC_MTL_RXQ0_OPERATION_MODE, val); - /* Enable flow control */ - val = RD4(sc, GMAC_MAC_Q0_TX_FLOW_CTRL); - val |= 0xU << GMAC_MAC_Q0_TX_FLOW_CTRL_PT_SHIFT; - val |= GMAC_MAC_Q0_TX_FLOW_CTRL_TFE; - WR4(sc, GMAC_MAC_Q0_TX_FLOW_CTRL, val); - val = RD4(sc, GMAC_MAC_RX_FLOW_CTRL); - val |= GMAC_MAC_RX_FLOW_CTRL_RFE; - WR4(sc, GMAC_MAC_RX_FLOW_CTRL, val); + /* + * Disable flow control. + * It'll be configured later from the negotiated result. + */ + WR4(sc, GMAC_MAC_Q0_TX_FLOW_CTRL, 0); + WR4(sc, GMAC_MAC_RX_FLOW_CTRL, 0); /* set RX queue mode. must be in DCB mode. */ val = __SHIFTIN(GMAC_RXQ_CTRL0_EN_DCB, GMAC_RXQ_CTRL0_EN_MASK); @@ -1431,7 +1444,6 @@ eqos_attach(struct eqos_softc *sc) struct ifnet * const ifp = >sc_ec.ec_if; uint8_t eaddr[ETHER_ADDR_LEN]; u_int userver, snpsver; - int mii_flags = 0; int error; int n; @@ -1556,7 +1568,7 @@ eqos_attach(struct eqos_softc *sc) mii->mii_writereg = eqos_mii_writereg; mii->mii_statchg = eqos_mii_statchg; mii_attach(sc->sc_dev, mii, 0x, sc->sc_phy_id, MII_OFFSET_ANY, - mii_flags); + MIIF_DOPAUSE); if (LIST_EMPTY(>mii_phys)) { aprint_error_dev(sc->sc_dev, "no PHY found!\n");
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Sun Oct 29 14:55:16 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: eqos(4): Set flow control correctly. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/dwc_eqos.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Thu Oct 26 13:00:13 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: eqos(4): Use EQOS_TXLOCK() more to be stable. Fix a bug that sc_tx.{cur,next,queued} become inconsitent. Use txlock when accessing TX data. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/dwc_eqos.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Thu Oct 26 13:00:13 UTC 2023 Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: eqos(4): Use EQOS_TXLOCK() more to be stable. Fix a bug that sc_tx.{cur,next,queued} become inconsitent. Use txlock when accessing TX data. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/dwc_eqos.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/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.25 src/sys/dev/ic/dwc_eqos.c:1.26 --- src/sys/dev/ic/dwc_eqos.c:1.25 Mon Oct 23 15:29:38 2023 +++ src/sys/dev/ic/dwc_eqos.c Thu Oct 26 13:00:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.25 2023/10/23 15:29:38 msaitoh Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.26 2023/10/26 13:00:13 msaitoh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill @@ -38,7 +38,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.25 2023/10/23 15:29:38 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.26 2023/10/26 13:00:13 msaitoh Exp $"); #include #include @@ -269,6 +269,8 @@ eqos_setup_txdesc(struct eqos_softc *sc, DPRINTF(EDEB_TXRING, "preparing desc %u\n", index); + EQOS_ASSERT_TXLOCKED(sc); + if (paddr == 0 || len == 0) { DPRINTF(EDEB_TXRING, "tx for desc %u done!\n", index); @@ -924,6 +926,7 @@ eqos_txintr(struct eqos_softc *sc, int q DPRINTF(EDEB_INTR, "qid: %u\n", qid); EQOS_ASSERT_LOCKED(sc); + EQOS_ASSERT_TXLOCKED(sc); for (i = sc->sc_tx.next; sc->sc_tx.queued > 0; i = TX_NEXT(i)) { KASSERT(sc->sc_tx.queued > 0); @@ -1128,7 +1131,9 @@ eqos_intr(void *arg) } if ((dma_status & GMAC_DMA_CHAN0_STATUS_TI) != 0) { + EQOS_TXLOCK(sc); eqos_txintr(sc, 0); + EQOS_TXUNLOCK(sc); if_schedule_deferred_start(ifp); sc->sc_ev_txintr.ev_count++; } @@ -1336,7 +1341,9 @@ eqos_setup_dma(struct eqos_softc *sc, in "cannot create TX buffer map\n"); return error; } + EQOS_TXLOCK(sc); eqos_setup_txdesc(sc, i, 0, 0, 0, 0); + EQOS_TXUNLOCK(sc); } /* Setup RX ring */