public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: WANG Chao <chaowang@redhat.com>
To: horms@verge.net.au, vgoyal@redhat.com, ebiederm@xmission.com,
	hpa@zytor.com, trenn@suse.de, dyoung@redhat.com, linn@hp.com
Cc: kexec@lists.infradead.org
Subject: [PATCH RESEND v5 08/10] x86, cleanup: Add a funtion add_setup_data()
Date: Fri, 11 Apr 2014 10:23:29 +0800	[thread overview]
Message-ID: <1397183011-1526-9-git-send-email-chaowang@redhat.com> (raw)
In-Reply-To: <1397183011-1526-1-git-send-email-chaowang@redhat.com>

add_setup_data() is used to add an instance to the single linked list
of setup_data structure.

Signed-off-by: WANG Chao <chaowang@redhat.com>
---
 kexec/arch/i386/x86-linux-setup.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index e04e45d..8ed36cc 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -603,6 +603,22 @@ struct efi_info {
 };
 
 /*
+ * Add another instance to single linked list of struct setup_data.
+ * Please refer to kernel Documentation/x86/boot.txt for more details
+ * about setup_data structure.
+ */
+static void add_setup_data(struct kexec_info *info,
+			   struct x86_linux_param_header *real_mode,
+			   struct setup_data *sd)
+{
+	int sdsize = sizeof(struct setup_data) + sd->len;
+
+	sd->next = real_mode->setup_data;
+	real_mode->setup_data = add_buffer(info, sd, sdsize, sdsize, getpagesize(),
+			    0x100000, ULONG_MAX, INT_MAX);
+}
+
+/*
  * setup_efi_data will collect below data and pass them to 2nd kernel.
  * 1) SMBIOS, fw_vendor, runtime, config_table, they are passed via x86
  *    setup_data.
@@ -611,11 +627,11 @@ struct efi_info {
 static int setup_efi_data(struct kexec_info *info,
 			  struct x86_linux_param_header *real_mode)
 {
-	int64_t setup_data_paddr, memmap_paddr;
+	int64_t memmap_paddr;
 	struct setup_data *sd;
 	struct efi_setup_data *esd;
 	struct efi_mem_descriptor *maps;
-	int nr_maps, size, sdsize, ret = 0;
+	int nr_maps, size, ret = 0;
 	struct efi_info *ei = (struct efi_info *)real_mode->efi_info;
 
 	ret = access("/sys/firmware/efi/systab", F_OK);
@@ -648,10 +664,8 @@ static int setup_efi_data(struct kexec_info *info,
 	sd->len = sizeof(*esd);
 	memcpy(sd->data, esd, sizeof(*esd));
 	free(esd);
-	sdsize = sd->len + sizeof(struct setup_data);
-	setup_data_paddr = add_buffer(info, sd, sdsize, sdsize, getpagesize(),
-					0x100000, ULONG_MAX, INT_MAX);
-	real_mode->setup_data = setup_data_paddr;
+
+	add_setup_data(info, real_mode, sd);
 
 	size = nr_maps * sizeof(struct efi_mem_descriptor);
 	memmap_paddr = add_buffer(info, maps, size, size, getpagesize(),
-- 
1.8.5.3


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2014-04-11  2:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11  2:23 [PATCH RESEND v5 00/10] kexec-tools, x86: E820 memmap pass for kdump WANG Chao
2014-04-11  2:23 ` [PATCH RESEND v5 01/10] x86, cleanup: fix indent WANG Chao
2014-04-14  2:09   ` Simon Horman
2014-04-11  2:23 ` [PATCH RESEND v5 02/10] x86, cleanup: add extra arguments to add_memmap() and delete_memmap() WANG Chao
2014-04-14  2:11   ` Simon Horman
2014-04-14  5:41     ` WANG Chao
2014-04-11  2:23 ` [PATCH RESEND v5 03/10] x86, cleanup: add other types of memory range for 2nd kernel boot to memmap_p WANG Chao
2014-04-14  2:12   ` Simon Horman
2014-04-14  5:24     ` WANG Chao
2014-04-11  2:23 ` [PATCH RESEND v5 04/10] x86, cleanup: add_memmap() only do alignment check on RANGE_RAM WANG Chao
2014-04-14  2:13   ` Simon Horman
2014-04-14  5:17     ` WANG Chao
2014-04-11  2:23 ` [PATCH RESEND v5 05/10] x86, cleanup: use dbgprint_mem_range for memory range debugging WANG Chao
2014-04-11  2:23 ` [PATCH RESEND v5 06/10] x86, cleanup: increase CRASH_MAX_MEMMAP_NR up to CRASH_MAX_MEMORY_RANGES WANG Chao
2014-04-11  2:23 ` [PATCH RESEND v5 07/10] x86, cleanup: Store crash memory ranges kexec_info WANG Chao
2014-04-11  2:23 ` WANG Chao [this message]
2014-04-14  2:16   ` [PATCH RESEND v5 08/10] x86, cleanup: Add a funtion add_setup_data() Simon Horman
2014-04-11  2:23 ` [PATCH RESEND v5 09/10] x86: add --pass-memmap-cmdline option WANG Chao
2014-04-11  2:23 ` [PATCH RESEND v5 10/10] x86: Pass memory range via E820 for kdump WANG Chao

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=1397183011-1526-9-git-send-email-chaowang@redhat.com \
    --to=chaowang@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=horms@verge.net.au \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=linn@hp.com \
    --cc=trenn@suse.de \
    --cc=vgoyal@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