diff options
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/adv.c | 7 | ||||
-rw-r--r-- | sys/dev/ic/adw.c | 6 | ||||
-rw-r--r-- | sys/dev/ic/bha.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/bwi.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/cac.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/ciss.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/dc.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/fxp.c | 6 | ||||
-rw-r--r-- | sys/dev/ic/iha.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/malo.c | 11 | ||||
-rw-r--r-- | sys/dev/ic/mtd8xx.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/oosiop.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/osiop.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/pgt.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/re.c | 10 | ||||
-rw-r--r-- | sys/dev/ic/rt2560.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/rt2661.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/rtl81x9.c | 6 | ||||
-rw-r--r-- | sys/dev/ic/sili.c | 6 | ||||
-rw-r--r-- | sys/dev/ic/trm.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/xl.c | 5 |
21 files changed, 57 insertions, 83 deletions
diff --git a/sys/dev/ic/adv.c b/sys/dev/ic/adv.c index bfd1cf8faf1..27f3a8257ef 100644 --- a/sys/dev/ic/adv.c +++ b/sys/dev/ic/adv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adv.c,v 1.28 2010/03/23 01:57:19 krw Exp $ */ +/* $OpenBSD: adv.c,v 1.29 2010/05/19 15:27:34 oga Exp $ */ /* $NetBSD: adv.c,v 1.6 1998/10/28 20:39:45 dante Exp $ */ /* @@ -124,7 +124,8 @@ adv_alloc_ccbs(sc) * Allocate the control blocks. */ if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct adv_control), - NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { + NBPG, 0, &seg, 1, &rseg, + BUS_DMA_NOWAIT | BUS_DMA_ZERO)) != 0) { printf("%s: unable to allocate control structures," " error = %d\n", sc->sc_dev.dv_xname, error); return (error); @@ -160,6 +161,7 @@ adv_alloc_ccbs(sc) /* * Create a set of ccbs and add them to the free list. Called once * by adv_init(). We return the number of CCBs successfully created. + * CCB data is already zeroed on allocation. */ static int adv_create_ccbs(sc, ccbstore, count) @@ -170,7 +172,6 @@ adv_create_ccbs(sc, ccbstore, count) ADV_CCB *ccb; int i, error; - bzero(ccbstore, sizeof(ADV_CCB) * count); for (i = 0; i < count; i++) { ccb = &ccbstore[i]; if ((error = adv_init_ccb(sc, ccb)) != 0) { diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index 87ebcb64b1a..30a508f9986 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw.c,v 1.42 2010/03/23 01:57:19 krw Exp $ */ +/* $OpenBSD: adw.c,v 1.43 2010/05/19 15:27:35 oga Exp $ */ /* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */ /* @@ -113,7 +113,7 @@ adw_alloc_controls(sc) * Allocate the control structure. */ if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct adw_control), - NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { + NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) != 0) { printf("%s: unable to allocate control structures," " error = %d\n", sc->sc_dev.dv_xname, error); return (error); @@ -474,8 +474,6 @@ adw_attach(sc) if (error) return; /* (error) */ ; - bzero(sc->sc_control, sizeof(struct adw_control)); - /* * Create and initialize the Control Blocks. */ diff --git a/sys/dev/ic/bha.c b/sys/dev/ic/bha.c index 4ef56533f94..f6c87629d96 100644 --- a/sys/dev/ic/bha.c +++ b/sys/dev/ic/bha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bha.c,v 1.21 2010/03/23 01:57:19 krw Exp $ */ +/* $OpenBSD: bha.c,v 1.22 2010/05/19 15:27:35 oga Exp $ */ /* $NetBSD: bha.c,v 1.27 1998/11/19 21:53:00 thorpej Exp $ */ #undef BHADEBUG @@ -536,7 +536,6 @@ bha_create_ccbs(sc, ccbstore, count) struct bha_ccb *ccb; int i, error; - bzero(ccbstore, sizeof(struct bha_ccb) * count); for (i = 0; i < count; i++) { ccb = &ccbstore[i]; if ((error = bha_init_ccb(sc, ccb)) != 0) { @@ -1119,7 +1118,7 @@ bha_init(sc) * Allocate the mailbox and control blocks. */ if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct bha_control), - NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { + NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) != 0) { printf("%s: unable to allocate control structures, " "error = %d\n", sc->sc_dev.dv_xname, error); return (error); diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index b4115985ad8..171546c1253 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwi.c,v 1.91 2009/09/13 14:42:52 krw Exp $ */ +/* $OpenBSD: bwi.c,v 1.92 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -7720,7 +7720,7 @@ bwi_dma_txstats_alloc(struct bwi_softc *sc, uint32_t ctrl_base, } error = bus_dmamem_alloc(sc->sc_dmat, dma_size, BWI_RING_ALIGN, 0, - &st->stats_ring_seg, 1, &nsegs, BUS_DMA_NOWAIT); + &st->stats_ring_seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error) { printf("%s: can't allocate txstats ring DMA mem\n", sc->sc_dev.dv_xname); @@ -7744,7 +7744,6 @@ bwi_dma_txstats_alloc(struct bwi_softc *sc, uint32_t ctrl_base, return (error); } - bzero(st->stats_ring, dma_size); st->stats_ring_paddr = st->stats_ring_dmap->dm_segs[0].ds_addr; /* @@ -7761,7 +7760,7 @@ bwi_dma_txstats_alloc(struct bwi_softc *sc, uint32_t ctrl_base, return (error); } error = bus_dmamem_alloc(sc->sc_dmat, dma_size, BWI_ALIGN, 0, - &st->stats_seg, 1, &nsegs, BUS_DMA_NOWAIT); + &st->stats_seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error) { printf("%s: can't allocate txstats DMA mem\n", sc->sc_dev.dv_xname); @@ -7783,7 +7782,6 @@ bwi_dma_txstats_alloc(struct bwi_softc *sc, uint32_t ctrl_base, return (error); } - bzero(st->stats, dma_size); st->stats_paddr = st->stats_dmap->dm_segs[0].ds_addr; st->stats_ctrl_base = ctrl_base; diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c index df4fd693049..2801a23644d 100644 --- a/sys/dev/ic/cac.c +++ b/sys/dev/ic/cac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cac.c,v 1.36 2010/03/29 23:33:39 krw Exp $ */ +/* $OpenBSD: cac.c,v 1.37 2010/05/19 15:27:35 oga Exp $ */ /* $NetBSD: cac.c,v 1.15 2000/11/08 19:20:35 ad Exp $ */ /* @@ -164,7 +164,7 @@ cac_init(struct cac_softc *sc, int startfw) size = sizeof(struct cac_ccb) * CAC_MAX_CCBS; if ((error = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, seg, 1, - &rseg, BUS_DMA_NOWAIT)) != 0) { + &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) != 0) { printf("%s: unable to allocate CCBs, error = %d\n", sc->sc_dv.dv_xname, error); return (-1); @@ -192,7 +192,6 @@ cac_init(struct cac_softc *sc, int startfw) } sc->sc_ccbs_paddr = sc->sc_dmamap->dm_segs[0].ds_addr; - memset(sc->sc_ccbs, 0, size); ccb = (struct cac_ccb *)sc->sc_ccbs; for (i = 0; i < CAC_MAX_CCBS; i++, ccb++) { diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c index 54d3cc8b1b4..c762165b495 100644 --- a/sys/dev/ic/ciss.c +++ b/sys/dev/ic/ciss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciss.c,v 1.41 2010/03/23 01:57:19 krw Exp $ */ +/* $OpenBSD: ciss.c,v 1.42 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2005,2006 Michael Shalayeff @@ -238,7 +238,7 @@ ciss_attach(struct ciss_softc *sc) total = sc->ccblen * sc->maxcmd; if ((error = bus_dmamem_alloc(sc->dmat, total, PAGE_SIZE, 0, - sc->cmdseg, 1, &rseg, BUS_DMA_NOWAIT))) { + sc->cmdseg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO))) { printf(": cannot allocate CCBs (%d)\n", error); return -1; } @@ -248,7 +248,6 @@ ciss_attach(struct ciss_softc *sc) printf(": cannot map CCBs (%d)\n", error); return -1; } - bzero(sc->ccbs, total); if ((error = bus_dmamap_create(sc->dmat, total, 1, total, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &sc->cmdmap))) { @@ -306,7 +305,7 @@ ciss_attach(struct ciss_softc *sc) } if ((error = bus_dmamem_alloc(sc->dmat, PAGE_SIZE, PAGE_SIZE, 0, - seg, 1, &rseg, BUS_DMA_NOWAIT))) { + seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO))) { printf(": cannot allocate scratch buffer (%d)\n", error); return -1; } @@ -316,7 +315,6 @@ ciss_attach(struct ciss_softc *sc) printf(": cannot map scratch buffer (%d)\n", error); return -1; } - bzero(sc->scratch, PAGE_SIZE); lock = CISS_LOCK_SCRATCH(sc); inq = sc->scratch; diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index ffc5ad11849..d0e5f5c6356 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.113 2009/10/15 17:54:54 deraadt Exp $ */ +/* $OpenBSD: dc.c,v 1.114 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1672,7 +1672,7 @@ hasmac: if (bus_dmamem_alloc(sc->sc_dmat, sizeof(struct dc_list_data), PAGE_SIZE, 0, sc->sc_listseg, 1, &sc->sc_listnseg, - BUS_DMA_NOWAIT) != 0) { + BUS_DMA_NOWAIT | BUS_DMA_ZERO) != 0) { printf(": can't alloc list mem\n"); goto fail; } @@ -1694,7 +1694,6 @@ hasmac: goto fail; } sc->dc_ldata = (struct dc_list_data *)sc->sc_listkva; - bzero(sc->dc_ldata, sizeof(struct dc_list_data)); for (i = 0; i < DC_RX_LIST_CNT; i++) { if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index 6d511b4adbe..1ebf6772268 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.100 2009/10/15 17:54:54 deraadt Exp $ */ +/* $OpenBSD: fxp.c,v 1.101 2010/05/19 15:27:35 oga Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -338,7 +338,8 @@ fxp_attach(struct fxp_softc *sc, const char *intrstr) DELAY(10); if (bus_dmamem_alloc(sc->sc_dmat, sizeof(struct fxp_ctrl), - PAGE_SIZE, 0, &sc->sc_cb_seg, 1, &sc->sc_cb_nseg, BUS_DMA_NOWAIT)) + PAGE_SIZE, 0, &sc->sc_cb_seg, 1, &sc->sc_cb_nseg, + BUS_DMA_NOWAIT | BUS_DMA_ZERO)) goto fail; if (bus_dmamem_map(sc->sc_dmat, &sc->sc_cb_seg, sc->sc_cb_nseg, sizeof(struct fxp_ctrl), (caddr_t *)&sc->sc_ctrl, @@ -375,7 +376,6 @@ fxp_attach(struct fxp_softc *sc, const char *intrstr) sc->txs[i].tx_off = offsetof(struct fxp_ctrl, tx_cb[i]); sc->txs[i].tx_next = &sc->txs[(i + 1) & FXP_TXCB_MASK]; } - bzero(sc->sc_ctrl, sizeof(struct fxp_ctrl)); /* * Pre-allocate some receive buffers. diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c index 51064bed6f2..704da2a2924 100644 --- a/sys/dev/ic/iha.c +++ b/sys/dev/ic/iha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iha.c,v 1.36 2010/03/23 01:57:19 krw Exp $ */ +/* $OpenBSD: iha.c,v 1.37 2010/05/19 15:27:35 oga Exp $ */ /*------------------------------------------------------------------------- * * Device driver for the INI-9XXXU/UW or INIC-940/950 PCI SCSI Controller. @@ -2681,7 +2681,7 @@ iha_alloc_scbs(sc) */ if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct iha_scb)*IHA_MAX_SCB, - NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) + NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) != 0) { printf("%s: unable to allocate SCBs," " error = %d\n", sc->sc_dev.dv_xname, error); @@ -2695,7 +2695,6 @@ iha_alloc_scbs(sc) sc->sc_dev.dv_xname, error); return (error); } - bzero(sc->HCS_Scb, sizeof(struct iha_scb)*IHA_MAX_SCB); return (0); } diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c index d9a2243e3de..c87afadadcc 100644 --- a/sys/dev/ic/malo.c +++ b/sys/dev/ic/malo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malo.c,v 1.89 2009/07/12 18:24:23 mglocker Exp $ */ +/* $OpenBSD: malo.c,v 1.90 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -552,7 +552,8 @@ malo_alloc_rx_ring(struct malo_softc *sc, struct malo_rx_ring *ring, int count) error = bus_dmamem_alloc(sc->sc_dmat, count * sizeof(struct malo_rx_desc), - PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); + PAGE_SIZE, 0, &ring->seg, 1, &nsegs, + BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: could not allocate DMA memory\n", sc->sc_dev.dv_xname); @@ -576,7 +577,6 @@ malo_alloc_rx_ring(struct malo_softc *sc, struct malo_rx_ring *ring, int count) goto fail; } - bzero(ring->desc, count * sizeof(struct malo_rx_desc)); ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct malo_rx_data), M_DEVBUF, @@ -711,8 +711,8 @@ malo_alloc_tx_ring(struct malo_softc *sc, struct malo_tx_ring *ring, } error = bus_dmamem_alloc(sc->sc_dmat, - count * sizeof(struct malo_tx_desc), - PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); + count * sizeof(struct malo_tx_desc), PAGE_SIZE, 0, + &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: could not allocate DMA memory\n", sc->sc_dev.dv_xname); @@ -736,7 +736,6 @@ malo_alloc_tx_ring(struct malo_softc *sc, struct malo_tx_ring *ring, goto fail; } - memset(ring->desc, 0, count * sizeof(struct malo_tx_desc)); ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof(struct malo_tx_data), M_DEVBUF, diff --git a/sys/dev/ic/mtd8xx.c b/sys/dev/ic/mtd8xx.c index f3c08baeecc..2d689ae4c98 100644 --- a/sys/dev/ic/mtd8xx.c +++ b/sys/dev/ic/mtd8xx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtd8xx.c,v 1.16 2008/11/28 02:44:17 brad Exp $ */ +/* $OpenBSD: mtd8xx.c,v 1.17 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2003 Oleg Safiullin <form@pdp11.org.ru> @@ -99,7 +99,7 @@ mtd_attach(struct mtd_softc *sc) if (bus_dmamem_alloc(sc->sc_dmat, sizeof(struct mtd_list_data), PAGE_SIZE, 0, sc->sc_listseg, 1, &sc->sc_listnseg, - BUS_DMA_NOWAIT) != 0) { + BUS_DMA_NOWAIT | BUS_DMA_ZERO) != 0) { printf(": can't alloc list mem\n"); return; } @@ -121,7 +121,6 @@ mtd_attach(struct mtd_softc *sc) return; } sc->mtd_ldata = (struct mtd_list_data *)sc->sc_listkva; - bzero(sc->mtd_ldata, sizeof(struct mtd_list_data)); for (i = 0; i < MTD_RX_LIST_CNT; i++) { if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, diff --git a/sys/dev/ic/oosiop.c b/sys/dev/ic/oosiop.c index db263a09af4..28d46e3eed4 100644 --- a/sys/dev/ic/oosiop.c +++ b/sys/dev/ic/oosiop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: oosiop.c,v 1.15 2010/04/20 20:21:56 miod Exp $ */ +/* $OpenBSD: oosiop.c,v 1.16 2010/05/19 15:27:35 oga Exp $ */ /* $NetBSD: oosiop.c,v 1.4 2003/10/29 17:45:55 tsutsui Exp $ */ /* @@ -156,7 +156,7 @@ oosiop_attach(struct oosiop_softc *sc) */ scrsize = round_page(sizeof(oosiop_script)); err = bus_dmamem_alloc(sc->sc_dmat, scrsize, PAGE_SIZE, 0, &seg, 1, - &nseg, BUS_DMA_NOWAIT); + &nseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (err) { printf(": failed to allocate script memory, err=%d\n", err); return; @@ -179,7 +179,6 @@ oosiop_attach(struct oosiop_softc *sc) printf(": failed to load script map, err=%d\n", err); return; } - bzero(sc->sc_scr, scrsize); sc->sc_scrbase = sc->sc_scrdma->dm_segs[0].ds_addr; /* Initialize command block array */ diff --git a/sys/dev/ic/osiop.c b/sys/dev/ic/osiop.c index 579f5f09e57..0427b8b89fa 100644 --- a/sys/dev/ic/osiop.c +++ b/sys/dev/ic/osiop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: osiop.c,v 1.41 2010/03/23 01:57:19 krw Exp $ */ +/* $OpenBSD: osiop.c,v 1.42 2010/05/19 15:27:35 oga Exp $ */ /* $NetBSD: osiop.c,v 1.9 2002/04/05 18:27:54 bouyer Exp $ */ /* @@ -206,7 +206,7 @@ osiop_attach(sc) * Allocate and map DMA-safe memory for the script. */ err = bus_dmamem_alloc(sc->sc_dmat, PAGE_SIZE, PAGE_SIZE, 0, - &seg, 1, &nseg, BUS_DMA_NOWAIT); + &seg, 1, &nseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (err) { printf(": failed to allocate script memory, err=%d\n", err); return; @@ -229,7 +229,6 @@ osiop_attach(sc) printf(": failed to load script map, err=%d\n", err); return; } - bzero(sc->sc_script, PAGE_SIZE); /* * Copy and sync script @@ -243,7 +242,7 @@ osiop_attach(sc) */ err = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct osiop_ds) * OSIOP_NACB, PAGE_SIZE, 0, - &seg, 1, &nseg, BUS_DMA_NOWAIT); + &seg, 1, &nseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (err) { printf(": failed to allocate ds memory, err=%d\n", err); return; @@ -269,7 +268,6 @@ osiop_attach(sc) printf(": failed to load ds map, err=%d\n", err); return; } - bzero(sc->sc_ds, sizeof(struct osiop_ds) * OSIOP_NACB); /* * Allocate (malloc) memory for acb's. diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c index 318e179cd14..6e6d57894b2 100644 --- a/sys/dev/ic/pgt.c +++ b/sys/dev/ic/pgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgt.c,v 1.58 2010/04/20 22:05:43 tedu Exp $ */ +/* $OpenBSD: pgt.c,v 1.59 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -3074,7 +3074,7 @@ pgt_dma_alloc(struct pgt_softc *sc) } error = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, - 0, &sc->sc_cbdmas, 1, &nsegs, BUS_DMA_NOWAIT); + 0, &sc->sc_cbdmas, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: can not allocate DMA memory for control block\n", sc->sc_dev.dv_xname); @@ -3088,7 +3088,6 @@ pgt_dma_alloc(struct pgt_softc *sc) sc->sc_dev.dv_xname); goto out; } - bzero(sc->sc_cb, size); error = bus_dmamap_load(sc->sc_dmat, sc->sc_cbdmam, sc->sc_cb, size, NULL, BUS_DMA_NOWAIT); @@ -3112,7 +3111,7 @@ pgt_dma_alloc(struct pgt_softc *sc) } error = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, - 0, &sc->sc_psmdmas, 1, &nsegs, BUS_DMA_NOWAIT); + 0, &sc->sc_psmdmas, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: can not allocate DMA memory for powersave\n", sc->sc_dev.dv_xname); @@ -3126,7 +3125,6 @@ pgt_dma_alloc(struct pgt_softc *sc) sc->sc_dev.dv_xname); goto out; } - bzero(sc->sc_psmbuf, size); error = bus_dmamap_load(sc->sc_dmat, sc->sc_psmdmam, sc->sc_psmbuf, size, NULL, BUS_DMA_WAITOK); diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index 6d1b2efb248..11f9635109f 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.118 2010/04/03 22:24:05 sthen Exp $ */ +/* $OpenBSD: re.c,v 1.119 2010/05/19 15:27:35 oga Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -994,7 +994,8 @@ re_attach(struct rl_softc *sc, const char *intrstr) /* Allocate DMA'able memory for the TX ring */ if ((error = bus_dmamem_alloc(sc->sc_dmat, RL_TX_LIST_SZ(sc), RL_RING_ALIGN, 0, &sc->rl_ldata.rl_tx_listseg, 1, - &sc->rl_ldata.rl_tx_listnseg, BUS_DMA_NOWAIT)) != 0) { + &sc->rl_ldata.rl_tx_listnseg, BUS_DMA_NOWAIT | + BUS_DMA_ZERO)) != 0) { printf("%s: can't allocate tx listseg, error = %d\n", sc->sc_dev.dv_xname, error); goto fail_0; @@ -1009,7 +1010,6 @@ re_attach(struct rl_softc *sc, const char *intrstr) sc->sc_dev.dv_xname, error); goto fail_1; } - memset(sc->rl_ldata.rl_tx_list, 0, RL_TX_LIST_SZ(sc)); if ((error = bus_dmamap_create(sc->sc_dmat, RL_TX_LIST_SZ(sc), 1, RL_TX_LIST_SZ(sc), 0, 0, @@ -1043,7 +1043,8 @@ re_attach(struct rl_softc *sc, const char *intrstr) /* Allocate DMA'able memory for the RX ring */ if ((error = bus_dmamem_alloc(sc->sc_dmat, RL_RX_DMAMEM_SZ, RL_RING_ALIGN, 0, &sc->rl_ldata.rl_rx_listseg, 1, - &sc->rl_ldata.rl_rx_listnseg, BUS_DMA_NOWAIT)) != 0) { + &sc->rl_ldata.rl_rx_listnseg, BUS_DMA_NOWAIT | + BUS_DMA_ZERO)) != 0) { printf("%s: can't allocate rx listnseg, error = %d\n", sc->sc_dev.dv_xname, error); goto fail_4; @@ -1059,7 +1060,6 @@ re_attach(struct rl_softc *sc, const char *intrstr) goto fail_5; } - memset(sc->rl_ldata.rl_rx_list, 0, RL_RX_DMAMEM_SZ); if ((error = bus_dmamap_create(sc->sc_dmat, RL_RX_DMAMEM_SZ, 1, RL_RX_DMAMEM_SZ, 0, 0, diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index ecc79997eb0..634eb1cd45e 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.47 2010/04/20 22:05:43 tedu Exp $ */ +/* $OpenBSD: rt2560.c,v 1.48 2010/05/19 15:27:35 oga Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -354,7 +354,7 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct rt2560_tx_ring *ring, } error = bus_dmamem_alloc(sc->sc_dmat, count * RT2560_TX_DESC_SIZE, - PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); + PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: could not allocate DMA memory\n", sc->sc_dev.dv_xname); @@ -378,7 +378,6 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct rt2560_tx_ring *ring, goto fail; } - memset(ring->desc, 0, count * RT2560_TX_DESC_SIZE); ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF, @@ -499,7 +498,7 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring, } error = bus_dmamem_alloc(sc->sc_dmat, count * RT2560_RX_DESC_SIZE, - PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); + PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: could not allocate DMA memory\n", sc->sc_dev.dv_xname); @@ -523,7 +522,6 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring, goto fail; } - memset(ring->desc, 0, count * RT2560_RX_DESC_SIZE); ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF, diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index 80124d98ab6..b9ce6f07b20 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.53 2010/04/20 22:05:43 tedu Exp $ */ +/* $OpenBSD: rt2661.c,v 1.54 2010/05/19 15:27:35 oga Exp $ */ /*- * Copyright (c) 2006 @@ -386,7 +386,7 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct rt2661_tx_ring *ring, } error = bus_dmamem_alloc(sc->sc_dmat, count * RT2661_TX_DESC_SIZE, - PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); + PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: could not allocate DMA memory\n", sc->sc_dev.dv_xname); @@ -410,7 +410,6 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct rt2661_tx_ring *ring, goto fail; } - memset(ring->desc, 0, count * RT2661_TX_DESC_SIZE); ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF, @@ -528,7 +527,7 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring, } error = bus_dmamem_alloc(sc->sc_dmat, count * RT2661_RX_DESC_SIZE, - PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); + PAGE_SIZE, 0, &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: could not allocate DMA memory\n", sc->sc_dev.dv_xname); @@ -552,7 +551,6 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring, goto fail; } - memset(ring->desc, 0, count * RT2661_RX_DESC_SIZE); ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF, diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index 071e99c24a2..5f636c712aa 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9.c,v 1.69 2009/12/21 18:14:51 naddy Exp $ */ +/* $OpenBSD: rtl81x9.c,v 1.70 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1162,7 +1162,7 @@ rl_attach(struct rl_softc *sc) sc->rl_type = RL_UNKNOWN; /* could be 8138 or other */ if (bus_dmamem_alloc(sc->sc_dmat, RL_RXBUFLEN + 32, PAGE_SIZE, 0, - &sc->sc_rx_seg, 1, &rseg, BUS_DMA_NOWAIT)) { + &sc->sc_rx_seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf("\n%s: can't alloc rx buffers\n", sc->sc_dev.dv_xname); return (1); } @@ -1191,8 +1191,6 @@ rl_attach(struct rl_softc *sc) sc->rl_cdata.rl_rx_buf = kva; sc->rl_cdata.rl_rx_buf_pa = sc->sc_rx_dmamap->dm_segs[0].ds_addr; - bzero(sc->rl_cdata.rl_rx_buf, RL_RXBUFLEN + 32); - bus_dmamap_sync(sc->sc_dmat, sc->sc_rx_dmamap, 0, sc->sc_rx_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); diff --git a/sys/dev/ic/sili.c b/sys/dev/ic/sili.c index 867396f7778..59410879076 100644 --- a/sys/dev/ic/sili.c +++ b/sys/dev/ic/sili.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sili.c,v 1.44 2009/12/07 09:37:33 dlg Exp $ */ +/* $OpenBSD: sili.c,v 1.45 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -584,7 +584,7 @@ sili_dmamem_alloc(struct sili_softc *sc, bus_size_t size, bus_size_t align) goto sdmfree; if (bus_dmamem_alloc(sc->sc_dmat, size, align, 0, &sdm->sdm_seg, - 1, &nsegs, BUS_DMA_NOWAIT) != 0) + 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO) != 0) goto destroy; if (bus_dmamem_map(sc->sc_dmat, &sdm->sdm_seg, nsegs, size, @@ -595,8 +595,6 @@ sili_dmamem_alloc(struct sili_softc *sc, bus_size_t size, bus_size_t align) NULL, BUS_DMA_NOWAIT) != 0) goto unmap; - bzero(sdm->sdm_kva, size); - return (sdm); unmap: diff --git a/sys/dev/ic/trm.c b/sys/dev/ic/trm.c index a4a62db4d05..29ce4b7a3f0 100644 --- a/sys/dev/ic/trm.c +++ b/sys/dev/ic/trm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trm.c,v 1.18 2010/03/23 01:57:19 krw Exp $ +/* $OpenBSD: trm.c,v 1.19 2010/05/19 15:27:35 oga Exp $ * ------------------------------------------------------------ * O.S : OpenBSD * File Name : trm.c @@ -2878,7 +2878,7 @@ trm_init(struct trm_softc *sc, int unit) all_srbs_size = TRM_MAX_SRB_CNT * sizeof(struct trm_scsi_req_q); error = bus_dmamem_alloc(sc->sc_dmatag, all_srbs_size, NBPG, 0, &seg, - 1, &rseg, BUS_DMA_NOWAIT); + 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: unable to allocate SCSI REQUEST BLOCKS, error = %d\n", sc->sc_device.dv_xname, error); @@ -2917,7 +2917,6 @@ trm_init(struct trm_softc *sc, int unit) printf("\n\n%s: all_srbs_size=%x\n", sc->sc_device.dv_xname, all_srbs_size); #endif - bzero(sc->SRB, all_srbs_size); trm_initACB(sc, unit); trm_initAdapter(sc); diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index 478166ee6a0..64f41ee9268 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.88 2009/12/22 21:10:25 naddy Exp $ */ +/* $OpenBSD: xl.c,v 1.89 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2427,7 +2427,7 @@ xl_attach(struct xl_softc *sc) if (bus_dmamem_alloc(sc->sc_dmat, sizeof(struct xl_list_data), PAGE_SIZE, 0, sc->sc_listseg, 1, &sc->sc_listnseg, - BUS_DMA_NOWAIT) != 0) { + BUS_DMA_NOWAIT | BUS_DMA_ZERO) != 0) { printf(": can't alloc list mem\n"); return; } @@ -2449,7 +2449,6 @@ xl_attach(struct xl_softc *sc) return; } sc->xl_ldata = (struct xl_list_data *)sc->sc_listkva; - bzero(sc->xl_ldata, sizeof(struct xl_list_data)); for (i = 0; i < XL_RX_LIST_CNT; i++) { if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, |