1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

- 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
This commit is contained in:
Marius Strobl 2005-03-02 00:49:37 +00:00
parent 04198d1800
commit e12405280b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142964

View File

@ -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);