本文整理汇总了C++中rman_get_flags函数的典型用法代码示例。如果您正苦于以下问题:C++ rman_get_flags函数的具体用法?C++ rman_get_flags怎么用?C++ rman_get_flags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rman_get_flags函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ofw_pci_adjust_resource
static int
ofw_pci_adjust_resource(device_t bus, device_t child, int type,
struct resource *res, u_long start, u_long end)
{
struct rman *rm = NULL;
struct ofw_pci_softc *sc = device_get_softc(bus);
KASSERT(!(rman_get_flags(res) & RF_ACTIVE),
("active resources cannot be adjusted"));
if (rman_get_flags(res) & RF_ACTIVE)
return (EINVAL);
switch (type) {
case SYS_RES_MEMORY:
rm = &sc->sc_mem_rman;
break;
case SYS_RES_IOPORT:
rm = &sc->sc_io_rman;
break;
default:
return (ENXIO);
}
if (!rman_is_region_manager(res, rm))
return (EINVAL);
return (rman_adjust_resource(res, start, end));
}
示例2: pci_vf_release_mem_resource
int
pci_vf_release_mem_resource(device_t dev, device_t child, int rid,
struct resource *r)
{
struct pci_devinfo *dinfo;
struct resource_list_entry *rle;
int error;
dinfo = device_get_ivars(child);
if (rman_get_flags(r) & RF_ACTIVE) {
error = bus_deactivate_resource(child, SYS_RES_MEMORY, rid, r);
if (error != 0)
return (error);
}
rle = resource_list_find(&dinfo->resources, SYS_RES_MEMORY, rid);
if (rle != NULL) {
rle->res = NULL;
resource_list_delete(&dinfo->resources, SYS_RES_MEMORY,
rid);
}
return (rman_release_resource(r));
}
示例3: 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 = inthand_add(device_get_nameunit(child), rman_get_start(r),
filt, intr, arg, flags, cookiep);
/*
* XXX in case of the AFB/FFB interrupt and a Psycho, Sabre or U2S
* bridge enable the interrupt in the respective bridge.
*/
return (error);
}
示例4: 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);
}
示例5: 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);
}
示例6: chipc_activate_bhnd_resource
static int
chipc_activate_bhnd_resource(device_t dev, device_t child, int type,
int rid, struct bhnd_resource *r)
{
struct chipc_softc *sc;
struct rman *rm;
int error;
sc = device_get_softc(dev);
/* Delegate non-locally managed resources to parent */
rm = chipc_get_rman(sc, type);
if (rm == NULL || !rman_is_region_manager(r->res, rm)) {
return (bhnd_bus_generic_activate_resource(dev, child, type,
rid, r));
}
/* Try activating the chipc region resource */
error = chipc_try_activate_resource(sc, child, type, rid, r->res,
false);
if (error)
return (error);
/* Mark the child resource as direct according to the returned resource
* state */
if (rman_get_flags(r->res) & RF_ACTIVE)
r->direct = true;
return (0);
}
示例7: 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, driver_filter_t filter, void (*ihand)(void *),
void *arg, void **cookiep)
{
int error;
/* somebody tried to setup an irq that failed to allocate! */
if (irq == NULL)
panic("nexus_setup_intr: NULL irq resource!");
*cookiep = 0;
if ((rman_get_flags(irq) & RF_SHAREABLE) == 0)
flags |= INTR_EXCL;
/*
* We depend here on rman_activate_resource() being idempotent.
*/
error = rman_activate_resource(irq);
if (error)
return (error);
error = intr_add_handler(device_get_nameunit(child),
rman_get_start(irq), filter, ihand, arg, flags, cookiep);
return (error);
}
示例8: nexus_release_resource
static int
nexus_release_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
if (rman_get_flags(r) & RF_ACTIVE) {
int error = bus_deactivate_resource(child, type, rid, r);
if (error)
return error;
}
return (rman_release_resource(r));
}
示例9: 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)
{
if ((rman_get_flags(res) & RF_SHAREABLE) == 0)
flags |= INTR_EXCL;
arm_setup_irqhandler(device_get_nameunit(child),
filt, intr, arg, rman_get_start(res), flags, cookiep);
return (0);
}
示例10: ofwbus_release_resource
static int
ofwbus_release_resource(device_t bus __unused, device_t child, int type,
int rid, struct resource *r)
{
int error;
if ((rman_get_flags(r) & RF_ACTIVE) != 0) {
error = bus_deactivate_resource(child, type, rid, r);
if (error)
return (error);
}
return (rman_release_resource(r));
}
示例11: lbc_release_resource
static int
lbc_release_resource(device_t dev, device_t child, int type, int rid,
struct resource *res)
{
int err;
if (rman_get_flags(res) & RF_ACTIVE) {
err = bus_deactivate_resource(child, type, rid, res);
if (err)
return (err);
}
return (rman_release_resource(res));
}
示例12: ofw_pci_release_resource
static int
ofw_pci_release_resource(device_t bus, device_t child, int type, int rid,
struct resource *res)
{
if (rman_get_flags(res) & RF_ACTIVE) {
int error;
error = bus_deactivate_resource(child, type, rid, res);
if (error != 0)
return (error);
}
return (rman_release_resource(res));
}
示例13: 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 irq;
if ((rman_get_flags(res) & RF_SHAREABLE) == 0)
flags |= INTR_EXCL;
for (irq = rman_get_start(res); irq <= rman_get_end(res); irq++) {
arm_setup_irqhandler(device_get_nameunit(child),
filt, intr, arg, irq, flags, cookiep);
arm_unmask_irq(irq);
}
return (0);
}
示例14: nexus_release_resource
static int
nexus_release_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
if (rman_get_flags(r) & RF_ACTIVE) {
int error = bus_deactivate_resource(child, type, rid, r);
if (error)
return error;
}
#ifdef PC98
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
i386_bus_space_handle_free(r->r_bustag, r->r_bushandle,
r->r_bushandle->bsh_sz);
}
#endif
return (rman_release_resource(r));
}
示例15: zbpci_release_resource
static int
zbpci_release_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
int error;
if (type != SYS_RES_IOPORT)
return (bus_generic_release_resource(bus, child, type, rid, r));
if (rman_get_flags(r) & RF_ACTIVE) {
error = bus_deactivate_resource(child, type, rid, r);
if (error)
return (error);
}
return (rman_release_resource(r));
}