当前位置: 首页>>代码示例>>C++>>正文


C++ rman_get_start函数代码示例

本文整理汇总了C++中rman_get_start函数的典型用法代码示例。如果您正苦于以下问题:C++ rman_get_start函数的具体用法?C++ rman_get_start怎么用?C++ rman_get_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rman_get_start函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gnttab_resume

int
gnttab_resume(device_t dev)
{
	unsigned int max_nr_gframes, nr_gframes;

	nr_gframes = nr_grant_frames;
	max_nr_gframes = max_nr_grant_frames();
	if (max_nr_gframes < nr_gframes)
		return (ENOSYS);

	if (!resume_frames) {
		KASSERT(dev != NULL,
		    ("No resume frames and no device provided"));

		gnttab_pseudo_phys_res = xenmem_alloc(dev,
		    &gnttab_pseudo_phys_res_id, PAGE_SIZE * max_nr_gframes);
		if (gnttab_pseudo_phys_res == NULL)
			panic("Unable to reserve physical memory for gnttab");
		resume_frames = rman_get_start(gnttab_pseudo_phys_res);
	}

	return (gnttab_map(0, nr_gframes - 1));
}
开发者ID:2asoft,项目名称:freebsd,代码行数:23,代码来源:grant_table.c

示例2: nexus_setup_intr

static int
nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
    driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
{
	int error;

	if ((rman_get_flags(res) & RF_SHAREABLE) == 0)
		flags |= INTR_EXCL;

	/* We depend here on rman_activate_resource() being idempotent. */
	error = rman_activate_resource(res);
	if (error)
		return (error);

#ifdef INTRNG
	error = intr_setup_irq(child, res, filt, intr, arg, flags, cookiep);
#else
	error = arm_setup_intr(device_get_nameunit(child), filt, intr,
	    arg, rman_get_start(res), flags, cookiep);
#endif

	return (error);
}
开发者ID:tomtor,项目名称:freebsd,代码行数:23,代码来源:nexus.c

示例3: nexus_activate_resource

static int
nexus_activate_resource(device_t bus __unused, device_t child __unused,
    int type, int rid __unused, struct resource *r)
{

	if (type == SYS_RES_MEMORY) {
		vm_offset_t start;
		void *p;

		start = (vm_offset_t) rman_get_start(r);
		if (bootverbose)
			printf("nexus mapdev: start %zx, len %ld\n", start,
			    rman_get_size(r));

		p = pmap_mapdev(start, (vm_size_t) rman_get_size(r));
		if (p == NULL)
			return (ENOMEM);
		rman_set_virtual(r, p);
		rman_set_bustag(r, &bs_be_tag);
		rman_set_bushandle(r, (u_long)p);
	}
	return (rman_activate_resource(r));
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:23,代码来源:nexus.c

示例4: nexus_setup_intr

static int
nexus_setup_intr(device_t bus __unused, device_t child, struct resource *r,
    int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg,
    void **cookiep)
{
	int error;

	if (r == NULL)
		panic("%s: NULL interrupt resource!", __func__);

	if ((rman_get_flags(r) & RF_SHAREABLE) == 0)
		flags |= INTR_EXCL;

	/* We depend here on rman_activate_resource() being idempotent. */
	error = rman_activate_resource(r);
	if (error)
		return (error);

	error = powerpc_setup_intr(device_get_nameunit(child),
	    rman_get_start(r), filt, intr, arg, flags, cookiep);

	return (error);
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:23,代码来源:nexus.c

示例5: XX_FreeIntr

t_Error
XX_FreeIntr(uintptr_t irq)
{
	device_t dev;
	struct resource *r;

	r = (struct resource *)irq;
	dev = rman_get_device(r);
	irq = rman_get_start(r);

	/* Handle preallocated interrupts */
	if (XX_IntrInfo[irq].flags & XX_INTR_FLAG_PREALLOCATED) {
		if (XX_IntrInfo[irq].handler == NULL)
			return (E_INVALID_STATE);

		XX_IntrInfo[irq].handler = NULL;
		XX_IntrInfo[irq].arg = NULL;

		return (E_OK);
	}

	return (bus_teardown_intr(dev, r, XX_IntrInfo[irq].cookie));
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:23,代码来源:xx.c

示例6: ndis_alloc_amem

static int
ndis_alloc_amem(struct ndis_softc *sc)
{
	int error, rid = NDIS_AM_RID;

	sc->ndis_res_am = bus_alloc_resource(sc->ndis_dev, SYS_RES_MEMORY,
	    &rid, 0UL, ~0UL, 0x1000, RF_ACTIVE);
	if (sc->ndis_res_am == NULL) {
		device_printf(sc->ndis_dev,
		    "failed to allocate attribute memory\n");
		return (ENXIO);
	}
	sc->ndis_rescnt++;
	resource_list_add(&sc->ndis_rl, SYS_RES_MEMORY, rid,
	    rman_get_start(sc->ndis_res_am), rman_get_end(sc->ndis_res_am),
	    rman_get_size(sc->ndis_res_am));

	error = CARD_SET_MEMORY_OFFSET(device_get_parent(sc->ndis_dev),
	    sc->ndis_dev, rid, 0, NULL);
	if (error) {
		device_printf(sc->ndis_dev,
		    "CARD_SET_MEMORY_OFFSET() returned 0x%x\n", error);
		return (error);
	}

	error = CARD_SET_RES_FLAGS(device_get_parent(sc->ndis_dev),
	    sc->ndis_dev, SYS_RES_MEMORY, rid, PCCARD_A_MEM_ATTR);
	if (error) {
		device_printf(sc->ndis_dev,
		    "CARD_SET_RES_FLAGS() returned 0x%x\n", error);
		return (error);
	}

	sc->ndis_am_rid = rid;

	return (0);
}
开发者ID:NDISulator,项目名称:ndisulator,代码行数:37,代码来源:if_ndis_pccard.c

示例7: ata_isa_probe

static int
ata_isa_probe(device_t dev)
{
    struct resource *io = NULL, *ctlio = NULL;
    u_long tmp;
    int rid;

    /* check isapnp ids */
    if (ISA_PNP_PROBE(device_get_parent(dev), dev, ata_ids) == ENXIO)
	return ENXIO;

    /* allocate the io port range */
    rid = ATA_IOADDR_RID;
    if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
				  ATA_IOSIZE, RF_ACTIVE)))
	return ENXIO;

    /* set the altport range */
    if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, &tmp, &tmp)) {
	bus_set_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID,
			 rman_get_start(io) + ATA_CTLOFFSET, ATA_CTLIOSIZE);
    }

    /* allocate the altport range */
    rid = ATA_CTLADDR_RID; 
    if (!(ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
				     ATA_CTLIOSIZE, RF_ACTIVE))) {
	bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
	return ENXIO;
    }

    /* Release resources to reallocate on attach. */
    bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlio);
    bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);

    return (ata_probe(dev));
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:37,代码来源:ata-isa.c

