[memmap] Allow explicit colour selection for memory map debug messages

Provide DBGC_MEMMAP() as a replacement for memmap_dump(), allowing the
colour used to match other messages within the same message group.

Retain a dedicated colour for output from memmap_dump_all(), on the
basis that it is generally most useful to visually compare full memory
dumps against previous full memory dumps.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-25 12:06:53 +01:00
parent 8d88870da5
commit 09140ab2c1
7 changed files with 36 additions and 33 deletions

View File

@@ -273,7 +273,7 @@ physaddr_t fdtmem_relocate ( struct fdt_header *hdr, physaddr_t max ) {
/* Parse FDT */
if ( ( rc = fdt_parse ( &fdt, hdr, -1UL ) ) != 0 ) {
DBGC ( &region, "FDTMEM could not parse FDT: %s\n",
DBGC ( hdr, "FDTMEM could not parse FDT: %s\n",
strerror ( rc ) );
/* Refuse relocation if we have no FDT */
return old;
@@ -282,7 +282,7 @@ physaddr_t fdtmem_relocate ( struct fdt_header *hdr, physaddr_t max ) {
/* Determine required length */
len = fdtmem_len ( &fdt );
assert ( len > 0 );
DBGC ( &region, "FDTMEM requires %#zx + %#zx => %#zx bytes for "
DBGC ( hdr, "FDTMEM requires %#zx + %#zx => %#zx bytes for "
"relocation\n", memsz, fdt.len, len );
/* Construct memory map and choose a relocation address */
@@ -297,7 +297,7 @@ physaddr_t fdtmem_relocate ( struct fdt_header *hdr, physaddr_t max ) {
next = ( region.max + 1 );
/* Dump region descriptor (for debugging) */
memmap_dump ( &region );
DBGC_MEMMAP ( hdr, &region );
assert ( region.max >= region.min );
/* Use highest possible region */
@@ -313,7 +313,7 @@ physaddr_t fdtmem_relocate ( struct fdt_header *hdr, physaddr_t max ) {
}
}
DBGC ( &region, "FDTMEM relocating %#08lx => [%#08lx,%#08lx]\n",
DBGC ( hdr, "FDTMEM relocating %#08lx => [%#08lx,%#08lx]\n",
old, new, ( ( physaddr_t ) ( new + len - 1 ) ) );
return new;
}

View File

@@ -127,7 +127,7 @@ size_t memmap_largest ( physaddr_t *start ) {
*start = 0;
largest = 0;
for_each_memmap ( &region, 1 ) {
memmap_dump ( &region );
DBGC_MEMMAP ( &region, &region );
if ( ! memmap_is_usable ( &region ) )
continue;
size = memmap_size ( &region );