diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2011-06-22 03:54:32 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2011-06-22 03:54:32 +0000 |
commit | 6ea77c720c86d80556e217bd293f549f6376e151 (patch) | |
tree | 2f01f26f5d0309513795022037cd0ccccb135009 /sys | |
parent | 4f0546e1bdcfaf41875f487df2603a194f410fe6 (diff) |
deraadt plugged his myx into a sparc64 and discovered 3 problems:
1. we want to write raw values to registers all the time, so promote the
myx_raw{read,write} to myx_{read,write} and use them everywhere. get rid
of the raw funcs.
2. i was setting the watermarks on the rx ring before knowhing how big
they were.
3. rxfill in the interrupt handler could lose data if you loop on
sts_isvalid.
almost working now...
"please commit your diff" deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_myx.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/sys/dev/pci/if_myx.c b/sys/dev/pci/if_myx.c index 03254501608..c7b38e9fb23 100644 --- a/sys/dev/pci/if_myx.c +++ b/sys/dev/pci/if_myx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_myx.c,v 1.20 2011/06/21 21:56:28 dlg Exp $ */ +/* $OpenBSD: if_myx.c,v 1.21 2011/06/22 03:54:31 dlg Exp $ */ /* * Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org> @@ -158,9 +158,7 @@ int myx_loadfirmware(struct myx_softc *, const char *); int myx_probe_firmware(struct myx_softc *); void myx_read(struct myx_softc *, bus_size_t, void *, bus_size_t); -void myx_rawread(struct myx_softc *, bus_size_t, void *, bus_size_t); void myx_write(struct myx_softc *, bus_size_t, void *, bus_size_t); -void myx_rawwrite(struct myx_softc *, bus_size_t, void *, bus_size_t); int myx_cmd(struct myx_softc *, u_int32_t, struct myx_cmd *, u_int32_t *); int myx_boot(struct myx_softc *, u_int32_t); @@ -322,7 +320,7 @@ myx_query(struct myx_softc *sc, char *part, size_t partlen) return (1); } - myx_rawread(sc, offset, &hdr, sizeof(hdr)); + myx_read(sc, offset, &hdr, sizeof(hdr)); offset = betoh32(hdr.fw_specs); len = min(betoh32(hdr.fw_specs_len), sizeof(strings)); @@ -390,7 +388,7 @@ myx_loadfirmware(struct myx_softc *sc, const char *filename) /* Write the firmware to the card's SRAM */ for (i = 0; i < fwlen; i += 256) - myx_rawwrite(sc, i + MYX_FW, fw + i, min(256, fwlen - i)); + myx_write(sc, i + MYX_FW, fw + i, min(256, fwlen - i)); if (myx_boot(sc, fwlen) != 0) { printf("%s: failed to boot %s\n", DEVNAME(sc), filename); @@ -456,9 +454,6 @@ myx_attachhook(void *arg) IFQ_SET_MAXLEN(&ifp->if_snd, 1); IFQ_SET_READY(&ifp->if_snd); - m_clsetwms(ifp, MCLBYTES, 2, sc->sc_rx_ring_count - 2); - m_clsetwms(ifp, 12 * 1024, 2, sc->sc_rx_ring_count - 2); - ifp->if_capabilities = IFCAP_VLAN_MTU; #if 0 ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; @@ -568,30 +563,12 @@ myx_read(struct myx_softc *sc, bus_size_t off, void *ptr, bus_size_t len) { bus_space_barrier(sc->sc_memt, sc->sc_memh, off, len, BUS_SPACE_BARRIER_READ); - bus_space_read_region_4(sc->sc_memt, sc->sc_memh, off, ptr, len / 4); -} - -void -myx_rawread(struct myx_softc *sc, bus_size_t off, void *ptr, - bus_size_t len) -{ - bus_space_barrier(sc->sc_memt, sc->sc_memh, off, len, - BUS_SPACE_BARRIER_READ); bus_space_read_raw_region_4(sc->sc_memt, sc->sc_memh, off, ptr, len); } void myx_write(struct myx_softc *sc, bus_size_t off, void *ptr, bus_size_t len) { - bus_space_write_region_4(sc->sc_memt, sc->sc_memh, off, ptr, len / 4); - bus_space_barrier(sc->sc_memt, sc->sc_memh, off, len, - BUS_SPACE_BARRIER_WRITE); -} - -void -myx_rawwrite(struct myx_softc *sc, bus_size_t off, void *ptr, - bus_size_t len) -{ bus_space_write_raw_region_4(sc->sc_memt, sc->sc_memh, off, ptr, len); bus_space_barrier(sc->sc_memt, sc->sc_memh, off, len, BUS_SPACE_BARRIER_WRITE); @@ -984,6 +961,9 @@ myx_up(struct myx_softc *sc) } sc->sc_rx_ring_count = r / sizeof(struct myx_rx_desc); + m_clsetwms(ifp, MCLBYTES, 2, sc->sc_rx_ring_count - 2); + m_clsetwms(ifp, 12 * 1024, 2, sc->sc_rx_ring_count - 2); + bzero(&mc, sizeof(mc)); if (myx_cmd(sc, MYXCMD_GET_TXRINGSZ, &mc, &r) != 0) { printf("%s: unable to get tx ring size\n", DEVNAME(sc)); |