bus_get_resource(9)

bus_get_resource9

Read a resource range/value with a given resource id

Usage

#include <sys/param.h>

#include <sys/bus.h>

#include <sys/rman.h>

int

bus_get_resource(device_t dev, int type, int rid, rman_res_t *startp, rman_res_t *countp);

Overview

The bus_get_resource() function reads the range or value of the resource type, rid, pair and stores it in the startp and countp arguments.

The arguments are as follows:

dev

The device to read the resource from.

type

The type of resource you want to read. It is one of:

SYS_RES_IRQ

for IRQs

SYS_RES_DRQ

for ISA DMA lines

SYS_RES_MEMORY

for I/O memory

SYS_RES_IOPORT

for I/O ports

rid

A bus-specific handle that identifies the resource being read.

startp

A pointer to the start address of this resource.

countp

A pointer to the length of the resource. For example, the size of the memory in bytes.

Return values

Zero is returned on success, otherwise an error is returned.

Releases

27 releases since FreeBSD 10.3-RELEASE; the text changed 13 times.

  1. 10.3
  2. 10.4
  3. 11.0
  4. 11.1
  5. 11.2
  6. 11.3
  7. 11.4
  8. 12.0
  9. 12.1
  10. 12.2
  11. 12.3
  12. 12.4
  13. 13.0–13.2
  14. 13.3–16.0

Authors

This manual page was written by Sascha Wildner.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.