Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/nge/if_nge.c
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | |||||
MODULE_DEPEND(nge, ether, 1, 1, 1); | MODULE_DEPEND(nge, ether, 1, 1, 1); | ||||
MODULE_DEPEND(nge, miibus, 1, 1, 1); | MODULE_DEPEND(nge, miibus, 1, 1, 1); | ||||
#define NGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) | #define NGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) | ||||
/* | /* | ||||
* Various supported device vendors/types and their names. | * Various supported device vendors/types and their names. | ||||
*/ | */ | ||||
static const struct nge_type nge_devs[] = { | struct pci_device_table nge_devs[] = { | ||||
{ NGE_VENDORID, NGE_DEVICEID, | {PCI_DEV(NGE_VENDORID, NGE_DEVICEID), | ||||
"National Semiconductor Gigabit Ethernet" }, | PCI_DESCR("National Semiconductor Gigabit Ethernet")} | ||||
{ 0, 0, NULL } | |||||
}; | }; | ||||
static int nge_probe(device_t); | static int nge_probe(device_t); | ||||
static int nge_attach(device_t); | static int nge_attach(device_t); | ||||
static int nge_detach(device_t); | static int nge_detach(device_t); | ||||
static int nge_shutdown(device_t); | static int nge_shutdown(device_t); | ||||
static int nge_suspend(device_t); | static int nge_suspend(device_t); | ||||
static int nge_resume(device_t); | static int nge_resume(device_t); | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | static driver_t nge_driver = { | ||||
"nge", | "nge", | ||||
nge_methods, | nge_methods, | ||||
sizeof(struct nge_softc) | sizeof(struct nge_softc) | ||||
}; | }; | ||||
static devclass_t nge_devclass; | static devclass_t nge_devclass; | ||||
DRIVER_MODULE(nge, pci, nge_driver, nge_devclass, 0, 0); | DRIVER_MODULE(nge, pci, nge_driver, nge_devclass, 0, 0); | ||||
PCI_PNP_INFO(nge_devs); | |||||
DRIVER_MODULE(miibus, nge, miibus_driver, miibus_devclass, 0, 0); | DRIVER_MODULE(miibus, nge, miibus_driver, miibus_devclass, 0, 0); | ||||
#define NGE_SETBIT(sc, reg, x) \ | #define NGE_SETBIT(sc, reg, x) \ | ||||
CSR_WRITE_4(sc, reg, \ | CSR_WRITE_4(sc, reg, \ | ||||
CSR_READ_4(sc, reg) | (x)) | CSR_READ_4(sc, reg) | (x)) | ||||
#define NGE_CLRBIT(sc, reg, x) \ | #define NGE_CLRBIT(sc, reg, x) \ | ||||
CSR_WRITE_4(sc, reg, \ | CSR_WRITE_4(sc, reg, \ | ||||
▲ Show 20 Lines • Show All 536 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Probe for a NatSemi chip. Check the PCI vendor and device | * Probe for a NatSemi 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 | ||||
nge_probe(device_t dev) | nge_probe(device_t dev) | ||||
{ | { | ||||
const struct nge_type *t; | const struct pci_device_table *nged; | ||||
t = nge_devs; | nged = PCI_MATCH(dev, nge_devs); | ||||
if (nged == NULL) | |||||
while (t->nge_name != NULL) { | |||||
if ((pci_get_vendor(dev) == t->nge_vid) && | |||||
(pci_get_device(dev) == t->nge_did)) { | |||||
device_set_desc(dev, t->nge_name); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | |||||
t++; | |||||
} | |||||
return (ENXIO); | return (ENXIO); | ||||
device_set_desc(dev, nged->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 | ||||
nge_attach(device_t dev) | nge_attach(device_t dev) | ||||
▲ Show 20 Lines • Show All 1,920 Lines • Show Last 20 Lines |