Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cy/cy_pci.c
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
#define PLX_VER 0x3400 | #define PLX_VER 0x3400 | ||||
#define PLX_9050 0x0b | #define PLX_9050 0x0b | ||||
#define PLX_9060 0x0c | #define PLX_9060 0x0c | ||||
#define PLX_9080 0x0d | #define PLX_9080 0x0d | ||||
static int cy_pci_attach(device_t dev); | static int cy_pci_attach(device_t dev); | ||||
static int cy_pci_probe(device_t dev); | static int cy_pci_probe(device_t dev); | ||||
static struct cy_dev { | struct pci_device_table cy_devs[] = { | ||||
uint32_t deviceid; | {PCI_DEV(0x120e, 0x0100), | ||||
const char *description; | PCI_DESCR("Cyclades Cyclom-Y Serial Adapter")}, | ||||
} cy_devs[] = { | {PCI_DEV(0x120e, 0x0101), | ||||
{0x0100120e, "Cyclades Cyclom-Y Serial Adapter"}, | PCI_DESCR("Cyclades Cyclom-Y Serial Adapter")} | ||||
{0x0101120e, "Cyclades Cyclom-Y Serial Adapter"}, | |||||
{ 0, NULL }, | |||||
}; | }; | ||||
static device_method_t cy_pci_methods[] = { | static device_method_t cy_pci_methods[] = { | ||||
/* Device interface. */ | /* Device interface. */ | ||||
DEVMETHOD(device_probe, cy_pci_probe), | DEVMETHOD(device_probe, cy_pci_probe), | ||||
DEVMETHOD(device_attach, cy_pci_attach), | DEVMETHOD(device_attach, cy_pci_attach), | ||||
{ 0, 0 } | { 0, 0 } | ||||
}; | }; | ||||
static driver_t cy_pci_driver = { | static driver_t cy_pci_driver = { | ||||
cy_driver_name, | cy_driver_name, | ||||
cy_pci_methods, | cy_pci_methods, | ||||
0, | 0, | ||||
}; | }; | ||||
DRIVER_MODULE(cy, pci, cy_pci_driver, cy_devclass, 0, 0); | DRIVER_MODULE(cy, pci, cy_pci_driver, cy_devclass, 0, 0); | ||||
MODULE_PNP_INFO("U32:device", pci, cy, cy_devs, | PCI_PNP_INFO(cy_devs); | ||||
sizeof(cy_devs[0]), nitems(cy_devs) - 1); | |||||
MODULE_DEPEND(cy, pci, 1, 1, 1); | MODULE_DEPEND(cy, pci, 1, 1, 1); | ||||
static int | static int | ||||
cy_pci_probe(dev) | cy_pci_probe(dev) | ||||
device_t dev; | device_t dev; | ||||
{ | { | ||||
const struct pci_device_table *cyd; | |||||
u_int32_t device_id; | u_int32_t device_id; | ||||
device_id = pci_get_devid(dev); | device_id = pci_get_devid(dev); | ||||
device_id &= ~0x00060000; | device_id &= ~0x00060000; | ||||
if (device_id != 0x0100120e && device_id != 0x0101120e) | if (device_id != 0x0100120e && device_id != 0x0101120e) | ||||
return (ENXIO); | return (ENXIO); | ||||
device_set_desc(dev, "Cyclades Cyclom-Y Serial Adapter"); | cyd = PCI_MATCH(dev, cy_devs); | ||||
if (cyd == NULL) | |||||
return (ENXIO); | |||||
device_set_desc(dev, cyd->descr); | |||||
return (BUS_PROBE_DEFAULT); | return (BUS_PROBE_DEFAULT); | ||||
} | } | ||||
static int | static int | ||||
cy_pci_attach(dev) | cy_pci_attach(dev) | ||||
device_t dev; | device_t dev; | ||||
{ | { | ||||
struct resource *ioport_res, *irq_res, *mem_res; | struct resource *ioport_res, *irq_res, *mem_res; | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |