From dbc86458e5028a3c98473635ae5b7f821b5618cc Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 15 May 2025 23:45:55 +0100 Subject: [PATCH] [comboot] Use memmap_describe() to obtain available memory Signed-off-by: Michael Brown --- src/arch/x86/image/com32.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/arch/x86/image/com32.c b/src/arch/x86/image/com32.c index 37fb2c3c0..fe55a3ee0 100644 --- a/src/arch/x86/image/com32.c +++ b/src/arch/x86/image/com32.c @@ -39,7 +39,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include -#include +#include #include /** @@ -49,8 +49,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); * @ret rc Return status code */ static int com32_exec_loop ( struct image *image ) { - struct memory_map memmap; - unsigned int i; + struct memmap_region region; int state; uint32_t avail_mem_top; @@ -59,21 +58,12 @@ static int com32_exec_loop ( struct image *image ) { switch ( state ) { case 0: /* First time through; invoke COM32 program */ - /* Get memory map */ - get_memmap ( &memmap ); - /* Find end of block covering COM32 image loading area */ - for ( i = 0, avail_mem_top = 0 ; i < memmap.count ; i++ ) { - if ( (memmap.regions[i].start <= COM32_START_PHYS) && - (memmap.regions[i].end > COM32_START_PHYS + image->len) ) { - avail_mem_top = memmap.regions[i].end; - break; - } - } - + memmap_describe ( COM32_START_PHYS, 1, ®ion ); + assert ( memmap_is_usable ( ®ion ) ); + avail_mem_top = ( COM32_START_PHYS + memmap_size ( ®ion ) ); DBGC ( image, "COM32 %p: available memory top = 0x%x\n", image, avail_mem_top ); - assert ( avail_mem_top != 0 ); /* Hook COMBOOT API interrupts */ -- 2.47.2