summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKairui Song <kasong@redhat.com>2019-05-24 14:23:21 +0800
committerSimon Horman <horms@verge.net.au>2019-05-31 11:27:24 +0200
commit40805e393b2fc84551a6705e1890e995e3ee8320 (patch)
treefc83f206fefa13085011fbdce1160354f234271c
parentb071fc084bdafd4674cd776581cab2bf2b44a004 (diff)
downloadkexec-tools-40805e393b2fc84551a6705e1890e995e3ee8320.tar.gz
crashdump/x86: Use new introduce helper for getting RSDP
Use the new introduce helper for getting RSDP, this ensures RSDP is always accessible and avoid code duplication. Signed-off-by: Kairui Song <kasong@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/i386/crashdump-x86.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 140f45bb..a2aea31f 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -787,35 +787,19 @@ static int sysfs_efi_runtime_map_exist(void)
/* Appends 'acpi_rsdp=' commandline for efi boot crash dump */
static void cmdline_add_efi(char *cmdline)
{
- FILE *fp;
- int cmdlen, len;
- char line[MAX_LINE], *s;
- const char *acpis = " acpi_rsdp=";
+ uint64_t acpi_rsdp;
+ char acpi_rsdp_buf[MAX_LINE];
- fp = fopen("/sys/firmware/efi/systab", "r");
- if (!fp)
- return;
+ acpi_rsdp = get_acpi_rsdp();
- while(fgets(line, sizeof(line), fp) != 0) {
- /* ACPI20= always goes before ACPI= */
- if ((strstr(line, "ACPI20=")) || (strstr(line, "ACPI="))) {
- line[strlen(line) - 1] = '\0';
- s = strchr(line, '=');
- s += 1;
- len = strlen(s) + strlen(acpis);
- cmdlen = strlen(cmdline) + len;
- if (cmdlen > (COMMAND_LINE_SIZE - 1))
- die("Command line overflow\n");
- strcat(cmdline, acpis);
- strcat(cmdline, s);
- dbgprintf("Command line after adding efi\n");
- dbgprintf("%s\n", cmdline);
+ if (!acpi_rsdp)
+ return;
- break;
- }
- }
+ sprintf(acpi_rsdp_buf, " acpi_rsdp=0x%lx", acpi_rsdp);
+ if (strlen(cmdline) + strlen(acpi_rsdp_buf) > (COMMAND_LINE_SIZE - 1))
+ die("Command line overflow\n");
- fclose(fp);
+ strcat(cmdline, acpi_rsdp_buf);
}
static void get_backup_area(struct kexec_info *info,