mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
Implement bus_adjust_resource() for the ia64 nexus driver.
Reviewed by: marcel Approved by: re (kib)
This commit is contained in:
parent
778b0e42a8
commit
fbd3fc8fc7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224184
@ -86,6 +86,8 @@ static device_t nexus_add_child(device_t bus, u_int order, const char *name,
|
||||
int unit);
|
||||
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
|
||||
u_long, u_long, u_long, u_int);
|
||||
static int nexus_adjust_resource(device_t, device_t, int, struct resource *,
|
||||
u_long, u_long);
|
||||
static int nexus_activate_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_deactivate_resource(device_t, device_t, int, int,
|
||||
@ -122,6 +124,7 @@ static device_method_t nexus_methods[] = {
|
||||
DEVMETHOD(bus_print_child, nexus_print_child),
|
||||
DEVMETHOD(bus_add_child, nexus_add_child),
|
||||
DEVMETHOD(bus_alloc_resource, nexus_alloc_resource),
|
||||
DEVMETHOD(bus_adjust_resource, nexus_adjust_resource),
|
||||
DEVMETHOD(bus_release_resource, nexus_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, nexus_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
|
||||
@ -238,6 +241,20 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit)
|
||||
return(child);
|
||||
}
|
||||
|
||||
static struct rman *
|
||||
nexus_rman(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
return (&irq_rman);
|
||||
case SYS_RES_IOPORT:
|
||||
return (&port_rman);
|
||||
case SYS_RES_MEMORY:
|
||||
return (&mem_rman);
|
||||
default:
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a resource on behalf of child. NB: child is usually going to be a
|
||||
@ -271,23 +288,9 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
||||
}
|
||||
|
||||
flags &= ~RF_ACTIVE;
|
||||
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
rm = &irq_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_IOPORT:
|
||||
rm = &port_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_MEMORY:
|
||||
rm = &mem_rman;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
rm = nexus_rman(type);
|
||||
if (rm == NULL)
|
||||
return (NULL);
|
||||
|
||||
rv = rman_reserve_resource(rm, start, end, count, flags, child);
|
||||
if (rv == 0)
|
||||
@ -304,6 +307,20 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_adjust_resource(device_t bus, device_t child, int type,
|
||||
struct resource *r, u_long start, u_long end)
|
||||
{
|
||||
struct rman *rm;
|
||||
|
||||
rm = nexus_rman(type);
|
||||
if (rm == NULL)
|
||||
return (ENXIO);
|
||||
if (!rman_is_region_manager(r, rm))
|
||||
return (EINVAL);
|
||||
return (rman_adjust_resource(r, start, end));
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
|
Loading…
Reference in New Issue
Block a user