示例8: simplebus_setup_intr

static int
simplebus_setup_intr(device_t bus, device_t child, struct resource *res,
    int flags, driver_filter_t *filter, driver_intr_t *ihand, void *arg,
    void **cookiep)
{
	struct simplebus_devinfo *di;
	enum intr_trigger trig;
	enum intr_polarity pol;
	int error, rid;

	if (device_get_parent(child) != bus)
		return (ECHILD);

	di = device_get_ivars(child);
	if (di == NULL)
		return (ENXIO);

	if (res == NULL)
		return (EINVAL);

	rid = rman_get_rid(res);
	if (rid >= DI_MAX_INTR_NUM)
		return (ENOENT);

	trig = di->di_intr_sl[rid].trig;
	pol = di->di_intr_sl[rid].pol;
	if (trig != INTR_TRIGGER_CONFORM || pol != INTR_POLARITY_CONFORM) {
		error = bus_generic_config_intr(bus, rman_get_start(res),
		    trig, pol);
		if (error)
			return (error);
	}

	error = bus_generic_setup_intr(bus, child, res, flags, filter, ihand,
	    arg, cookiep);
	return (error);
}
开发者ID:ornarium,项目名称:freebsd,代码行数:37,代码来源:simplebus.c

示例9: obio_setup_intr

static int
obio_setup_intr(device_t dev, device_t child, struct resource *ires,
		int flags, driver_filter_t *filt, driver_intr_t *handler,
		void *arg, void **cookiep)
{
	struct obio_softc *sc = device_get_softc(dev);
	struct intr_event *event;
	int irq, ip_bit, error, mask, mask_register;

	irq = rman_get_start(ires);

	if (irq >= NIRQS)
		panic("%s: bad irq %d", __func__, irq);

	event = sc->sc_eventstab[irq];
	if (event == NULL) {
		error = intr_event_create(&event, (void *)irq, 0, irq, 
		    obio_mask_irq, obio_unmask_irq,
		    NULL, NULL,
		    "obio intr%d:", irq);

		sc->sc_eventstab[irq] = event;
	}

	intr_event_add_handler(event, device_get_nameunit(child), filt,
	    handler, arg, intr_priority(flags), flags, cookiep);

	/* unmask IRQ */
	mask_register = ICU_IRQ_MASK_REG(irq);
	ip_bit = ICU_IP_BIT(irq);

	mask = ICU_REG_READ(mask_register);
	ICU_REG_WRITE(mask_register, mask & ~ip_bit);

	return (0);
}
开发者ID:JabirTech,项目名称:Source,代码行数:36,代码来源:obio.c

示例10: omap_activate_resource

/**
 * omap_activate_resource
 *
 * 
 *
 */
static int
omap_activate_resource(device_t dev, device_t child, int type, int rid,
						 struct resource *r)
{

#if 0
	struct omap3_softc *sc = device_get_softc(dev);
	const struct hwvtrans *vtrans;
	uint32_t start = rman_get_start(r);
	uint32_t size = rman_get_size(r);
	
