summaryrefslogtreecommitdiffstats
path: root/sys/dev/mca/mca_bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mca/mca_bus.c')
-rw-r--r--sys/dev/mca/mca_bus.c46
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 }
};
OpenPOWER on IntegriCloud