From 783e9b1a7ad6e416d5b8d1def38180e5847e8b4f Mon Sep 17 00:00:00 2001 From: Ian Dowse Date: Fri, 2 Mar 2001 00:40:06 +0000 Subject: [PATCH] There were a few changes missed when this file was converted to newbus in revision 1.19. As a result, lnc was, I believe, broken for all PCI cards. The softc fields `lnc_btag' and `lnc_bhandle' were not initialised, `rap', `rdp' and `bdp' were initialised to the wrong values, and the size of the DMA ring memory was calculated incorrectly. Paul Richards has further cleanups in the pipeline, but this at least is enough to make the driver usable with VMware. Approved by: paul --- sys/dev/lnc/if_lnc_pci.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/dev/lnc/if_lnc_pci.c b/sys/dev/lnc/if_lnc_pci.c index e5a84e7b1504..6c8b05a49277 100644 --- a/sys/dev/lnc/if_lnc_pci.c +++ b/sys/dev/lnc/if_lnc_pci.c @@ -50,6 +50,7 @@ #include #include +#include #include #define AMD_VENDOR_ID 0x1022 @@ -122,6 +123,8 @@ lnc_pci_attach(device_t dev) device_printf(dev, "Cannot setup irq handler\n"); sc->iobase = rman_get_start(sc->portres); + sc->lnc_btag = rman_get_bustag(sc->portres); + sc->lnc_bhandle = rman_get_bushandle(sc->portres); /* XXX temp setting for nic */ sc->nic.ic = PCnet_PCI; @@ -129,15 +132,18 @@ lnc_pci_attach(device_t dev) sc->nic.mem_mode = DMA_FIXED; sc->nrdre = NRDRE; sc->ntdre = NTDRE; - sc->rap = sc->iobase + PCNET_RAP; - sc->rdp = sc->iobase + PCNET_RDP; - sc->bdp = sc->iobase + PCNET_BDP; + sc->rap = PCNET_RAP; + sc->rdp = PCNET_RDP; + sc->bdp = PCNET_BDP; /* Create a DMA tag describing the ring memory we need */ lnc_mem_size = ((NDESC(sc->nrdre) + NDESC(sc->ntdre)) * sizeof(struct host_ring_entry)); + lnc_mem_size += sizeof(struct init_block) + (sizeof(struct mds) * + (NDESC(sc->nrdre) + NDESC(sc->ntdre))) + MEM_SLEW; + lnc_mem_size += (NDESC(sc->nrdre) * RECVBUFSIZE) + (NDESC(sc->ntdre) * TRANSBUFSIZE);