本文整理汇总了C++中bus_generic_probe函数的典型用法代码示例。如果您正苦于以下问题:C++ bus_generic_probe函数的具体用法?C++ bus_generic_probe怎么用?C++ bus_generic_probe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bus_generic_probe函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: acpi_syscont_attach
static int
acpi_syscont_attach(device_t dev)
{
bus_generic_probe(dev);
return (bus_generic_attach(dev));
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:7,代码来源:acpi_container.c
示例2: nexus_xen_attach
static int
nexus_xen_attach(device_t dev)
{
int error;
device_t acpi_dev = NULL;
nexus_init_resources();
bus_generic_probe(dev);
if (xen_initial_domain()) {
/* Disable some ACPI devices that are not usable by Dom0 */
acpi_cpu_disabled = true;
acpi_hpet_disabled = true;
acpi_timer_disabled = true;
acpi_dev = BUS_ADD_CHILD(dev, 10, "acpi", 0);
if (acpi_dev == NULL)
panic("Unable to add ACPI bus to Xen Dom0");
}
error = bus_generic_attach(dev);
if (xen_initial_domain() && (error == 0))
acpi_install_wakeup_handler(device_get_softc(acpi_dev));
return (error);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:26,代码来源:xen_nexus.c
示例3: isab_pci_attach
static int
isab_pci_attach(device_t dev)
{
bus_generic_probe(dev);
return (isab_attach(dev));
}
开发者ID:coyizumi,项目名称:cs111,代码行数:7,代码来源:isa_pci.c
示例4: iodi_attach
int
iodi_attach(device_t dev)
{
device_t tmpd;
int i;
/*
* Attach each devices
*/
device_add_child(dev, "uart", 0);
device_add_child(dev, "xlr_i2c", 0);
device_add_child(dev, "xlr_i2c", 1);
device_add_child(dev, "pcib", 0);
device_add_child(dev, "rmisec", -1);
if (xlr_board_info.usb)
device_add_child(dev, "ehci", 0);
if (xlr_board_info.cfi)
device_add_child(dev, "cfi", 0);
if (xlr_board_info.ata)
device_add_child(dev, "ata", 0);
for (i = 0; i < 3; i++) {
if (xlr_board_info.gmac_block[i].enabled == 0)
continue;
tmpd = device_add_child(dev, "nlna", i);
device_set_ivars(tmpd, &xlr_board_info.gmac_block[i]);
}
bus_generic_probe(dev);
bus_generic_attach(dev);
return 0;
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:35,代码来源:iodi.c
示例5: nexus_attach
static int
nexus_attach(device_t dev)
{
device_t child;
/*
* First, let our child driver's identify any child devices that
* they can find. Once that is done attach any devices that we
* found.
*/
#if 0 /* FUTURE */
bus_generic_probe(dev);
#endif
bus_generic_attach(dev);
/*
* And if we didn't see ISA on a pci bridge, create a
* connection point now so it shows up "on motherboard".
*/
if (!devclass_get_device(devclass_find("isa"), 0)) {
child = BUS_ADD_CHILD(dev, dev, 0, "isa", 0);
if (child == NULL)
panic("nexus_attach isa");
device_probe_and_attach(child);
}
return 0;
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:28,代码来源:nexus.c
示例6: acpi_cpu_cst_attach
static int
acpi_cpu_cst_attach(device_t dev)
{
ACPI_BUFFER buf;
ACPI_OBJECT *obj;
struct mdglobaldata *md;
struct acpi_cpu_softc *sc;
ACPI_STATUS status;
int cpu_id;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
sc = device_get_softc(dev);
sc->cpu_dev = dev;
sc->cpu_parent = device_get_softc(device_get_parent(dev));
sc->cpu_handle = acpi_get_handle(dev);
cpu_id = acpi_get_magic(dev);
cpu_softc[cpu_id] = sc;
md = (struct mdglobaldata *)globaldata_find(device_get_unit(dev));
sc->md = md;
cpu_smi_cmd = AcpiGbl_FADT.SmiCommand;
cpu_cst_cnt = AcpiGbl_FADT.CstControl;
buf.Pointer = NULL;
buf.Length = ACPI_ALLOCATE_BUFFER;
status = AcpiEvaluateObject(sc->cpu_handle, NULL, NULL, &buf);
if (ACPI_FAILURE(status)) {
device_printf(dev, "attach failed to get Processor obj - %s\n",
AcpiFormatException(status));
return (ENXIO);
}
obj = (ACPI_OBJECT *)buf.Pointer;
sc->cpu_p_blk = obj->Processor.PblkAddress;
sc->cpu_p_blk_len = obj->Processor.PblkLength;
sc->cpu_acpi_id = obj->Processor.ProcId;
AcpiOsFree(obj);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "acpi_cpu%d: P_BLK at %#x/%d\n",
device_get_unit(dev), sc->cpu_p_blk, sc->cpu_p_blk_len));
/*
* If this is the first cpu we attach, create and initialize the generic
* resources that will be used by all acpi cpu devices.
*/
if (device_get_unit(dev) == 0) {
/* Assume we won't be using generic Cx mode by default */
cpu_cx_generic = FALSE;
/* Queue post cpu-probing task handler */
AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_cpu_startup, NULL);
}
/* Probe for Cx state support. */
acpi_cpu_cx_probe(sc);
/* Finally, call identify and probe/attach for child devices. */
bus_generic_probe(dev);
bus_generic_attach(dev);
return (0);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:60,代码来源:acpi_cpu_cstate.c
示例7: nexus_probe
static int
nexus_probe(device_t dev)
{
bus_generic_probe(dev);
device_set_desc(dev, "Open Firmware Nexus device");
return (0);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:7,代码来源:nexus.c
示例8: nexus_attach
static int
nexus_attach(device_t dev)
{
mem_rman.rm_start = 0;
mem_rman.rm_end = BUS_SPACE_MAXADDR;
mem_rman.rm_type = RMAN_ARRAY;
mem_rman.rm_descr = "I/O memory addresses";
if (rman_init(&mem_rman) ||
rman_manage_region(&mem_rman, 0, BUS_SPACE_MAXADDR))
panic("nexus_attach mem_rman");
irq_rman.rm_start = 0;
irq_rman.rm_end = ~0;
irq_rman.rm_type = RMAN_ARRAY;
irq_rman.rm_descr = "Interrupts";
if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, ~0))
panic("nexus_attach irq_rman");
nexus_add_child(dev, 8, "timer", 0);
nexus_add_child(dev, 9, "rcons", 0);
nexus_add_child(dev, 10, "ofwbus", 0);
bus_generic_probe(dev);
bus_generic_attach(dev);
return (0);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:27,代码来源:nexus.c
示例9: canbus_attach
static int
canbus_attach(device_t dev)
{
struct canbus_softc *sc = device_get_softc(dev);
struct sysctl_oid *canbus_sysctl_tree;
sc->io_delay_time = CANBE_IO_DELAY_TIME;
/* I/O resource setup */
if(alloc_ioresource(dev))
return (ENXIO);
/* Dynamic sysctl tree setup */
sysctl_ctx_init(&sc->canbus_sysctl_ctx);
canbus_sysctl_tree = SYSCTL_ADD_NODE(&sc->canbus_sysctl_ctx,
SYSCTL_STATIC_CHILDREN(/* tree top */), OID_AUTO,
"canbus", CTLFLAG_RD, 0, "CanBe I/O Bus");
SYSCTL_ADD_INT(&sc->canbus_sysctl_ctx,
SYSCTL_CHILDREN(canbus_sysctl_tree), OID_AUTO, "io_delay_time",
CTLFLAG_RW, &sc->io_delay_time, 0, "CanBe Bus I/O delay time");
bus_generic_probe(dev);
bus_generic_attach(dev);
return (0);
}
开发者ID:JabirTech,项目名称:Source,代码行数:26,代码来源:canbus.c
示例10: atkbdc_isa_attach
static int
atkbdc_isa_attach(device_t dev)
{
atkbdc_softc_t *sc;
int unit;
int error;
int rid;
unit = device_get_unit(dev);
sc = *(atkbdc_softc_t **)device_get_softc(dev);
if (sc == NULL) {
/*
* We have to maintain two copies of the kbdc_softc struct,
* as the low-level console needs to have access to the
* keyboard controller before kbdc is probed and attached.
* kbdc_soft[] contains the default entry for that purpose.
* See atkbdc.c. XXX
*/
sc = atkbdc_get_softc(unit);
if (sc == NULL)
return ENOMEM;
}
rid = 0;
sc->retry = 5000;
sc->port0 = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
RF_ACTIVE);
if (sc->port0 == NULL)
return ENXIO;
rid = 1;
sc->port1 = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
RF_ACTIVE);
if (sc->port1 == NULL) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->port0);
return ENXIO;
}
/*
* If the device is not created by the PnP BIOS or ACPI, then
* the hint for the IRQ is on the child atkbd device, not the
* keyboard controller, so this can fail.
*/
rid = 0;
sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
error = atkbdc_attach_unit(unit, sc, sc->port0, sc->port1);
if (error) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->port0);
bus_release_resource(dev, SYS_RES_IOPORT, 1, sc->port1);
if (sc->irq != NULL)
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
return error;
}
*(atkbdc_softc_t **)device_get_softc(dev) = sc;
bus_generic_probe(dev);
bus_generic_attach(dev);
return 0;
}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:60,代码来源:atkbdc_isa.c
示例11: obio_attach
int
obio_attach(device_t dev)
{
struct obio_softc *sc = device_get_softc(dev);
sc->oba_st = MIPS_BUS_SPACE_IO;
sc->oba_addr = MIPS_PHYS_TO_KSEG1(MALTA_UART0ADR);
sc->oba_size = MALTA_PCIMEM3_SIZE;
sc->oba_rman.rm_type = RMAN_ARRAY;
sc->oba_rman.rm_descr = "OBIO I/O";
if (rman_init(&sc->oba_rman) != 0 ||
rman_manage_region(&sc->oba_rman,
sc->oba_addr, sc->oba_addr + sc->oba_size) != 0)
panic("obio_attach: failed to set up I/O rman");
sc->oba_irq_rman.rm_type = RMAN_ARRAY;
sc->oba_irq_rman.rm_descr = "OBIO IRQ";
/*
* This module is intended for UART purposes only and
* it's IRQ is 4
*/
if (rman_init(&sc->oba_irq_rman) != 0 ||
rman_manage_region(&sc->oba_irq_rman, 4, 4) != 0)
panic("obio_attach: failed to set up IRQ rman");
device_add_child(dev, "uart", 0);
bus_generic_probe(dev);
bus_generic_attach(dev);
return (0);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:31,代码来源:obio.c
示例12: obio_attach
static int
obio_attach(device_t dev)
{
struct obio_softc *sc = device_get_softc(dev);
int rid;
sc->oba_mem_rman.rm_type = RMAN_ARRAY;
sc->oba_mem_rman.rm_descr = "OBIO memeory";
if (rman_init(&sc->oba_mem_rman) != 0 ||
rman_manage_region(&sc->oba_mem_rman, OBIO_MEM_START,
OBIO_MEM_START + OBIO_MEM_SIZE) != 0)
panic("obio_attach: failed to set up I/O rman");
sc->oba_irq_rman.rm_type = RMAN_ARRAY;
sc->oba_irq_rman.rm_descr = "OBIO IRQ";
if (rman_init(&sc->oba_irq_rman) != 0 ||
rman_manage_region(&sc->oba_irq_rman, 0, NIRQS-1) != 0)
panic("obio_attach: failed to set up IRQ rman");
/* Hook up our interrupt handler. */
if ((sc->sc_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
ADM5120_INTR, ADM5120_INTR, 1,
RF_SHAREABLE | RF_ACTIVE)) == NULL) {
device_printf(dev, "unable to allocate IRQ resource\n");
return (ENXIO);
}
if ((bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_MISC, obio_intr, NULL,
sc, &sc->sc_ih))) {
device_printf(dev,
"WARNING: unable to register interrupt handler\n");
return (ENXIO);
}
/* Hook up our FAST interrupt handler. */
if ((sc->sc_fast_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
ADM5120_FAST_INTR, ADM5120_FAST_INTR, 1,
RF_SHAREABLE | RF_ACTIVE)) == NULL) {
device_printf(dev, "unable to allocate IRQ resource\n");
return (ENXIO);
}
if ((bus_setup_intr(dev, sc->sc_fast_irq, INTR_TYPE_MISC, obio_intr,
NULL, sc, &sc->sc_fast_ih))) {
device_printf(dev,
"WARNING: unable to register interrupt handler\n");
return (ENXIO);
}
/* disable all interrupts */
REG_WRITE(ICU_ENABLE_REG, ICU_INT_MASK);
bus_generic_probe(dev);
bus_enumerate_hinted_children(dev);
bus_generic_attach(dev);
return (0);
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:59,代码来源:obio.c
示例13: ixp425_attach
static int
ixp425_attach(device_t dev)
{
struct ixp425_softc *sc;
device_printf(dev, "%b\n", ixp4xx_read_feature_bits(), EXP_FCTRL_BITS);
sc = device_get_softc(dev);
sc->sc_iot = &ixp425_bs_tag;
KASSERT(ixp425_softc == NULL, ("%s called twice?", __func__));
ixp425_softc = sc;
intr_enabled = 0;
ixp425_set_intrmask();
ixp425_set_intrsteer();
if (cpu_is_ixp43x()) {
intr_enabled2 = 0;
ixp435_set_intrmask();
ixp435_set_intrsteer();
}
if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, 0xffffffff, 0xff, 0xffffffff, 0,
NULL, NULL, &sc->sc_dmat))
panic("%s: failed to create dma tag", __func__);
sc->sc_irq_rman.rm_type = RMAN_ARRAY;
sc->sc_irq_rman.rm_descr = "IXP4XX IRQs";
if (rman_init(&sc->sc_irq_rman) != 0 ||
rman_manage_region(&sc->sc_irq_rman, 0, cpu_is_ixp43x() ? 63 : 31) != 0)
panic("%s: failed to set up IRQ rman", __func__);
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
sc->sc_mem_rman.rm_descr = "IXP4XX Memory";
if (rman_init(&sc->sc_mem_rman) != 0 ||
rman_manage_region(&sc->sc_mem_rman, 0, ~0) != 0)
panic("%s: failed to set up memory rman", __func__);
BUS_ADD_CHILD(dev, 0, "pcib", 0);
BUS_ADD_CHILD(dev, 0, "ixpclk", 0);
BUS_ADD_CHILD(dev, 0, "ixpiic", 0);
/* XXX move to hints? */
BUS_ADD_CHILD(dev, 0, "ixpwdog", 0);
/* attach wired devices via hints */
bus_enumerate_hinted_children(dev);
if (bus_space_map(sc->sc_iot, IXP425_GPIO_HWBASE, IXP425_GPIO_SIZE,
0, &sc->sc_gpio_ioh))
panic("%s: unable to map GPIO registers", __func__);
if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE,
0, &sc->sc_exp_ioh))
panic("%s: unable to map Expansion Bus registers", __func__);
bus_generic_probe(dev);
bus_generic_attach(dev);
return (0);
}
开发者ID:coolgoose85,项目名称:FreeBSD,代码行数:59,代码来源:ixp425.c
示例14: ofw_spibus_attach
static int
ofw_spibus_attach(device_t dev)
{
struct spibus_softc *sc = device_get_softc(dev);
struct ofw_spibus_devinfo *dinfo;
phandle_t child;
pcell_t clock, paddr;
device_t childdev;
sc->dev = dev;
bus_generic_probe(dev);
bus_enumerate_hinted_children(dev);
/*
* Attach those children represented in the device tree.
*/
for (child = OF_child(ofw_bus_get_node(dev)); child != 0;
child = OF_peer(child)) {
/*
* Try to get the CS number first from the spi-chipselect
* property, then try the reg property.
*/
if (OF_getencprop(child, "spi-chipselect", &paddr,
sizeof(paddr)) == -1) {
if (OF_getencprop(child, "reg", &paddr,
sizeof(paddr)) == -1)
continue;
}
/*
* Get the maximum clock frequency for device, zero means
* use the default bus speed.
*/
if (OF_getencprop(child, "spi-max-frequency", &clock,
sizeof(clock)) == -1)
clock = 0;
/*
* Now set up the SPI and OFW bus layer devinfo and add it
* to the bus.
*/
dinfo = malloc(sizeof(struct ofw_spibus_devinfo), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (dinfo == NULL)
continue;
dinfo->opd_dinfo.cs = paddr;
dinfo->opd_dinfo.clock = clock;
if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) !=
0) {
free(dinfo, M_DEVBUF);
continue;
}
childdev = device_add_child(dev, NULL, -1);
device_set_ivars(childdev, dinfo);
}
return (bus_generic_attach(dev));
}
开发者ID:2asoft,项目名称:freebsd,代码行数:59,代码来源:ofw_spibus.c
示例15: smbus_attach
static int
smbus_attach(device_t dev)
{
bus_generic_probe(dev);
bus_generic_attach(dev);
return (0);
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:8,代码来源:smbus.c
示例16: mdio_attach
static int
mdio_attach(device_t dev)
{
bus_generic_probe(dev);
bus_enumerate_hinted_children(dev);
return (bus_generic_attach(dev));
}
开发者ID:2asoft,项目名称:freebsd,代码行数:8,代码来源:mdio.c
示例17: nexus_attach
static int
nexus_attach(device_t dev)
{
bus_generic_probe(dev);
bus_generic_attach(dev);
return 0;
}
开发者ID:MarginC,项目名称:kame,代码行数:8,代码来源:nexus.c
示例18: ofwbus_attach
static int
ofwbus_attach(device_t dev)
{
struct ofwbus_devinfo *ndi;
struct ofwbus_softc *sc;
device_t cdev;
phandle_t node;
sc = device_get_softc(dev);
node = OF_peer(0);
/*
* If no Open Firmware, bail early
*/
if (node == -1)
return (ENXIO);
sc->sc_intr_rman.rm_type = RMAN_ARRAY;
sc->sc_intr_rman.rm_descr = "Interrupts";
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
sc->sc_mem_rman.rm_descr = "Device Memory";
if (rman_init(&sc->sc_intr_rman) != 0 ||
rman_init(&sc->sc_mem_rman) != 0 ||
rman_manage_region(&sc->sc_intr_rman, 0, ~0) != 0 ||
rman_manage_region(&sc->sc_mem_rman, 0, BUS_SPACE_MAXADDR) != 0)
panic("%s: failed to set up rmans.", __func__);
/*
* Allow devices to identify.
*/
bus_generic_probe(dev);
/*
* Some important numbers
*/
sc->acells = 2;
OF_getencprop(node, "#address-cells", &sc->acells, sizeof(sc->acells));
sc->scells = 1;
OF_getencprop(node, "#size-cells", &sc->scells, sizeof(sc->scells));
/*
* Now walk the OFW tree and attach top-level devices.
*/
for (node = OF_child(node); node > 0; node = OF_peer(node)) {
if ((ndi = ofwbus_setup_dinfo(dev, node)) == NULL)
continue;
cdev = device_add_child(dev, NULL, -1);
if (cdev == NULL) {
device_printf(dev, "<%s>: device_add_child failed\n",
ndi->ndi_obdinfo.obd_name);
ofwbus_destroy_dinfo(ndi);
continue;
}
device_set_ivars(cdev, ndi);
}
return (bus_generic_attach(dev));
}
开发者ID:ChristosKa,项目名称:freebsd,代码行数:58,代码来源:ofwbus.c
示例19: nexus_probe
static int
nexus_probe(device_t dev)
{
int cpuid;
device_quiet(dev); /* suppress attach message for neatness */
for (cpuid = 0; cpuid < ncpus; ++cpuid) {
struct rman *rm = &irq_rman[cpuid];
rm->rm_start = 0;
rm->rm_end = IDT_HWI_VECTORS - 1;
rm->rm_type = RMAN_ARRAY;
rm->rm_descr = "Interrupt request lines";
if (rman_init(rm, cpuid))
panic("nexus_probe rman_init");
MachIntrABI.rman_setup(rm);
}
/*
* ISA DMA on PCI systems is implemented in the ISA part of each
* PCI->ISA bridge and the channels can be duplicated if there are
* multiple bridges. (eg: laptops with docking stations)
*/
drq_rman.rm_start = 0;
drq_rman.rm_end = 7;
drq_rman.rm_type = RMAN_ARRAY;
drq_rman.rm_descr = "DMA request lines";
/* XXX drq 0 not available on some machines */
if (rman_init(&drq_rman, -1)
|| rman_manage_region(&drq_rman,
drq_rman.rm_start, drq_rman.rm_end))
panic("nexus_probe drq_rman");
/*
* However, IO ports and Memory truely are global at this level,
* as are APIC interrupts (however many IO APICS there turn out
* to be on large systems..)
*/
port_rman.rm_start = 0;
port_rman.rm_end = 0xffff;
port_rman.rm_type = RMAN_ARRAY;
port_rman.rm_descr = "I/O ports";
if (rman_init(&port_rman, -1)
|| rman_manage_region(&port_rman, 0, 0xffff))
panic("nexus_probe port_rman");
mem_rman.rm_start = 0;
mem_rman.rm_end = ~0u;
mem_rman.rm_type = RMAN_ARRAY;
mem_rman.rm_descr = "I/O memory addresses";
if (rman_init(&mem_rman, -1)
|| rman_manage_region(&mem_rman, 0, ~0))
panic("nexus_probe mem_rman");
return bus_generic_probe(dev);
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:58,代码来源:nexus.c
示例20: ata_identify
int
ata_identify(device_t dev)
{
struct ata_channel *ch = device_get_softc(dev);
struct ata_device *master = NULL, *slave = NULL;
device_t master_child = NULL, slave_child = NULL;
int master_unit = -1, slave_unit = -1;
if (ch->devices & (ATA_ATA_MASTER | ATA_ATAPI_MASTER)) {
if (!(master = malloc(sizeof(struct ata_device),
M_ATA, M_NOWAIT | M_ZERO))) {
device_printf(dev, "out of memory\n");
return ENOMEM;
}
master->unit = ATA_MASTER;
}
if (ch->devices & (ATA_ATA_SLAVE | ATA_ATAPI_SLAVE)) {
if (!(slave = malloc(sizeof(struct ata_device),
M_ATA, M_NOWAIT | M_ZERO))) {
free(master, M_ATA);
device_printf(dev, "out of memory\n");
return ENOMEM;
}
slave->unit = ATA_SLAVE;
}
#ifdef ATA_STATIC_ID
if (ch->devices & ATA_ATA_MASTER)
master_unit = (device_get_unit(dev) << 1);
#endif
if (master && !(master_child = ata_add_child(dev, master, master_unit))) {
free(master, M_ATA);
master = NULL;
}
#ifdef ATA_STATIC_ID
if (ch->devices & ATA_ATA_SLAVE)
slave_unit = (device_get_unit(dev) << 1) + 1;
#endif
if (slave && !(slave_child = ata_add_child(dev, slave, slave_unit))) {
free(slave, M_ATA);
slave = NULL;
}
if (slave && ata_getparam(slave, 1)) {
device_delete_child(dev, slave_child);
free(slave, M_ATA);
}
if (master && ata_getparam(master, 1)) {
device_delete_child(dev, master_child);
free(master, M_ATA);
}
bus_generic_probe(dev);
bus_generic_attach(dev);
return 0;
}
开发者ID:syedzubairahmed,项目名称:FreeBSD-7.3-dyntick,代码行数:56,代码来源:ata-all.c
注:本文中的bus_generic_probe函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论