mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-23 16:01:42 +00:00
Since r117657, bge(4) does not enable buffer manager for BCM5705 or
newer controllers. However, all data sheet I have access has no indication that buffer manager should not be touched on these controllers. It seems the buffer manager always runs on BCM5705 or newer controllers. Some controller(e.g. BCM5719) needs other buffer manager configuration so driver should enable buffer manager for all controllers. Both Linux and OpenBSD/NetBSD use the same approach. This change polls enable bit of block to know whether specified block was really stopped as well as enabling buffer manager for all controllers in driver initialization. Obtained from: NetBSD
This commit is contained in:
parent
876379ca45
commit
5a147ba6c9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=221712
@ -403,6 +403,7 @@ static void bge_start(struct ifnet *);
|
||||
static int bge_ioctl(struct ifnet *, u_long, caddr_t);
|
||||
static void bge_init_locked(struct bge_softc *);
|
||||
static void bge_init(void *);
|
||||
static void bge_stop_block(struct bge_softc *, bus_size_t, uint32_t);
|
||||
static void bge_stop(struct bge_softc *);
|
||||
static void bge_watchdog(struct bge_softc *);
|
||||
static int bge_shutdown(device_t);
|
||||
@ -1593,22 +1594,19 @@ bge_blockinit(struct bge_softc *sc)
|
||||
CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10);
|
||||
|
||||
/* Enable buffer manager */
|
||||
if (!(BGE_IS_5705_PLUS(sc))) {
|
||||
CSR_WRITE_4(sc, BGE_BMAN_MODE,
|
||||
BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
|
||||
CSR_WRITE_4(sc, BGE_BMAN_MODE,
|
||||
BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
|
||||
|
||||
/* Poll for buffer manager start indication */
|
||||
for (i = 0; i < BGE_TIMEOUT; i++) {
|
||||
DELAY(10);
|
||||
if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE)
|
||||
break;
|
||||
}
|
||||
/* Poll for buffer manager start indication */
|
||||
for (i = 0; i < BGE_TIMEOUT; i++) {
|
||||
DELAY(10);
|
||||
if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == BGE_TIMEOUT) {
|
||||
device_printf(sc->bge_dev,
|
||||
"buffer manager failed to start\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
if (i == BGE_TIMEOUT) {
|
||||
device_printf(sc->bge_dev, "buffer manager failed to start\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
/* Enable flow-through queues */
|
||||
@ -5136,6 +5134,20 @@ bge_watchdog(struct bge_softc *sc)
|
||||
ifp->if_oerrors++;
|
||||
}
|
||||
|
||||
static void
|
||||
bge_stop_block(struct bge_softc *sc, bus_size_t reg, uint32_t bit)
|
||||
{
|
||||
int i;
|
||||
|
||||
BGE_CLRBIT(sc, reg, bit);
|
||||
|
||||
for (i = 0; i < BGE_TIMEOUT; i++) {
|
||||
if ((CSR_READ_4(sc, reg) & bit) == 0)
|
||||
return;
|
||||
DELAY(100);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop the adapter and free any mbufs allocated to the
|
||||
* RX and TX lists.
|
||||
@ -5164,35 +5176,36 @@ bge_stop(struct bge_softc *sc)
|
||||
/*
|
||||
* Disable all of the receiver blocks.
|
||||
*/
|
||||
BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_RBDI_MODE, BGE_RBDIMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE);
|
||||
if (!(BGE_IS_5705_PLUS(sc)))
|
||||
BGE_CLRBIT(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_RDBDI_MODE, BGE_RBDIMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_RBDC_MODE, BGE_RBDCMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_RBDI_MODE, BGE_RBDIMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE);
|
||||
if (BGE_IS_5700_FAMILY(sc))
|
||||
bge_stop_block(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_RDBDI_MODE, BGE_RBDIMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_RBDC_MODE, BGE_RBDCMODE_ENABLE);
|
||||
|
||||
/*
|
||||
* Disable all of the transmit blocks.
|
||||
*/
|
||||
BGE_CLRBIT(sc, BGE_SRS_MODE, BGE_SRSMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_SBDI_MODE, BGE_SBDIMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_RDMA_MODE, BGE_RDMAMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_SDC_MODE, BGE_SDCMODE_ENABLE);
|
||||
if (!(BGE_IS_5705_PLUS(sc)))
|
||||
BGE_CLRBIT(sc, BGE_DMAC_MODE, BGE_DMACMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_SBDC_MODE, BGE_SBDCMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_SRS_MODE, BGE_SRSMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_SBDI_MODE, BGE_SBDIMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_RDMA_MODE, BGE_RDMAMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_SDC_MODE, BGE_SDCMODE_ENABLE);
|
||||
if (BGE_IS_5700_FAMILY(sc))
|
||||
bge_stop_block(sc, BGE_DMAC_MODE, BGE_DMACMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_SBDC_MODE, BGE_SBDCMODE_ENABLE);
|
||||
|
||||
/*
|
||||
* Shut down all of the memory managers and related
|
||||
* state machines.
|
||||
*/
|
||||
BGE_CLRBIT(sc, BGE_HCC_MODE, BGE_HCCMODE_ENABLE);
|
||||
BGE_CLRBIT(sc, BGE_WDMA_MODE, BGE_WDMAMODE_ENABLE);
|
||||
if (!(BGE_IS_5705_PLUS(sc)))
|
||||
BGE_CLRBIT(sc, BGE_MBCF_MODE, BGE_MBCFMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_HCC_MODE, BGE_HCCMODE_ENABLE);
|
||||
bge_stop_block(sc, BGE_WDMA_MODE, BGE_WDMAMODE_ENABLE);
|
||||
if (BGE_IS_5700_FAMILY(sc))
|
||||
bge_stop_block(sc, BGE_MBCF_MODE, BGE_MBCFMODE_ENABLE);
|
||||
|
||||
CSR_WRITE_4(sc, BGE_FTQ_RESET, 0xFFFFFFFF);
|
||||
CSR_WRITE_4(sc, BGE_FTQ_RESET, 0);
|
||||
if (!(BGE_IS_5705_PLUS(sc))) {
|
||||
|
Loading…
Reference in New Issue
Block a user