Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cp/if_cp.c
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
#define CP_LOCK(_bd) mtx_lock (&(_bd)->cp_mtx) | #define CP_LOCK(_bd) mtx_lock (&(_bd)->cp_mtx) | ||||
#define CP_UNLOCK(_bd) mtx_unlock (&(_bd)->cp_mtx) | #define CP_UNLOCK(_bd) mtx_unlock (&(_bd)->cp_mtx) | ||||
#define CP_LOCK_ASSERT(_bd) mtx_assert (&(_bd)->cp_mtx, MA_OWNED) | #define CP_LOCK_ASSERT(_bd) mtx_assert (&(_bd)->cp_mtx, MA_OWNED) | ||||
static int cp_probe __P((device_t)); | static int cp_probe __P((device_t)); | ||||
static int cp_attach __P((device_t)); | static int cp_attach __P((device_t)); | ||||
static int cp_detach __P((device_t)); | static int cp_detach __P((device_t)); | ||||
static struct cp_dev { | |||||
uint16_t vendorid; | |||||
uint16_t deviceid; | |||||
const char *description; | |||||
} cp_devs[] = { | |||||
{ cp_vendor_id, cp_device_id, | |||||
"Cronyx-Tau-PCI serial adapter" }, | |||||
}; | |||||
static device_method_t cp_methods[] = { | static device_method_t cp_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, cp_probe), | DEVMETHOD(device_probe, cp_probe), | ||||
DEVMETHOD(device_attach, cp_attach), | DEVMETHOD(device_attach, cp_attach), | ||||
DEVMETHOD(device_detach, cp_detach), | DEVMETHOD(device_detach, cp_detach), | ||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | static struct mbuf *makembuf (void *buf, unsigned len) | ||||
} | } | ||||
m->m_pkthdr.len = m->m_len = len; | m->m_pkthdr.len = m->m_len = len; | ||||
bcopy (buf, mtod (m, caddr_t), len); | bcopy (buf, mtod (m, caddr_t), len); | ||||
return m; | return m; | ||||
} | } | ||||
static int cp_probe (device_t dev) | static int cp_probe (device_t dev) | ||||
{ | { | ||||
if ((pci_get_vendor (dev) == cp_vendor_id) && | const struct cp_dev *cpd; | ||||
(pci_get_device (dev) == cp_device_id)) { | cpd = &cp_devs[0]; | ||||
device_set_desc (dev, "Cronyx-Tau-PCI serial adapter"); | if ((pci_get_vendor (dev) == cp->vendorid) && | ||||
(pci_get_device (dev) == cp->deviceid)) { | |||||
device_set_desc (dev, cp->description); | |||||
return BUS_PROBE_DEFAULT; | return BUS_PROBE_DEFAULT; | ||||
} | } | ||||
return ENXIO; | return ENXIO; | ||||
} | } | ||||
static void cp_timeout (void *arg) | static void cp_timeout (void *arg) | ||||
{ | { | ||||
drv_t *d; | drv_t *d; | ||||
▲ Show 20 Lines • Show All 2,046 Lines • ▼ Show 20 Lines | |||||
#endif /*NETGRAPH*/ | #endif /*NETGRAPH*/ | ||||
#ifdef NETGRAPH | #ifdef NETGRAPH | ||||
MODULE_DEPEND (ng_cp, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); | MODULE_DEPEND (ng_cp, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); | ||||
#else | #else | ||||
MODULE_DEPEND (cp, sppp, 1, 1, 1); | MODULE_DEPEND (cp, sppp, 1, 1, 1); | ||||
#endif | #endif | ||||
DRIVER_MODULE (cp, pci, cp_driver, cp_devclass, cp_modevent, NULL); | DRIVER_MODULE (cp, pci, cp_driver, cp_devclass, cp_modevent, NULL); | ||||
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, cp, cp_devs, | |||||
sizeof(cp_devs[0]), nitems(cp_devs)); | |||||
MODULE_VERSION (cp, 1); | MODULE_VERSION (cp, 1); |