smmu_device_report_reserved()

Updated: May 06, 2022

Report which memory region or regions are reserved for a DMA device that requires device-specific reserved memory

Synopsis:

#include <smmu.h>

unsigned smmu_device_report_reserved(const union smmu_devid *devid,
                                           unsigned offset,
                                           struct smmu_map_entry *resv,
                                           unsigned nresv);

Arguments:

devid
A pointer to the DMA device's ID.
offset
The starting index of the reserved memory array for which information will be returned.
If you set this argument to a location beyond the last reserved entry, you can call smmu_device_report_reserved() repeatedly with an ever-increasing offset, retrieving a fixed number of entries at each call, until you have retrieved all the entries.
resv
A pointer to a structure that the function populates with information about the memory regions reserved for the DMA device (see smmu_map_entry).
nresv
The number of elements in the array referenced by resv; should be greater than 0 (zero).

Library:

libsmmu.a

Description:

The smmu_device_report_reserved() function fills in the smmu_map_entry data structure referenced by resv with information about the reserved memory regions for the device referenced by devid.

For more information about reserved memory regions, see the reserved option under Global options.

Returns:

-1
Failure: errno is set.
0
The offset argument is to a location beyond the last reserved entry.
>0
The number of elements filled into the resv array.
If there are additional entries to be returned, this returned value will be greater than the value of nresv. However, the number of array entries actually filled in is only ever nresv.