Logical memory blocks
-
enum lmb_flags
definition of memory region attributes
Constants
LMB_NONEno special request
LMB_NOMAPdon’t add to mmu configuration
-
struct lmb_property
Description of one region.
Definition
struct lmb_property {
phys_addr_t base;
phys_size_t size;
enum lmb_flags flags;
};
Members
baseBase address of the region.
sizeSize of the region
flagsmemory region attributes
-
struct lmb_region
Description of a set of region.
Definition
struct lmb_region {
unsigned long cnt;
unsigned long max;
#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS);
struct lmb_property region[CONFIG_LMB_MAX_REGIONS];
#else;
struct lmb_property *region;
#endif;
};
Members
cntNumber of regions.
maxSize of the region array, max value of cnt.
regionArray of the region properties
regionArray of the region properties
-
struct lmb
Logical memory block handle.
Definition
struct lmb {
struct lmb_region memory;
struct lmb_region reserved;
#if !IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS);
struct lmb_property memory_regions[CONFIG_LMB_MEMORY_REGIONS];
struct lmb_property reserved_regions[CONFIG_LMB_RESERVED_REGIONS];
#endif;
};
Members
memoryDescription of memory regions.
reservedDescription of reserved regions.
memory_regionsArray of the memory regions (statically allocated)
reserved_regionsArray of the reserved regions (statically allocated)
Description
Clients provide storage for Logical memory block (lmb) handles. The content of the structure is managed by the lmb library. A lmb struct is initialized by lmb_init() functions. The lmb struct is passed to all other lmb APIs.
-
long lmb_reserve_flags(struct lmb *lmb, phys_addr_t base, phys_size_t size, enum lmb_flags flags)
Reserve one region with a specific flags bitfield.
Parameters
struct lmb *lmbthe logical memory block struct
phys_addr_t basebase address of the memory region
phys_size_t sizesize of the memory region
enum lmb_flags flagsflags for the memory region
Return
0 if OK, > 0 for coalesced region or a negative error code.
Parameters
struct lmb *lmbthe logical memory block struct
phys_addr_t addraddress to be tested
Description
The function checks if a reserved region comprising addr exists.
Return
1 if reservation exists, 0 otherwise
-
int lmb_is_reserved_flags(struct lmb *lmb, phys_addr_t addr, int flags)
test if address is in reserved region with flag bits set
Parameters
struct lmb *lmbthe logical memory block struct
phys_addr_t addraddress to be tested
int flagsbitmap with bits to be tested
Description
The function checks if a reserved region comprising addr exists which has all flag bits set which are set in flags.
Return
1 if matching reservation exists, 0 otherwise