Fix the memory allocation of le(4) on PCI by using the bus_dma{map/mem} interface. As a side effect, this fixes OpenBSD running under VMWare. Apply by doing: cd /usr/src patch -p0 < 019_lepci.patch And then rebuild your kernel. Index: sys/dev/pci/if_le_pci.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_le_pci.c,v retrieving revision 1.12 diff -u -r1.12 if_le_pci.c --- sys/dev/pci/if_le_pci.c 1999/08/10 08:10:35 1.12 +++ sys/dev/pci/if_le_pci.c 2001/02/01 02:12:02 @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le_pci.c,v 1.12 1999/08/10 08:10:35 deraadt Exp $ */ +/* $OpenBSD: if_le_pci.c,v 1.12.8.1 2001/02/01 02:01:09 jason Exp $ */ /* $NetBSD: if_le_pci.c,v 1.13 1996/10/25 21:33:32 cgd Exp $ */ /*- @@ -160,8 +160,11 @@ bus_space_tag_t iot = pa->pa_iot; pci_chipset_tag_t pc = pa->pa_pc; pcireg_t csr; - int i; + int i, rseg; const char *intrstr; + bus_dma_segment_t seg; + bus_dmamap_t dmamap; + caddr_t kva; switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_AMD_PCNET_PCI: @@ -185,11 +188,34 @@ for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) sc->sc_arpcom.ac_enaddr[i] = bus_space_read_1(iot, ioh, i); - sc->sc_mem = malloc(16384, M_DEVBUF, M_NOWAIT); - if (sc->sc_mem == 0) { + if (bus_dmamem_alloc(pa->pa_dmat, PCNET_MEMSIZE, PAGE_SIZE, + 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) { printf(": couldn't allocate memory for card\n"); return; } + if (bus_dmamem_map(pa->pa_dmat, &seg, rseg, PCNET_MEMSIZE, + &kva, BUS_DMA_NOWAIT)) { + printf(": couldn't map memory for card\n"); + bus_dmamem_free(pa->pa_dmat, &seg, rseg); + return; + } + if (bus_dmamap_create(pa->pa_dmat, PCNET_MEMSIZE, 1, 36384, + 0, BUS_DMA_NOWAIT, &dmamap)) { + printf(": couldn't create dma map\n"); + bus_dmamem_unmap(pa->pa_dmat, kva, PCNET_MEMSIZE); + bus_dmamem_free(pa->pa_dmat, &seg, rseg); + return; + } + if (bus_dmamap_load(pa->pa_dmat, dmamap, kva, PCNET_MEMSIZE, + NULL, BUS_DMA_NOWAIT)) { + printf(": couldn't load dma map\n"); + bus_dmamap_destroy(pa->pa_dmat, dmamap); + bus_dmamem_unmap(pa->pa_dmat, kva, PCNET_MEMSIZE); + bus_dmamem_free(pa->pa_dmat, &seg, rseg); + return; + } + sc->sc_mem = kva; + bzero(sc->sc_mem, PCNET_MEMSIZE); printf("\n"); @@ -198,7 +224,7 @@ sc->sc_conf3 = 0; sc->sc_addr = vtophys(sc->sc_mem); /* XXX XXX XXX */ - sc->sc_memsize = 16384; + sc->sc_memsize = PCNET_MEMSIZE; sc->sc_copytodesc = am7990_copytobuf_contig; sc->sc_copyfromdesc = am7990_copyfrombuf_contig; Index: sys/dev/pci/if_levar.h =================================================================== RCS file: /cvs/src/sys/dev/pci/if_levar.h,v retrieving revision 1.4 diff -u -r1.4 if_levar.h --- sys/dev/pci/if_levar.h 1997/11/07 08:07:29 1.4 +++ sys/dev/pci/if_levar.h 2001/02/01 02:12:02 @@ -1,4 +1,4 @@ -/* $OpenBSD: if_levar.h,v 1.4 1997/11/07 08:07:29 niklas Exp $ */ +/* $OpenBSD: if_levar.h,v 1.4.14.1 2001/02/01 02:01:10 jason Exp $ */ /* $NetBSD: if_levar.h,v 1.3 1996/10/21 22:56:46 thorpej Exp $ */ /* @@ -16,6 +16,18 @@ #define PCNET_PCI_RDP 0x10 #define PCNET_PCI_RAP 0x12 + +/* + * Size of packet buffer + * + * The MI code will split this between initialization block, descriptors, + * transmit and receive buffers. + * + * Must be 8192 <= PCNET_MEMSIZE <= 262144 and a power of 2 + */ + +#define PCNET_MEMSIZE 16384 + /* * Ethernet software status per interface.