int
firmware_open(
const char *drvname
, const char *imgname
, firmware_handle_t *fhp
)
int
firmware_close(
firmware_handle_t fh
)
off_t
firmware_get_size(
firmware_handle_t fh
)
int
firmware_read(
firmware_handle_t fh
, off_t offset
, void *buf
, size_t size
)
void
*
firmware_malloc(
size_t size
)
void
firmware_free(
void *buf
, size_t size
)
hw.firmware.path
.
The following functions are provided by the firmload API:
, const char *drvname
, const char *imgname
, firmware_handle_t *fhp
)
Open then firmware image
imgname
for the driver
drvname
.
The path to the firmware image file is constructed by appending the string
``/drvname/imgname''
to each configured path prefix until opening the firmware image file succeeds.
Upon success,
firmware_open()
returns 0 and stores a firmware image handle in the location pointed to by
fhp
.
Otherwise, an error code is returned to indicate the reason for failure.
, firmware_handle_t fh
)
Close the firmware image file associated with the firmware handle
fh
.
Returns 0 upon success or an error code to indicate the reason for failure.
, firmware_handle_t fh
)
Returns the size of the image file associated with the firmware handle
fh
.
, firmware_handle_t fh
, off_t offset
, void *buf
, size_t size
)
Reads from the image file associated with the firmware handle
fh
beginning at offset
offset
for length
size
.
The firmware image data is placed into the buffer specified by
buf
.
Returns 0 upon success or an error code to indicate the reason for failure.
size_t size
)
Allocates a region of wired kernel memory of size
size
.
Note:
firmware_malloc()
may block.
, void *buf
, size_t size
)
Frees a region of memory previously allocated by
firmware_malloc().