diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-26 16:58:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-26 16:58:47 +0000 |
commit | 507a199df037c6f0928c55f8761c51c7935dba71 (patch) | |
tree | 2184fe709f23ee7fcf49306b244567a702bf905d /sys | |
parent | fc4c122129c4d2da0ff29b5f5ca69c6a324c13c6 (diff) |
Using information gleamed from the FreeBSD driver, change the MAC address
reading to use the eeprom instead of CIS, and then the Xircom Cardbus cards
can work in the expresscard adaptor, as pci devices.
ok jsg
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/cardbus/if_dc_cardbus.c | 12 | ||||
-rw-r--r-- | sys/dev/ic/dc.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/if_dc_pci.c | 24 |
3 files changed, 27 insertions, 12 deletions
diff --git a/sys/dev/cardbus/if_dc_cardbus.c b/sys/dev/cardbus/if_dc_cardbus.c index 266db43a555..987c2efcc9b 100644 --- a/sys/dev/cardbus/if_dc_cardbus.c +++ b/sys/dev/cardbus/if_dc_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dc_cardbus.c,v 1.28 2009/06/02 15:39:35 jsg Exp $ */ +/* $OpenBSD: if_dc_cardbus.c,v 1.29 2009/06/26 16:58:46 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -157,9 +157,11 @@ dc_cardbus_attach(struct device *parent, struct device *self, void *aux) dc_cardbus_setup(csc); - /* Get the eeprom width, but XIRCOM has no eeprom */ - if (!(PCI_VENDOR(ca->ca_id) == PCI_VENDOR_XIRCOM && + /* Get the eeprom width */ + if ((PCI_VENDOR(ca->ca_id) == PCI_VENDOR_XIRCOM && PCI_PRODUCT(ca->ca_id) == PCI_PRODUCT_XIRCOM_X3201_3_21143)) + ; /* XIRCOM has non-standard eeprom */ + else dc_eeprom_width(sc); switch (PCI_VENDOR(ca->ca_id)) { @@ -179,10 +181,6 @@ dc_cardbus_attach(struct device *parent, struct device *self, void *aux) sc->dc_flags |= DC_TX_INTR_ALWAYS|DC_TX_COALESCE | DC_TX_ALIGN; sc->dc_pmode = DC_PMODE_MII; - - bcopy(ca->ca_cis.funce.network.netid, - &sc->sc_arpcom.ac_enaddr, - sizeof sc->sc_arpcom.ac_enaddr); } break; case PCI_VENDOR_ADMTEK: diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 03ed39e7ca0..0e0ab657965 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.109 2009/06/02 15:39:35 jsg Exp $ */ +/* $OpenBSD: dc.c,v 1.110 2009/06/26 16:58:46 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1651,6 +1651,7 @@ dc_attach(struct dc_softc *sc) &sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); break; case DC_TYPE_XIRCOM: + dc_read_eeprom(sc, (caddr_t)&sc->sc_arpcom.ac_enaddr, 3, 3, 0); break; default: dc_read_eeprom(sc, (caddr_t)&sc->sc_arpcom.ac_enaddr, diff --git a/sys/dev/pci/if_dc_pci.c b/sys/dev/pci/if_dc_pci.c index d9558e090a8..d6e19ca72af 100644 --- a/sys/dev/pci/if_dc_pci.c +++ b/sys/dev/pci/if_dc_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dc_pci.c,v 1.63 2009/06/02 15:39:35 jsg Exp $ */ +/* $OpenBSD: if_dc_pci.c,v 1.64 2009/06/26 16:58:45 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -111,6 +111,7 @@ struct dc_type dc_devs[] = { { PCI_VENDOR_MICROSOFT, PCI_PRODUCT_MICROSOFT_MN130 }, { PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_X3201_3_21143 }, { PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_AN985 }, + { PCI_VENDOR_ABOCOM, PCI_PRODUCT_ABOCOM_FE2500 }, { PCI_VENDOR_ABOCOM, PCI_PRODUCT_ABOCOM_FE2500MX }, { PCI_VENDOR_ABOCOM, PCI_PRODUCT_ABOCOM_PCM200 }, { PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DRP32TXD }, @@ -274,9 +275,14 @@ dc_pci_attach(struct device *parent, struct device *self, void *aux) /* Need this info to decide on a chip type. */ sc->dc_revision = PCI_REVISION(pa->pa_class); - /* Get the eeprom width, but PNIC has no eeprom */ - if (!(PCI_VENDOR(pa->pa_id) == PCI_VENDOR_LITEON && + /* Get the eeprom width, if possible */ + if ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_LITEON && PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_LITEON_PNIC)) + ; /* PNIC has non-standard eeprom */ + else if ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_XIRCOM && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_XIRCOM_X3201_3_21143)) + ; /* XIRCOM has non-standard eeprom */ + else dc_eeprom_width(sc); switch (PCI_VENDOR(pa->pa_id)) { @@ -433,6 +439,16 @@ dc_pci_attach(struct device *parent, struct device *self, void *aux) dc_read_srom(sc, sc->dc_romwidth); } break; + case PCI_VENDOR_XIRCOM: + if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_XIRCOM_X3201_3_21143) { + found = 1; + sc->dc_type = DC_TYPE_XIRCOM; + sc->dc_flags |= DC_TX_INTR_ALWAYS; + sc->dc_flags |= DC_TX_COALESCE; + sc->dc_flags |= DC_TX_ALIGN; + sc->dc_pmode = DC_PMODE_MII; + } + break; } if (found == 0) { /* This shouldn't happen if probe has done its job... */ @@ -452,7 +468,7 @@ dc_pci_attach(struct device *parent, struct device *self, void *aux) dc_reset(sc); /* Take 21143 out of snooze mode */ - if (DC_IS_INTEL(sc)) { + if (DC_IS_INTEL(sc) || DC_IS_XIRCOM(sc)) { command = pci_conf_read(pc, pa->pa_tag, DC_PCI_CFDD); command &= ~(DC_CFDD_SNOOZE_MODE|DC_CFDD_SLEEP_MODE); pci_conf_write(pc, pa->pa_tag, DC_PCI_CFDD, command); |