arch/loongarch/kernel/acpi.c | 4 ++++ drivers/acpi/Kconfig | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
Add ACPI BGRT support on LoongArch so it can display image provied by
acpi table at boot stage and switch to graphical UI smoothly.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
arch/loongarch/kernel/acpi.c | 4 ++++
drivers/acpi/Kconfig | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
index 929a497c987e..f1a74b80f22c 100644
--- a/arch/loongarch/kernel/acpi.c
+++ b/arch/loongarch/kernel/acpi.c
@@ -9,6 +9,7 @@
#include <linux/init.h>
#include <linux/acpi.h>
+#include <linux/efi-bgrt.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/memblock.h>
@@ -212,6 +213,9 @@ void __init acpi_boot_table_init(void)
/* Do not enable ACPI SPCR console by default */
acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
+ if (IS_ENABLED(CONFIG_ACPI_BGRT))
+ acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
+
return;
fdt_earlycon:
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index e3a7c2aedd5f..d67f63d93b2a 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -451,7 +451,7 @@ config ACPI_HED
config ACPI_BGRT
bool "Boottime Graphics Resource Table support"
- depends on EFI && (X86 || ARM64)
+ depends on EFI && (X86 || ARM64 || LOONGARCH)
help
This driver adds support for exposing the ACPI Boottime Graphics
Resource Table, which allows the operating system to obtain
base-commit: b31c4492884252a8360f312a0ac2049349ddf603
--
2.39.3
Hi Bibo, kernel test robot noticed the following build warnings: [auto build test WARNING on b31c4492884252a8360f312a0ac2049349ddf603] url: https://github.com/intel-lab-lkp/linux/commits/Bibo-Mao/LoongArch-Enable-ACPI-BGRT-handling/20240909-095705 base: b31c4492884252a8360f312a0ac2049349ddf603 patch link: https://lore.kernel.org/r/20240909015514.597253-1-maobibo%40loongson.cn patch subject: [PATCH] LoongArch: Enable ACPI BGRT handling config: loongarch-randconfig-r133-20240910 (https://download.01.org/0day-ci/archive/20240910/202409102056.DNqh6zzA-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 14.1.0 reproduce: (https://download.01.org/0day-ci/archive/20240910/202409102056.DNqh6zzA-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202409102056.DNqh6zzA-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> drivers/firmware/efi/efi-bgrt.c:69:15: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *image @@ got void [noderef] __iomem * @@ drivers/firmware/efi/efi-bgrt.c:69:15: sparse: expected void *image drivers/firmware/efi/efi-bgrt.c:69:15: sparse: got void [noderef] __iomem * >> drivers/firmware/efi/efi-bgrt.c:76:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got void *image @@ drivers/firmware/efi/efi-bgrt.c:76:24: sparse: expected void [noderef] __iomem *addr drivers/firmware/efi/efi-bgrt.c:76:24: sparse: got void *image vim +69 drivers/firmware/efi/efi-bgrt.c 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 26 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 27 void __init efi_bgrt_init(struct acpi_table_header *table) 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 28 { 50a0cb565246f2 arch/x86/platform/efi/efi-bgrt.c Sai Praneeth 2015-12-09 29 void *image; 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 30 struct bmp_header bmp_header; 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 31 struct acpi_table_bgrt *bgrt = &bgrt_tab; 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 32 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 33 if (acpi_disabled) 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 34 return; 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 35 792ef14df5c585 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-06-09 36 if (!efi_enabled(EFI_MEMMAP)) 7425826f4f7ac6 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-05-26 37 return; 7425826f4f7ac6 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-05-26 38 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 39 if (table->length < sizeof(bgrt_tab)) { 7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 40 pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n", 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 41 table->length, sizeof(bgrt_tab)); 5d6d578c170bb2 arch/x86/platform/efi/efi-bgrt.c Jan Beulich 2012-11-07 42 return; 1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 43 } 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 44 *bgrt = *(struct acpi_table_bgrt *)table; 55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 45 /* 55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 46 * Only version 1 is defined but some older laptops (seen on Lenovo 55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 47 * Ivy Bridge models) have a correct version 1 BGRT table with the 55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 48 * version set to 0, so we accept version 0 and 1. 55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 49 */ 55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 50 if (bgrt->version > 1) { 7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 51 pr_notice("Ignoring BGRT: invalid version %u (expected 1)\n", 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 52 bgrt->version); 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 53 goto out; 1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 54 } 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 55 if (bgrt->image_type != 0) { 7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 56 pr_notice("Ignoring BGRT: invalid image type %u (expected 0)\n", 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 57 bgrt->image_type); 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 58 goto out; 1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 59 } 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 60 if (!bgrt->image_address) { 7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 61 pr_notice("Ignoring BGRT: null image address\n"); 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 62 goto out; 1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 63 } 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 64 6de47a5e371f75 drivers/firmware/efi/efi-bgrt.c Jan Beulich 2017-08-25 65 if (efi_mem_type(bgrt->image_address) != EFI_BOOT_SERVICES_DATA) { 792ef14df5c585 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-06-09 66 pr_notice("Ignoring BGRT: invalid image address\n"); 792ef14df5c585 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-06-09 67 goto out; 792ef14df5c585 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-06-09 68 } 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 @69 image = early_memremap(bgrt->image_address, sizeof(bmp_header)); 1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 70 if (!image) { 7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 71 pr_notice("Ignoring BGRT: failed to map image header memory\n"); 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 72 goto out; 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 73 } 2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 74 50a0cb565246f2 arch/x86/platform/efi/efi-bgrt.c Sai Praneeth 2015-12-09 75 memcpy(&bmp_header, image, sizeof(bmp_header)); 7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 @76 early_memunmap(image, sizeof(bmp_header)); -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi, Jianmin, On Mon, Sep 9, 2024 at 9:55 AM Bibo Mao <maobibo@loongson.cn> wrote: > > Add ACPI BGRT support on LoongArch so it can display image provied by > acpi table at boot stage and switch to graphical UI smoothly. This patch seems very useful, could you please confirm it on real machines? Or you can only provide me with a BIOS with BGRT. Huacai > > Signed-off-by: Bibo Mao <maobibo@loongson.cn> > --- > arch/loongarch/kernel/acpi.c | 4 ++++ > drivers/acpi/Kconfig | 2 +- > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c > index 929a497c987e..f1a74b80f22c 100644 > --- a/arch/loongarch/kernel/acpi.c > +++ b/arch/loongarch/kernel/acpi.c > @@ -9,6 +9,7 @@ > > #include <linux/init.h> > #include <linux/acpi.h> > +#include <linux/efi-bgrt.h> > #include <linux/irq.h> > #include <linux/irqdomain.h> > #include <linux/memblock.h> > @@ -212,6 +213,9 @@ void __init acpi_boot_table_init(void) > /* Do not enable ACPI SPCR console by default */ > acpi_parse_spcr(earlycon_acpi_spcr_enable, false); > > + if (IS_ENABLED(CONFIG_ACPI_BGRT)) > + acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt); > + > return; > > fdt_earlycon: > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig > index e3a7c2aedd5f..d67f63d93b2a 100644 > --- a/drivers/acpi/Kconfig > +++ b/drivers/acpi/Kconfig > @@ -451,7 +451,7 @@ config ACPI_HED > > config ACPI_BGRT > bool "Boottime Graphics Resource Table support" > - depends on EFI && (X86 || ARM64) > + depends on EFI && (X86 || ARM64 || LOONGARCH) > help > This driver adds support for exposing the ACPI Boottime Graphics > Resource Table, which allows the operating system to obtain > > base-commit: b31c4492884252a8360f312a0ac2049349ddf603 > -- > 2.39.3 >
© 2016 - 2024 Red Hat, Inc.