Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hme/if_hme_pci.c
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
static int hme_pci_detach(device_t); | static int hme_pci_detach(device_t); | ||||
static int hme_pci_suspend(device_t); | static int hme_pci_suspend(device_t); | ||||
static int hme_pci_resume(device_t); | static int hme_pci_resume(device_t); | ||||
#define PCI_VENDOR_SUN 0x108e | #define PCI_VENDOR_SUN 0x108e | ||||
#define PCI_PRODUCT_SUN_EBUS 0x1000 | #define PCI_PRODUCT_SUN_EBUS 0x1000 | ||||
#define PCI_PRODUCT_SUN_HMENETWORK 0x1001 | #define PCI_PRODUCT_SUN_HMENETWORK 0x1001 | ||||
static struct hme_dev{ | struct pci_device_table hme_devs[] = { | ||||
uint16_t vendorid; | {PCI_DEV(PCI_VENDOR_SUN, PCI_PRODUCT_SUN_HMENETWORK), | ||||
uint16_t deviceid; | PCI_DESCR("Sun HME 10/100 Ethernet")} | ||||
const char *description; | |||||
} hme_devs[] = { | |||||
{PCI_VENDOR_SUN, PCI_PRODUCT_SUN_HMENETWORK, | |||||
"Sun HME 10/100 Ethernet"}, | |||||
{0, 0, NULL}, | |||||
}; | }; | ||||
static device_method_t hme_pci_methods[] = { | static device_method_t hme_pci_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, hme_pci_probe), | DEVMETHOD(device_probe, hme_pci_probe), | ||||
DEVMETHOD(device_attach, hme_pci_attach), | DEVMETHOD(device_attach, hme_pci_attach), | ||||
DEVMETHOD(device_detach, hme_pci_detach), | DEVMETHOD(device_detach, hme_pci_detach), | ||||
DEVMETHOD(device_suspend, hme_pci_suspend), | DEVMETHOD(device_suspend, hme_pci_suspend), | ||||
Show All 11 Lines | |||||
static driver_t hme_pci_driver = { | static driver_t hme_pci_driver = { | ||||
"hme", | "hme", | ||||
hme_pci_methods, | hme_pci_methods, | ||||
sizeof(struct hme_pci_softc) | sizeof(struct hme_pci_softc) | ||||
}; | }; | ||||
DRIVER_MODULE(hme, pci, hme_pci_driver, hme_devclass, 0, 0); | DRIVER_MODULE(hme, pci, hme_pci_driver, hme_devclass, 0, 0); | ||||
MODULE_PNP_INFO("U16:vendor;U16:device", pci, hme, hme_devs, | PCI_PNP_INFO(hme_devs); | ||||
sizeof(hme_devs[0]), nitems(hme_devs) - 1); | |||||
MODULE_DEPEND(hme, pci, 1, 1, 1); | MODULE_DEPEND(hme, pci, 1, 1, 1); | ||||
MODULE_DEPEND(hme, ether, 1, 1, 1); | MODULE_DEPEND(hme, ether, 1, 1, 1); | ||||
int | int | ||||
hme_pci_probe(device_t dev) | hme_pci_probe(device_t dev) | ||||
{ | { | ||||
const struct hme_dev *hmed; | const struct pci_device_table *hmed; | ||||
uint16_t vid; | |||||
uint16_t did; | |||||
size_t i; | |||||
vid = pci_get_vendor(dev); | hmed = PCI_MATCH(dev, hme_devs); | ||||
did = pci_get_device(dev); | if (hmed == NULL) | ||||
for(i=0; i<nitems(hme_devs) - 1; i++){ | |||||
hmed = &hme_devs[i]; | |||||
if(vid == hmed->vendorid && did == hmed->deviceid){ | |||||
device_set_desc(dev, hmed->description); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | |||||
} | |||||
return (ENXIO); | return (ENXIO); | ||||
device_set_desc(dev, hmed->descr); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | } | ||||
int | int | ||||
hme_pci_attach(device_t dev) | hme_pci_attach(device_t dev) | ||||
{ | { | ||||
struct hme_pci_softc *hsc; | struct hme_pci_softc *hsc; | ||||
struct hme_softc *sc; | struct hme_softc *sc; | ||||
bus_space_tag_t memt; | bus_space_tag_t memt; | ||||
▲ Show 20 Lines • Show All 275 Lines • Show Last 20 Lines |