|
iPXE
|
System memory map. More...
#include <stddef.h>#include <stdint.h>#include <ipxe/api.h>#include <ipxe/tables.h>#include <config/ioapi.h>#include <ipxe/null_memmap.h>#include <ipxe/fdtmem.h>#include <bits/memmap.h>Go to the source code of this file.
Data Structures | |
| struct | memmap_region |
| A memory region descriptor. More... | |
| struct | used_region |
| An in-use memory region. More... | |
Macros | |
| #define | MEMMAP_INLINE(_subsys, _api_func) SINGLE_API_INLINE ( MEMMAP_PREFIX_ ## _subsys, _api_func ) |
| Calculate static inline memory map API function name. More... | |
| #define | PROVIDE_MEMMAP(_subsys, _api_func, _func) PROVIDE_SINGLE_API ( MEMMAP_PREFIX_ ## _subsys, _api_func, _func ) |
| Provide a memory map API implementation. More... | |
| #define | PROVIDE_MEMMAP_INLINE(_subsys, _api_func) PROVIDE_SINGLE_API_INLINE ( MEMMAP_PREFIX_ ## _subsys, _api_func ) |
| Provide a static inline memory map API implementation. More... | |
| #define | MEMMAP_FL_MEMORY 0x0001 |
| Contains memory. More... | |
| #define | MEMMAP_FL_RESERVED 0x0002 |
| Is reserved. More... | |
| #define | MEMMAP_FL_USED 0x0004 |
| Is in use by iPXE. More... | |
| #define | MEMMAP_FL_INACCESSIBLE 0x0008 |
| Outside of addressable range. More... | |
| #define | USED_REGIONS __table ( struct used_region, "used_regions" ) |
| In-use memory region table. More... | |
| #define | __used_region __table_entry ( USED_REGIONS, 01 ) |
| Declare an in-use memory region. More... | |
| #define | for_each_memmap_from(region, start, hide) |
| Iterate over memory regions from a given starting address. More... | |
| #define | for_each_memmap(region, hide) for_each_memmap_from ( (region), 0, (hide) ) |
| Iterate over memory regions. More... | |
| #define | DBG_MEMMAP_IF(level, region) |
| #define | DBGC_MEMMAP_IF(level, id, ...) |
| #define | DBGC_MEMMAP(...) DBGC_MEMMAP_IF ( LOG, ##__VA_ARGS__ ) |
| #define | DBGC2_MEMMAP(...) DBGC_MEMMAP_IF ( EXTRA, ##__VA_ARGS__ ) |
| #define | DBGCP_MEMMAP(...) DBGC_MEMMAP_IF ( PROFILE, ##__VA_ARGS__ ) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static void | memmap_init (uint64_t min, struct memmap_region *region) |
| Initialise memory region descriptor. More... | |
| static int | memmap_is_usable (const struct memmap_region *region) |
| Check if memory region is usable. More... | |
| static uint64_t | memmap_size (const struct memmap_region *region) |
| Get remaining size of memory region (from the described address upwards) More... | |
| void | memmap_describe (uint64_t min, int hide, struct memmap_region *region) |
| Describe memory region from system memory map. More... | |
| void | memmap_sync (void) |
| Synchronise in-use regions with the externally visible system memory map. More... | |
| static void | memmap_use (struct used_region *used, physaddr_t start, size_t size) |
| Update an in-use memory region. More... | |
| static void | memmap_dump_all (int hide) |
| Dump system memory map (for debugging) More... | |
| void | memmap_update (struct memmap_region *region, uint64_t start, uint64_t size, unsigned int flags, const char *name) |
| Update memory region descriptor. More... | |
| void | memmap_update_used (struct memmap_region *region) |
| Update memory region descriptor based on all in-use memory regions. More... | |
| size_t | memmap_largest (physaddr_t *start) |
| Find largest usable memory region. More... | |
System memory map.
Definition in file memmap.h.
| #define MEMMAP_INLINE | ( | _subsys, | |
| _api_func | |||
| ) | SINGLE_API_INLINE ( MEMMAP_PREFIX_ ## _subsys, _api_func ) |
| #define PROVIDE_MEMMAP | ( | _subsys, | |
| _api_func, | |||
| _func | |||
| ) | PROVIDE_SINGLE_API ( MEMMAP_PREFIX_ ## _subsys, _api_func, _func ) |
| #define PROVIDE_MEMMAP_INLINE | ( | _subsys, | |
| _api_func | |||
| ) | PROVIDE_SINGLE_API_INLINE ( MEMMAP_PREFIX_ ## _subsys, _api_func ) |
| #define MEMMAP_FL_INACCESSIBLE 0x0008 |
| #define USED_REGIONS __table ( struct used_region, "used_regions" ) |
| #define __used_region __table_entry ( USED_REGIONS, 01 ) |
| #define for_each_memmap_from | ( | region, | |
| start, | |||
| hide | |||
| ) |
Iterate over memory regions from a given starting address.
| region | Region descriptor |
| start | Starting address |
| hide | Hide in-use regions from the memory map |
| #define for_each_memmap | ( | region, | |
| hide | |||
| ) | for_each_memmap_from ( (region), 0, (hide) ) |
| #define DBG_MEMMAP_IF | ( | level, | |
| region | |||
| ) |
| #define DBGC_MEMMAP_IF | ( | level, | |
| id, | |||
| ... | |||
| ) |
| #define DBGC_MEMMAP | ( | ... | ) | DBGC_MEMMAP_IF ( LOG, ##__VA_ARGS__ ) |
| #define DBGC2_MEMMAP | ( | ... | ) | DBGC_MEMMAP_IF ( EXTRA, ##__VA_ARGS__ ) |
| #define DBGCP_MEMMAP | ( | ... | ) | DBGC_MEMMAP_IF ( PROFILE, ##__VA_ARGS__ ) |
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Initialise memory region descriptor.
| min | Minimum address |
| region | Region descriptor to fill in |
Definition at line 71 of file memmap.h.
References memmap_region::flags, memmap_region::max, min, memmap_region::min, memmap_region::name, and NULL.
Referenced by fdtmem_describe(), int15_describe(), and memmap_describe().
|
inlinestatic |
Check if memory region is usable.
| region | Region descriptor |
| is_usable | Memory region is usable |
Definition at line 86 of file memmap.h.
References memmap_region::flags, and MEMMAP_FL_MEMORY.
Referenced by com32_exec_loop(), fdtmem_relocate(), memmap_largest(), prep_segment(), and relocate().
|
inlinestatic |
Get remaining size of memory region (from the described address upwards)
| region | Region descriptor |
| size | Size of memory region |
Definition at line 98 of file memmap.h.
References memmap_region::max, and memmap_region::min.
Referenced by com32_exec_loop(), lkrn_exec(), memmap_largest(), memmap_settings_fetch(), multiboot_build_memmap(), and relocate().
| void memmap_describe | ( | uint64_t | min, |
| int | hide, | ||
| struct memmap_region * | region | ||
| ) |
Describe memory region from system memory map.
| min | Minimum address |
| hide | Hide in-use regions from the memory map |
| region | Region descriptor to fill in |
Definition at line 28 of file null_memmap.h.
References memmap_init(), and min.
Referenced by com32_exec_loop(), memmap_dump_all(), and prep_segment().
| void memmap_sync | ( | void | ) |
Synchronise in-use regions with the externally visible system memory map.
In environments such as x86 BIOS, we need to patch the global system memory map to hide our in-use regions, since there is no other way to communicate this information to external code.
Definition at line 25 of file fdtmem.h.
Referenced by memmap_use().
|
inlinestatic |
Update an in-use memory region.
| used | In-use memory region |
| start | Start address |
| size | Length of region |
Definition at line 153 of file memmap.h.
References memmap_sync(), size, used_region::size, start, and used_region::start.
Referenced by fdtmem_register(), and uheap_resize().
|
inlinestatic |
Dump system memory map (for debugging)
| hide | Hide in-use regions from the memory map |
Definition at line 215 of file memmap.h.
References DBG_LOG, DBGC, DBGC_MEMMAP, for_each_memmap, and memmap_describe().
Referenced by fdtmem_register(), hide_etherboot(), int13_boot(), relocate(), uheap_resize(), and unhide_etherboot().
| void memmap_update | ( | struct memmap_region * | region, |
| uint64_t | start, | ||
| uint64_t | size, | ||
| unsigned int | flags, | ||
| const char * | name | ||
| ) |
Update memory region descriptor.
| region | Memory region of interest to be updated |
| start | Start address of known region |
| size | Size of known region |
| flags | Flags for known region |
| name | Name of known region (for debugging) |
Update a memory region descriptor based on a known existent region.
Definition at line 47 of file memmap.c.
References assert(), DBGC, flags, memmap_region::flags, max, memmap_region::max, min, memmap_region::min, memmap_region::name, name, size, and start.
Referenced by fdtmem_describe(), fdtmem_relocate(), fdtmem_update_node(), fdtmem_update_tree(), int15_describe(), meme820(), and memmap_update_used().
| void memmap_update_used | ( | struct memmap_region * | region | ) |
Update memory region descriptor based on all in-use memory regions.
| region | Memory region of interest to be updated |
Definition at line 104 of file memmap.c.
References for_each_table_entry, MEMMAP_FL_USED, memmap_update(), used_region::name, used_region::size, used_region::start, and USED_REGIONS.
Referenced by fdtmem_describe_region().
| size_t memmap_largest | ( | physaddr_t * | start | ) |
Find largest usable memory region.
| start | Start address to fill in |
| len | Length of region |
Definition at line 120 of file memmap.c.
References DBGC, DBGC_MEMMAP, for_each_memmap, memmap_is_usable(), memmap_size(), memmap_region::min, size, and start.
Referenced by uheap_find().
1.8.15