Implement BUS_{GET,SET,DELETE}_RESOURCE methods.

This commit is contained in:
Matthew N. Dodd 2000-01-13 09:01:46 +00:00
parent 919886a01f
commit 47a70d921b

View File

@ -51,7 +51,7 @@
#include <sys/interrupt.h>
#define MAX_COL 79
#define MAX_COL 79
static void mca_reg_print (device_t, char *, char *, int *);
@ -497,7 +497,45 @@ mca_release_resource (device_t dev, device_t child, int type, int rid,
{
struct mca_device * m_dev = device_get_ivars(child);
return (resource_list_release(&(m_dev->rl), dev, child, type, rid, r));
return (resource_list_release(&(m_dev->rl), dev, child, type, rid, r));
}
static int
mca_get_resource(device_t dev, device_t child, int type, int rid,
u_long *startp, u_long *countp)
{
struct mca_device * m_dev = device_get_ivars(child);
struct resource_list * rl = &(m_dev->rl);
struct resource_list_entry * rle;
rle = resource_list_find(rl, type, rid);
if (!rle)
return ENOENT;
*startp = rle->start;
*countp = rle->count;
return (0);
}
static int
mca_set_resource(device_t dev, device_t child, int type, int rid,
u_long start, u_long count)
{
struct mca_device * m_dev = device_get_ivars(child);
struct resource_list * rl = &(m_dev->rl);
resource_list_add(rl, type, rid, start, start + count - 1, count);
return (0);
}
static void
mca_delete_resource(device_t dev, device_t child, int type, int rid)
{
struct mca_device * m_dev = device_get_ivars(child);
struct resource_list * rl = &(m_dev->rl);
resource_list_delete(rl, type, rid);
}
static device_method_t mca_methods[] = {
@ -521,6 +559,10 @@ static device_method_t mca_methods[] = {
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
DEVMETHOD(bus_set_resource, mca_set_resource),
DEVMETHOD(bus_get_resource, mca_get_resource),
DEVMETHOD(bus_delete_resource, mca_delete_resource),
{ 0, 0 }
};