Received: from list by lists.gnu.org with archive (Exim 4.71) id 1fdbif-0005xb-Cf for mharc-grub-devel@gnu.org; Thu, 12 Jul 2018 09:33:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdbiX-0005sC-Uj for grub-devel@gnu.org; Thu, 12 Jul 2018 09:33:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdbiU-0000uI-Qq for grub-devel@gnu.org; Thu, 12 Jul 2018 09:33:09 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:41310) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fdbiU-0000t6-K5 for grub-devel@gnu.org; Thu, 12 Jul 2018 09:33:06 -0400 Received: by mail-pg1-x544.google.com with SMTP id z8-v6so2433931pgu.8 for ; Thu, 12 Jul 2018 06:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :reply-to; bh=lP2glRs0q1iL3WDaNCWr1bGyf09Qvbj1JddI60LSenc=; b=uq9RFwBMFeGy7nnKJbAtdOEv/HFTHeUNiRmU94RZ14Zgs8T0F7Z1OLVGx5/LSytROG Ee/JHKRAf1esJBGr3nej5WQiS+Sv6QBlJ/CKy/L0UHulGuU1f17jTv7CvfcKUZSIJ3U+ 2z6ilxVmxkl863SZgr+pKiboKCS3uTWSbWUzV+M1mh/Zr/FO1+OONXShvEwRs48nPBc3 DVHyd/K0u1Zfqdu7ZEVs5x+ZVMoscmZcN/SucReHJCha/te35EreWaE+q8Dcfqnz2A7Y 36NnEDC4M9WK0pXCtt53px/rIF4N94elmJVsu0IpCLIi1gxBUbNvO6CPGlN+upuQu3i+ hOYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:reply-to; bh=lP2glRs0q1iL3WDaNCWr1bGyf09Qvbj1JddI60LSenc=; b=QzxOxgr+90JLO/y27Bmuxe+GzfzItBceAm5H9HKyM6NPs5KcM+1kzFbQ6Z7deEEain Q/JZ1a3aD64V1L1V2DJqya1WPeYIy8QVkrv3OIC//9OGHcPzdFu8QzLqnA7ObqRnoBry 8M5yW9sKh10gpwxrUm3weF6/SpBmifuDmmJcxNFP+FbBcgs5NckOq69HVww3VL3Vwu97 xfrzyWtti2oIh5dzO5pgDgbeaK4G8ISw7ll/52DoMAkEoXCA9m9pVSRc/PWq5m283LVK io4kn3F5PxqwRAJhCz8noKOveY2pTxDakDxQVoU75ng8SdlN7VPArcoxdGtT6aVxtWTu hS2Q== X-Gm-Message-State: AOUpUlGqApsMW+r6zr9O7nfHNNip2geL/SEPNEgMTSZ3Cy3tpqfnoIh9 U7L6T+TLbRKJmQ/BYtYhaTAeXY+y X-Google-Smtp-Source: AAOMgpc/a3MAqEdble1vfGtZAViPsjE0la0IwqPTc3yHOOeYOiCN6ajukIPFtX4gae1kOEMCOdqbAQ== X-Received: by 2002:a63:2359:: with SMTP id u25-v6mr2189294pgm.220.1531402385282; Thu, 12 Jul 2018 06:33:05 -0700 (PDT) Received: from emb-Wallaby.amd.com ([202.56.249.162]) by smtp.gmail.com with ESMTPSA id n9-v6sm31447192pfg.21.2018.07.12.06.33.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 06:33:04 -0700 (PDT) Sender: Arindam Nath From: Arindam Nath To: grub-devel@gnu.org Cc: Daniel Kiper , Arindam Nath , Arindam Nath Subject: [PATCH v3] i386/linux: add support for ext_lfb_base Date: Thu, 12 Jul 2018 19:02:49 +0530 Message-Id: <20180712133249.21381-1-arindam.nath@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180712115419.GA6526@router-fw-old.local.net-space.pl> References: <20180712115419.GA6526@router-fw-old.local.net-space.pl> Reply-To: Arindam Nath X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 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: Thu, 12 Jul 2018 13:33:15 -0000 From: Arindam Nath Signed-off-by: Arindam Nath --- Cc: Daniel Kiper --- v1: The EFI Graphics Output Protocol can return a 64-bit linear frame buffer address in some firmware/BIOS implementations. We currently only store the lower 32-bits in the lfb_base. This will eventually be passed to Linux kernel and the efifb driver will incorrectly interpret the framebuffer address as 32-bit address. The Linux kernel has already added support to handle 64-bit linear framebuffer address in the efifb driver since quite some time now. This patch adds the support for 64-bit linear frame buffer address in GRUB to address the above mentioned scenario. v2: changes suggested by Daniel - added #if defined (GRUB_MACHINE_EFI) && defined (__x86_64__) - moved constant definitions to the beginning of header file v3: changes suggested by Daniel - moved patch version info below SOB - added empty lines above and below the modified lines - removed unnecessary #if and #endif from header file --- grub-core/loader/i386/linux.c | 6 ++++++ include/grub/i386/linux.h | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index 083f9417c..e66164bac 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -306,6 +306,12 @@ grub_linux_setup_video (struct linux_kernel_params *params) params->lfb_line_len = mode_info.pitch; params->lfb_base = (grub_size_t) framebuffer; + +#if defined (GRUB_MACHINE_EFI) && defined (__x86_64__) + params->ext_lfb_base = (grub_size_t) (((grub_uint64_t)(grub_size_t) framebuffer) >> 32); + params->capabilities |= VIDEO_CAPABILITY_64BIT_BASE; +#endif + params->lfb_size = ALIGN_UP (params->lfb_line_len * params->lfb_height, 65536); params->red_mask_size = mode_info.red_mask_size; diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h index da0ca3b83..ebac95e41 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -43,6 +43,9 @@ #define GRUB_LINUX_CL_MAGIC 0xA33F +#define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0) +#define VIDEO_CAPABILITY_64BIT_BASE (1 << 1) /* Frame buffer base is 64-bit */ + #ifdef __x86_64__ #define GRUB_LINUX_EFI_SIGNATURE \ @@ -188,8 +191,9 @@ struct linux_kernel_params grub_uint16_t lfb_pages; /* 32 */ grub_uint16_t vesa_attrib; /* 34 */ grub_uint32_t capabilities; /* 36 */ + grub_uint32_t ext_lfb_base; /* 3a */ - grub_uint8_t padding3[0x40 - 0x3a]; + grub_uint8_t padding3[0x40 - 0x3e]; grub_uint16_t apm_version; /* 40 */ grub_uint16_t apm_code_segment; /* 42 */ -- 2.17.1