summaryrefslogtreecommitdiffstats
path: root/sys/dev/hea
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2002-06-07 05:23:01 +0000
committermdodd <mdodd@FreeBSD.org>2002-06-07 05:23:01 +0000
commitda76203a8f846291b00970a4ce175706a7eb28f9 (patch)
tree04c18ef5f120b5eca63526b418113db6182b3959 /sys/dev/hea
parent3c64b3be285bc90bc505a514372c4c9a3b394069 (diff)
downloadFreeBSD-src-da76203a8f846291b00970a4ce175706a7eb28f9.zip
FreeBSD-src-da76203a8f846291b00970a4ce175706a7eb28f9.tar.gz
Recognize Adaptec ANA-5910/30/40[A] boards.
Read the MAC address from Adaptec boards correctly. Bits borrowed from sys/pci/if_en_pci.c.
Diffstat (limited to 'sys/dev/hea')
-rw-r--r--sys/dev/hea/eni.h4
-rw-r--r--sys/dev/hea/hea_freebsd.c50
-rw-r--r--sys/dev/hea/hea_pci.c30
3 files changed, 65 insertions, 19 deletions
diff --git a/sys/dev/hea/eni.h b/sys/dev/hea/eni.h
index 54bb04f..3d4b485 100644
--- a/sys/dev/hea/eni.h
+++ b/sys/dev/hea/eni.h
@@ -478,6 +478,10 @@ struct eni_unit {
Eni_stats eu_stats; /* Statistics */
+ int eu_type;
+#define TYPE_UNKNOWN 0
+#define TYPE_ENI 1
+#define TYPE_ADP 2
};
typedef struct eni_unit Eni_unit;
diff --git a/sys/dev/hea/hea_freebsd.c b/sys/dev/hea/hea_freebsd.c
index b723c8c..7499401 100644
--- a/sys/dev/hea/hea_freebsd.c
+++ b/sys/dev/hea/hea_freebsd.c
@@ -203,24 +203,42 @@ hea_attach (device_t dev)
goto fail;
}
- /*
- * Read the contents of the SEEPROM
- */
- eni_read_seeprom(eup);
+ if (eup->eu_type == TYPE_ADP) {
+ int i;
+#define MID_ADPMACOFF 0xffc0 /* mac address offset (adaptec only) */
+
+ for (i = 0; i < sizeof(struct mac_addr); i++) {
+ eup->eu_pif.pif_macaddr.ma_data[i] =
+ bus_space_read_1(rman_get_bustag(sc->mem),
+ rman_get_bushandle(sc->mem),
+ MID_ADPMACOFF + i);
+ }
+
+ } else
+ if (eup->eu_type == TYPE_ENI) {
+ /*
+ * Read the contents of the SEEPROM
+ */
+ eni_read_seeprom(eup);
- /*
- * Copy MAC address to PIF and config structures
- */
- bcopy((caddr_t)&eup->eu_seeprom[SEPROM_MAC_OFF],
- (caddr_t)&eup->eu_pif.pif_macaddr,
- sizeof(struct mac_addr));
- eup->eu_config.ac_macaddr = eup->eu_pif.pif_macaddr;
+ /*
+ * Copy MAC address to PIF and config structures
+ */
+ bcopy((caddr_t)&eup->eu_seeprom[SEPROM_MAC_OFF],
+ (caddr_t)&eup->eu_pif.pif_macaddr,
+ sizeof(struct mac_addr));
+ /*
+ * Copy serial number into config space
+ */
+ eup->eu_config.ac_serial =
+ ntohl(*(u_long *)&eup->eu_seeprom[SEPROM_SN_OFF]);
+ } else {
+ device_printf(dev, "Unknown adapter type!\n");
+ error = ENXIO;
+ goto fail;
+ }
- /*
- * Copy serial number into config space
- */
- eup->eu_config.ac_serial =
- ntohl(*(u_long *)&eup->eu_seeprom[SEPROM_SN_OFF]);
+ eup->eu_config.ac_macaddr = eup->eu_pif.pif_macaddr;
/*
* Setup some of the adapter configuration
diff --git a/sys/dev/hea/hea_pci.c b/sys/dev/hea/hea_pci.c
index d6b5e34..d54a898 100644
--- a/sys/dev/hea/hea_pci.c
+++ b/sys/dev/hea/hea_pci.c
@@ -97,15 +97,27 @@
static int hea_pci_probe(device_t);
static int hea_pci_attach(device_t);
-#define ENI_VENDORID 0x111A
-#define ENI_DEVICEID 0x0002
+#define ENI_VENDORID 0x111A
+#define ENI_DEVICEID_ENI155PF 0x0000
+#define ENI_DEVICEID_ENI155PA 0x0002
+
+#define ADP_VENDORID 0x9004
+#define ADP_DEVICEID_AIC5900 0x5900
+#define ADP_DEVICEID_AIC5905 0x5905
struct hea_pci_type {
u_int16_t vid;
u_int16_t did;
char * name;
} hea_pci_devs[] = {
- { ENI_VENDORID, ENI_DEVICEID, "Efficent Networks ENI ATM Adapter" },
+ { ENI_VENDORID, ENI_DEVICEID_ENI155PF,
+ "Efficient Networks 155P-MF1 (FPGA) ATM Adapter" },
+ { ENI_VENDORID, ENI_DEVICEID_ENI155PA,
+ "Efficient Networks 155P-MF1 (ASIC) ATM Adapter" },
+ { ADP_VENDORID, ADP_DEVICEID_AIC5900,
+ "ANA-5910/5930/5940 ATM155 & 25 LAN Adapter" },
+ { ADP_VENDORID, ADP_DEVICEID_AIC5905,
+ "ANA-5910A/5930A/5940A ATM Adapter" },
{ 0, 0, NULL },
};
@@ -191,6 +203,18 @@ hea_pci_attach (dev)
eup->eu_config.ac_bustype = BUS_PCI;
eup->eu_config.ac_busslot = (pci_get_bus(dev) << 8)| pci_get_slot(dev);
+ switch (pci_get_vendor(dev)) {
+ case ENI_VENDORID:
+ eup->eu_type = TYPE_ENI;
+ break;
+ case ADP_VENDORID:
+ eup->eu_type = TYPE_ADP;
+ break;
+ default:
+ eup->eu_type = TYPE_UNKNOWN;
+ break;
+ }
+
error = hea_attach(dev);
if (error) {
device_printf(dev, "hea_attach() failed.\n");
OpenPOWER on IntegriCloud