summaryrefslogtreecommitdiffstats
path: root/sys/dev/hme
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2005-03-02 00:49:37 +0000
committermarius <marius@FreeBSD.org>2005-03-02 00:49:37 +0000
commitd7036279051677c0eef0f014f0115f935b01e15b (patch)
tree0a1038b37496026b5181d8d6ea27c488a16ebe2d /sys/dev/hme
parentff2589bdb2f30336188578c01b8e0b5e57ec01e1 (diff)
downloadFreeBSD-src-d7036279051677c0eef0f014f0115f935b01e15b.zip
FreeBSD-src-d7036279051677c0eef0f014f0115f935b01e15b.tar.gz
- Fix braino introduced in rev. 1.17, unlike the X1032A (HME-ISP1040-combo)
and the X1034A (quad HME; QFE) cards the X1033A (single HME) don't have a PCI-PCI-bridge so we can't rely on the PCI slot number being useable as index for the network address to read from the VPD on the latter. Use the end tag to determine whether it is a QFE VPD with 4 NAs and only use the slot number as index in this case. - Remove a useless check. Prodded by: joerg Additional testing by: joerg MFC after: 1 day
Diffstat (limited to 'sys/dev/hme')
-rw-r--r--sys/dev/hme/if_hme_pci.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/hme/if_hme_pci.c b/sys/dev/hme/if_hme_pci.c
index 63bfbb2..929c286 100644
--- a/sys/dev/hme/if_hme_pci.c
+++ b/sys/dev/hme/if_hme_pci.c
@@ -310,9 +310,14 @@ hme_pci_attach(device_t dev)
* all-zero "checksum" byte. Sun calls this a "Fresh Choice
* Ethernet" VPD...
*/
- bus_space_read_region_1(romt, romh,
- vpdoff + slot * (3 + sizeof(struct pci_vpd) + ETHER_ADDR_LEN),
- buf, sizeof(buf));
+ /* Look at the end tag to determine whether this is a VPD with 4 NAs. */
+ if (bus_space_read_1(romt, romh,
+ vpdoff + 3 + sizeof(struct pci_vpd) + ETHER_ADDR_LEN) != 0x79 &&
+ bus_space_read_1(romt, romh,
+ vpdoff + 4 * (3 + sizeof(struct pci_vpd) + ETHER_ADDR_LEN)) == 0x79)
+ /* Use the Nth NA for the Nth HME on this SUNW,qfe. */
+ vpdoff += slot * (3 + sizeof(struct pci_vpd) + ETHER_ADDR_LEN);
+ bus_space_read_region_1(romt, romh, vpdoff, buf, sizeof(buf));
vpd = (void *)(buf + 3);
if (PCI_VPDRES_ISLARGE(buf[0]) == 0 ||
PCI_VPDRES_LARGE_NAME(buf[0]) != PCI_VPDRES_TYPE_VPD ||
@@ -324,11 +329,6 @@ hme_pci_attach(device_t dev)
error = ENXIO;
goto fail_rres;
}
- if (buf + 3 + sizeof(struct pci_vpd) == NULL) {
- device_printf(dev, "could not read network address\n");
- error = ENXIO;
- goto fail_rres;
- }
bcopy(buf + 3 + sizeof(struct pci_vpd), sc->sc_arpcom.ac_enaddr,
ETHER_ADDR_LEN);
OpenPOWER on IntegriCloud