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


C++ rman_activate_resource函数代码示例

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


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

示例1: nexus_activate_resource

static int
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
			struct resource *r)
{
	/*
	 * If this is a memory resource, map it into the kernel.
	 */
	if (rman_get_bustag(r) == I386_BUS_SPACE_MEM) {
		caddr_t vaddr = 0;

		if (rman_get_end(r) < 1024 * 1024) {
			/*
			 * The first 1Mb is mapped at KERNBASE.
			 */
			vaddr = (caddr_t)(uintptr_t)(KERNBASE + rman_get_start(r));
		} else {
			u_int64_t paddr;
			u_int64_t psize;
			u_int32_t poffs;

			paddr = rman_get_start(r);
			psize = rman_get_size(r);

			poffs = paddr - trunc_page(paddr);
			vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs;
		}
		rman_set_virtual(r, vaddr);
		/* IBM-PC: the type of bus_space_handle_t is u_int */
		rman_set_bushandle(r, (bus_space_handle_t) vaddr);
	}
	return (rman_activate_resource(r));
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:32,代码来源:nexus.c

示例2: nexus_activate_resource

static int
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
			struct resource *r)
{
	vm_paddr_t paddr, psize;
	void *vaddr;

	/*
	 * If this is a memory resource, map it into the kernel.
	 */
	switch (type) {
	case SYS_RES_IOPORT:
		rman_set_bustag(r, IA64_BUS_SPACE_IO);
		rman_set_bushandle(r, rman_get_start(r));
		break;
	case SYS_RES_MEMORY:
		paddr = rman_get_start(r);
		psize = rman_get_size(r);
		vaddr = pmap_mapdev(paddr, psize);
		rman_set_virtual(r, vaddr);
		rman_set_bustag(r, IA64_BUS_SPACE_MEM);
		rman_set_bushandle(r, (bus_space_handle_t) paddr);
		break;
	}
	return (rman_activate_resource(r));
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:26,代码来源:nexus.c

示例3: ofw_pci_activate_resource

int
ofw_pci_activate_resource(device_t bus, device_t child, int type, int rid,
                          struct resource *r)
{
    struct ofw_pci_softc *sc;
    struct bus_space_tag *tag;

    sc = device_get_softc(bus);
    switch (type) {
    case SYS_RES_IRQ:
        return (bus_generic_activate_resource(bus, child, type, rid,
                                              r));
    case SYS_RES_MEMORY:
        tag = sparc64_alloc_bus_tag(r, PCI_MEMORY_BUS_SPACE);
        if (tag == NULL)
            return (ENOMEM);
        rman_set_bustag(r, tag);
        rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_MEM32] +
                           rman_get_start(r));
        break;
    case SYS_RES_IOPORT:
        rman_set_bustag(r, sc->sc_pci_iot);
        rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_IO] +
                           rman_get_start(r));
        break;
    }
    return (rman_activate_resource(r));
}
开发者ID:embedclub,项目名称:freebsd,代码行数:28,代码来源:ofw_pci.c

示例4: thunder_pem_activate_resource

static int
thunder_pem_activate_resource(device_t dev, 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;
	struct thunder_pem_softc *sc;

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

	sc = device_get_softc(dev);

	/*
	 * 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);

		paddr = range_addr_pci_to_phys(sc->ranges, paddr);

		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);
	}
	return (0);
}
开发者ID:tomtor,项目名称:freebsd,代码行数:35,代码来源:thunder_pcie_pem.c

示例5: nexus_activate_resource

static int
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
    struct resource *r)
{
	void *vaddr;
	vm_paddr_t paddr;
	vm_size_t psize;
	int err;

	/*
	 * If this is a memory resource, use pmap_mapdev to map it.
	 */
	if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
		paddr = rman_get_start(r);
		psize = rman_get_size(r);
		rman_set_bustag(r, mips_bus_space_generic);
		err = bus_space_map(rman_get_bustag(r), paddr, psize, 0,
		    (bus_space_handle_t *)&vaddr);
		if (err != 0) {
			rman_deactivate_resource(r);
			return (err);
		}
		rman_set_virtual(r, vaddr);
		rman_set_bushandle(r, (bus_space_handle_t)(uintptr_t)vaddr);
	} else if (type == SYS_RES_IRQ) {
#ifdef INTRNG
		intr_activate_irq(child, r);
#endif
	}

	return (rman_activate_resource(r));
}
开发者ID:nomadlogic,项目名称:freebsd-base-graphics,代码行数:32,代码来源:nexus.c

示例6: ocpbus_setup_intr

static int
ocpbus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
    driver_filter_t *filter, driver_intr_t *ihand, void *arg, void **cookiep)
{
	int error;

	if (res == NULL)
		panic("ocpbus_setup_intr: NULL irq resource!");

	*cookiep = 0;
	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);

	error = powerpc_setup_intr(device_get_nameunit(child),
	    rman_get_start(res), filter, ihand, arg, flags, cookiep);

	return (error);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:25,代码来源:ocpbus.c

示例7: 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, domain;

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

	if (cookiep != NULL)
		*cookiep = NULL;
	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);

	if (bus_get_domain(child, &domain) != 0) {
		if(bootverbose)
			device_printf(child, "no domain found\n");
		domain = 0;
	}
	error = powerpc_setup_intr(device_get_nameunit(child),
	    rman_get_start(r), filt, intr, arg, flags, cookiep, domain);

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

