mirror of
https://github.com/ipxe/ipxe
synced 2026-04-04 03:00:20 +03:00
[bios] Update to use the generic system memory map API
Provide an implementation of the system memory map API based on the assorted BIOS INT 15 calls, and a temporary implementation of the legacy get_memmap() function using the new API. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <assert.h>
|
||||
#include <ipxe/io.h>
|
||||
#include <ipxe/memmap.h>
|
||||
|
||||
/** @file
|
||||
@@ -110,5 +111,29 @@ void memmap_update_used ( struct memmap_region *region ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get legacy system memory map
|
||||
*
|
||||
* @v memmap Legacy memory map to fill in
|
||||
*/
|
||||
void get_memmap ( struct memory_map *memmap ) {
|
||||
struct memmap_region region;
|
||||
struct memory_region *usable;
|
||||
|
||||
/* Clear legacy memory map */
|
||||
memmap->count = 0;
|
||||
|
||||
/* Populate legacy memory map */
|
||||
for_each_memmap ( ®ion, 1 ) {
|
||||
if ( memmap_is_usable ( ®ion ) ) {
|
||||
usable = &memmap->regions[memmap->count++];
|
||||
usable->start = region.addr;
|
||||
usable->end = ( region.last + 1 );
|
||||
if ( memmap->count == MAX_MEMORY_REGIONS )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PROVIDE_MEMMAP_INLINE ( null, memmap_describe );
|
||||
PROVIDE_MEMMAP_INLINE ( null, memmap_sync );
|
||||
|
||||
Reference in New Issue
Block a user