Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107145768
D44124.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D44124.diff
View Options
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -4545,6 +4545,13 @@
return (BUS_ADJUST_RESOURCE(dev->parent, dev, type, r, start, end));
}
+int
+bus_adjust_resource_new(device_t dev, struct resource *r, rman_res_t start,
+ rman_res_t end)
+{
+ return (bus_adjust_resource(dev, rman_get_type(r), r, start, end));
+}
+
/**
* @brief Wrapper function for BUS_TRANSLATE_RESOURCE().
*
@@ -4574,6 +4581,13 @@
return (BUS_ACTIVATE_RESOURCE(dev->parent, dev, type, rid, r));
}
+int
+bus_activate_resource_new(device_t dev, struct resource *r)
+{
+ return (bus_activate_resource(dev, rman_get_type(r), rman_get_rid(r),
+ r));
+}
+
/**
* @brief Wrapper function for BUS_DEACTIVATE_RESOURCE().
*
@@ -4588,6 +4602,13 @@
return (BUS_DEACTIVATE_RESOURCE(dev->parent, dev, type, rid, r));
}
+int
+bus_deactivate_resource_new(device_t dev, struct resource *r)
+{
+ return (bus_deactivate_resource(dev, rman_get_type(r), rman_get_rid(r),
+ r));
+}
+
/**
* @brief Wrapper function for BUS_MAP_RESOURCE().
*
@@ -4603,6 +4624,13 @@
return (BUS_MAP_RESOURCE(dev->parent, dev, type, r, args, map));
}
+int
+bus_map_resource_new(device_t dev, struct resource *r,
+ struct resource_map_request *args, struct resource_map *map)
+{
+ return (bus_map_resource(dev, rman_get_type(r), r, args, map));
+}
+
/**
* @brief Wrapper function for BUS_UNMAP_RESOURCE().
*
@@ -4618,6 +4646,13 @@
return (BUS_UNMAP_RESOURCE(dev->parent, dev, type, r, map));
}
+int
+bus_unmap_resource_new(device_t dev, struct resource *r,
+ struct resource_map *map)
+{
+ return (bus_unmap_resource(dev, rman_get_type(r), r, map));
+}
+
/**
* @brief Wrapper function for BUS_RELEASE_RESOURCE().
*
@@ -4635,6 +4670,13 @@
return (rv);
}
+int
+bus_release_resource_new(device_t dev, struct resource *r)
+{
+ return (bus_release_resource(dev, rman_get_type(r), rman_get_rid(r),
+ r));
+}
+
/**
* @brief Wrapper function for BUS_SETUP_INTR().
*
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -613,6 +613,43 @@
return (bus_alloc_resource(dev, type, rid, 0, ~0, count, flags));
}
+/* Compat shims for simpler bus resource API. */
+int bus_adjust_resource_new(device_t child, struct resource *r,
+ rman_res_t start, rman_res_t end);
+int bus_activate_resource_new(device_t dev, struct resource *r);
+int bus_deactivate_resource_new(device_t dev, struct resource *r);
+int bus_map_resource_new(device_t dev, struct resource *r,
+ struct resource_map_request *args, struct resource_map *map);
+int bus_unmap_resource_new(device_t dev, struct resource *r,
+ struct resource_map *map);
+int bus_release_resource_new(device_t dev, struct resource *r);
+
+#define _BUS_API_MACRO(_1, _2, _3, _4, _5, NAME, ...) NAME
+
+#define bus_adjust_resource(...) \
+ _BUS_API_MACRO(__VA_ARGS__, bus_adjust_resource, \
+ bus_adjust_resource_new)(__VA_ARGS__)
+
+#define bus_activate_resource(...) \
+ _BUS_API_MACRO(__VA_ARGS__, INVALID, bus_activate_resource, \
+ INVALID, bus_activate_resource_new)(__VA_ARGS__)
+
+#define bus_deactivate_resource(...) \
+ _BUS_API_MACRO(__VA_ARGS__, INVALID, bus_deactivate_resource, \
+ INVALID, bus_deactivate_resource_new)(__VA_ARGS__)
+
+#define bus_map_resource(...) \
+ _BUS_API_MACRO(__VA_ARGS__, bus_map_resource, \
+ bus_map_resource_new)(__VA_ARGS__)
+
+#define bus_unmap_resource(...) \
+ _BUS_API_MACRO(__VA_ARGS__, INVALID, bus_unmap_resource, \
+ bus_unmap_resource_new)(__VA_ARGS__)
+
+#define bus_release_resource(...) \
+ _BUS_API_MACRO(__VA_ARGS__, INVALID, bus_release_resource, \
+ INVALID, bus_release_resource_new)(__VA_ARGS__)
+
/*
* Access functions for device.
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 8:02 PM (20 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15757297
Default Alt Text
D44124.diff (3 KB)
Attached To
Mode
D44124: new-bus: Introduce a simpler bus API for managing resources
Attached
Detach File
Event Timeline
Log In to Comment