	if (type == SYS_RES_MEMORY) {
		vtrans = omap3_gethwvtrans(start, size);
		if (vtrans == NULL) {		/* NB: should not happen */
			device_printf(child, "%s: no mapping for 0x%lx:0x%lx\n",
						  __func__, start, size);
			return (ENOENT);
		}
		rman_set_bustag(r, sc->sc_iot);
		rman_set_bushandle(r, vtrans->vbase + (start - vtrans->hwbase));
	}
#endif
	return (rman_activate_resource(r));
}
开发者ID:christianrodher,项目名称:freebsd-armv6,代码行数:30,代码来源:omap.c

示例11: iobus_activate_resource

static int
iobus_activate_resource(device_t bus, device_t child, int type, int rid,
			   struct resource *res)
{
	struct iobus_softc *sc;
	void    *p;

	sc = device_get_softc(bus);

	if (type == SYS_RES_IRQ)
                return (bus_activate_resource(bus, type, rid, res));

	if ((type == SYS_RES_MEMORY) || (type == SYS_RES_IOPORT)) {
		p = pmap_mapdev((vm_offset_t)rman_get_start(res) + sc->sc_addr,
				(vm_size_t)rman_get_size(res));
		if (p == NULL)
			return (ENOMEM);
		rman_set_virtual(res, p);
		rman_set_bustag(res, &bs_le_tag);
		rman_set_bushandle(res, (u_long)p);
	}

	return (rman_activate_resource(res));
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:24,代码来源:iobus.c

示例12: nexus_activate_resource

static int
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
    struct resource *r)
{
	int err;
	bus_addr_t paddr;
	bus_size_t psize;
	bus_space_handle_t vaddr;

	if ((err = rman_activate_resource(r)) != 0)
		return (err);

	/*
	 * If this is a memory resource, map it into the kernel.
	 */
	if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
		paddr = (bus_addr_t)rman_get_start(r);
		psize = (bus_size_t)rman_get_size(r);
		err = bus_space_map(&memmap_bus, paddr, psize, 0, &vaddr);
		if (err != 0) {
			rman_deactivate_resource(r);
			return (err);
		}
		rman_set_bustag(r, &memmap_bus);
		rman_set_virtual(r, (void *)vaddr);
		rman_set_bushandle(r, vaddr);
	} else if (type == SYS_RES_IRQ) {
		err = intr_activate_irq(child, r);
		if (err != 0) {
			rman_deactivate_resource(r);
			return (err);
		}
	}

	return (0);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:36,代码来源:nexus.c

示例13: pxa_smi_attach

static int
pxa_smi_attach(device_t dev)
{
	int		error, i, dunit;
	const char	*dname;
	struct		pxa_smi_softc *sc;

	sc = (struct pxa_smi_softc *)device_get_softc(dev);

	error = bus_alloc_resources(dev, pxa_smi_spec, sc->ps_res);
	if (error) {
		device_printf(dev, "could not allocate resources\n");
		return (ENXIO);
	}

	sc->ps_mem.rm_type = RMAN_ARRAY;
	sc->ps_mem.rm_descr = device_get_nameunit(dev);
	if (rman_init(&sc->ps_mem) != 0)
		panic("pxa_smi_attach: failed to init mem rman");
	if (rman_manage_region(&sc->ps_mem, 0, PXA2X0_CS_SIZE * 6) != 0)
		panic("pxa_smi_attach: failed ot set up mem rman");

	sc->ps_bst = base_tag;
	sc->ps_base = rman_get_start(sc->ps_res[0]);

	i = 0;
	while (resource_find_match(&i, &dname, &dunit, "at",
	    device_get_nameunit(dev)) == 0) {
		pxa_smi_add_device(dev, dname, dunit);
	}

	bus_generic_probe(dev);
	bus_generic_attach(dev);

	return (0);
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:36,代码来源:pxa_smi.c

示例14: nexus_setup_intr

static int
nexus_setup_intr(device_t bus, device_t child, struct resource *res, int flags,
    driver_filter_t *ifilt, driver_intr_t *ihand, void *arg, void **cookiep)
{
	int error;

	*cookiep = NULL;

	/* somebody tried to setup an irq that failed to allocate! */
	if (res == NULL)
		return (EINVAL);

	if ((rman_get_flags(res) & RF_SHAREABLE) == 0)
		flags |= INTR_EXCL;

	/* We depend on rman_activate_resource() being idempotent. */
	error = rman_activate_resource(res);
	if (error)
		return (error);

	error = powerpc_setup_intr(device_get_nameunit(child),
	    rman_get_start(res), ifilt, ihand, arg, flags, cookiep);
	return (error);
}
开发者ID:ornarium,项目名称:freebsd,代码行数:24,代码来源:nexus.c

示例15: 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:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:79,代码来源:if_smc.c


注:本文中的rman_get_start函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。