本文整理汇总了C++中device_probe_and_attach函数的典型用法代码示例。如果您正苦于以下问题:C++ device_probe_and_attach函数的具体用法?C++ device_probe_and_attach怎么用?C++ device_probe_and_attach使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了device_probe_and_attach函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ixpiic_attach
static int
ixpiic_attach(device_t dev)
{
struct ixpiic_softc *sc = device_get_softc(dev);
struct ixp425_softc *sa = device_get_softc(device_get_parent(dev));
ixpiic_sc = sc;
sc->sc_dev = dev;
sc->sc_iot = sa->sc_iot;
sc->sc_gpio_ioh = sa->sc_gpio_ioh;
GPIO_CONF_SET(sc, IXP425_GPIO_GPOER,
GPIO_I2C_SCL_BIT | GPIO_I2C_SDA_BIT);
GPIO_CONF_CLR(sc, IXP425_GPIO_GPOUTR,
GPIO_I2C_SCL_BIT | GPIO_I2C_SDA_BIT);
/* add generic bit-banging code */
if ((sc->iicbb = device_add_child(dev, "iicbb", -1)) == NULL)
device_printf(dev, "could not add iicbb\n");
/* probe and attach the bit-banging code */
device_probe_and_attach(sc->iicbb);
return (0);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:26,代码来源:ixp425_iic.c
示例2: ehci_oxu_attach
int
ehci_oxu_attach(device_t self)
{
ehci_softc_t *sc = device_get_softc(self);
int err;
#if EHCI_OXU_DEBUG_LEDS
dbg_port_set_mode (dbg_port_uh_mon);
#endif
/* 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_io_tag = 0U;
sc->sc_io_hdl = OXU210_USB_EHCI_OFST;
sc->sc_io_size = 0x00020000;
sc->sc_flags |= (EHCI_SCFLG_SETMODE |
EHCI_SCFLG_TT | EHCI_SCFLG_FORCESPEED |
EHCI_SCFLG_NORESTERM |
EHCI_SCFLG_SETFRSZ);
/* 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.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);
err = oxu210_intr_attach (oxu210_intr_shc,
(oxu210_intr_handler) ehci_interrupt,
sc);
if (err) {
device_printf(self, "USB EHCI intr attach error\n");
goto error;
}
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;
}
return (0);
error:
ehci_oxu_detach(self);
return (ENXIO);
}
开发者ID:wsoltys,项目名称:pacedev,代码行数:60,代码来源:ehci_oxu210.c
示例3: twe_attach_drive
/********************************************************************************
* Given a detected drive, attach it to the bio interface.
*
* This is called from twe_add_unit.
*/
int
twe_attach_drive(struct twe_softc *sc, struct twe_drive *dr)
{
char buf[80];
int error;
mtx_lock(&Giant);
dr->td_disk = device_add_child(sc->twe_dev, NULL, -1);
if (dr->td_disk == NULL) {
mtx_unlock(&Giant);
twe_printf(sc, "Cannot add unit\n");
return (EIO);
}
device_set_ivars(dr->td_disk, dr);
/*
* XXX It would make sense to test the online/initialising bits, but they seem to be
* always set...
*/
sprintf(buf, "Unit %d, %s, %s",
dr->td_twe_unit,
twe_describe_code(twe_table_unittype, dr->td_type),
twe_describe_code(twe_table_unitstate, dr->td_state & TWE_PARAM_UNITSTATUS_MASK));
device_set_desc_copy(dr->td_disk, buf);
error = device_probe_and_attach(dr->td_disk);
mtx_unlock(&Giant);
if (error != 0) {
twe_printf(sc, "Cannot attach unit to controller. error = %d\n", error);
return (EIO);
}
return (0);
}
开发者ID:JabirTech,项目名称:Source,代码行数:38,代码来源:twe_freebsd.c
示例4: acpi_perf_identify
static void
acpi_perf_identify(driver_t *driver, device_t parent)
{
ACPI_HANDLE handle;
device_t dev;
/* Make sure we're not being doubly invoked. */
if (device_find_child(parent, "acpi_perf", -1) != NULL)
return;
/* Get the handle for the Processor object and check for perf states. */
handle = acpi_get_handle(parent);
if (handle == NULL)
return;
if (ACPI_FAILURE(AcpiEvaluateObject(handle, "_PSS", NULL, NULL)))
return;
/*
* Add a child to every CPU that has the right methods. In future
* versions of the ACPI spec, CPUs can have different settings.
* We probe this child now so that other devices that depend
* on it (i.e., for info about supported states) will see it.
*/
if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_perf", -1)) != NULL)
device_probe_and_attach(dev);
else
device_printf(parent, "add acpi_perf child failed\n");
}
开发者ID:MattDooner,项目名称:freebsd-west,代码行数:28,代码来源:acpi_perf.c
示例5: bcm_fb_setup_fbd
static int
bcm_fb_setup_fbd(struct bcmsc_softc *sc)
{
struct bcm2835_fb_config fb;
device_t fbd;
int err;
err = bcm_fb_init(sc, &fb);
if (err)
return (err);
memset(&sc->info, 0, sizeof(sc->info));
sc->info.fb_name = device_get_nameunit(sc->dev);
sc->info.fb_vbase = (intptr_t)pmap_mapdev(fb.base, fb.size);
sc->info.fb_pbase = fb.base;
sc->info.fb_size = fb.size;
sc->info.fb_bpp = sc->info.fb_depth = fb.bpp;
sc->info.fb_stride = fb.pitch;
sc->info.fb_width = fb.xres;
sc->info.fb_height = fb.yres;
sc->info.fb_flags = FB_FLAG_MEMATTR;
sc->info.fb_memattr = VM_MEMATTR_WRITE_COMBINING;
if (sc->fbswap) {
switch (sc->info.fb_bpp) {
case 24:
vt_generate_cons_palette(sc->info.fb_cmap,
COLOR_FORMAT_RGB, 0xff, 0, 0xff, 8, 0xff, 16);
sc->info.fb_cmsize = 16;
break;
case 32:
vt_generate_cons_palette(sc->info.fb_cmap,
COLOR_FORMAT_RGB, 0xff, 16, 0xff, 8, 0xff, 0);
sc->info.fb_cmsize = 16;
break;
}
}
fbd = device_add_child(sc->dev, "fbd", device_get_unit(sc->dev));
if (fbd == NULL) {
device_printf(sc->dev, "Failed to add fbd child\n");
pmap_unmapdev(sc->info.fb_vbase, sc->info.fb_size);
return (ENXIO);
} else if (device_probe_and_attach(fbd) != 0) {
device_printf(sc->dev, "Failed to attach fbd device\n");
device_delete_child(sc->dev, fbd);
pmap_unmapdev(sc->info.fb_vbase, sc->info.fb_size);
return (ENXIO);
}
device_printf(sc->dev, "%dx%d(%dx%[email protected]%d,%d) %dbpp\n", fb.xres, fb.yres,
fb.vxres, fb.vyres, fb.xoffset, fb.yoffset, fb.bpp);
device_printf(sc->dev,
"fbswap: %d, pitch %d, base 0x%08x, screen_size %d\n",
sc->fbswap, fb.pitch, fb.base, fb.size);
return (0);
}
开发者ID:KingD512,项目名称:freebsd,代码行数:59,代码来源:bcm2835_fbd.c
示例6: acpi_ec_ecdt_probe
/*
* Look for an ECDT and if we find one, set up default GPE and
* space handlers to catch attempts to access EC space before
* we have a real driver instance in place.
*
* TODO: Some old Gateway laptops need us to fake up an ECDT or
* otherwise attach early so that _REG methods can run.
*/
void
acpi_ec_ecdt_probe(device_t parent)
{
ACPI_TABLE_ECDT *ecdt;
ACPI_STATUS status;
device_t child;
ACPI_HANDLE h;
struct acpi_ec_params *params;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
/* Find and validate the ECDT. */
status = AcpiGetTable(ACPI_SIG_ECDT, 1, (ACPI_TABLE_HEADER **)&ecdt);
if (ACPI_FAILURE(status) ||
ecdt->Control.BitWidth != 8 ||
ecdt->Data.BitWidth != 8) {
return;
}
/* Create the child device with the given unit number. */
child = BUS_ADD_CHILD(parent, parent, 0, "acpi_ec", ecdt->Uid);
if (child == NULL) {
kprintf("%s: can't add child\n", __func__);
return;
}
/* Find and save the ACPI handle for this device. */
status = AcpiGetHandle(NULL, ecdt->Id, &h);
if (ACPI_FAILURE(status)) {
device_delete_child(parent, child);
kprintf("%s: can't get handle\n", __func__);
return;
}
acpi_set_handle(child, h);
/* Set the data and CSR register addresses. */
bus_set_resource(child, SYS_RES_IOPORT, 0, ecdt->Data.Address,
/*count*/1, -1);
bus_set_resource(child, SYS_RES_IOPORT, 1, ecdt->Control.Address,
/*count*/1, -1);
/*
* Store values for the probe/attach routines to use. Store the
* ECDT GPE bit and set the global lock flag according to _GLK.
* Note that it is not perfectly correct to be evaluating a method
* before initializing devices, but in practice this function
* should be safe to call at this point.
*/
params = kmalloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO);
params->gpe_handle = NULL;
params->gpe_bit = ecdt->Gpe;
params->uid = ecdt->Uid;
acpi_GetInteger(h, "_GLK", ¶ms->glk);
acpi_set_private(child, params);
/* Finish the attach process. */
if (device_probe_and_attach(child) != 0)
device_delete_child(parent, child);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:67,代码来源:acpi_ec.c
示例7: tcasic_attach
static int
tcasic_attach(device_t dev)
{
tcasic0 = dev;
/* chipset = tcasic_chipset;*/
device_probe_and_attach(tc0);
return 0;
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:9,代码来源:tcasic.c
示例8: octusb_octeon_attach
static int
octusb_octeon_attach(device_t dev)
{
struct octusb_octeon_softc *sc = device_get_softc(dev);
int err;
int rid;
/* setup controller interface softc */
/* initialise some bus fields */
sc->sc_dci.sc_bus.parent = dev;
sc->sc_dci.sc_bus.devices = sc->sc_dci.sc_devices;
sc->sc_dci.sc_bus.devices_max = OCTUSB_MAX_DEVICES;
/* get all DMA memory */
if (usb_bus_mem_alloc_all(&sc->sc_dci.sc_bus,
USB_GET_DMA_TAG(dev), NULL)) {
return (ENOMEM);
}
rid = 0;
sc->sc_dci.sc_irq_res =
bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
CVMX_IRQ_USB, CVMX_IRQ_USB, 1, RF_ACTIVE);
if (!(sc->sc_dci.sc_irq_res)) {
goto error;
}
sc->sc_dci.sc_bus.bdev = device_add_child(dev, "usbus", -1);
if (!(sc->sc_dci.sc_bus.bdev)) {
goto error;
}
device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus);
#if (__FreeBSD_version >= 700031)
err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
NULL, (driver_intr_t *)octusb_interrupt, sc, &sc->sc_dci.sc_intr_hdl);
#else
err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
(driver_intr_t *)octusb_interrupt, sc, &sc->sc_dci.sc_intr_hdl);
#endif
if (err) {
sc->sc_dci.sc_intr_hdl = NULL;
goto error;
}
err = octusb_init(&sc->sc_dci);
if (!err) {
err = device_probe_and_attach(sc->sc_dci.sc_bus.bdev);
}
if (err) {
goto error;
}
return (0);
error:
octusb_octeon_detach(dev);
return (ENXIO);
}
开发者ID:ppaeps,项目名称:freebsd-head,代码行数:57,代码来源:octusb_octeon.c
示例9: cardbus_attach_card
static int
cardbus_attach_card(device_t cbdev)
{
device_t brdev = device_get_parent(cbdev);
device_t child;
int bus, domain, slot, func;
int cardattached = 0;
int cardbusfunchigh = 0;
struct cardbus_softc *sc;
sc = device_get_softc(cbdev);
cardbus_detach_card(cbdev); /* detach existing cards */
POWER_ENABLE_SOCKET(brdev, cbdev);
domain = pcib_get_domain(cbdev);
bus = pcib_get_bus(cbdev);
slot = 0;
/* For each function, set it up and try to attach a driver to it */
for (func = 0; func <= cardbusfunchigh; func++) {
struct cardbus_devinfo *dinfo;
dinfo = (struct cardbus_devinfo *)
pci_read_device(brdev, domain, bus, slot, func,
sizeof(struct cardbus_devinfo));
if (dinfo == NULL)
continue;
if (dinfo->pci.cfg.mfdev)
cardbusfunchigh = PCI_FUNCMAX;
child = device_add_child(cbdev, NULL, -1);
if (child == NULL) {
DEVPRINTF((cbdev, "Cannot add child!\n"));
pci_freecfg((struct pci_devinfo *)dinfo);
continue;
}
dinfo->pci.cfg.dev = child;
resource_list_init(&dinfo->pci.resources);
device_set_ivars(child, dinfo);
cardbus_device_create(sc, dinfo, cbdev, child);
if (cardbus_do_cis(cbdev, child) != 0)
DEVPRINTF((cbdev, "Warning: Bogus CIS ignored\n"));
pci_cfg_save(dinfo->pci.cfg.dev, &dinfo->pci, 0);
pci_cfg_restore(dinfo->pci.cfg.dev, &dinfo->pci);
cardbus_device_setup_regs(&dinfo->pci.cfg);
pci_add_resources(cbdev, child, 1, dinfo->mprefetchable);
pci_print_verbose(&dinfo->pci);
if (device_probe_and_attach(child) == 0)
cardattached++;
else
pci_cfg_save(dinfo->pci.cfg.dev, &dinfo->pci, 1);
}
if (cardattached > 0)
return (0);
/* POWER_DISABLE_SOCKET(brdev, cbdev); */
return (ENOENT);
}
开发者ID:MattDooner,项目名称:freebsd-west,代码行数:55,代码来源:cardbus.c
示例10: lpbb_attach
static int
lpbb_attach(device_t dev)
{
device_t bitbang;
/* add generic bit-banging code */
bitbang = device_add_child(dev, "iicbb", -1);
device_probe_and_attach(bitbang);
return (0);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:11,代码来源:lpbb.c
示例11: tcasic_attach
static int
tcasic_attach(device_t dev)
{
struct tcasic_softc* sc = TCASIC_SOFTC(dev);
device_t parent = device_get_parent(dev);
vm_offset_t regs;
tcasic0 = dev;
/* chipset = tcasic_chipset;*/
chipset.intrdev = dev;
device_probe_and_attach(tc0);
return 0;
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:13,代码来源:tcasic.c
示例12: card_detect_task
static void
card_detect_task(void *arg, int pending)
{
struct fsl_sdhc_softc *sc = (struct fsl_sdhc_softc *)arg;
int err;
int insert;
insert = read4(sc, SDHC_PRSSTAT) & PRSSTAT_CINS;
mtx_lock(&sc->mtx);
if (insert) {
if (sc->child != NULL) {
mtx_unlock(&sc->mtx);
return;
}
sc->child = device_add_child(sc->self, "mmc", -1);
if (sc->child == NULL) {
device_printf(sc->self, "Couldn't add MMC bus!\n");
mtx_unlock(&sc->mtx);
return;
}
/* Initialize MMC bus host structure. */
init_mmc_host_struct(sc);
device_set_ivars(sc->child, &sc->mmc_host);
} else {
if (sc->child == NULL) {
mtx_unlock(&sc->mtx);
return;
}
}
mtx_unlock(&sc->mtx);
if (insert) {
if ((err = device_probe_and_attach(sc->child)) != 0) {
device_printf(sc->self, "MMC bus failed on probe "
"and attach! error %d\n", err);
device_delete_child(sc->self, sc->child);
sc->child = NULL;
}
} else {
if (device_delete_child(sc->self, sc->child) != 0)
device_printf(sc->self, "Could not delete MMC bus!\n");
sc->child = NULL;
}
}
开发者ID:ngkaho1234,项目名称:freebsd,代码行数:50,代码来源:fsl_sdhc.c
示例13: acpi_dock_attach_later
static void
acpi_dock_attach_later(void *context)
{
device_t dev;
dev = (device_t)context;
if (!device_is_enabled(dev))
device_enable(dev);
mtx_lock(&Giant);
device_probe_and_attach(dev);
mtx_unlock(&Giant);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:14,代码来源:acpi_dock.c
示例14: nexus_attach
static int
nexus_attach(device_t dev)
{
device_t child;
/*
* First, deal with the children we know about already
*/
bus_generic_attach(dev);
/*
* And if we didn't see EISA or ISA on a pci bridge, create some
* connection points now so they show up "on motherboard".
*/
if (!devclass_get_device(devclass_find("eisa"), 0)) {
child = device_add_child(dev, "eisa", 0);
if (child == NULL)
panic("nexus_attach eisa");
device_probe_and_attach(child);
}
#if NMCA > 0
if (!devclass_get_device(devclass_find("mca"), 0)) {
child = device_add_child(dev, "mca", 0);
if (child == 0)
panic("nexus_probe mca");
device_probe_and_attach(child);
}
#endif
if (!devclass_get_device(devclass_find("isa"), 0)) {
child = device_add_child(dev, "isa", 0);
if (child == NULL)
panic("nexus_attach isa");
device_probe_and_attach(child);
}
return 0;
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:36,代码来源:nexus.c
示例15: nandsim_start_ctrl
static int
nandsim_start_ctrl(int num)
{
device_t nexus, ndev;
devclass_t nexus_devclass;
int ret = 0;
nand_debug(NDBG_SIM,"start ctlr num:%d", num);
if (num >= MAX_SIM_DEV)
return (EINVAL);
if (!ctrls[num].created)
return (ENODEV);
if (ctrls[num].running)
return (EBUSY);
/* We will add our device as a child of the nexus0 device */
if (!(nexus_devclass = devclass_find("nexus")) ||
!(nexus = devclass_get_device(nexus_devclass, 0)))
return (EFAULT);
/*
* Create a newbus device representing this frontend instance
*
* XXX powerpc nexus doesn't implement bus_add_child, so child
* must be added by device_add_child().
*/
#if defined(__powerpc__)
ndev = device_add_child(nexus, "nandsim", num);
#else
ndev = BUS_ADD_CHILD(nexus, 0, "nandsim", num);
#endif
if (!ndev)
return (EFAULT);
mtx_lock(&Giant);
ret = device_probe_and_attach(ndev);
mtx_unlock(&Giant);
if (ret == 0) {
ctrls[num].sim_ctrl_dev = ndev;
ctrls[num].running = 1;
}
return (ret);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:48,代码来源:nandsim.c
示例16: saf1761_otg_fdt_attach
static int
saf1761_otg_fdt_attach(device_t dev)
{
struct saf1761_otg_softc *sc = device_get_softc(dev);
int err;
/* 32-bit data bus */
sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_DATA_BUS_WIDTH;
/* initialise some bus fields */
sc->sc_bus.parent = dev;
sc->sc_bus.devices = sc->sc_devices;
sc->sc_bus.devices_max = SOTG_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(dev), NULL))
return (ENOMEM);
sc->sc_io_res = (void *)1;
sc->sc_io_tag = (void *)1;
sc->sc_io_hdl = (void *)USB_PCI_MEMORY_ADDRESS;
sc->sc_io_size = USB_PCI_MEMORY_SIZE;
sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
if (sc->sc_bus.bdev == NULL)
goto error;
device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
device_set_interrupt(dev, &saf1761_otg_filter_interrupt, &saf1761_otg_interrupt, sc);
err = saf1761_otg_init(sc);
if (err) {
device_printf(dev, "Init failed\n");
goto error;
}
err = device_probe_and_attach(sc->sc_bus.bdev);
if (err) {
device_printf(dev, "USB probe and attach failed\n");
goto error;
}
return (0);
error:
saf1761_otg_fdt_detach(dev);
return (ENXIO);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:47,代码来源:saf1761_otg_boot.c
示例17: gpioiic_attach
static int
gpioiic_attach(device_t dev)
{
device_t bitbang;
#ifdef FDT
phandle_t node;
pcell_t pin;
#endif
struct gpiobus_ivar *devi;
struct gpioiic_softc *sc;
sc = device_get_softc(dev);
sc->sc_dev = dev;
sc->sc_busdev = device_get_parent(dev);
if (resource_int_value(device_get_name(dev),
device_get_unit(dev), "scl", &sc->scl_pin))
sc->scl_pin = SCL_PIN_DEFAULT;
if (resource_int_value(device_get_name(dev),
device_get_unit(dev), "sda", &sc->sda_pin))
sc->sda_pin = SDA_PIN_DEFAULT;
#ifdef FDT
if ((node = ofw_bus_get_node(dev)) == -1)
return (ENXIO);
if (OF_getencprop(node, "scl", &pin, sizeof(pin)) > 0)
sc->scl_pin = (int)pin;
if (OF_getencprop(node, "sda", &pin, sizeof(pin)) > 0)
sc->sda_pin = (int)pin;
#endif
if (sc->scl_pin < 0 || sc->scl_pin > 1)
sc->scl_pin = SCL_PIN_DEFAULT;
if (sc->sda_pin < 0 || sc->sda_pin > 1)
sc->sda_pin = SDA_PIN_DEFAULT;
devi = GPIOBUS_IVAR(dev);
device_printf(dev, "SCL pin: %d, SDA pin: %d\n",
devi->pins[sc->scl_pin], devi->pins[sc->sda_pin]);
/* add generic bit-banging code */
bitbang = device_add_child(dev, "iicbb", -1);
device_probe_and_attach(bitbang);
return (0);
}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:45,代码来源:gpioiic.c
示例18: pst_add_raid
int
pst_add_raid(struct iop_softc *sc, struct i2o_lct_entry *lct)
{
struct pst_softc *psc;
device_t child = device_add_child(sc->dev, "pst", -1);
if (!child)
return ENOMEM;
if (!(psc = malloc(sizeof(struct pst_softc),
M_PSTRAID, M_NOWAIT | M_ZERO))) {
device_delete_child(sc->dev, child);
return ENOMEM;
}
psc->iop = sc;
psc->lct = lct;
device_set_softc(child, psc);
return device_probe_and_attach(child);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:18,代码来源:pst-raid.c
示例19: ppc_attach
int
ppc_attach(device_t dev)
{
struct ppc_data *ppc = DEVTOSOFTC(dev);
device_t ppbus;
device_t parent = device_get_parent(dev);
device_printf(dev, "%s chipset (%s) in %s mode%s\n",
ppc_models[ppc->ppc_model], ppc_avms[ppc->ppc_avm],
ppc_modes[ppc->ppc_mode], (PPB_IS_EPP(ppc->ppc_mode)) ?
ppc_epp_protocol[ppc->ppc_epp] : "");
if (ppc->ppc_fifo)
device_printf(dev, "FIFO with %d/%d/%d bytes threshold\n",
ppc->ppc_fifo, ppc->ppc_wthr, ppc->ppc_rthr);
if ((ppc->ppc_avm & PPB_ECP) && (ppc->ppc_dmachan > 0)) {
/* acquire the DMA channel forever */ /* XXX */
isa_dma_acquire(ppc->ppc_dmachan);
isa_dmainit(ppc->ppc_dmachan, 1024); /* nlpt.BUFSIZE */
}
/* add ppbus as a child of this isa to parallel bridge */
ppbus = device_add_child(dev, "ppbus", -1);
/*
* Probe the ppbus and attach devices found.
*/
device_probe_and_attach(ppbus);
/* register the ppc interrupt handler as default */
if (ppc->res_irq) {
/* default to the tty mask for registration */ /* XXX */
if (BUS_SETUP_INTR(parent, dev, ppc->res_irq, INTR_TYPE_TTY,
ppcintr, dev, &ppc->intr_cookie) == 0) {
/* remember the ppcintr is registered */
ppc->ppc_registered = 1;
}
}
return (0);
}
开发者ID:MarginC,项目名称:kame,代码行数:44,代码来源:ppc.c
示例20: ofw_clkbus_attach
static int
ofw_clkbus_attach(device_t dev)
{
struct ofw_clkbus_softc *sc;
phandle_t node, child;
device_t cdev;
sc = device_get_softc(dev);
node = ofw_bus_get_node(dev);
simplebus_init(dev, node);
for (child = OF_child(node); child > 0; child = OF_peer(child)) {
cdev = simplebus_add_device(dev, child, 0, NULL, -1, NULL);
if (cdev != NULL)
device_probe_and_attach(cdev);
}
return (bus_generic_attach(dev));
}
开发者ID:2asoft,项目名称:freebsd,代码行数:19,代码来源:clk_bus.c
注:本文中的device_probe_and_attach函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论