diff options
author | mdodd <mdodd@FreeBSD.org> | 2000-01-13 09:01:46 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2000-01-13 09:01:46 +0000 |
commit | a6ceaaf2dd424868a9a6f110b91a1ccee7ab42bb (patch) | |
tree | 4673014693e49b327f90a8c62136e074306b5f4e /sys/dev/mca | |
parent | 1c77c86e65f80ee2f2844caa9168c1e73fec6ace (diff) | |
download | FreeBSD-src-a6ceaaf2dd424868a9a6f110b91a1ccee7ab42bb.zip FreeBSD-src-a6ceaaf2dd424868a9a6f110b91a1ccee7ab42bb.tar.gz |
Implement BUS_{GET,SET,DELETE}_RESOURCE methods.
Diffstat (limited to 'sys/dev/mca')
-rw-r--r-- | sys/dev/mca/mca_bus.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/sys/dev/mca/mca_bus.c b/sys/dev/mca/mca_bus.c index a2dd456..61aa5be 100644 --- a/sys/dev/mca/mca_bus.c +++ b/sys/dev/mca/mca_bus.c @@ -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 } }; |