Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ste/if_ste.c
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
MODULE_DEPEND(ste, miibus, 1, 1, 1); | MODULE_DEPEND(ste, miibus, 1, 1, 1); | ||||
/* Define to show Tx error status. */ | /* Define to show Tx error status. */ | ||||
#define STE_SHOW_TXERRORS | #define STE_SHOW_TXERRORS | ||||
/* | /* | ||||
* Various supported device vendors/types and their names. | * Various supported device vendors/types and their names. | ||||
*/ | */ | ||||
static const struct ste_type ste_devs[] = { | struct pci_device_table ste_devs[] = { | ||||
{ ST_VENDORID, ST_DEVICEID_ST201_1, "Sundance ST201 10/100BaseTX" }, | {PCI_DEV(ST_VENDORID, ST_DEVICEID_ST201_1), | ||||
{ ST_VENDORID, ST_DEVICEID_ST201_2, "Sundance ST201 10/100BaseTX" }, | PCI_DESCR("Sundance ST201 10/100BaseTX")}, | ||||
{ DL_VENDORID, DL_DEVICEID_DL10050, "D-Link DL10050 10/100BaseTX" }, | {PCI_DEV(ST_VENDORID, ST_DEVICEID_ST201_2), | ||||
{ 0, 0, NULL } | PCI_DESCR("Sundance ST201 10/100BaseTX")}, | ||||
{PCI_DEV(DL_VENDORID, DL_DEVICEID_DL10050), | |||||
PCI_DESCR("D-Link DL10050 10/100BaseTX")} | |||||
}; | }; | ||||
static int ste_attach(device_t); | static int ste_attach(device_t); | ||||
static int ste_detach(device_t); | static int ste_detach(device_t); | ||||
static int ste_probe(device_t); | static int ste_probe(device_t); | ||||
static int ste_resume(device_t); | static int ste_resume(device_t); | ||||
static int ste_shutdown(device_t); | static int ste_shutdown(device_t); | ||||
static int ste_suspend(device_t); | static int ste_suspend(device_t); | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | static driver_t ste_driver = { | ||||
"ste", | "ste", | ||||
ste_methods, | ste_methods, | ||||
sizeof(struct ste_softc) | sizeof(struct ste_softc) | ||||
}; | }; | ||||
static devclass_t ste_devclass; | static devclass_t ste_devclass; | ||||
DRIVER_MODULE(ste, pci, ste_driver, ste_devclass, 0, 0); | DRIVER_MODULE(ste, pci, ste_driver, ste_devclass, 0, 0); | ||||
PCI_PNP_INFO(ste_devs); | |||||
DRIVER_MODULE(miibus, ste, miibus_driver, miibus_devclass, 0, 0); | DRIVER_MODULE(miibus, ste, miibus_driver, miibus_devclass, 0, 0); | ||||
#define STE_SETBIT4(sc, reg, x) \ | #define STE_SETBIT4(sc, reg, x) \ | ||||
CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) | (x)) | CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) | (x)) | ||||
#define STE_CLRBIT4(sc, reg, x) \ | #define STE_CLRBIT4(sc, reg, x) \ | ||||
CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) & ~(x)) | CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) & ~(x)) | ||||
▲ Show 20 Lines • Show All 684 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Probe for a Sundance ST201 chip. Check the PCI vendor and device | * Probe for a Sundance ST201 chip. Check the PCI vendor and device | ||||
* IDs against our list and return a device name if we find a match. | * IDs against our list and return a device name if we find a match. | ||||
*/ | */ | ||||
static int | static int | ||||
ste_probe(device_t dev) | ste_probe(device_t dev) | ||||
{ | { | ||||
const struct ste_type *t; | const struct pci_device_table *sted; | ||||
t = ste_devs; | sted = PCI_MATCH(dev, ste_devs); | ||||
if (sted == NULL) | |||||
while (t->ste_name != NULL) { | |||||
if ((pci_get_vendor(dev) == t->ste_vid) && | |||||
(pci_get_device(dev) == t->ste_did)) { | |||||
device_set_desc(dev, t->ste_name); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | |||||
t++; | |||||
} | |||||
return (ENXIO); | return (ENXIO); | ||||
device_set_desc(dev, sted->descr); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | } | ||||
/* | /* | ||||
* Attach the interface. Allocate softc structures, do ifmedia | * Attach the interface. Allocate softc structures, do ifmedia | ||||
* setup and ethernet/BPF attach. | * setup and ethernet/BPF attach. | ||||
*/ | */ | ||||
static int | static int | ||||
ste_attach(device_t dev) | ste_attach(device_t dev) | ||||
▲ Show 20 Lines • Show All 1,229 Lines • Show Last 20 Lines |