diff options
| author | msaitoh <msaitoh@NetBSD.org> | 2019-03-27 03:10:39 +0000 |
|---|---|---|
| committer | msaitoh <msaitoh@NetBSD.org> | 2019-03-27 03:10:39 +0000 |
| commit | 5810085705388eccf4331a2ceb7019aeefdb894a (patch) | |
| tree | 9f9c5631f687c4bfce636acd04ab0bc89894b1dd /sys/dev | |
| parent | 4b7915c6468973c19744d85321be097d50bca2b0 (diff) | |
Sync with other *BSDs:
From OpenBSD's rev. 1.93:
> to quote from the gospel of bus_dma.9:
>
> Synchronization operations are expressed from the perspective of the host
> RAM, e.g., a device -> memory operation is a READ and a memory -> device
> operation is a WRITE.
>
> the status block that the isr reads is written to by the device.
> the chip writes to memory, it is therefore a READ.
>
> this also adds the preread sync when the map is set up and the postread
> sync when the map is torn down for better symmetry. there are probably
> more issues like this in the code, but this is a start.
>
> discovered while discussing another diff with claudio@
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/if_bnx.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index 4e486cc27ae..29bb58a13fe 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bnx.c,v 1.68 2019/01/22 03:42:27 msaitoh Exp $ */ +/* $NetBSD: if_bnx.c,v 1.69 2019/03/27 03:10:39 msaitoh Exp $ */ /* $OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */ /*- @@ -35,7 +35,7 @@ #if 0 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.68 2019/01/22 03:42:27 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.69 2019/03/27 03:10:39 msaitoh Exp $"); /* * The following controllers are supported by this driver: @@ -2213,6 +2213,8 @@ bnx_dma_free(struct bnx_softc *sc) /* Destroy the status block. */ if (sc->status_block != NULL && sc->status_map != NULL) { + bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0, + sc->status_map->dm_mapsize, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->bnx_dmatag, sc->status_map); bus_dmamem_unmap(sc->bnx_dmatag, (void *)sc->status_block, BNX_STATUS_BLK_SZ); @@ -2355,6 +2357,9 @@ bnx_dma_alloc(struct bnx_softc *sc) goto bnx_dma_alloc_exit; } + bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0, + sc->status_map->dm_mapsize, BUS_DMASYNC_PREREAD); + sc->status_block_paddr = sc->status_map->dm_segs[0].ds_addr; memset(sc->status_block, 0, BNX_STATUS_BLK_SZ); @@ -5275,7 +5280,7 @@ bnx_intr(void *xsc) DBRUNIF(1, sc->interrupts_generated++); bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0, - sc->status_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); + sc->status_map->dm_mapsize, BUS_DMASYNC_POSTREAD); /* * If the hardware status block index @@ -5354,7 +5359,7 @@ bnx_intr(void *xsc) } bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0, - sc->status_map->dm_mapsize, BUS_DMASYNC_PREWRITE); + sc->status_map->dm_mapsize, BUS_DMASYNC_PREREAD); /* Re-enable interrupts. */ REG_WR(sc, BNX_PCICFG_INT_ACK_CMD, |
