summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/man/man9/Makefile1
-rw-r--r--share/man/man9/bus_alloc_resource.924
-rw-r--r--sys/sys/bus.h6
3 files changed, 27 insertions, 4 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 471c1e0..f6f7e51 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -344,6 +344,7 @@ MLINKS+=atomic.9 atomic_add.9 \
atomic.9 atomic_subtract.9
MLINKS+=buf.9 bp.9
MLINKS+=bus_activate_resource.9 bus_deactivate_resource.9
+MLINKS+=bus_alloc_resource.9 bus_alloc_resource_any.9
MLINKS+=bus_dma.9 busdma.9 \
bus_dma.9 bus_dmamap_create.9 \
bus_dma.9 bus_dmamap_destroy.9 \
diff --git a/share/man/man9/bus_alloc_resource.9 b/share/man/man9/bus_alloc_resource.9
index 9bb9c88..b0c151b 100644
--- a/share/man/man9/bus_alloc_resource.9
+++ b/share/man/man9/bus_alloc_resource.9
@@ -32,7 +32,8 @@
.Dt BUS_ALLOC_RESOURCE 9
.Os
.Sh NAME
-.Nm bus_alloc_resource
+.Nm bus_alloc_resource ,
+.Nm bus_alloc_resource_any
.Nd allocate resources from a parent bus
.Sh SYNOPSIS
.In sys/param.h
@@ -43,13 +44,28 @@
.In machine/resource.h
.Ft struct resource *
.Fn bus_alloc_resource "device_t dev" "int type" "int *rid" "u_long start" "u_long end" "u_long count" "u_int flags"
+.Ft struct resource *
+.Fn bus_alloc_resource_any "device_t dev" "int type" "int *rid" "u_int flags"
.Sh DESCRIPTION
This is an easy interface to the resource-management functions.
It hides the indirection through the parent's method table.
This function generally should be called in attach, but (except in some
rare cases) never earlier.
.Pp
-Its arguments are as follows:
+The
+.Fn bus_alloc_resource_any
+function is a convenience wrapper for
+.Fn bus_alloc_resource .
+It sets the values for
+.Fa start ,
+.Fa end ,
+and
+.Fa count
+to the default resource (see description of
+.Fa start
+below).
+.Pp
+The arguments are as follows:
.Bl -item
.It
.Fa dev
@@ -150,8 +166,8 @@ should be saved in the softc of the device after these calls.
irqid = 0;
portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &portid,
0ul, ~0ul, 32, RF_ACTIVE);
- irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &irqid,
- 0ul, ~0ul, 1, RF_ACTIVE | RF_SHAREABLE);
+ irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &irqid,
+ RF_ACTIVE | RF_SHAREABLE);
.Ed
.Sh SEE ALSO
.Xr bus_activate_resource 9 ,
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 79d4d157..ff260ed 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -309,6 +309,12 @@ int bus_child_present(device_t child);
int bus_child_pnpinfo_str(device_t child, char *buf, size_t buflen);
int bus_child_location_str(device_t child, char *buf, size_t buflen);
+static __inline struct resource *
+bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
+{
+ return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags));
+}
+
/*
* Access functions for device.
*/
OpenPOWER on IntegriCloud