Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/et/if_et.c
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | |||||
static int et_stop_txdma(struct et_softc *); | static int et_stop_txdma(struct et_softc *); | ||||
static void et_reset(struct et_softc *); | static void et_reset(struct et_softc *); | ||||
static int et_bus_config(struct et_softc *); | static int et_bus_config(struct et_softc *); | ||||
static void et_get_eaddr(device_t, uint8_t[]); | static void et_get_eaddr(device_t, uint8_t[]); | ||||
static void et_setmulti(struct et_softc *); | static void et_setmulti(struct et_softc *); | ||||
static void et_tick(void *); | static void et_tick(void *); | ||||
static void et_stats_update(struct et_softc *); | static void et_stats_update(struct et_softc *); | ||||
static const struct et_dev { | struct pci_device_table et_devices[] = { | ||||
uint16_t vid; | {PCI_DEV(PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_ET1310), | ||||
uint16_t did; | PCI_DESCR("Agere ET1310 Gigabit Ethernet")}, | ||||
const char *desc; | {PCI_DEV(PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_ET1310_FAST), | ||||
} et_devices[] = { | PCI_DESCR("Agere ET1310 Fast Ethernet")} | ||||
{ PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_ET1310, | |||||
"Agere ET1310 Gigabit Ethernet" }, | |||||
{ PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_ET1310_FAST, | |||||
"Agere ET1310 Fast Ethernet" }, | |||||
{ 0, 0, NULL } | |||||
}; | }; | ||||
static device_method_t et_methods[] = { | static device_method_t et_methods[] = { | ||||
DEVMETHOD(device_probe, et_probe), | DEVMETHOD(device_probe, et_probe), | ||||
DEVMETHOD(device_attach, et_attach), | DEVMETHOD(device_attach, et_attach), | ||||
DEVMETHOD(device_detach, et_detach), | DEVMETHOD(device_detach, et_detach), | ||||
DEVMETHOD(device_shutdown, et_shutdown), | DEVMETHOD(device_shutdown, et_shutdown), | ||||
DEVMETHOD(device_suspend, et_suspend), | DEVMETHOD(device_suspend, et_suspend), | ||||
Show All 10 Lines | static driver_t et_driver = { | ||||
"et", | "et", | ||||
et_methods, | et_methods, | ||||
sizeof(struct et_softc) | sizeof(struct et_softc) | ||||
}; | }; | ||||
static devclass_t et_devclass; | static devclass_t et_devclass; | ||||
DRIVER_MODULE(et, pci, et_driver, et_devclass, 0, 0); | DRIVER_MODULE(et, pci, et_driver, et_devclass, 0, 0); | ||||
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, et, et_devices, | PCI_PNP_INFO(et_devices); | ||||
sizeof(et_devices[0]), nitems(et_devices) - 1); | |||||
DRIVER_MODULE(miibus, et, miibus_driver, miibus_devclass, 0, 0); | DRIVER_MODULE(miibus, et, miibus_driver, miibus_devclass, 0, 0); | ||||
static int et_rx_intr_npkts = 32; | static int et_rx_intr_npkts = 32; | ||||
static int et_rx_intr_delay = 20; /* x10 usec */ | static int et_rx_intr_delay = 20; /* x10 usec */ | ||||
static int et_tx_intr_nsegs = 126; | static int et_tx_intr_nsegs = 126; | ||||
static uint32_t et_timer = 1000 * 1000 * 1000; /* nanosec */ | static uint32_t et_timer = 1000 * 1000 * 1000; /* nanosec */ | ||||
TUNABLE_INT("hw.et.timer", &et_timer); | TUNABLE_INT("hw.et.timer", &et_timer); | ||||
TUNABLE_INT("hw.et.rx_intr_npkts", &et_rx_intr_npkts); | TUNABLE_INT("hw.et.rx_intr_npkts", &et_rx_intr_npkts); | ||||
TUNABLE_INT("hw.et.rx_intr_delay", &et_rx_intr_delay); | TUNABLE_INT("hw.et.rx_intr_delay", &et_rx_intr_delay); | ||||
TUNABLE_INT("hw.et.tx_intr_nsegs", &et_tx_intr_nsegs); | TUNABLE_INT("hw.et.tx_intr_nsegs", &et_tx_intr_nsegs); | ||||
static int | static int | ||||
et_probe(device_t dev) | et_probe(device_t dev) | ||||
{ | { | ||||
const struct et_dev *d; | const struct pci_device_table *etd; | ||||
uint16_t did, vid; | |||||
vid = pci_get_vendor(dev); | etd = PCI_MATCH(dev, et_devices); | ||||
did = pci_get_device(dev); | if (etd == NULL) | ||||
for (d = et_devices; d->desc != NULL; ++d) { | |||||
if (vid == d->vid && did == d->did) { | |||||
device_set_desc(dev, d->desc); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | |||||
} | |||||
return (ENXIO); | return (ENXIO); | ||||
device_set_desc(dev, etd->descr); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | } | ||||
static int | static int | ||||
et_attach(device_t dev) | et_attach(device_t dev) | ||||
{ | { | ||||
struct et_softc *sc; | struct et_softc *sc; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
uint8_t eaddr[ETHER_ADDR_LEN]; | uint8_t eaddr[ETHER_ADDR_LEN]; | ||||
▲ Show 20 Lines • Show All 2,523 Lines • Show Last 20 Lines |