diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-05-19 15:27:36 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-05-19 15:27:36 +0000 |
commit | 158d178f03df6b6e0f7f96e4596904b0ab8274bb (patch) | |
tree | 592e86ac7a4fefc86456a1838bc06aab1a0602ed | |
parent | fa977d1430aef60feb0d5aa71b3610a2ad13ba3e (diff) |
BUS_DMA_ZERO instead of alloc, map, bzero.
ok krw@
43 files changed, 110 insertions, 172 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, diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c index adf6114189a..98630fcb7c0 100644 --- a/sys/dev/pci/ahci.c +++ b/sys/dev/pci/ahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci.c,v 1.163 2010/04/16 22:15:39 kettenis Exp $ */ +/* $OpenBSD: ahci.c,v 1.164 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -2192,7 +2192,7 @@ ahci_dmamem_alloc(struct ahci_softc *sc, size_t size) goto admfree; if (bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &adm->adm_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, &adm->adm_seg, nsegs, size, @@ -2203,8 +2203,6 @@ ahci_dmamem_alloc(struct ahci_softc *sc, size_t size) NULL, BUS_DMA_NOWAIT) != 0) goto unmap; - bzero(adm->adm_kva, size); - return (adm); unmap: diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c index bdc4d9a5e54..31c2e2d6c0e 100644 --- a/sys/dev/pci/arc.c +++ b/sys/dev/pci/arc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc.c,v 1.82 2010/04/08 00:23:53 tedu Exp $ */ +/* $OpenBSD: arc.c,v 1.83 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -1866,7 +1866,7 @@ arc_dmamem_alloc(struct arc_softc *sc, size_t size) goto admfree; if (bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &adm->adm_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, &adm->adm_seg, nsegs, size, @@ -1877,8 +1877,6 @@ arc_dmamem_alloc(struct arc_softc *sc, size_t size) NULL, BUS_DMA_NOWAIT) != 0) goto unmap; - bzero(adm->adm_kva, size); - return (adm); unmap: diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index de52be79c3e..e7234e4d68b 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.159 2010/04/08 00:23:53 tedu Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.160 2010/05/19 15:27:35 oga Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -197,7 +197,8 @@ hifn_attach(struct device *parent, struct device *self, void *aux) goto fail_io1; } if (bus_dmamem_alloc(sc->sc_dmat, sizeof(*sc->sc_dma), PAGE_SIZE, 0, - sc->sc_dmasegs, 1, &sc->sc_dmansegs, BUS_DMA_NOWAIT)) { + sc->sc_dmasegs, 1, &sc->sc_dmansegs, + BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf(": can't alloc dma buffer\n"); bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap); goto fail_io1; @@ -219,7 +220,6 @@ hifn_attach(struct device *parent, struct device *self, void *aux) goto fail_io1; } sc->sc_dma = (struct hifn_dma *)kva; - bzero(sc->sc_dma, sizeof(*sc->sc_dma)); hifn_reset_board(sc, 0); diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index 2095b5ed2dc..03981d6880f 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnx.c,v 1.86 2009/11/23 10:54:43 claudio Exp $ */ +/* $OpenBSD: if_bnx.c,v 1.87 2010/05/19 15:27:35 oga Exp $ */ /*- * Copyright (c) 2006 Broadcom Corporation @@ -2357,7 +2357,7 @@ bnx_dma_alloc(struct bnx_softc *sc) if (bus_dmamem_alloc(sc->bnx_dmatag, BNX_STATUS_BLK_SZ, BNX_DMA_ALIGN, BNX_DMA_BOUNDARY, &sc->status_seg, 1, - &sc->status_rseg, BUS_DMA_NOWAIT)) { + &sc->status_rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf(": Could not allocate status block DMA memory!\n"); rc = ENOMEM; goto bnx_dma_alloc_exit; @@ -2378,7 +2378,6 @@ bnx_dma_alloc(struct bnx_softc *sc) } sc->status_block_paddr = sc->status_map->dm_segs[0].ds_addr; - bzero(sc->status_block, BNX_STATUS_BLK_SZ); /* DRC - Fix for 64 bit addresses. */ DBPRINT(sc, BNX_INFO, "status_block_paddr = 0x%08X\n", @@ -2445,7 +2444,7 @@ bnx_dma_alloc(struct bnx_softc *sc) if (bus_dmamem_alloc(sc->bnx_dmatag, BNX_STATS_BLK_SZ, BNX_DMA_ALIGN, BNX_DMA_BOUNDARY, &sc->stats_seg, 1, - &sc->stats_rseg, BUS_DMA_NOWAIT)) { + &sc->stats_rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf(": Could not allocate stats block DMA memory!\n"); rc = ENOMEM; goto bnx_dma_alloc_exit; @@ -2466,7 +2465,6 @@ bnx_dma_alloc(struct bnx_softc *sc) } sc->stats_block_paddr = sc->stats_map->dm_segs[0].ds_addr; - bzero(sc->stats_block, BNX_STATS_BLK_SZ); /* DRC - Fix for 64 bit address. */ DBPRINT(sc,BNX_INFO, "stats_block_paddr = 0x%08X\n", @@ -2541,7 +2539,7 @@ bnx_dma_alloc(struct bnx_softc *sc) if (bus_dmamem_alloc(sc->bnx_dmatag, BNX_RX_CHAIN_PAGE_SZ, BCM_PAGE_SIZE, BNX_DMA_BOUNDARY, &sc->rx_bd_chain_seg[i], 1, - &sc->rx_bd_chain_rseg[i], BUS_DMA_NOWAIT)) { + &sc->rx_bd_chain_rseg[i], BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf(": Could not allocate Rx desc %d DMA memory!\n", i); rc = ENOMEM; @@ -2564,7 +2562,6 @@ bnx_dma_alloc(struct bnx_softc *sc) goto bnx_dma_alloc_exit; } - bzero(sc->rx_bd_chain[i], BNX_RX_CHAIN_PAGE_SZ); sc->rx_bd_chain_paddr[i] = sc->rx_bd_chain_map[i]->dm_segs[0].ds_addr; diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index ab8b150961f..5d8d8ca42b5 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $ */ +/* $OpenBSD: if_cas.c,v 1.30 2010/05/19 15:27:35 oga Exp $ */ /* * @@ -386,7 +386,7 @@ cas_config(struct cas_softc *sc) */ if ((error = bus_dmamem_alloc(sc->sc_dmatag, sizeof(struct cas_control_data), CAS_PAGE_SIZE, 0, &sc->sc_cdseg, - 1, &sc->sc_cdnseg, 0)) != 0) { + 1, &sc->sc_cdnseg, BUS_DMA_ZERO)) != 0) { printf("\n%s: unable to allocate control data, error = %d\n", sc->sc_dev.dv_xname, error); goto fail_0; @@ -417,8 +417,6 @@ cas_config(struct cas_softc *sc) goto fail_3; } - bzero(sc->sc_control_data, sizeof(struct cas_control_data)); - /* * Create the receive buffer DMA maps. */ diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index 654783c715b..31ed0ead832 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_et.c,v 1.19 2009/09/13 14:42:52 krw Exp $ */ +/* $OpenBSD: if_et.c,v 1.20 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. * @@ -850,7 +850,7 @@ et_dma_mem_create(struct et_softc *sc, bus_size_t size, } error = bus_dmamem_alloc(sc->sc_dmat, size, ET_ALIGN, 0, seg, - 1, &nsegs, BUS_DMA_WAITOK); + 1, &nsegs, BUS_DMA_WAITOK | BUS_DMA_ZERO); if (error) { printf("%s: can't allocate DMA mem\n", sc->sc_dev.dv_xname); return error; @@ -871,8 +871,6 @@ et_dma_mem_create(struct et_softc *sc, bus_size_t size, return error; } - memset(*addr, 0, size); - *paddr = (*dmap)->dm_segs[0].ds_addr; return 0; diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 68c181949df..50abb89e7d5 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwi.c,v 1.102 2010/04/20 22:05:43 tedu Exp $ */ +/* $OpenBSD: if_iwi.c,v 1.103 2010/05/19 15:27:35 oga Exp $ */ /*- * Copyright (c) 2004-2008 @@ -378,7 +378,7 @@ iwi_alloc_cmd_ring(struct iwi_softc *sc, struct iwi_cmd_ring *ring) error = bus_dmamem_alloc(sc->sc_dmat, sizeof (struct iwi_cmd_desc) * IWI_CMD_RING_COUNT, PAGE_SIZE, 0, - &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); + &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: could not allocate cmd ring DMA memory\n", sc->sc_dev.dv_xname); @@ -403,7 +403,6 @@ iwi_alloc_cmd_ring(struct iwi_softc *sc, struct iwi_cmd_ring *ring) goto fail; } - bzero(ring->desc, sizeof (struct iwi_cmd_desc) * IWI_CMD_RING_COUNT); return 0; fail: iwi_free_cmd_ring(sc, ring); @@ -454,7 +453,7 @@ iwi_alloc_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring, int ac) error = bus_dmamem_alloc(sc->sc_dmat, sizeof (struct iwi_tx_desc) * IWI_TX_RING_COUNT, PAGE_SIZE, 0, - &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT); + &ring->seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); if (error != 0) { printf("%s: could not allocate tx ring DMA memory\n", sc->sc_dev.dv_xname); @@ -479,8 +478,6 @@ iwi_alloc_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring, int ac) goto fail; } - bzero(ring->desc, sizeof (struct iwi_tx_desc) * IWI_TX_RING_COUNT); - for (i = 0; i < IWI_TX_RING_COUNT; i++) { data = &ring->data[i]; diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c index af3a404fff2..0a26e88122a 100644 --- a/sys/dev/pci/if_jme.c +++ b/sys/dev/pci/if_jme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_jme.c,v 1.21 2010/01/07 12:26:06 sthen Exp $ */ +/* $OpenBSD: if_jme.c,v 1.22 2010/05/19 15:27:35 oga Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> * All rights reserved. @@ -748,7 +748,7 @@ jme_dma_alloc(struct jme_softc *sc) /* Allocate DMA'able memory for RX ring */ error = bus_dmamem_alloc(sc->sc_dmat, JME_RX_RING_SIZE, ETHER_ALIGN, 0, &sc->jme_rdata.jme_rx_ring_seg, 1, &nsegs, - BUS_DMA_WAITOK); + BUS_DMA_WAITOK | BUS_DMA_ZERO); /* XXX zero */ if (error) { printf("%s: could not allocate DMA'able memory for Rx ring.\n", @@ -762,8 +762,6 @@ jme_dma_alloc(struct jme_softc *sc) if (error) return (ENOBUFS); - bzero(sc->jme_rdata.jme_rx_ring, JME_RX_RING_SIZE); - /* Load the DMA map for Rx ring. */ error = bus_dmamap_load(sc->sc_dmat, sc->jme_cdata.jme_rx_ring_map, sc->jme_rdata.jme_rx_ring, diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c index 9d26a7442d0..c8a55c9b28e 100644 --- a/sys/dev/pci/if_lge.c +++ b/sys/dev/pci/if_lge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lge.c,v 1.52 2009/08/13 14:24:47 jasper Exp $ */ +/* $OpenBSD: if_lge.c,v 1.53 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -504,7 +504,7 @@ lge_attach(struct device *parent, struct device *self, void *aux) sc->sc_dmatag = pa->pa_dmat; DPRINTFN(5, ("bus_dmamem_alloc\n")); if (bus_dmamem_alloc(sc->sc_dmatag, sizeof(struct lge_list_data), - PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) { + PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf("%s: can't alloc rx buffers\n", sc->sc_dv.dv_xname); goto fail_2; } @@ -532,7 +532,6 @@ lge_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(5, ("bzero\n")); sc->lge_ldata = (struct lge_list_data *)kva; - bzero(sc->lge_ldata, sizeof(struct lge_list_data)); /* Try to allocate memory for jumbo buffers. */ DPRINTFN(5, ("lge_alloc_jumbo_mem\n")); diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index 01e6a545b0f..b6123841892 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_msk.c,v 1.86 2010/01/09 02:40:18 sthen Exp $ */ +/* $OpenBSD: if_msk.c,v 1.87 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -890,7 +890,7 @@ msk_attach(struct device *parent, struct device *self, void *aux) /* Allocate the descriptor queues. */ if (bus_dmamem_alloc(sc->sc_dmatag, sizeof(struct msk_ring_data), PAGE_SIZE, 0, &sc_if->sk_ring_seg, 1, &sc_if->sk_ring_nseg, - BUS_DMA_NOWAIT)) { + BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf(": can't alloc rx buffers\n"); goto fail; } @@ -913,7 +913,6 @@ msk_attach(struct device *parent, struct device *self, void *aux) goto fail_3; } sc_if->sk_rdata = (struct msk_ring_data *)kva; - bzero(sc_if->sk_rdata, sizeof(struct msk_ring_data)); if (sc->sk_type != SK_YUKON_FE && sc->sk_type != SK_YUKON_FE_P) @@ -1170,7 +1169,8 @@ mskc_attach(struct device *parent, struct device *self, void *aux) if (bus_dmamem_alloc(sc->sc_dmatag, MSK_STATUS_RING_CNT * sizeof(struct msk_status_desc), MSK_STATUS_RING_CNT * sizeof(struct msk_status_desc), - 0, &sc->sk_status_seg, 1, &sc->sk_status_nseg, BUS_DMA_NOWAIT)) { + 0, &sc->sk_status_seg, 1, &sc->sk_status_nseg, + BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf(": can't alloc status buffers\n"); goto fail_2; } @@ -1197,8 +1197,6 @@ mskc_attach(struct device *parent, struct device *self, void *aux) goto fail_5; } sc->sk_status_ring = (struct msk_status_desc *)kva; - bzero(sc->sk_status_ring, - MSK_STATUS_RING_CNT * sizeof(struct msk_status_desc)); /* Reset the adapter. */ mskc_reset(sc); diff --git a/sys/dev/pci/if_myx.c b/sys/dev/pci/if_myx.c index 590726936f9..685f7535fbd 100644 --- a/sys/dev/pci/if_myx.c +++ b/sys/dev/pci/if_myx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_myx.c,v 1.11 2009/08/13 14:24:47 jasper Exp $ */ +/* $OpenBSD: if_myx.c,v 1.12 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org> @@ -508,7 +508,7 @@ myx_dmamem_alloc(struct myx_softc *sc, struct myx_dmamem *mxm, return (1); if (bus_dmamem_alloc(sc->sc_dmat, mxm->mxm_size, align, 0, &mxm->mxm_seg, 1, &mxm->mxm_nsegs, - BUS_DMA_WAITOK) != 0) + BUS_DMA_WAITOK | BUS_DMA_ZERO) != 0) goto destroy; if (bus_dmamem_map(sc->sc_dmat, &mxm->mxm_seg, mxm->mxm_nsegs, mxm->mxm_size, &mxm->mxm_kva, BUS_DMA_WAITOK) != 0) @@ -517,7 +517,6 @@ myx_dmamem_alloc(struct myx_softc *sc, struct myx_dmamem *mxm, mxm->mxm_size, NULL, BUS_DMA_WAITOK) != 0) goto unmap; - bzero(mxm->mxm_kva, mxm->mxm_size); mxm->mxm_name = mname; return (0); diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c index 74ff3e7d363..60bdea92877 100644 --- a/sys/dev/pci/if_nfe.c +++ b/sys/dev/pci/if_nfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nfe.c,v 1.89 2009/06/18 08:19:03 jsg Exp $ */ +/* $OpenBSD: if_nfe.c,v 1.90 2010/05/19 15:27:35 oga Exp $ */ /*- * Copyright (c) 2006, 2007 Damien Bergamini <damien.bergamini@free.fr> @@ -1236,7 +1236,7 @@ nfe_alloc_rx_ring(struct nfe_softc *sc, struct nfe_rx_ring *ring) } error = bus_dmamem_alloc(sc->sc_dmat, NFE_RX_RING_COUNT * descsize, - 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); @@ -1258,8 +1258,6 @@ nfe_alloc_rx_ring(struct nfe_softc *sc, struct nfe_rx_ring *ring) sc->sc_dev.dv_xname); goto fail; } - - bzero(*desc, NFE_RX_RING_COUNT * descsize); ring->physaddr = ring->map->dm_segs[0].ds_addr; if (sc->sc_flags & NFE_USE_JUMBO) { @@ -1555,7 +1553,7 @@ nfe_alloc_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) } error = bus_dmamem_alloc(sc->sc_dmat, NFE_TX_RING_COUNT * descsize, - 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); @@ -1577,8 +1575,6 @@ nfe_alloc_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) sc->sc_dev.dv_xname); goto fail; } - - bzero(*desc, NFE_TX_RING_COUNT * descsize); ring->physaddr = ring->map->dm_segs[0].ds_addr; for (i = 0; i < NFE_TX_RING_COUNT; i++) { diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c index 54996d893bb..591519cf3d0 100644 --- a/sys/dev/pci/if_nge.c +++ b/sys/dev/pci/if_nge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nge.c,v 1.68 2009/08/13 14:24:47 jasper Exp $ */ +/* $OpenBSD: if_nge.c,v 1.69 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -834,7 +834,8 @@ nge_attach(parent, self, aux) sc->sc_dmatag = pa->pa_dmat; DPRINTFN(5, ("%s: bus_dmamem_alloc\n", sc->sc_dv.dv_xname)); if (bus_dmamem_alloc(sc->sc_dmatag, sizeof(struct nge_list_data), - PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) { + PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT | + BUS_DMA_ZERO)) { printf("%s: can't alloc rx buffers\n", sc->sc_dv.dv_xname); goto fail_2; } @@ -862,7 +863,6 @@ nge_attach(parent, self, aux) DPRINTFN(5, ("%s: bzero\n", sc->sc_dv.dv_xname)); sc->nge_ldata = (struct nge_list_data *)kva; - bzero(sc->nge_ldata, sizeof(struct nge_list_data)); /* Try to allocate memory for jumbo buffers. */ DPRINTFN(5, ("%s: nge_alloc_jumbo_mem\n", sc->sc_dv.dv_xname)); diff --git a/sys/dev/pci/if_nxe.c b/sys/dev/pci/if_nxe.c index 79662b324db..e7d24cce0da 100644 --- a/sys/dev/pci/if_nxe.c +++ b/sys/dev/pci/if_nxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nxe.c,v 1.60 2009/06/02 12:33:42 reyk Exp $ */ +/* $OpenBSD: if_nxe.c,v 1.61 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -2001,7 +2001,7 @@ nxe_dmamem_alloc(struct nxe_softc *sc, bus_size_t size, bus_size_t align) goto ndmfree; if (bus_dmamem_alloc(sc->sc_dmat, size, align, 0, &ndm->ndm_seg, 1, - &nsegs, BUS_DMA_WAITOK) != 0) + &nsegs, BUS_DMA_WAITOK |BUS_DMA_ZERO) != 0) goto destroy; if (bus_dmamem_map(sc->sc_dmat, &ndm->ndm_seg, nsegs, size, @@ -2012,8 +2012,6 @@ nxe_dmamem_alloc(struct nxe_softc *sc, bus_size_t size, bus_size_t align) NULL, BUS_DMA_WAITOK) != 0) goto unmap; - bzero(ndm->ndm_kva, size); - return (ndm); unmap: diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 7ba68968ae9..335b274f697 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.97 2009/08/13 14:24:47 jasper Exp $ */ +/* $OpenBSD: if_sis.c,v 1.98 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -1062,7 +1062,7 @@ sis_attach(struct device *parent, struct device *self, void *aux) if (bus_dmamem_alloc(sc->sc_dmat, sizeof(struct sis_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_2; } @@ -1084,7 +1084,6 @@ sis_attach(struct device *parent, struct device *self, void *aux) goto fail_2; } sc->sis_ldata = (struct sis_list_data *)sc->sc_listkva; - bzero(sc->sis_ldata, sizeof(struct sis_list_data)); for (i = 0; i < SIS_RX_LIST_CNT; i++) { if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 7ae968d3037..f95bb218b8f 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sk.c,v 1.156 2009/10/17 21:40:43 martynas Exp $ */ +/* $OpenBSD: if_sk.c,v 1.157 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1134,7 +1134,7 @@ sk_attach(struct device *parent, struct device *self, void *aux) /* Allocate the descriptor queues. */ if (bus_dmamem_alloc(sc->sc_dmatag, sizeof(struct sk_ring_data), PAGE_SIZE, 0, &sc_if->sk_ring_seg, 1, &sc_if->sk_ring_nseg, - BUS_DMA_NOWAIT)) { + BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf(": can't alloc rx buffers\n"); goto fail; } @@ -1156,7 +1156,6 @@ sk_attach(struct device *parent, struct device *self, void *aux) goto fail_3; } sc_if->sk_rdata = (struct sk_ring_data *)kva; - bzero(sc_if->sk_rdata, sizeof(struct sk_ring_data)); /* Try to allocate memory for jumbo buffers. */ if (sk_alloc_jumbo_mem(sc_if)) { diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c index 3efa0a960fd..7524b382148 100644 --- a/sys/dev/pci/if_tht.c +++ b/sys/dev/pci/if_tht.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tht.c,v 1.123 2010/04/08 00:23:53 tedu Exp $ */ +/* $OpenBSD: if_tht.c,v 1.124 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -1826,7 +1826,7 @@ tht_dmamem_alloc(struct tht_softc *sc, bus_size_t size, bus_size_t align) goto tdmfree; if (bus_dmamem_alloc(dmat, size, align, 0, &tdm->tdm_seg, 1, &nsegs, - BUS_DMA_WAITOK) != 0) + BUS_DMA_WAITOK | BUS_DMA_ZERO) != 0) goto destroy; if (bus_dmamem_map(dmat, &tdm->tdm_seg, nsegs, size, &tdm->tdm_kva, @@ -1837,8 +1837,6 @@ tht_dmamem_alloc(struct tht_softc *sc, bus_size_t size, bus_size_t align) NULL, BUS_DMA_WAITOK) != 0) goto unmap; - bzero(tdm->tdm_kva, size); - return (tdm); unmap: diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c index 69b0bc04c76..7b37446df9c 100644 --- a/sys/dev/pci/if_tl.c +++ b/sys/dev/pci/if_tl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tl.c,v 1.49 2009/08/13 14:24:47 jasper Exp $ */ +/* $OpenBSD: if_tl.c,v 1.50 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 1997, 1998 @@ -2047,7 +2047,7 @@ tl_attach(parent, self, aux) sc->sc_dmat = pa->pa_dmat; if (bus_dmamem_alloc(sc->sc_dmat, sizeof(struct tl_list_data), - PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) { + PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf("%s: can't alloc list\n", sc->sc_dev.dv_xname); bus_space_unmap(sc->tl_btag, sc->tl_bhandle, iosize); return; @@ -2077,7 +2077,6 @@ tl_attach(parent, self, aux) return; } sc->tl_ldata = (struct tl_list_data *)kva; - bzero(sc->tl_ldata, sizeof(struct tl_list_data)); for (sc->tl_product = tl_prods; sc->tl_product->tp_vend; sc->tl_product++) { diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c index 8c9d172e8fa..e6e4b0db9c4 100644 --- a/sys/dev/pci/if_vic.c +++ b/sys/dev/pci/if_vic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vic.c,v 1.75 2009/11/17 03:21:36 sthen Exp $ */ +/* $OpenBSD: if_vic.c,v 1.76 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org> @@ -1389,7 +1389,7 @@ vic_alloc_dmamem(struct vic_softc *sc) goto err; if (bus_dmamem_alloc(sc->sc_dmat, sc->sc_dma_size, 16, 0, - &sc->sc_dma_seg, 1, &nsegs, BUS_DMA_NOWAIT) != 0) + &sc->sc_dma_seg, 1, &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO) != 0) goto destroy; if (bus_dmamem_map(sc->sc_dmat, &sc->sc_dma_seg, nsegs, @@ -1400,8 +1400,6 @@ vic_alloc_dmamem(struct vic_softc *sc) sc->sc_dma_size, NULL, BUS_DMA_NOWAIT) != 0) goto unmap; - bzero(sc->sc_dma_kva, sc->sc_dma_size); - return (0); unmap: diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index 5d6516fcac7..fb2b03220be 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.104 2009/11/25 13:14:47 claudio Exp $ */ +/* $OpenBSD: if_vr.c,v 1.105 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 1997, 1998 @@ -604,7 +604,8 @@ vr_attach(struct device *parent, struct device *self, void *aux) sc->sc_dmat = pa->pa_dmat; if (bus_dmamem_alloc(sc->sc_dmat, sizeof(struct vr_list_data), - PAGE_SIZE, 0, &sc->sc_listseg, 1, &rseg, BUS_DMA_NOWAIT)) { + PAGE_SIZE, 0, &sc->sc_listseg, 1, &rseg, + BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf(": can't alloc list\n"); goto fail_2; } @@ -625,7 +626,6 @@ vr_attach(struct device *parent, struct device *self, void *aux) goto fail_5; } sc->vr_ldata = (struct vr_list_data *)kva; - bzero(sc->vr_ldata, sizeof(struct vr_list_data)); sc->vr_quirks = vr_quirks(pa); ifp = &sc->arpcom.ac_if; diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index e63819144c7..38e61009294 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.45 2009/08/13 14:24:47 jasper Exp $ */ +/* $OpenBSD: if_wb.c,v 1.46 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 1997, 1998 @@ -797,7 +797,7 @@ wb_attach(parent, self, aux) printf(", address %s\n", ether_sprintf(sc->arpcom.ac_enaddr)); if (bus_dmamem_alloc(pa->pa_dmat, sizeof(struct wb_list_data), - PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) { + PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_ZERO)) { printf(": can't alloc list data\n"); goto fail_2; } @@ -818,7 +818,6 @@ wb_attach(parent, self, aux) goto fail_5; } sc->wb_ldata = (struct wb_list_data *)kva; - bzero(sc->wb_ldata, sizeof(struct wb_list_data)); ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; diff --git a/sys/dev/pci/musycc.c b/sys/dev/pci/musycc.c index d641ac96164..6a57d691c9f 100644 --- a/sys/dev/pci/musycc.c +++ b/sys/dev/pci/musycc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: musycc.c,v 1.20 2010/04/08 00:23:53 tedu Exp $ */ +/* $OpenBSD: musycc.c,v 1.21 2010/05/19 15:27:35 oga Exp $ */ /* * Copyright (c) 2004,2005 Internet Business Solutions AG, Zurich, Switzerland @@ -262,7 +262,7 @@ musycc_alloc_group(struct musycc_group *mg) /* Allocate per group dma memory */ if (bus_dmamem_alloc(mg->mg_dmat, MUSYCC_DMA_MAPSIZE, PAGE_SIZE, 0, mg->mg_listseg, 1, &mg->mg_listnseg, - BUS_DMA_NOWAIT)) + BUS_DMA_NOWAIT | BUS_DMA_ZERO)) return (-1); if (bus_dmamem_map(mg->mg_dmat, mg->mg_listseg, mg->mg_listnseg, MUSYCC_DMA_MAPSIZE, &mg->mg_listkva, BUS_DMA_NOWAIT)) { @@ -302,8 +302,6 @@ musycc_alloc_group(struct musycc_group *mg) } mg->mg_dma_pool = (struct dma_desc *)mg->mg_listkva; - bzero(mg->mg_dma_pool, - MUSYCC_DMA_CNT * sizeof(struct dma_desc)); /* add all descriptors to the freelist */ for (j = 0; j < MUSYCC_DMA_CNT; j++) { |