示例8: fdtbus_activate_resource

static int
fdtbus_activate_resource(device_t bus, device_t child, int type, int rid,
    struct resource *res)
{

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

示例9: nexus_setup_intr

/*
 * Currently this uses the really grody interface from kern/kern_intr.c
 * (which really doesn't belong in kern/anything.c).  Eventually, all of
 * the code in kern_intr.c and machdep_intr.c should get moved here, since
 * this is going to be the official interface.
 */
static int
nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
		 int flags, void (*ihand)(void *), void *arg,
		 void **cookiep, lwkt_serialize_t serializer)
{
	int	error, icflags;

	/* somebody tried to setup an irq that failed to allocate! */
	if (irq == NULL)
		panic("nexus_setup_intr: NULL irq resource!");

	*cookiep = 0;
	icflags = flags;
	if ((irq->r_flags & RF_SHAREABLE) == 0)
		icflags |= INTR_EXCL;

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

	/*
	 * XXX cast the interrupt handler function to an inthand2_t.  The
	 * difference is that an additional frame argument is passed which
	 * we do not currently want to expose the BUS subsystem to.
	 */
	*cookiep = register_int(irq->r_start, (inthand2_t *)ihand, arg,
				device_get_nameunit(child), serializer,
				icflags, rman_get_cpuid(irq));
	if (*cookiep == NULL)
		error = EINVAL;
	return (error);
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:41,代码来源:nexus.c

示例10: 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) {
		intr_activate_irq(child, r);
	}
	return (0);
}
开发者ID:nomadlogic,项目名称:freebsd-base-graphics,代码行数:31,代码来源:nexus.c

示例11: nexus_activate_resource

static int
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
    struct resource *r)
{
	/*
	 * If this is a memory resource, map it into the kernel.
	 */
	if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
		caddr_t vaddr = 0;
		u_int32_t paddr;
		u_int32_t psize;
		u_int32_t poffs;

		paddr = rman_get_start(r);
		psize = rman_get_size(r);
		poffs = paddr - trunc_page(paddr);
		vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs;
		rman_set_virtual(r, vaddr);
#ifdef FDT
		rman_set_bustag(r, fdtbus_bs_tag);
#else
		rman_set_bustag(r, (void *)1);
#endif
		rman_set_bushandle(r, (bus_space_handle_t) vaddr);
	}
	return (rman_activate_resource(r));
}
开发者ID:amir-partovi,项目名称:Taha,代码行数:27,代码来源:nexus.c

示例12: pxa_activate_resource

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

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

示例13: unin_chip_activate_resource

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

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

	if ((type == SYS_RES_MEMORY) || (type == SYS_RES_IOPORT)) {
		vm_offset_t start;

		start = (vm_offset_t) rman_get_start(res);

		if (bootverbose)
			printf("unin mapdev: start %zx, len %ld\n", start,
			       rman_get_size(res));

		p = pmap_mapdev(start, (vm_size_t) rman_get_size(res));
		if (p == NULL)
			return (ENOMEM);
		rman_set_virtual(res, p);
		rman_set_bustag(res, &bs_be_tag);
		rman_set_bushandle(res, (u_long)p);
	}

	return (rman_activate_resource(res));
}
开发者ID:coyizumi,项目名称:cs111,代码行数:28,代码来源:uninorth.c

示例14: ebus_activate_resource

static int
ebus_activate_resource(device_t bus, device_t child, int type, int rid,
    struct resource *res)
{
	struct ebus_softc *sc;
	struct ebus_rinfo *eri;
	bus_space_tag_t bt;
	bus_space_handle_t bh;
	int i, rv;

	sc = device_get_softc(bus);
	if ((sc->sc_flags & EBUS_PCI) != 0 && type == SYS_RES_MEMORY) {
		for (i = 0; i < sc->sc_nrange; i++) {
			eri = &sc->sc_rinfo[i];
			if (rman_is_region_manager(res, &eri->eri_rman) != 0) {
				bt = rman_get_bustag(eri->eri_res);
				rv = bus_space_subregion(bt,
				    rman_get_bushandle(eri->eri_res),
				    rman_get_start(res) -
				    rman_get_start(eri->eri_res),
				    rman_get_size(res), &bh);
				if (rv != 0)
					return (rv);
				rman_set_bustag(res, bt);
				rman_set_bushandle(res, bh);
				return (rman_activate_resource(res));
			}
		}
		return (EINVAL);
	}
	return (bus_generic_activate_resource(bus, child, type, rid, res));
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:32,代码来源:ebus.c

示例15: wiibus_activate_resource

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

	switch (type) {
	case SYS_RES_MEMORY:
		p = pmap_mapdev(rman_get_start(res), rman_get_size(res));
		if (p == NULL)
			return (ENOMEM);
		rman_set_virtual(res, p);
		rman_set_bustag(res, &bs_be_tag);
		rman_set_bushandle(res, (unsigned long)p);
		break;
	case SYS_RES_IRQ:
		return (bus_activate_resource(bus, type, rid, res));
	default:
		device_printf(bus,
		    "unknown activate resource request from %s\n",
		    device_get_nameunit(child));
		return (ENXIO);
	}
	
	return (rman_activate_resource(res));
}
开发者ID:coyizumi,项目名称:cs111,代码行数:26,代码来源:wii_bus.c


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