From: Kairui Song <kasong@redhat.com>
To: kexec@lists.infradead.org
Cc: Simon Horman <horms@verge.net.au>, Dave Young <dyoung@redhat.com>,
Lianbo Jiang <lijiang@redhat.com>, Baoquan He <bhe@redhat.com>,
Kairui Song <kasong@redhat.com>
Subject: [PATCH v2 4/4] crashdump/x86: Use new introduced helper for getting RSDP
Date: Tue, 14 May 2019 13:15:19 +0800 [thread overview]
Message-ID: <20190514051519.21942-1-kasong@redhat.com> (raw)
In-Reply-To: <20190514050959.21093-1-kasong@redhat.com>
Use the new introduced helper for getting RSDP, this ensures RSDP is
always accessible and avoid code duplication.
Signed-off-by: Kairui Song <kasong@redhat.com>
---
kexec/arch/i386/crashdump-x86.c | 34 +++++++++------------------------
1 file changed, 9 insertions(+), 25 deletions(-)
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 140f45b..a2aea31 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,
--
2.20.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2019-05-14 5:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 5:09 [PATCH v2 0/4] x86: Always to to fill acpi_rsdp_addr in boot params Kairui Song
2019-05-14 5:09 ` [PATCH v2 1/4] x86: Update boot parameters defination Kairui Song
2019-05-23 3:01 ` Dave Young
2019-05-23 11:12 ` Kairui Song
2019-05-23 13:26 ` Dave Young
2019-05-14 5:09 ` [PATCH v2 2/4] x86: Introduce helpers for getting RSDP address Kairui Song
2019-05-23 3:16 ` Dave Young
2019-05-23 3:43 ` Kairui Song
2019-05-23 11:06 ` Kairui Song
2019-05-14 5:09 ` [PATCH v2 3/4] x86: Always try to fill acpi_rsdp_addr in boot params Kairui Song
2019-05-23 3:17 ` Dave Young
2019-05-14 5:15 ` Kairui Song [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190514051519.21942-1-kasong@redhat.com \
--to=kasong@redhat.com \
--cc=bhe@redhat.com \
--cc=dyoung@redhat.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=lijiang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox