From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1g9pnh-0001SP-PY for mharc-grub-devel@gnu.org; Tue, 09 Oct 2018 07:03:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9pnX-0001Mt-3s for grub-devel@gnu.org; Tue, 09 Oct 2018 07:03:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9pnS-0005Kr-Pk for grub-devel@gnu.org; Tue, 09 Oct 2018 07:03:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:55076 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9pnS-0005IO-Be for grub-devel@gnu.org; Tue, 09 Oct 2018 07:03:26 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8B245AF51; Tue, 9 Oct 2018 11:03:20 +0000 (UTC) From: Juergen Gross To: grub-devel@gnu.org Cc: xen-devel@lists.xen.org, phcoder@gmail.com, daniel.kiper@oracle.com, hans@knorrie.org, Juergen Gross Subject: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params Date: Tue, 9 Oct 2018 13:03:01 +0200 Message-Id: <20181009110317.6022-3-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181009110317.6022-1-jgross@suse.com> References: <20181009110317.6022-1-jgross@suse.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2018 11:03:33 -0000 Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux. The new protocol version 2.14 requires to set version to 0x8000 ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect. Signed-off-by: Juergen Gross --- V2: add oring 0x8000 to version field --- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index 4eab55a2d..f96309476 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -35,6 +35,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -750,6 +751,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), prot_init_space = page_align (prot_size) * 3; } +#ifdef GRUB_KERNEL_USE_RSDP_ADDR + if (grub_le_to_cpu16 (lh.version) >= 0x020e) + lh.acpi_rsdp_addr = grub_le_to_cpu64 (grub_rsdp_addr); +#endif + + if (grub_le_to_cpu16 (lh.version) >= 0x020e) + lh.version = grub_le_to_cpu16 (LINUX_LOADER_VERSION_TAG | 0x020e); + if (allocate_pages (prot_size, &align, min_align, relocatable, preferred_address)) diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h index 60c7c3b5e..5cbcfbe5a 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -87,7 +87,7 @@ enum GRUB_VIDEO_LINUX_TYPE_SIMPLE = 0x70 /* Linear framebuffer without any additional functions. */ }; -/* For the Linux/i386 boot protocol version 2.10. */ +/* For the Linux/i386 boot protocol version 2.14. */ struct linux_i386_kernel_header { grub_uint8_t code1[0x0020]; @@ -105,6 +105,7 @@ struct linux_i386_kernel_header grub_uint16_t jump; /* Jump instruction */ grub_uint32_t header; /* Magic signature "HdrS" */ grub_uint16_t version; /* Boot protocol version supported */ +#define LINUX_LOADER_VERSION_TAG 0x8000 grub_uint32_t realmode_swtch; /* Boot loader hook */ grub_uint16_t start_sys; /* The load-low segment (obsolete) */ grub_uint16_t kernel_version; /* Points to kernel version string */ @@ -142,6 +143,8 @@ struct linux_i386_kernel_header grub_uint64_t setup_data; grub_uint64_t pref_address; grub_uint32_t init_size; + grub_uint32_t handover_offset; + grub_uint64_t acpi_rsdp_addr; } GRUB_PACKED; /* Boot parameters for Linux based on 2.6.12. This is used by the setup -- 2.16.4