本文整理汇总了C++中device_set_desc函数的典型用法代码示例。如果您正苦于以下问题:C++ device_set_desc函数的具体用法?C++ device_set_desc怎么用?C++ device_set_desc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了device_set_desc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ehci_ixp_attach
static int
ehci_ixp_attach(device_t self)
{
struct ixp_ehci_softc *isc = device_get_softc(self);
ehci_softc_t *sc = &isc->base;
int err;
int rid;
/* initialise some bus fields */
sc->sc_bus.parent = self;
sc->sc_bus.devices = sc->sc_devices;
sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
sc->sc_bus.dma_bits = 32;
/* get all DMA memory */
if (usb_bus_mem_alloc_all(&sc->sc_bus,
USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) {
return (ENOMEM);
}
/* NB: hints fix the memory location and irq */
rid = 0;
sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (!sc->sc_io_res) {
device_printf(self, "Could not map memory\n");
goto error;
}
/*
* Craft special resource for bus space ops that handle
* byte-alignment of non-word addresses. Also, since
* we're already intercepting bus space ops we handle
* the register window offset that could otherwise be
* done with bus_space_subregion.
*/
isc->iot = rman_get_bustag(sc->sc_io_res);
isc->tag.bs_privdata = isc->iot;
/* read single */
isc->tag.bs_r_1 = ehci_bs_r_1,
isc->tag.bs_r_2 = ehci_bs_r_2,
isc->tag.bs_r_4 = ehci_bs_r_4,
/* write (single) */
isc->tag.bs_w_1 = ehci_bs_w_1,
isc->tag.bs_w_2 = ehci_bs_w_2,
isc->tag.bs_w_4 = ehci_bs_w_4,
sc->sc_io_tag = &isc->tag;
sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
sc->sc_io_size = IXP435_USB1_SIZE - 0x100;
rid = 0;
sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
RF_ACTIVE);
if (sc->sc_irq_res == NULL) {
device_printf(self, "Could not allocate irq\n");
goto error;
}
sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
goto error;
}
device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
device_set_desc(sc->sc_bus.bdev, EHCI_HC_DEVSTR);
sprintf(sc->sc_vendor, "Intel");
err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl);
if (err) {
device_printf(self, "Could not setup irq, %d\n", err);
sc->sc_intr_hdl = NULL;
goto error;
}
/*
* Select big-endian byte alignment and arrange to not terminate
* reset operations (the adapter will ignore it if we do but might
* as well save a reg write). Also, the controller has an embedded
* Transaction Translator which means port speed must be read from
* the Port Status register following a port enable.
*/
sc->sc_flags |= EHCI_SCFLG_TT
| EHCI_SCFLG_BIGEDESC
| EHCI_SCFLG_NORESTERM
;
/* Setup callbacks. */
sc->sc_vendor_post_reset = ehci_ixp_post_reset;
sc->sc_vendor_get_port_speed = ehci_get_port_speed_portsc;
err = ehci_init(sc);
if (!err) {
err = device_probe_and_attach(sc->sc_bus.bdev);
}
if (err) {
device_printf(self, "USB init failed err=%d\n", err);
goto error;
//.........这里部分代码省略.........
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:101,代码来源:ehci_ixp4xx.c
示例2: smc_probe
int
smc_probe(device_t dev)
{
int rid, type, error;
uint16_t val;
struct smc_softc *sc;
struct resource *reg;
sc = device_get_softc(dev);
rid = 0;
type = SYS_RES_IOPORT;
error = 0;
if (sc->smc_usemem)
type = SYS_RES_MEMORY;
reg = bus_alloc_resource(dev, type, &rid, 0, ~0, 16, RF_ACTIVE);
if (reg == NULL) {
if (bootverbose)
device_printf(dev,
"could not allocate I/O resource for probe\n");
return (ENXIO);
}
/* Check for the identification value in the BSR. */
val = bus_read_2(reg, BSR);
if ((val & BSR_IDENTIFY_MASK) != BSR_IDENTIFY) {
if (bootverbose)
device_printf(dev, "identification value not in BSR\n");
error = ENXIO;
goto done;
}
/*
* Try switching banks and make sure we still get the identification
* value.
*/
bus_write_2(reg, BSR, 0);
val = bus_read_2(reg, BSR);
if ((val & BSR_IDENTIFY_MASK) != BSR_IDENTIFY) {
if (bootverbose)
device_printf(dev,
"identification value not in BSR after write\n");
error = ENXIO;
goto done;
}
#if 0
/* Check the BAR. */
bus_write_2(reg, BSR, 1);
val = bus_read_2(reg, BAR);
val = BAR_ADDRESS(val);
if (rman_get_start(reg) != val) {
if (bootverbose)
device_printf(dev, "BAR address %x does not match "
"I/O resource address %lx\n", val,
rman_get_start(reg));
error = ENXIO;
goto done;
}
#endif
/* Compare REV against known chip revisions. */
bus_write_2(reg, BSR, 3);
val = bus_read_2(reg, REV);
val = (val & REV_CHIP_MASK) >> REV_CHIP_SHIFT;
if (smc_chip_ids[val] == NULL) {
if (bootverbose)
device_printf(dev, "Unknown chip revision: %d\n", val);
error = ENXIO;
goto done;
}
device_set_desc(dev, smc_chip_ids[val]);
done:
bus_release_resource(dev, type, rid, reg);
return (error);
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:79,代码来源:if_smc.c
示例3: max6657_probe
static int
max6657_probe(device_t dev)
{
device_set_desc(dev, "MAX6657MSA Temperature Sensor");
return (0);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:6,代码来源:max6657.c
示例4: ohci_ec_probe
static int
ohci_ec_probe(device_t dev)
{
device_set_desc(dev, "Econa integrated OHCI controller");
return (BUS_PROBE_DEFAULT);
}
开发者ID:JabirTech,项目名称:Source,代码行数:6,代码来源:ohci_ec.c
示例5: ar71xx_ehci_attach
static int
ar71xx_ehci_attach(device_t self)
{
struct ar71xx_ehci_softc *isc = device_get_softc(self);
ehci_softc_t *sc = &isc->base;
int err;
int rid;
/* initialise some bus fields */
sc->sc_bus.parent = self;
sc->sc_bus.devices = sc->sc_devices;
sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
sc->sc_bus.dma_bits = 32;
/* get all DMA memory */
if (usb_bus_mem_alloc_all(&sc->sc_bus,
USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) {
return (ENOMEM);
}
sc->sc_bus.usbrev = USB_REV_2_0;
/* NB: hints fix the memory location and irq */
rid = 0;
sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (!sc->sc_io_res) {
device_printf(self, "Could not map memory\n");
goto error;
}
/*
* Craft special resource for bus space ops that handle
* byte-alignment of non-word addresses.
*/
sc->sc_io_tag = ar71xx_bus_space_reversed;
sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
sc->sc_io_size = rman_get_size(sc->sc_io_res);
rid = 0;
sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
RF_ACTIVE | RF_SHAREABLE);
if (sc->sc_irq_res == NULL) {
device_printf(self, "Could not allocate irq\n");
goto error;
}
sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
goto error;
}
device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
device_set_desc(sc->sc_bus.bdev, EHCI_HC_DEVSTR);
sprintf(sc->sc_vendor, "Atheros");
err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
NULL, ar71xx_ehci_intr, sc, &sc->sc_intr_hdl);
if (err) {
device_printf(self, "Could not setup irq, %d\n", err);
sc->sc_intr_hdl = NULL;
goto error;
}
/*
* Arrange to force Host mode, select big-endian byte alignment,
* and arrange to not terminate reset operations (the adapter
* will ignore it if we do but might as well save a reg write).
* Also, the controller has an embedded Transaction Translator
* which means port speed must be read from the Port Status
* register following a port enable.
*/
sc->sc_flags = 0;
sc->sc_vendor_post_reset = ar71xx_ehci_post_reset;
switch (ar71xx_soc) {
case AR71XX_SOC_AR7241:
case AR71XX_SOC_AR7242:
case AR71XX_SOC_AR9130:
case AR71XX_SOC_AR9132:
case AR71XX_SOC_AR9330:
case AR71XX_SOC_AR9331:
case AR71XX_SOC_AR9341:
case AR71XX_SOC_AR9342:
case AR71XX_SOC_AR9344:
case AR71XX_SOC_QCA9533:
case AR71XX_SOC_QCA9533_V2:
case AR71XX_SOC_QCA9556:
case AR71XX_SOC_QCA9558:
sc->sc_flags |= EHCI_SCFLG_TT | EHCI_SCFLG_NORESTERM;
sc->sc_vendor_get_port_speed =
ehci_get_port_speed_portsc;
break;
default:
/* fallthrough */
break;
}
/*
* ehci_reset() needs the correct offset to access the host controller
//.........这里部分代码省略.........
开发者ID:2trill2spill,项目名称:freebsd,代码行数:101,代码来源:ar71xx_ehci.c
示例6: cryptocteon_probe
static int
cryptocteon_probe(device_t dev)
{
device_set_desc(dev, "Octeon Secure Coprocessor");
return (0);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:6,代码来源:cryptocteon.c
示例7: iq80321_probe
int
iq80321_probe(device_t dev)
{
device_set_desc(dev, "Intel 80321");
return (BUS_PROBE_NOWILDCARD);
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:6,代码来源:iq80321.c
示例8: rp_probe
static int
rp_probe(device_t dev)
{
int unit;
CONTROLLER_t *controller;
int num_aiops;
CONTROLLER_t *ctlp;
int retval;
/*
* We have no PnP RocketPort cards.
* (At least according to LINT)
*/
if (isa_get_logicalid(dev) != 0)
return (ENXIO);
/* We need IO port resource to configure an ISA device. */
if (bus_get_resource_count(dev, SYS_RES_IOPORT, 0) == 0)
return (ENXIO);
unit = device_get_unit(dev);
if (unit >= 4) {
device_printf(dev, "rpprobe: unit number %d invalid.\n", unit);
return (ENXIO);
}
device_printf(dev, "probing for RocketPort(ISA) unit %d.\n", unit);
ctlp = device_get_softc(dev);
bzero(ctlp, sizeof(*ctlp));
ctlp->dev = dev;
ctlp->aiop2rid = rp_isa_aiop2rid;
ctlp->aiop2off = rp_isa_aiop2off;
ctlp->ctlmask = rp_isa_ctlmask;
/* The IO ports of AIOPs for an ISA controller are discrete. */
ctlp->io_num = 1;
ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO);
ctlp->io = malloc(sizeof(*(ctlp->io)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctlp->io_rid == NULL || ctlp->io == NULL) {
device_printf(dev, "rp_attach: Out of memory.\n");
retval = ENOMEM;
goto nogo;
}
ctlp->bus_ctlp = malloc(sizeof(ISACONTROLLER_t) * 1, M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctlp->bus_ctlp == NULL) {
device_printf(dev, "rp_attach: Out of memory.\n");
retval = ENOMEM;
goto nogo;
}
ctlp->io_rid[0] = 0;
if (rp_controller != NULL) {
controller = rp_controller;
ctlp->io[0] = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &ctlp->io_rid[0], 0x40, RF_ACTIVE);
} else {
controller = rp_controller = ctlp;
ctlp->io[0] = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &ctlp->io_rid[0], 0x44, RF_ACTIVE);
}
if (ctlp->io[0] == NULL) {
device_printf(dev, "rp_attach: Resource not available.\n");
retval = ENXIO;
goto nogo;
}
num_aiops = sInitController(ctlp,
controller,
MAX_AIOPS_PER_BOARD, 0,
FREQ_DIS, 0);
if (num_aiops <= 0) {
device_printf(dev, "board%d init failed.\n", unit);
retval = ENXIO;
goto nogo;
}
if (rp_controller == NULL)
rp_controller = controller;
rp_nisadevs++;
device_set_desc(dev, "RocketPort ISA");
return (0);
nogo:
rp_isareleaseresource(ctlp);
return (retval);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:88,代码来源:rp_isa.c
示例9: ehci_pci_attach
static int
ehci_pci_attach(device_t self)
{
ehci_softc_t *sc = device_get_softc(self);
int err;
int rid;
/* initialise some bus fields */
sc->sc_bus.parent = self;
sc->sc_bus.devices = sc->sc_devices;
sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
/* get all DMA memory */
if (usb_bus_mem_alloc_all(&sc->sc_bus,
USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) {
return (ENOMEM);
}
pci_enable_busmaster(self);
switch (pci_read_config(self, PCI_USBREV, 1) & PCI_USB_REV_MASK) {
case PCI_USB_REV_PRE_1_0:
case PCI_USB_REV_1_0:
case PCI_USB_REV_1_1:
/*
* NOTE: some EHCI USB controllers have the wrong USB
* revision number. It appears those controllers are
* fully compliant so we just ignore this value in
* some common cases.
*/
device_printf(self, "pre-2.0 USB revision (ignored)\n");
/* fallthrough */
case PCI_USB_REV_2_0:
break;
default:
/* Quirk for Parallels Desktop 4.0 */
device_printf(self, "USB revision is unknown. Assuming v2.0.\n");
break;
}
rid = PCI_CBMEM;
sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
if (!sc->sc_io_res) {
device_printf(self, "Could not map memory\n");
goto error;
}
sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
sc->sc_io_size = rman_get_size(sc->sc_io_res);
rid = 0;
sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE);
if (sc->sc_irq_res == NULL) {
device_printf(self, "Could not allocate irq\n");
goto error;
}
sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
goto error;
}
device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
/*
* ehci_pci_match will never return NULL if ehci_pci_probe
* succeeded
*/
device_set_desc(sc->sc_bus.bdev, ehci_pci_match(self));
switch (pci_get_vendor(self)) {
case PCI_EHCI_VENDORID_ACERLABS:
sprintf(sc->sc_vendor, "AcerLabs");
break;
case PCI_EHCI_VENDORID_AMD:
sprintf(sc->sc_vendor, "AMD");
break;
case PCI_EHCI_VENDORID_APPLE:
sprintf(sc->sc_vendor, "Apple");
break;
case PCI_EHCI_VENDORID_ATI:
sprintf(sc->sc_vendor, "ATI");
break;
case PCI_EHCI_VENDORID_CMDTECH:
sprintf(sc->sc_vendor, "CMDTECH");
break;
case PCI_EHCI_VENDORID_INTEL:
sprintf(sc->sc_vendor, "Intel");
break;
case PCI_EHCI_VENDORID_NEC:
sprintf(sc->sc_vendor, "NEC");
break;
case PCI_EHCI_VENDORID_OPTI:
sprintf(sc->sc_vendor, "OPTi");
break;
case PCI_EHCI_VENDORID_PHILIPS:
sprintf(sc->sc_vendor, "Philips");
break;
case PCI_EHCI_VENDORID_SIS:
sprintf(sc->sc_vendor, "SiS");
//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:freebsd,代码行数:101,代码来源:ehci_pci.c
示例10: gt_probe
static int
gt_probe(device_t dev)
{
device_set_desc(dev, "GT64120 chip");
return (0);
}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:6,代码来源:gt.c
示例11: mpt_pci_probe
static int
mpt_pci_probe(device_t dev)
{
const char *desc;
int rval;
if (pci_get_vendor(dev) != MPI_MANUFACTPAGE_VENDORID_LSILOGIC)
return (ENXIO);
rval = BUS_PROBE_DEFAULT;
switch (pci_get_device(dev)) {
case MPI_MANUFACTPAGE_DEVICEID_FC909_FB:
desc = "LSILogic FC909 FC Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC909:
desc = "LSILogic FC909A FC Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC919:
desc = "LSILogic FC919 FC Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC919_LAN_FB:
desc = "LSILogic FC919 LAN Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC929:
desc = "Dual LSILogic FC929 FC Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB:
desc = "Dual LSILogic FC929 LAN Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC919X:
desc = "LSILogic FC919 FC PCI-X Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC919X_LAN_FB:
desc = "LSILogic FC919 LAN PCI-X Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC929X:
desc = "Dual LSILogic FC929X 2Gb/s FC PCI-X Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC929X_LAN_FB:
desc = "Dual LSILogic FC929X LAN PCI-X Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC949E:
desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-Express Adapter";
break;
case MPI_MANUFACTPAGE_DEVICEID_FC949X:
desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-X Adapter";
break;
case MPI_MANUFACTPAGE_DEVID_53C1030:
case MPI_MANUFACTPAGE_DEVID_53C1030ZC:
desc = "LSILogic 1030 Ultra4 Adapter";
break;
case MPI_MANUFACTPAGE_DEVID_SAS1068E_FB:
/*
* Allow mfi(4) to claim this device in case it's in MegaRAID
* mode.
*/
rval = BUS_PROBE_LOW_PRIORITY;
/* FALLTHROUGH */
case MPI_MANUFACTPAGE_DEVID_SAS1064:
case MPI_MANUFACTPAGE_DEVID_SAS1064A:
case MPI_MANUFACTPAGE_DEVID_SAS1064E:
case MPI_MANUFACTPAGE_DEVID_SAS1066:
case MPI_MANUFACTPAGE_DEVID_SAS1066E:
case MPI_MANUFACTPAGE_DEVID_SAS1068:
case MPI_MANUFACTPAGE_DEVID_SAS1068A_FB:
case MPI_MANUFACTPAGE_DEVID_SAS1068E:
case MPI_MANUFACTPAGE_DEVID_SAS1078:
case MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB:
desc = "LSILogic SAS/SATA Adapter";
break;
default:
return (ENXIO);
}
device_set_desc(dev, desc);
return (rval);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:77,代码来源:mpt_pci.c
示例12: xhci_attach
static int
xhci_attach(device_t dev)
{
struct xhci_softc *sc = device_get_softc(dev);
int err = 0, rid = 0;
sc->sc_bus.parent = dev;
sc->sc_bus.devices = sc->sc_devices;
sc->sc_bus.devices_max = XHCI_MAX_DEVICES;
sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
if (sc->sc_io_res == NULL) {
device_printf(dev, "Failed to map memory\n");
xhci_detach(dev);
return (ENXIO);
}
sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
sc->sc_io_size = rman_get_size(sc->sc_io_res);
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE);
if (sc->sc_irq_res == NULL) {
device_printf(dev, "Failed to allocate IRQ\n");
xhci_detach(dev);
return (ENXIO);
}
sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
if (sc->sc_bus.bdev == NULL) {
device_printf(dev, "Failed to add USB device\n");
xhci_detach(dev);
return (ENXIO);
}
device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
sprintf(sc->sc_vendor, XHCI_HC_VENDOR);
device_set_desc(sc->sc_bus.bdev, XHCI_HC_DEVSTR);
err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
NULL, (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl);
if (err != 0) {
device_printf(dev, "Failed to setup error IRQ, %d\n", err);
sc->sc_intr_hdl = NULL;
xhci_detach(dev);
return (err);
}
err = xhci_init(sc, dev, IS_DMA_32B);
if (err != 0) {
device_printf(dev, "Failed to init XHCI, with error %d\n", err);
xhci_detach(dev);
return (ENXIO);
}
err = xhci_start_controller(sc);
if (err != 0) {
device_printf(dev, "Failed to start XHCI controller, with error %d\n", err);
xhci_detach(dev);
return (ENXIO);
}
err = device_probe_and_attach(sc->sc_bus.bdev);
if (err != 0) {
device_printf(dev, "Failed to initialize USB, with error %d\n", err);
xhci_detach(dev);
return (ENXIO);
}
return (0);
}
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:74,代码来源:xhci_mv.c
示例13: dotg_obio_probe
static int
dotg_obio_probe(device_t dev)
{
device_set_desc(dev, "DWC like USB OTG controller");
return (0);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:6,代码来源:rt305x_dotg.c
示例14: ahc_isa_probe
static int
ahc_isa_probe(device_t dev)
{
struct aic7770_identity *entry;
bus_space_tag_t tag;
bus_space_handle_t bsh;
struct resource *regs;
struct resource *irq;
uint32_t iobase;
u_int intdef;
u_int hcntrl;
int irq_num;
int error;
int zero;
error = ENXIO;
zero = 0;
regs = NULL;
irq = NULL;
/* Skip probes for ISA PnP devices */
if (isa_get_logicalid(dev) != 0)
return (error);
regs = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &zero, RF_ACTIVE);
if (regs == NULL) {
device_printf(dev, "No resources allocated.\n");
return (ENOMEM);
}
iobase = rman_get_start(regs);
tag = rman_get_bustag(regs);
bsh = rman_get_bushandle(regs);
entry = ahc_isa_find_device(tag, bsh);
if (entry == NULL)
goto cleanup;
/* Pause the card preseving the IRQ type */
hcntrl = bus_space_read_1(tag, bsh, HCNTRL) & IRQMS;
bus_space_write_1(tag, bsh, HCNTRL, hcntrl | PAUSE);
while ((bus_space_read_1(tag, bsh, HCNTRL) & PAUSE) == 0)
;
/* Make sure we have a valid interrupt vector */
intdef = bus_space_read_1(tag, bsh, INTDEF);
irq_num = intdef & VECTOR;
switch (irq_num) {
case 9:
case 10:
case 11:
case 12:
case 14:
case 15:
break;
default:
device_printf(dev, "@0x%x: illegal irq setting %d\n",
iobase, irq_num);
goto cleanup;
}
if (bus_set_resource(dev, SYS_RES_IRQ, zero, irq_num, 1) != 0)
goto cleanup;
/*
* The 284X only supports edge triggered interrupts,
* so do not claim RF_SHAREABLE.
*/
irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &zero,
0 /*!(RF_ACTIVE|RF_SHAREABLE)*/);
if (irq != NULL) {
error = 0;
device_set_desc(dev, entry->name);
} else
device_printf(dev, "@0x%x: irq %d allocation failed\n",
iobase, irq_num);
cleanup:
if (regs != NULL) {
bus_release_resource(dev, SYS_RES_IOPORT, zero, regs);
regs = NULL;
}
if (irq != NULL) {
bus_release_resource(dev, SYS_RES_IRQ, zero, irq);
irq = NULL;
}
return (error);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:90,代码来源:ahc_isa.c
示例15: ep_eisa_probe
static int
ep_eisa_probe(device_t dev)
{
const char *desc;
u_long iobase;
u_short conf;
u_long port;
int irq;
int int_trig;
desc = ep_match(eisa_get_id(dev));
if (!desc)
return (ENXIO);
device_set_desc(dev, desc);
port = (eisa_get_slot(dev) * EISA_SLOT_SIZE);
iobase = port + EP_EISA_SLOT_OFFSET;
/* We must be in EISA configuration mode */
if ((inw(iobase + EP_W0_ADDRESS_CFG) & 0x1f) != 0x1f)
return (ENXIO);
eisa_add_iospace(dev, iobase, EP_EISA_IOSIZE, RESVADDR_NONE);
eisa_add_iospace(dev, port, EP_IOSIZE, RESVADDR_NONE);
conf = inw(iobase + EISA_IOCONF);
/* Determine our IRQ */
switch (conf & IRQ_CHANNEL) {
case INT_3:
irq = 3;
break;
case INT_5:
irq = 5;
break;
case INT_7:
irq = 7;
break;
case INT_9:
irq = 9;
break;
case INT_10:
irq = 10;
break;
case INT_11:
irq = 11;
break;
case INT_12:
irq = 12;
break;
case INT_15:
irq = 15;
break;
default:
/* Disabled */
printf("ep: 3COM Network Adapter at "
"slot %d has its IRQ disabled. "
"Probe failed.\n",
eisa_get_slot(dev));
return (ENXIO);
}
switch (eisa_get_id(dev)) {
case EISA_DEVICE_ID_3COM_3C579_BNC:
case EISA_DEVICE_ID_3COM_3C579_TP:
int_trig = EISA_TRIGGER_LEVEL;
break;
default:
int_trig = EISA_TRIGGER_EDGE;
break;
}
eisa_add_intr(dev, irq, int_trig);
return (0);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:75,代码来源:if_ep_eisa.c
示例16: ixpclk_probe
static int
ixpclk_probe(device_t dev)
{
device_set_desc(dev, "IXP4XX Timer");
return (0);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:6,代码来源:ixp425_timer.c
示例17: iavc_isa_probe
static int
iavc_isa_probe(device_t dev)
{
struct iavc_softc *sc;
int ret = ENXIO;
int unit = device_get_unit(dev);
if(isa_get_vendorid(dev)) /* no PnP probes here */
return ENXIO;
/* check max unit range */
if (unit >= IAVC_MAXUNIT)
{
kprintf("iavc%d: too many units\n", unit);
return(ENXIO);
}
sc = iavc_find_sc(unit); /* get softc */
sc->sc_unit = unit;
if (!(sc->sc_resources.io_base[0] =
bus_alloc_resource(dev, SYS_RES_IOPORT,
&sc->sc_resources.io_rid[0],
0UL, ~0UL, B1_IOLENGTH, RF_ACTIVE)))
{
kprintf("iavc%d: can't allocate io region\n", unit);
return(ENXIO);
}
sc->sc_iobase = rman_get_start(sc->sc_resources.io_base[0]);
switch(sc->sc_iobase)
{
case 0x150:
case 0x250:
case 0x300:
case 0x340:
break;
default:
kprintf("iavc%d: ERROR, invalid i/o base addr 0x%x configured!\n", sc->sc_unit, sc->sc_iobase);
bus_release_resource(dev, SYS_RES_IOPORT,
sc->sc_resources.io_rid[0],
sc->sc_resources.io_base[0]);
return(ENXIO);
}
sc->sc_io_bt = rman_get_bustag(sc->sc_resources.io_base[0]);
sc->sc_io_bh = rman_get_bushandle(sc->sc_resources.io_base[0]);
/* setup characteristics */
sc->sc_t1 = FALSE;
sc->sc_dma = FALSE;
sc->sc_capi.card_type = CARD_TYPEC_AVM_B1_ISA;
sc->sc_capi.sc_nbch = 2;
b1_reset(sc);
DELAY(100);
ret = b1_detect(sc);
if(ret)
{
kprintf("iavc%d: no card ? b1_detect returns %0x02x\n", sc->sc_unit, ret);
return(ENXIO);
}
DELAY(100);
b1_reset(sc);
DELAY(100);
if(bootverbose)
{
kprintf("iavc%d: class = 0x%02x, rev = 0x%02x\n", sc->sc_unit,
iavc_read_port(sc, B1_ANALYSE),
iavc_read_port(sc, B1_REVISION));
}
device_set_desc(dev, "AVM B1 ISA");
return(0);
}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:86,代码来源:iavc_isa.c
示例18: at91_ssc_probe
static int
at91_ssc_probe(device_t dev)
{
device_set_desc(dev, "SSC");
return (0);
}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:6,代码来源:at91_ssc.c
示例19: gpioc_probe
static int
gpioc_probe(device_t dev)
{
device_set_desc(dev, "GPIO controller");
return (0);
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:6,代码来源:gpioc.c
示例20: atkbdc_isa_probe
static int
atkbdc_isa_probe(device_t dev)
{
struct resource *port0;
struct resource *port1;
u_long start;
u_long count;
int error;
int rid;
#if defined(__i386__) || defined(__amd64__)
bus_space_tag_t tag;
bus_space_handle_t ioh1;
volatile int i;
register_t flags;
#endif
/* check PnP IDs */
if (ISA_PNP_PROBE(device_get_parent(dev), dev, atkbdc_ids) == ENXIO)
return ENXIO;
device_set_desc(dev, "Keyboard controller (i8042)");
/*
* Adjust I/O port resources.
* The AT keyboard controller uses two ports (a command/data port
* 0x60 and a status port 0x64), which may be given to us in
* one resource (0x60 through 0x64) or as two separate resources
* (0x60 and 0x64). Some brain-damaged ACPI BIOS has reversed
* command/data port and status port. Furthermore, /boot/device.hints
* may contain just one port, 0x60. We shall adjust resource settings
* so that these two ports are available as two separate resources
* in correct order.
*/
device_quiet(dev);
rid = 0;
if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count) != 0)
return ENXIO;
if (start == IO_KBD + KBD_STATUS_PORT) {
start = IO_KBD;
count++;
}
if (count > 1) /* adjust the count and/or start port */
bus_set_resource(dev, SYS_RES_IOPORT, rid, start, 1);
port0 = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
if (port0 == NULL)
return ENXIO;
rid = 1;
if (bus_get_resource(dev, SYS_RES_IOPORT, rid, NULL, NULL) != 0)
bus_set_resource(dev, SYS_RES_IOPORT, 1,
start + KBD_STATUS_PORT, 1);
port1 = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
if (port1 == NULL) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, port0);
return ENXIO;
}
#if defined(__i386__) || defined(__amd64__)
/*
* Check if we really have AT keyboard controller. Poll status
* register until we get "all clear" indication. If no such
* indication comes, it probably means that there is no AT
* keyboard controller present. Give up in such case. Check relies
* on the fact that reading from non-existing in/out port returns
* 0xff on i386. May or may not be true on other platforms.
*/
tag = rman_get_bustag(port0);
ioh1 = rman_get_bushandle(port1);
flags = intr_disable();
for (i = 0; i != 65535; i++) {
if ((bus_space_read_1(tag, ioh1, 0) & 0x2) == 0)
break;
}
intr_restore(flags);
if (i == 65535) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, port0);
bus_release_resource(dev, SYS_RES_IOPORT, 1, port1);
if (bootverbose)
device_printf(dev, "AT keyboard controller not found\n");
return ENXIO;
}
#endif
device_verbose(dev);
error = atkbdc_probe_unit(device_get_unit(dev), port0, port1);
bus_release_resource(dev, SYS_RES_IOPORT, 0, port0);
bus_release_resource(dev, SYS_RES_IOPORT, 1, port1);
return error;
}
开发者ID:grembo,项目名称:freebsd_c720,代码行数:91,代码来源:atkbdc_isa.c
注:本文中的device_set_desc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论