mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
sys: Don't pass RF_ALLOCATED to bus_alloc_resource*
This is a nop as eventually these flags are passed to rman_reserve_resource which unconditionally sets RF_ALLOCATED in the new flags for a region. However, it's really a layering violation to use RF_ALLOCATED in relation to struct resource objects outside of subr_rman.c as subr_rman.c uses this flag to manage it's internal tracking of allocated vs free regions. In addition, don't document this as a valid flag in the manual. I think the intention here was that if a caller didn't want to pass RF_ACTIVE or RF_SHAREABLE, they could pass RF_ALLOCATED instead of 0, but given the layering violation, I think it's best to just pass 0 instead in that case. NB: The bhnd bus uses RF_ALLOCATED (along with RF_ACTIVE) in a separate API to manage resource regions that are not struct resource objects (but a separate wrapper object). It would perhaps be cleaner if the chipc_retain_region and chipc_release_region functions used their own flag constants instead of reusing the rman(9) flags. Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D55683
This commit is contained in:
1 parent
ca25b1b263
commit
1e4086d052
3 files changed
+6
-11
No files matched your search
@@ -26,7 +26,7 @@
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd October 30, 2025
|
||||
.Dd March 6, 2026
|
||||
.Dt BUS_ALLOC_RESOURCE 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -142,12 +142,8 @@ is used, if it is bigger than the default value.
|
||||
.It
|
||||
.Fa flags
|
||||
sets the flags for the resource.
|
||||
You can set one or more of these flags:
|
||||
.Bl -tag -width RF_SHAREABLE
|
||||
.It Dv RF_ALLOCATED
|
||||
resource has been reserved.
|
||||
The resource still needs to be activated with
|
||||
.Xr bus_activate_resource 9 .
|
||||
You can set zero or more of these flags:
|
||||
.Bl -tag -width RF_PREFETCHABLE
|
||||
.It Dv RF_ACTIVE
|
||||
activate resource atomically.
|
||||
.It Dv RF_PREFETCHABLE
|
||||
|
||||
@@ -1468,7 +1468,7 @@ tegra_pcib_attach(device_t dev)
|
||||
}
|
||||
/*
|
||||
* XXX - FIXME
|
||||
* tag for config space is not filled when RF_ALLOCATED flag is used.
|
||||
* tag for config space is not filled when RF_ACTIVE flag is not used.
|
||||
*/
|
||||
sc->bus_tag = rman_get_bustag(sc->pads_mem_res);
|
||||
|
||||
@@ -1482,8 +1482,7 @@ tegra_pcib_attach(device_t dev)
|
||||
}
|
||||
|
||||
rid = 2;
|
||||
sc->cfg_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
|
||||
RF_ALLOCATED);
|
||||
sc->cfg_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0);
|
||||
if (sc->cfg_mem_res == NULL) {
|
||||
device_printf(dev, "Cannot allocate config space memory\n");
|
||||
rv = ENXIO;
|
||||
|
||||
@@ -494,7 +494,7 @@ amdiommu_attach(device_t dev)
|
||||
}
|
||||
sc->mmio_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mmio_rid,
|
||||
sc->mmio_base, sc->mmio_base + sc->mmio_sz - 1, sc->mmio_sz,
|
||||
RF_ALLOCATED | RF_ACTIVE | RF_SHAREABLE);
|
||||
RF_ACTIVE | RF_SHAREABLE);
|
||||
if (sc->mmio_res == NULL) {
|
||||
device_printf(dev,
|
||||
"bus_alloc_resource %#jx-%#jx failed\n",
|
||||
|
||||
Reference in new issue
Block a user