summaryrefslogtreecommitdiffstats
path: root/sys/dev/hea/hea_freebsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/hea/hea_freebsd.c')
-rw-r--r--sys/dev/hea/hea_freebsd.c50
1 files changed, 34 insertions, 16 deletions
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
OpenPOWER on IntegriCloud