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.
This commit is contained in:
Matthew N. Dodd 2002-06-07 05:23:01 +00:00
parent 609d46568c
commit 14eaf06493
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97988
3 changed files with 65 additions and 19 deletions

View File

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

View File

@ -203,25 +203,43 @@ 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));
/*
* 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 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 serial number into config space
*/
eup->eu_config.ac_serial =
ntohl(*(u_long *)&eup->eu_seeprom[SEPROM_SN_OFF]);
/*
* Setup some of the adapter configuration
*/

View File

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