@@ -64,9 +64,9 @@ static int fwts_memory_map_str_to_type(const char *str)
/* Strings from kernel log */
- if (strstr(str, "(usable)"))
+ if (strstr(str, "usable"))
return FWTS_MEMORY_MAP_USABLE;
- if (strstr(str, "(reserved)"))
+ if (strstr(str, "reserved"))
return FWTS_MEMORY_MAP_RESERVED;
if (strstr(str, "ACPI"))
return FWTS_MEMORY_MAP_ACPI;
@@ -199,6 +199,22 @@ static void fwts_memory_map_dmesg_info(void *data, void *private)
return;
fwts_register_memory_map_line(memory_map_list, start, end - 1, fwts_memory_map_str_to_type(line));
}
+ } else if ((str = strstr(line,"BIOS-e820:")) != NULL) {
+ uint64_t start;
+
+ errno = 0;
+ start = strtoull(str + sizeof("BIOS-e820: [mem 0x"), NULL, 16);
+ if (errno != 0)
+ return;
+ str = strstr(line,"-0x");
+ if (str) {
+ uint64_t end;
+ errno = 0;
+ end = strtoull(str + sizeof("-0x"), NULL, 16);
+ if (errno != 0 || end == 0)
+ return;
+ fwts_register_memory_map_line(memory_map_list, start, end - 1, fwts_memory_map_str_to_type(line));
+ }
}
}
BugLink: https://bugs.launchpad.net/fwts/+bug/2110534 The current kernel logs memory map entries using the prefix "BIOS-e820:" instead of the older "BIOS-memory_map:". Update the parser to also check for "BIOS-e820:" to ensure memory map information can still be extracted from dmesg. Signed-off-by: Ivan Hu <ivan.hu@canonical.com> --- src/lib/src/fwts_memorymap.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)