Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bfe/if_bfe.c
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | |||||
MODULE_DEPEND(bfe, ether, 1, 1, 1); | MODULE_DEPEND(bfe, ether, 1, 1, 1); | ||||
MODULE_DEPEND(bfe, miibus, 1, 1, 1); | MODULE_DEPEND(bfe, miibus, 1, 1, 1); | ||||
/* "device miibus" required. See GENERIC if you get errors here. */ | /* "device miibus" required. See GENERIC if you get errors here. */ | ||||
#include "miibus_if.h" | #include "miibus_if.h" | ||||
#define BFE_DEVDESC_MAX 64 /* Maximum device description length */ | #define BFE_DEVDESC_MAX 64 /* Maximum device description length */ | ||||
static struct bfe_type bfe_devs[] = { | struct pci_device_table bfe_devs[] = { | ||||
{ BCOM_VENDORID, BCOM_DEVICEID_BCM4401, | {PCI_DEV(BCOM_VENDORID, BCOM_DEVICEID_BCM4401), | ||||
"Broadcom BCM4401 Fast Ethernet" }, | PCI_DESCR("Broadcom BCM4401 Fast Ethernet")}, | ||||
{ BCOM_VENDORID, BCOM_DEVICEID_BCM4401B0, | {PCI_DEV(BCOM_VENDORID, BCOM_DEVICEID_BCM4401B0), | ||||
"Broadcom BCM4401-B0 Fast Ethernet" }, | PCI_DESCR("Broadcom BCM4401-B0 Fast Ethernet")} | ||||
{ 0, 0, NULL } | |||||
}; | }; | ||||
static int bfe_probe (device_t); | static int bfe_probe (device_t); | ||||
static int bfe_attach (device_t); | static int bfe_attach (device_t); | ||||
static int bfe_detach (device_t); | static int bfe_detach (device_t); | ||||
static int bfe_suspend (device_t); | static int bfe_suspend (device_t); | ||||
static int bfe_resume (device_t); | static int bfe_resume (device_t); | ||||
static void bfe_release_resources (struct bfe_softc *); | static void bfe_release_resources (struct bfe_softc *); | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | static driver_t bfe_driver = { | ||||
"bfe", | "bfe", | ||||
bfe_methods, | bfe_methods, | ||||
sizeof(struct bfe_softc) | sizeof(struct bfe_softc) | ||||
}; | }; | ||||
static devclass_t bfe_devclass; | static devclass_t bfe_devclass; | ||||
DRIVER_MODULE(bfe, pci, bfe_driver, bfe_devclass, 0, 0); | DRIVER_MODULE(bfe, pci, bfe_driver, bfe_devclass, 0, 0); | ||||
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bfe, bfe_devs, | PCI_PNP_INFO(bfe_devs); | ||||
sizeof(bfe_devs[0]), nitems(bfe_devs) - 1); | |||||
DRIVER_MODULE(miibus, bfe, miibus_driver, miibus_devclass, 0, 0); | DRIVER_MODULE(miibus, bfe, miibus_driver, miibus_devclass, 0, 0); | ||||
/* | /* | ||||
* Probe for a Broadcom 4401 chip. | * Probe for a Broadcom 4401 chip. | ||||
*/ | */ | ||||
static int | static int | ||||
bfe_probe(device_t dev) | bfe_probe(device_t dev) | ||||
{ | { | ||||
struct bfe_type *t; | const struct pci_device_table *bfed; | ||||
t = bfe_devs; | bfed = PCI_MATCH(dev, bfe_devs); | ||||
if (bfed == NULL) | |||||
while (t->bfe_name != NULL) { | |||||
if (pci_get_vendor(dev) == t->bfe_vid && | |||||
pci_get_device(dev) == t->bfe_did) { | |||||
device_set_desc(dev, t->bfe_name); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | |||||
t++; | |||||
} | |||||
return (ENXIO); | return (ENXIO); | ||||
device_set_desc(dev, bfed->descr); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | } | ||||
struct bfe_dmamap_arg { | struct bfe_dmamap_arg { | ||||
bus_addr_t bfe_busaddr; | bus_addr_t bfe_busaddr; | ||||
}; | }; | ||||
static int | static int | ||||
bfe_dma_alloc(struct bfe_softc *sc) | bfe_dma_alloc(struct bfe_softc *sc) | ||||
▲ Show 20 Lines • Show All 1,779 Lines • Show Last 20 Lines |