Make sure changing ownership of RX descriptor to be done as last

operation.  Previously ownership was transferred to hardware before
setting address of new RX buffer such that it was possible for
hardware to use wrong RX buffer address.
While here keep compiler from re-ordering instructions by declaring
descriptor members volatile. Memory barriers would do the same job
but volatile is supposed to be cheaper than using memory barriers,
especially on MP systems.

Submitted by:	marius
MFC after:	1 week
This commit is contained in:
Pyun YongHyeon 2011-02-28 20:37:48 +00:00
parent 892f48069d
commit 5ed8e782f9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219102
2 changed files with 3 additions and 3 deletions

View File

@ -1566,8 +1566,8 @@ sis_newbuf(struct sis_softc *sc, struct sis_rxdesc *rxd)
sc->sis_rx_sparemap = map;
bus_dmamap_sync(sc->sis_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_PREREAD);
rxd->rx_m = m;
rxd->rx_desc->sis_cmdsts = htole32(SIS_RXLEN);
rxd->rx_desc->sis_ptr = htole32(SIS_ADDR_LO(segs[0].ds_addr));
rxd->rx_desc->sis_cmdsts = htole32(SIS_RXLEN);
return (0);
}

View File

@ -337,8 +337,8 @@
struct sis_desc {
/* SiS hardware descriptor section */
uint32_t sis_next;
uint32_t sis_cmdsts;
uint32_t sis_ptr;
volatile uint32_t sis_cmdsts;
volatile uint32_t sis_ptr;
};
#define SIS_CMDSTS_BUFLEN 0x00000FFF