Skip to contentSkip to conversation

x86/efi: earlyprintk - Add 64bit efi fb address support

PATCH Superseded Aaron Ma 3 participants 6 messages Sep 8, 2018 – Sep 12, 2018

Subsystems (2)
lore
Share & tools
lore

Aaron Ma

author
#0 lore raw

PATCH 1/1 x86/efi: earlyprintk - Add 64bit efi fb address support

EFI GOP uses 64-bit frame buffer address in some BIOS. Add 64bit address support in efi earlyprintk.

---
 arch/x86/platform/efi/early_printk.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/platform/efi/early_printk.c +4 -0
index 5fdacb322ceb..c0ae25f59acd 100644
@@ -32,6 +32,8 @@ static __init int early_efi_map_fb(void)
 		return 0;
 
 	base = boot_params.screen_info.lfb_base;
+	if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+		base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
 	size = boot_params.screen_info.lfb_size;
 	efi_fb = ioremap(base, size);
 
@@ -49,6 +51,8 @@ static __ref void *early_efi_map(unsigned long start, unsigned long len)
 	unsigned long base;
 
 	base = boot_params.screen_info.lfb_base;
+	if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+		base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
 
 	if (efi_fb)
 		return (efi_fb + start);
Signature · 1 line
2.17.1
#1 lore raw

arch/x86/platform/efi/early_printk.c static __ref void *early_efi_map(unsigned long start, unsigned long len) · line 58

Quoted 2 lines · Aaron Ma
arch/x86/platform/efi/early_printk.c +0 -0
 	if (efi_fb)
 		return (efi_fb + start);

Just noticed this detail unrelated to your patch: return is not a function.

Thanks,

Ingo

#2 lore raw
In reply to Aaron Ma
Quoted 22 lines · Aaron Ma

EFI GOP uses 64-bit frame buffer address in some BIOS. Add 64bit address support in efi earlyprintk.

---
 arch/x86/platform/efi/early_printk.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/platform/efi/early_printk.c +2 -0
index 5fdacb322ceb..c0ae25f59acd 100644
@@ -32,6 +32,8 @@ static __init int early_efi_map_fb(void)
                return 0;
 
        base = boot_params.screen_info.lfb_base;
+       if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+               base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
        size = boot_params.screen_info.lfb_size;
        efi_fb = ioremap(base, size);
 

arch/x86/platform/efi/early_printk.c static __ref void *early_efi_map(unsigned long start, unsigned long len) · line 58

Quoted 8 lines
arch/x86/platform/efi/early_printk.c +2 -0
@@ -49,6 +51,8 @@ static __ref void *early_efi_map(unsigned long start, unsigned long len)
        unsigned long base;
 
        base = boot_params.screen_info.lfb_base;
+       if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+               base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
 
        if (efi_fb)
                return (efi_fb + start);

Please fix this in a way that works on 32-bit x86/PAE as well (i.e., use a suitable type for base)

author
#3 lore raw
Quoted 25 lines · Ard Biesheuvel
Quoted 24 lines · Aaron Ma

EFI GOP uses 64-bit frame buffer address in some BIOS. Add 64bit address support in efi earlyprintk.

---
 arch/x86/platform/efi/early_printk.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/platform/efi/early_printk.c +2 -0
index 5fdacb322ceb..c0ae25f59acd 100644
@@ -32,6 +32,8 @@ static __init int early_efi_map_fb(void)
                return 0;
 
        base = boot_params.screen_info.lfb_base;
+       if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+               base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
        size = boot_params.screen_info.lfb_size;
        efi_fb = ioremap(base, size);
 
@@ -49,6 +51,8 @@ static __ref void *early_efi_map(unsigned long start, unsigned long len)
        unsigned long base;
 
Quoted 9 lines

arch/x86/platform/efi/early_printk.c static __ref void *early_efi_map(unsigned long start, unsigned long len) · line 58

Quoted 6 lines
arch/x86/platform/efi/early_printk.c +2 -0
        base = boot_params.screen_info.lfb_base;
+       if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+               base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
 
        if (efi_fb)
                return (efi_fb + start);

Please fix this in a way that works on 32-bit x86/PAE as well (i.e., use a suitable type for base)

Right, I will send a v2 patch.

Thanks,
Aaron

author
#4 lore raw

PATCH v2 1/1 x86/efi: earlyprintk - Add 64bit efi fb address support

In reply to Aaron Ma

EFI GOP uses 64-bit frame buffer address in some BIOS. Add 64bit address support in efi earlyprintk.

V2:
Fix type of address.

---
 arch/x86/platform/efi/early_printk.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/platform/efi/early_printk.c +6 -2
index 5fdacb322ceb..7476b3b097e1 100644
@@ -26,12 +26,14 @@ static bool early_efi_keep;
  */
 static __init int early_efi_map_fb(void)
 {
-	unsigned long base, size;
+	u64 base, size;
 
 	if (!early_efi_keep)
 		return 0;
 
 	base = boot_params.screen_info.lfb_base;
+	if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+		base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
 	size = boot_params.screen_info.lfb_size;
 	efi_fb = ioremap(base, size);
 
@@ -46,9 +48,11 @@ early_initcall(early_efi_map_fb);
  */
 static __ref void *early_efi_map(unsigned long start, unsigned long len)
 {
-	unsigned long base;
+	u64 base;
 
 	base = boot_params.screen_info.lfb_base;
+	if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+		base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
 
 	if (efi_fb)
 		return (efi_fb + start);
Signature · 1 line
2.17.1
#5 lore raw
Quoted 7 lines · Aaron Ma

EFI GOP uses 64-bit frame buffer address in some BIOS. Add 64bit address support in efi earlyprintk.

V2:
Fix type of address.

Thanks. Queued in efi/next.

Quoted 40 lines
---
 arch/x86/platform/efi/early_printk.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/platform/efi/early_printk.c +6 -3
index 5fdacb322ceb..7476b3b097e1 100644
@@ -26,12 +26,14 @@ static bool early_efi_keep;
  */
 static __init int early_efi_map_fb(void)
 {
-       unsigned long base, size;
+       u64 base, size;
 
        if (!early_efi_keep)
                return 0;
 
        base = boot_params.screen_info.lfb_base;
+       if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+               base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
        size = boot_params.screen_info.lfb_size;
        efi_fb = ioremap(base, size);
 
@@ -46,9 +48,11 @@ early_initcall(early_efi_map_fb);
  */
 static __ref void *early_efi_map(unsigned long start, unsigned long len)
 {
-       unsigned long base;
+       u64 base;
 
        base = boot_params.screen_info.lfb_base;
+       if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+               base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
 
        if (efi_fb)
                return (efi_fb + start);
--

2.17.1