本文整理汇总了C++中resource_list_init函数的典型用法代码示例。如果您正苦于以下问题:C++ resource_list_init函数的具体用法?C++ resource_list_init怎么用?C++ resource_list_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resource_list_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gic_v3_add_children
static void
gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, void *arg)
{
ACPI_MADT_GENERIC_TRANSLATOR *gict;
struct gic_v3_acpi_devinfo *di;
struct gic_v3_softc *sc;
device_t child, dev;
if (entry->Type == ACPI_MADT_TYPE_GENERIC_TRANSLATOR) {
/* We have an ITS, add it as a child */
gict = (ACPI_MADT_GENERIC_TRANSLATOR *)entry;
dev = arg;
sc = device_get_softc(dev);
child = device_add_child(dev, "its", -1);
if (child == NULL)
return;
di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO);
resource_list_init(&di->di_rl);
resource_list_add(&di->di_rl, SYS_RES_MEMORY, 0,
gict->BaseAddress, gict->BaseAddress + 128 * 1024 - 1,
128 * 1024);
di->di_gic_dinfo.gic_domain = -1;
sc->gic_nchildren++;
device_set_ivars(child, di);
}
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:28,代码来源:gic_v3_acpi.c
示例2: at91_add_child
static void
at91_add_child(device_t dev, int prio, const char *name, int unit,
bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
{
device_t kid;
struct at91_ivar *ivar;
kid = device_add_child_ordered(dev, prio, name, unit);
if (kid == NULL) {
printf("Can't add child %s%d ordered\n", name, unit);
return;
}
ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ivar == NULL) {
device_delete_child(dev, kid);
printf("Can't add alloc ivar\n");
return;
}
device_set_ivars(kid, ivar);
resource_list_init(&ivar->resources);
if (irq0 != -1)
bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
if (irq1 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
if (irq2 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
if (addr != 0)
bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:29,代码来源:at91.c
示例3: madt_gicv2m_handler
static void
madt_gicv2m_handler(ACPI_SUBTABLE_HEADER *entry, void *arg)
{
struct arm_gic_softc *sc;
ACPI_MADT_GENERIC_MSI_FRAME *msi;
struct gic_acpi_devinfo *dinfo;
device_t dev, cdev;
if (entry->Type == ACPI_MADT_TYPE_GENERIC_MSI_FRAME) {
sc = arg;
dev = sc->gic_dev;
msi = (ACPI_MADT_GENERIC_MSI_FRAME *)entry;
device_printf(dev, "frame: %x %lx %x %u %u\n", msi->MsiFrameId,
msi->BaseAddress, msi->Flags, msi->SpiCount, msi->SpiBase);
cdev = device_add_child(dev, NULL, -1);
if (cdev == NULL)
return;
dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO);
resource_list_init(&dinfo->rl);
resource_list_add(&dinfo->rl, SYS_RES_MEMORY, 0,
msi->BaseAddress, msi->BaseAddress + PAGE_SIZE - 1,
PAGE_SIZE);
device_set_ivars(cdev, dinfo);
}
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:28,代码来源:gic_acpi.c
示例4: localbus_attach
static int
localbus_attach(device_t dev)
{
device_t dev_child;
struct localbus_softc *sc;
struct localbus_devinfo *di;
phandle_t dt_node, dt_child;
sc = device_get_softc(dev);
sc->sc_dev = dev;
sc->sc_banks = localbus_banks;
/*
* Walk localbus and add direct subordinates as our children.
*/
dt_node = ofw_bus_get_node(dev);
for (dt_child = OF_child(dt_node); dt_child != 0;
dt_child = OF_peer(dt_child)) {
/* Check and process 'status' property. */
if (!(fdt_is_enabled(dt_child)))
continue;
if (!(fdt_pm_is_enabled(dt_child)))
continue;
di = malloc(sizeof(*di), M_LOCALBUS, M_WAITOK | M_ZERO);
if (ofw_bus_gen_setup_devinfo(&di->di_ofw, dt_child) != 0) {
free(di, M_LOCALBUS);
device_printf(dev, "could not set up devinfo\n");
continue;
}
resource_list_init(&di->di_res);
if (fdt_localbus_reg_decode(dt_child, sc, di)) {
device_printf(dev, "could not process 'reg' "
"property\n");
ofw_bus_gen_destroy_devinfo(&di->di_ofw);
free(di, M_LOCALBUS);
continue;
}
/* Add newbus device for this FDT node */
dev_child = device_add_child(dev, NULL, -1);
if (dev_child == NULL) {
device_printf(dev, "could not add child: %s\n",
di->di_ofw.obd_name);
resource_list_free(&di->di_res);
ofw_bus_gen_destroy_devinfo(&di->di_ofw);
free(di, M_LOCALBUS);
continue;
}
#ifdef DEBUG
device_printf(dev, "added child: %s\n\n", di->di_ofw.obd_name);
#endif
device_set_ivars(dev_child, di);
}
return (bus_generic_attach(dev));
}
开发者ID:ChristosKa,项目名称:freebsd,代码行数:60,代码来源:mv_localbus.c
示例5: cpu_add_child
static device_t
cpu_add_child(device_t bus, u_int order, const char *name, int unit)
{
struct cpu_device *cd;
device_t child;
#ifndef __rtems__
struct pcpu *pc;
#endif /* __rtems__ */
if ((cd = malloc(sizeof(*cd), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL)
return (NULL);
resource_list_init(&cd->cd_rl);
#ifndef __rtems__
pc = pcpu_find(device_get_unit(bus));
cd->cd_pcpu = pc;
#endif /* __rtems__ */
child = device_add_child_ordered(bus, order, name, unit);
if (child != NULL) {
#ifndef __rtems__
pc->pc_device = child;
#endif /* __rtems__ */
device_set_ivars(child, cd);
} else
free(cd, M_DEVBUF);
return (child);
}
开发者ID:asuol,项目名称:rtems-libbsd,代码行数:28,代码来源:legacy.c
示例6: pcib_host_res_init
/*
* Some Host-PCI bridge drivers know which resource ranges they can
* decode and should only allocate subranges to child PCI devices.
* This API provides a way to manage this. The bridge drive should
* initialize this structure during attach and call
* pcib_host_res_decodes() on each resource range it decodes. It can
* then use pcib_host_res_alloc() and pcib_host_res_adjust() as helper
* routines for BUS_ALLOC_RESOURCE() and BUS_ADJUST_RESOURCE(). This
* API assumes that resources for any decoded ranges can be safely
* allocated from the parent via bus_generic_alloc_resource().
*/
int
pcib_host_res_init(device_t pcib, struct pcib_host_resources *hr)
{
hr->hr_pcib = pcib;
resource_list_init(&hr->hr_rl);
return (0);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:19,代码来源:pci_subr.c
示例7: gic_v3_ofw_bus_attach
/*
* Bus capability support for GICv3.
* Collects and configures device informations and finally
* adds ITS device as a child of GICv3 in Newbus hierarchy.
*/
static int
gic_v3_ofw_bus_attach(device_t dev)
{
struct gic_v3_ofw_devinfo *di;
device_t child;
phandle_t parent, node;
pcell_t addr_cells, size_cells;
parent = ofw_bus_get_node(dev);
if (parent > 0) {
addr_cells = 2;
OF_getencprop(parent, "#address-cells", &addr_cells,
sizeof(addr_cells));
size_cells = 2;
OF_getencprop(parent, "#size-cells", &size_cells,
sizeof(size_cells));
/* Iterate through all GIC subordinates */
for (node = OF_child(parent); node > 0; node = OF_peer(node)) {
/* Allocate and populate devinfo. */
di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO);
if (ofw_bus_gen_setup_devinfo(&di->di_dinfo, node)) {
if (bootverbose) {
device_printf(dev,
"Could not set up devinfo for ITS\n");
}
free(di, M_GIC_V3);
continue;
}
/* Initialize and populate resource list. */
resource_list_init(&di->di_rl);
ofw_bus_reg_to_rl(dev, node, addr_cells, size_cells,
&di->di_rl);
/* Should not have any interrupts, so don't add any */
/* Add newbus device for this FDT node */
child = device_add_child(dev, NULL, -1);
if (!child) {
if (bootverbose) {
device_printf(dev,
"Could not add child: %s\n",
di->di_dinfo.obd_name);
}
resource_list_free(&di->di_rl);
ofw_bus_gen_destroy_devinfo(&di->di_dinfo);
free(di, M_GIC_V3);
continue;
}
device_set_ivars(child, di);
}
}
return (bus_generic_attach(dev));
}
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:61,代码来源:gic_v3_fdt.c
示例8: 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
示例9: ebus_setup_dinfo
static struct ebus_devinfo *
ebus_setup_dinfo(device_t dev, struct ebus_softc *sc, phandle_t node)
{
struct ebus_devinfo *edi;
struct isa_regs *reg;
ofw_isa_intr_t *intrs;
ofw_pci_intr_t rintr;
u_int64_t start;
int nreg, nintr, i;
edi = malloc(sizeof(*edi), M_DEVBUF, M_ZERO | M_WAITOK);
if (ofw_bus_gen_setup_devinfo(&edi->edi_obdinfo, node) != 0) {
free(edi, M_DEVBUF);
return (NULL);
}
resource_list_init(&edi->edi_rl);
nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)®);
if (nreg == -1) {
device_printf(dev, "<%s>: incomplete\n",
edi->edi_obdinfo.obd_name);
goto fail;
}
for (i = 0; i < nreg; i++) {
start = ISA_REG_PHYS(reg + i);
resource_list_add(&edi->edi_rl, SYS_RES_MEMORY, i,
start, start + reg[i].size - 1, reg[i].size);
}
free(reg, M_OFWPROP);
nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intrs),
(void **)&intrs);
for (i = 0; i < nintr; i++) {
rintr = ofw_isa_route_intr(dev, node, &sc->sc_iinfo, intrs[i]);
if (rintr == PCI_INVALID_IRQ) {
device_printf(dev,
"<%s>: could not map EBus interrupt %d\n",
edi->edi_obdinfo.obd_name, intrs[i]);
free(intrs, M_OFWPROP);
goto fail;
}
resource_list_add(&edi->edi_rl, SYS_RES_IRQ, i,
rintr, rintr, 1);
}
free(intrs, M_OFWPROP);
return (edi);
fail:
ebus_destroy_dinfo(edi);
return (NULL);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:51,代码来源:ebus.c
示例10: ofw_gpiobus_setup_devinfo
static struct ofw_gpiobus_devinfo *
ofw_gpiobus_setup_devinfo(device_t bus, device_t child, phandle_t node)
{
int i, npins;
struct gpiobus_ivar *devi;
struct gpiobus_pin *pins;
struct gpiobus_softc *sc;
struct ofw_gpiobus_devinfo *dinfo;
sc = device_get_softc(bus);
dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_NOWAIT | M_ZERO);
if (dinfo == NULL)
return (NULL);
if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, node) != 0) {
free(dinfo, M_DEVBUF);
return (NULL);
}
/* Parse the gpios property for the child. */
npins = ofw_gpiobus_parse_gpios_impl(child, node, "gpios", sc, &pins);
if (npins <= 0) {
ofw_bus_gen_destroy_devinfo(&dinfo->opd_obdinfo);
free(dinfo, M_DEVBUF);
return (NULL);
}
/* Initialize the irq resource list. */
resource_list_init(&dinfo->opd_dinfo.rl);
/* Allocate the child ivars and copy the parsed pin data. */
devi = &dinfo->opd_dinfo;
devi->npins = (uint32_t)npins;
if (gpiobus_alloc_ivars(devi) != 0) {
free(pins, M_DEVBUF);
ofw_gpiobus_destroy_devinfo(bus, dinfo);
return (NULL);
}
for (i = 0; i < devi->npins; i++) {
devi->flags[i] = pins[i].flags;
devi->pins[i] = pins[i].pin;
}
free(pins, M_DEVBUF);
#ifndef INTRNG
/* Parse the interrupt resources. */
if (ofw_bus_intr_to_rl(bus, node, &dinfo->opd_dinfo.rl, NULL) != 0) {
ofw_gpiobus_destroy_devinfo(bus, dinfo);
return (NULL);
}
#endif
device_set_ivars(child, dinfo);
return (dinfo);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:50,代码来源:ofw_gpiobus.c
示例11: mdionexus_ofw_bus_attach
static int
mdionexus_ofw_bus_attach(device_t dev)
{
struct simplebus_softc *sc;
struct mdionexus_ofw_devinfo *di;
device_t child;
phandle_t parent, node;
parent = ofw_bus_get_node(dev);
simplebus_init(dev, parent);
sc = (struct simplebus_softc *)device_get_softc(dev);
if (mdionexus_ofw_fill_ranges(parent, sc) < 0) {
device_printf(dev, "could not get ranges\n");
return (ENXIO);
}
/* Iterate through all bus subordinates */
for (node = OF_child(parent); node > 0; node = OF_peer(node)) {
/* Allocate and populate devinfo. */
di = malloc(sizeof(*di), M_THUNDER_MDIO, M_WAITOK | M_ZERO);
if (ofw_bus_gen_setup_devinfo(&di->di_dinfo, node) != 0) {
free(di, M_THUNDER_MDIO);
continue;
}
/* Initialize and populate resource list. */
resource_list_init(&di->di_rl);
ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells,
&di->di_rl);
#ifndef INTRNG
ofw_bus_intr_to_rl(dev, node, &di->di_rl, NULL);
#endif
/* Add newbus device for this FDT node */
child = device_add_child(dev, NULL, -1);
if (child == NULL) {
resource_list_free(&di->di_rl);
ofw_bus_gen_destroy_devinfo(&di->di_dinfo);
free(di, M_THUNDER_MDIO);
continue;
}
device_set_ivars(child, di);
}
return (0);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:48,代码来源:thunder_mdio_fdt.c
示例12: pxa_attach
int
pxa_attach(device_t dev)
{
struct obio_softc *sc;
struct obio_device *od;
int i;
device_t child;
sc = device_get_softc(dev);
sc->obio_bst = obio_tag;
sc->obio_mem.rm_type = RMAN_ARRAY;
sc->obio_mem.rm_descr = "PXA2X0 OBIO Memory";
if (rman_init(&sc->obio_mem) != 0)
panic("pxa_attach: failed to init obio mem rman");
if (rman_manage_region(&sc->obio_mem, 0, PXA250_PERIPH_END) != 0)
panic("pxa_attach: failed to set up obio mem rman");
sc->obio_irq.rm_type = RMAN_ARRAY;
sc->obio_irq.rm_descr = "PXA2X0 OBIO IRQ";
if (rman_init(&sc->obio_irq) != 0)
panic("pxa_attach: failed to init obio irq rman");
if (rman_manage_region(&sc->obio_irq, 0, 31) != 0)
panic("pxa_attach: failed to set up obio irq rman (main irqs)");
if (rman_manage_region(&sc->obio_irq, IRQ_GPIO0, IRQ_GPIO_MAX) != 0)
panic("pxa_attach: failed to set up obio irq rman (gpio irqs)");
for (od = obio_devices; od->od_name != NULL; od++) {
resource_list_init(&od->od_resources);
resource_list_add(&od->od_resources, SYS_RES_MEMORY, 0,
od->od_base, od->od_base + od->od_size, od->od_size);
for (i = 0; od->od_irqs[i] != 0; i++) {
resource_list_add(&od->od_resources, SYS_RES_IRQ, i,
od->od_irqs[i], od->od_irqs[i], 1);
}
child = device_add_child(dev, od->od_name, -1);
device_set_ivars(child, od);
}
bus_generic_probe(dev);
bus_generic_attach(dev);
return (0);
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:48,代码来源:pxa_obio.c
示例13: atkbdc_isa_add_child
static device_t
atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit)
{
atkbdc_device_t *ivar;
atkbdc_softc_t *sc;
device_t child;
int t;
sc = *(atkbdc_softc_t **)device_get_softc(bus);
ivar = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
M_NOWAIT | M_ZERO);
if (!ivar)
return NULL;
child = device_add_child_ordered(bus, order, name, unit);
if (child == NULL) {
free(ivar, M_ATKBDDEV);
return child;
}
resource_list_init(&ivar->resources);
ivar->rid = order;
/*
* If the device is not created by the PnP BIOS or ACPI, refer
* to device hints for IRQ. We always populate the resource
* list entry so we can use a standard bus_get_resource()
* method.
*/
if (order == KBDC_RID_KBD) {
if (sc->irq == NULL) {
if (resource_int_value(name, unit, "irq", &t) != 0)
t = -1;
} else
t = rman_get_start(sc->irq);
if (t > 0)
resource_list_add(&ivar->resources, SYS_RES_IRQ,
ivar->rid, t, t, 1);
}
if (resource_disabled(name, unit))
device_disable(child);
device_set_ivars(child, ivar);
return child;
}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:47,代码来源:atkbdc_isa.c
示例14: simplebus_add_child
static device_t
simplebus_add_child(device_t dev, u_int order, const char *name, int unit)
{
device_t cdev;
struct simplebus_devinfo *ndi;
cdev = device_add_child_ordered(dev, order, name, unit);
if (cdev == NULL)
return (NULL);
ndi = malloc(sizeof(*ndi), M_DEVBUF, M_WAITOK | M_ZERO);
ndi->obdinfo.obd_node = -1;
resource_list_init(&ndi->rl);
device_set_ivars(cdev, ndi);
return (cdev);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:17,代码来源:simplebus.c
示例15: mv_pcib_ctrl_add_child
static device_t
mv_pcib_ctrl_add_child(device_t dev, u_int order, const char *name, int unit)
{
device_t cdev;
struct mv_pcib_ctrl_devinfo *di;
cdev = device_add_child_ordered(dev, order, name, unit);
if (cdev == NULL)
return (NULL);
di = malloc(sizeof(*di), M_DEVBUF, M_WAITOK | M_ZERO);
di->di_dinfo.obd_node = -1;
resource_list_init(&di->di_rl);
device_set_ivars(cdev, di);
return (cdev);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:17,代码来源:mv_pci_ctrl.c
示例16: nexus_add_child
static device_t
nexus_add_child(device_t bus, int order, const char *name, int unit)
{
device_t child;
struct nexus_device *ndev;
ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO);
if (!ndev)
return(0);
resource_list_init(&ndev->nx_resources);
child = device_add_child_ordered(bus, order, name, unit);
/* should we free this in nexus_child_detached? */
device_set_ivars(child, ndev);
return(child);
}
开发者ID:MarginC,项目名称:kame,代码行数:18,代码来源:nexus.c
示例17: iicbus_add_child
static device_t
iicbus_add_child(device_t dev, u_int order, const char *name, int unit)
{
device_t child;
struct iicbus_ivar *devi;
child = device_add_child_ordered(dev, order, name, unit);
if (child == NULL)
return (child);
devi = malloc(sizeof(struct iicbus_ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
if (devi == NULL) {
device_delete_child(dev, child);
return (0);
}
resource_list_init(&devi->rl);
device_set_ivars(child, devi);
return (child);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:18,代码来源:iicbus.c
示例18: canbus_add_child
static device_t
canbus_add_child(device_t bus, u_int order, const char *name, int unit)
{
device_t child;
struct canbus_device *cbdev;
child = device_add_child_ordered(bus, order, name, unit);
cbdev = malloc(
sizeof(struct canbus_device), M_CANBUSDEV, M_NOWAIT | M_ZERO);
if (!cbdev)
return (0);
resource_list_init(&cbdev->cbdev_resources);
device_set_ivars(child, cbdev);
return (child);
}
开发者ID:JabirTech,项目名称:Source,代码行数:18,代码来源:canbus.c
示例19: acpi_cpu_add_child
static device_t
acpi_cpu_add_child(device_t dev, int order, const char *name, int unit)
{
struct acpi_cpu_device *ad;
device_t child;
if ((ad = malloc(sizeof(*ad), M_TEMP, M_NOWAIT | M_ZERO)) == NULL)
return (NULL);
resource_list_init(&ad->ad_rl);
child = device_add_child_ordered(dev, order, name, unit);
if (child != NULL)
device_set_ivars(child, ad);
else
free(ad, M_TEMP);
return (child);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:18,代码来源:acpi_cpu.c
示例20: newbus_device_create
static device_t
newbus_device_create(device_t dev_par, phandle_t node, char *name, char *type,
char *compat)
{
device_t child;
struct fdtbus_devinfo *di;
child = device_add_child(dev_par, NULL, -1);
if (child == NULL) {
free(name, M_OFWPROP);
free(type, M_OFWPROP);
free(compat, M_OFWPROP);
return (NULL);
}
di = malloc(sizeof(*di), M_FDTBUS, M_WAITOK);
di->di_node = node;
di->di_name = name;
di->di_type = type;
di->di_compat = compat;
resource_list_init(&di->di_res);
if (fdt_reg_to_rl(node, &di->di_res)) {
device_printf(child, "could not process 'reg' property\n");
newbus_device_destroy(child);
child = NULL;
goto out;
}
if (fdt_intr_to_rl(node, &di->di_res, di->di_intr_sl)) {
device_printf(child, "could not process 'interrupts' "
"property\n");
newbus_device_destroy(child);
child = NULL;
goto out;
}
device_set_ivars(child, di);
debugf("added child name='%s', node=%p\n", name, (void *)node);
out:
return (child);
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:44,代码来源:fdtbus.c
注:本文中的resource_list_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论