Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

2022-09-07 Thread Arnd Bergmann
On Tue, Sep 6, 2022, at 11:52 PM, Daniel Vetter wrote:
> On Sat, Aug 06, 2022 at 07:32:24PM +0300, Markuss Broks wrote:
>
> Ok I have a more fundamental issue with this than the lack of proper patch
> splitting I mentioned in the other thread.
>
> This is the wrong place.
>
> drivers/video/console is about the various vt console implementations,
> which supply a struct consw to con_register_driver.

You are right, that was my mistake. The original patch was for
drivers/video/fbdev/, and I suggested moving it out of there because
it does not depend on the fbdev subsystem, but clearly my suggestions
of drivers/video/console was equally wrong.

> This otoh is an (early) kernel/printk console implemented using struct
> console. Totally different thing, and really shouldn't end up in
> drivers/video/console imo. Somewhere in drivers/firmware might still be
> the best place, the sysfb stuff is also there. Maybe
> drivers/firmware/sysfb_earlycon.c?

drivers/firmware/ is better but doesn't sound great to me either,
since one important thing the patch does is to not make it depend
on EFI firmware or BIOS style screen_info any more. 

Maybe drivers/tty/earlycon_simplefb.c would work better, keeping
it close to the earlycon base support in drivers/tty/serial/,
the vt console and the old simplefb driver/, without tying to too
closely to fbdev of UEFI.

 Arnd


Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

2022-09-07 Thread Thomas Zimmermann

Hi

Am 06.09.22 um 23:52 schrieb Daniel Vetter:

On Sat, Aug 06, 2022 at 07:32:24PM +0300, Markuss Broks wrote:

Add early console support for generic linear framebuffer devices.
This driver supports probing from cmdline early parameters
or from the device-tree using information in simple-framebuffer node.
The EFI functionality should be retained in whole.
The driver was disabled on ARM because of a bug in early_ioremap
implementation on ARM and on IA64 because of lack of early_memremap_prot.

Signed-off-by: Markuss Broks 
---
  .../admin-guide/kernel-parameters.txt |  12 +-
  MAINTAINERS   |   5 +
  drivers/firmware/efi/Kconfig  |   7 +-
  drivers/firmware/efi/Makefile |   1 -
  drivers/firmware/efi/earlycon.c   | 246 --
  drivers/video/console/Kconfig |  11 +
  drivers/video/console/Makefile|   1 +
  drivers/video/console/earlycon.c  | 305 ++


Ok I have a more fundamental issue with this than the lack of proper patch
splitting I mentioned in the other thread.

This is the wrong place.

drivers/video/console is about the various vt console implementations,
which supply a struct consw to con_register_driver.

This otoh is an (early) kernel/printk console implemented using struct
console. Totally different thing, and really shouldn't end up in
drivers/video/console imo. Somewhere in drivers/firmware might still be
the best place, the sysfb stuff is also there. Maybe
drivers/firmware/sysfb_earlycon.c?


Then better use just earlycon.c in that directory. We use the sysfb_ 
prefix for code of the framebuffer devices that simpledrm and simplefb 
run on top. It would not fit well here.


Best regards
Thomas



Also patch split is still an issue here, like I and Greg already said.
-Daniel


  8 files changed, 332 insertions(+), 256 deletions(-)
  delete mode 100644 drivers/firmware/efi/earlycon.c
  create mode 100644 drivers/video/console/earlycon.c

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 
8090130b544b0701237a7b657a29c83c000a60f4..bccb1ac8978eb5cf7e2bb20834b1881b27040666
 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1281,12 +1281,9 @@
specified address. The serial port must already be
setup and configured. Options are not yet supported.
  
-		efifb,[options]

+   efifb
Start an early, unaccelerated console on the EFI
-   memory mapped framebuffer (if available). On cache
-   coherent non-x86 systems that use system memory for
-   the framebuffer, pass the 'ram' option so that it is
-   mapped with the correct attributes.
+   memory mapped framebuffer (if available).
  
  		linflex,

Use early console provided by Freescale LINFlexD UART
@@ -1294,6 +1291,11 @@
address must be provided, and the serial port must
already be setup and configured.
  
+		simplefb,,xx

+   Use early console with simple framebuffer that is
+   pre-initialized by firmware. A valid base address,
+   width, height and pixel size must be provided.
+
earlyprintk=[X86,SH,ARM,M68k,S390]
earlyprintk=vga
earlyprintk=sclp
diff --git a/MAINTAINERS b/MAINTAINERS
index 
1fc9ead83d2aa3e60ccc4cfa8ee16df09ef579bf..af8b8e289483b6a264d477145061bd0e0ba34a25
 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7033,6 +7033,11 @@ Q:   
http://patchwork.linuxtv.org/project/linux-media/list/
  T:git git://linuxtv.org/anttip/media_tree.git
  F:drivers/media/tuners/e4000*
  
+EARLY CONSOLE FRAMEBUFFER DRIVER

+M: Markuss Broks 
+S: Maintained
+F: drivers/video/console/earlycon.c
+
  EARTH_PT1 MEDIA DRIVER
  M:Akihiro Tsukada 
  L:linux-me...@vger.kernel.org
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 
7aa4717cdcac46f91dd202f868c463388eb02735..ea76ccfb9bcd8ba44ddca06052eaa442ed6c30f7
 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -259,10 +259,9 @@ config EFI_DISABLE_PCI_DMA
  may be used to override this option.
  
  config EFI_EARLYCON

-   def_bool y
-   depends on SERIAL_EARLYCON && !ARM && !IA64
-   select FONT_SUPPORT
-   select ARCH_USE_MEMREMAP_PROT
+   bool "EFI early console support"
+   select FB_EARLYCON
+   default y
  
  config EFI_CUSTOM_SSDT_OVERLAYS

bool "Load custom ACPI SSDT overlay from an EFI variable"
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index 

Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

2022-09-06 Thread Daniel Vetter
On Sat, Aug 06, 2022 at 07:32:24PM +0300, Markuss Broks wrote:
> Add early console support for generic linear framebuffer devices.
> This driver supports probing from cmdline early parameters
> or from the device-tree using information in simple-framebuffer node.
> The EFI functionality should be retained in whole.
> The driver was disabled on ARM because of a bug in early_ioremap
> implementation on ARM and on IA64 because of lack of early_memremap_prot.
> 
> Signed-off-by: Markuss Broks 
> ---
>  .../admin-guide/kernel-parameters.txt |  12 +-
>  MAINTAINERS   |   5 +
>  drivers/firmware/efi/Kconfig  |   7 +-
>  drivers/firmware/efi/Makefile |   1 -
>  drivers/firmware/efi/earlycon.c   | 246 --
>  drivers/video/console/Kconfig |  11 +
>  drivers/video/console/Makefile|   1 +
>  drivers/video/console/earlycon.c  | 305 ++

Ok I have a more fundamental issue with this than the lack of proper patch
splitting I mentioned in the other thread.

This is the wrong place.

drivers/video/console is about the various vt console implementations,
which supply a struct consw to con_register_driver.

This otoh is an (early) kernel/printk console implemented using struct
console. Totally different thing, and really shouldn't end up in
drivers/video/console imo. Somewhere in drivers/firmware might still be
the best place, the sysfb stuff is also there. Maybe
drivers/firmware/sysfb_earlycon.c?

Also patch split is still an issue here, like I and Greg already said.
-Daniel

>  8 files changed, 332 insertions(+), 256 deletions(-)
>  delete mode 100644 drivers/firmware/efi/earlycon.c
>  create mode 100644 drivers/video/console/earlycon.c
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt 
> b/Documentation/admin-guide/kernel-parameters.txt
> index 
> 8090130b544b0701237a7b657a29c83c000a60f4..bccb1ac8978eb5cf7e2bb20834b1881b27040666
>  100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1281,12 +1281,9 @@
>   specified address. The serial port must already be
>   setup and configured. Options are not yet supported.
>  
> - efifb,[options]
> + efifb
>   Start an early, unaccelerated console on the EFI
> - memory mapped framebuffer (if available). On cache
> - coherent non-x86 systems that use system memory for
> - the framebuffer, pass the 'ram' option so that it is
> - mapped with the correct attributes.
> + memory mapped framebuffer (if available).
>  
>   linflex,
>   Use early console provided by Freescale LINFlexD UART
> @@ -1294,6 +1291,11 @@
>   address must be provided, and the serial port must
>   already be setup and configured.
>  
> + simplefb,,xx
> + Use early console with simple framebuffer that is
> + pre-initialized by firmware. A valid base address,
> + width, height and pixel size must be provided.
> +
>   earlyprintk=[X86,SH,ARM,M68k,S390]
>   earlyprintk=vga
>   earlyprintk=sclp
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 
> 1fc9ead83d2aa3e60ccc4cfa8ee16df09ef579bf..af8b8e289483b6a264d477145061bd0e0ba34a25
>  100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7033,6 +7033,11 @@ Q: 
> http://patchwork.linuxtv.org/project/linux-media/list/
>  T:   git git://linuxtv.org/anttip/media_tree.git
>  F:   drivers/media/tuners/e4000*
>  
> +EARLY CONSOLE FRAMEBUFFER DRIVER
> +M:   Markuss Broks 
> +S:   Maintained
> +F:   drivers/video/console/earlycon.c
> +
>  EARTH_PT1 MEDIA DRIVER
>  M:   Akihiro Tsukada 
>  L:   linux-me...@vger.kernel.org
> diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
> index 
> 7aa4717cdcac46f91dd202f868c463388eb02735..ea76ccfb9bcd8ba44ddca06052eaa442ed6c30f7
>  100644
> --- a/drivers/firmware/efi/Kconfig
> +++ b/drivers/firmware/efi/Kconfig
> @@ -259,10 +259,9 @@ config EFI_DISABLE_PCI_DMA
> may be used to override this option.
>  
>  config EFI_EARLYCON
> - def_bool y
> - depends on SERIAL_EARLYCON && !ARM && !IA64
> - select FONT_SUPPORT
> - select ARCH_USE_MEMREMAP_PROT
> + bool "EFI early console support"
> + select FB_EARLYCON
> + default y
>  
>  config EFI_CUSTOM_SSDT_OVERLAYS
>   bool "Load custom ACPI SSDT overlay from an EFI variable"
> diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
> index 
> c02ff25dd47707090a2ab86ee4f330e467f878f5..64eea61fbb43d76ec2d5416d467dfbb9aa21bda0
>  100644
> --- a/drivers/firmware/efi/Makefile
> +++ b/drivers/firmware/efi/Makefile
> @@ -44,6 

Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

2022-08-14 Thread kernel test robot
Hi Markuss,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on efi/next staging/staging-testing usb/usb-testing 
linus/master v5.19 next-20220812]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git 
tty-testing
config: x86_64-kismet-CONFIG_FB_EARLYCON-CONFIG_EFI_EARLYCON-0-0 
(https://download.01.org/0day-ci/archive/20220814/202208141430.ez8ekewo-...@intel.com/config)
reproduce:
# 
https://github.com/intel-lab-lkp/linux/commit/97dfc2aa69b065de769a191352afe2099c52fedb
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
git checkout 97dfc2aa69b065de769a191352afe2099c52fedb
# 1. reproduce by kismet
   # install kmax per 
https://github.com/paulgazz/kmax/blob/master/README.md
   kismet --linux-ksrc=linux --selectees CONFIG_FB_EARLYCON --selectors 
CONFIG_EFI_EARLYCON -a=x86_64
# 2. reproduce by make
   # save the config file to linux source tree
   cd linux
   make ARCH=x86_64 olddefconfig

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 

kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for FB_EARLYCON when 
>> selected by EFI_EARLYCON
   
   WARNING: unmet direct dependencies detected for FB_EARLYCON
 Depends on [n]: VT [=y] && SERIAL_EARLYCON [=n] && !ARM && !IA64
 Selected by [y]:
 - EFI_EARLYCON [=y] && EFI [=y]

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

2022-08-13 Thread kernel test robot
Hi Markuss,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on efi/next staging/staging-testing usb/usb-testing 
linus/master v5.19 next-20220812]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git 
tty-testing
config: loongarch-randconfig-s031-20220807 
(https://download.01.org/0day-ci/archive/20220814/202208140705.bu9i1c1t-...@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# 
https://github.com/intel-lab-lkp/linux/commit/97dfc2aa69b065de769a191352afe2099c52fedb
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
git checkout 97dfc2aa69b065de769a191352afe2099c52fedb
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch 
SHELL=/bin/bash drivers/video/console/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 

sparse warnings: (new ones prefixed by >>)
>> drivers/video/console/earlycon.c:43:24: sparse: sparse: incorrect type in 
>> assignment (different address spaces) @@ expected void [noderef] __iomem 
>> *static [toplevel] virt_base @@ got void * @@
   drivers/video/console/earlycon.c:43:24: sparse: expected void [noderef] 
__iomem *static [toplevel] virt_base
   drivers/video/console/earlycon.c:43:24: sparse: got void *
>> drivers/video/console/earlycon.c:53:30: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@ expected void *addr @@ got 
>> void [noderef] __iomem *static [toplevel] virt_base @@
   drivers/video/console/earlycon.c:53:30: sparse: expected void *addr
   drivers/video/console/earlycon.c:53:30: sparse: got void [noderef] 
__iomem *static [toplevel] virt_base
>> drivers/video/console/earlycon.c:63:39: sparse: sparse: incorrect type in 
>> return expression (different address spaces) @@ expected void * @@ 
>> got void [noderef] __iomem * @@
   drivers/video/console/earlycon.c:63:39: sparse: expected void *
   drivers/video/console/earlycon.c:63:39: sparse: got void [noderef] 
__iomem *
>> drivers/video/console/earlycon.c:74:24: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@ expected void [noderef] __iomem 
>> *addr @@ got void *addr @@
   drivers/video/console/earlycon.c:74:24: sparse: expected void [noderef] 
__iomem *addr
   drivers/video/console/earlycon.c:74:24: sparse: got void *addr

vim +43 drivers/video/console/earlycon.c

29  
30  static int __init simplefb_earlycon_remap_fb(void)
31  {
32  unsigned long mapping;
33  /* bail if there is no bootconsole or it has been disabled 
already */
34  if (!earlycon_console || !(earlycon_console->flags & 
CON_ENABLED))
35  return 0;
36  
37  if (region_intersects(info.phys_base, info.size,
38IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE) 
== REGION_INTERSECTS) 
39  mapping = MEMREMAP_WB;
40  else
41  mapping = MEMREMAP_WC;
42  
  > 43  info.virt_base = memremap(info.phys_base, info.size, mapping);
44  
45  return info.virt_base ? 0 : -ENOMEM;
46  }
47  early_initcall(simplefb_earlycon_remap_fb);
48  
49  static int __init simplefb_earlycon_unmap_fb(void)
50  {
51  /* unmap the bootconsole fb unless keep_bootcon has left it 
enabled */
52  if (info.virt_base && !(earlycon_console->flags & CON_ENABLED))
  > 53  memunmap(info.virt_base);
54  return 0;
55  }
56  late_initcall(simplefb_earlycon_unmap_fb);
57  
58  static __ref void *simplefb_earlycon_map(unsigned long start, unsigned 
long len)
59  {
60  pgprot_t fb_prot;
61  
62  if (info.virt_base)
  > 63  return info.virt_base + start;
64  
65  fb_prot = PAGE_KERNEL;
66  return early_memremap_prot(info.phys_base + start, len, 

Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

2022-08-07 Thread kernel test robot
Hi Markuss,

I love your patch! Yet something to improve:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on efi/next staging/staging-testing usb/usb-testing 
linus/master v5.19 next-20220805]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git 
tty-testing
config: sh-allmodconfig 
(https://download.01.org/0day-ci/archive/20220807/202208072145.ywogkrw1-...@intel.com/config)
compiler: sh4-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/97dfc2aa69b065de769a191352afe2099c52fedb
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
git checkout 97dfc2aa69b065de769a191352afe2099c52fedb
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 
O=build_dir ARCH=sh SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/video/console/earlycon.c:7:10: fatal error: asm/early_ioremap.h: No 
>> such file or directory
   7 | #include 
 |  ^
   compilation terminated.


vim +7 drivers/video/console/earlycon.c

   > 7  #include 
 8  #include 
 9  #include 
10  #include 
11  #include 
12  #include 
13  #include 
14  #include 
15  #include 
16  #include 
17  #include 
18  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

2022-08-06 Thread Andy Shevchenko
On Sat, Aug 6, 2022 at 6:38 PM Markuss Broks  wrote:
>
> Add early console support for generic linear framebuffer devices.
> This driver supports probing from cmdline early parameters
> or from the device-tree using information in simple-framebuffer node.
> The EFI functionality should be retained in whole.
> The driver was disabled on ARM because of a bug in early_ioremap

We refer to functions like func().

> implementation on ARM and on IA64 because of lack of early_memremap_prot.

Ditto.

...

> +#include 

Can it be placed after linux/* ones?

> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

...

> +static int __init simplefb_earlycon_remap_fb(void)
> +{
> +   unsigned long mapping;

+ Blank line.

> +   /* bail if there is no bootconsole or it has been disabled already */
> +   if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED))
> +   return 0;
> +
> +   if (region_intersects(info.phys_base, info.size,
> + IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE) == 
> REGION_INTERSECTS)
> +   mapping = MEMREMAP_WB;
> +   else
> +   mapping = MEMREMAP_WC;

> +   info.virt_base = memremap(info.phys_base, info.size, mapping);
> +
> +   return info.virt_base ? 0 : -ENOMEM;

Easier to read the standard pattern:

  if (!info.virt_base)
return -ENOMEM;

  return 0;

> +}

...

> +static void simplefb_earlycon_write_char(u8 *dst, unsigned char c, unsigned 
> int h)
> +{
> +   const u8 *src;
> +   int m, n, bytes;
> +   u8 x;
> +
> +   bytes = BITS_TO_BYTES(font->width);
> +   src = font->data + c * font->height * bytes + h * bytes;
> +
> +   for (m = 0; m < font->width; m++) {
> +   n = m % 8;
> +   x = *(src + m / 8);

I would write it as

  x = src[m / 8];

> +   if ((x >> (7 - n)) & 1)

> +   memset(dst, 0xff, (info.depth / 8));

Too many parentheses.

> +   else
> +   memset(dst, 0, (info.depth / 8));

Ditto.

> +   dst += (info.depth / 8);

Ditto.

> +   }
> +}

-- 
With Best Regards,
Andy Shevchenko


[PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

2022-08-06 Thread Markuss Broks
Add early console support for generic linear framebuffer devices.
This driver supports probing from cmdline early parameters
or from the device-tree using information in simple-framebuffer node.
The EFI functionality should be retained in whole.
The driver was disabled on ARM because of a bug in early_ioremap
implementation on ARM and on IA64 because of lack of early_memremap_prot.

Signed-off-by: Markuss Broks 
---
 .../admin-guide/kernel-parameters.txt |  12 +-
 MAINTAINERS   |   5 +
 drivers/firmware/efi/Kconfig  |   7 +-
 drivers/firmware/efi/Makefile |   1 -
 drivers/firmware/efi/earlycon.c   | 246 --
 drivers/video/console/Kconfig |  11 +
 drivers/video/console/Makefile|   1 +
 drivers/video/console/earlycon.c  | 305 ++
 8 files changed, 332 insertions(+), 256 deletions(-)
 delete mode 100644 drivers/firmware/efi/earlycon.c
 create mode 100644 drivers/video/console/earlycon.c

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 
8090130b544b0701237a7b657a29c83c000a60f4..bccb1ac8978eb5cf7e2bb20834b1881b27040666
 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1281,12 +1281,9 @@
specified address. The serial port must already be
setup and configured. Options are not yet supported.
 
-   efifb,[options]
+   efifb
Start an early, unaccelerated console on the EFI
-   memory mapped framebuffer (if available). On cache
-   coherent non-x86 systems that use system memory for
-   the framebuffer, pass the 'ram' option so that it is
-   mapped with the correct attributes.
+   memory mapped framebuffer (if available).
 
linflex,
Use early console provided by Freescale LINFlexD UART
@@ -1294,6 +1291,11 @@
address must be provided, and the serial port must
already be setup and configured.
 
+   simplefb,,xx
+   Use early console with simple framebuffer that is
+   pre-initialized by firmware. A valid base address,
+   width, height and pixel size must be provided.
+
earlyprintk=[X86,SH,ARM,M68k,S390]
earlyprintk=vga
earlyprintk=sclp
diff --git a/MAINTAINERS b/MAINTAINERS
index 
1fc9ead83d2aa3e60ccc4cfa8ee16df09ef579bf..af8b8e289483b6a264d477145061bd0e0ba34a25
 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7033,6 +7033,11 @@ Q:   
http://patchwork.linuxtv.org/project/linux-media/list/
 T: git git://linuxtv.org/anttip/media_tree.git
 F: drivers/media/tuners/e4000*
 
+EARLY CONSOLE FRAMEBUFFER DRIVER
+M: Markuss Broks 
+S: Maintained
+F: drivers/video/console/earlycon.c
+
 EARTH_PT1 MEDIA DRIVER
 M: Akihiro Tsukada 
 L: linux-me...@vger.kernel.org
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 
7aa4717cdcac46f91dd202f868c463388eb02735..ea76ccfb9bcd8ba44ddca06052eaa442ed6c30f7
 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -259,10 +259,9 @@ config EFI_DISABLE_PCI_DMA
  may be used to override this option.
 
 config EFI_EARLYCON
-   def_bool y
-   depends on SERIAL_EARLYCON && !ARM && !IA64
-   select FONT_SUPPORT
-   select ARCH_USE_MEMREMAP_PROT
+   bool "EFI early console support"
+   select FB_EARLYCON
+   default y
 
 config EFI_CUSTOM_SSDT_OVERLAYS
bool "Load custom ACPI SSDT overlay from an EFI variable"
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index 
c02ff25dd47707090a2ab86ee4f330e467f878f5..64eea61fbb43d76ec2d5416d467dfbb9aa21bda0
 100644
--- a/drivers/firmware/efi/Makefile
+++ b/drivers/firmware/efi/Makefile
@@ -44,6 +44,5 @@ obj-$(CONFIG_ARM64)   += $(arm-obj-y)
 riscv-obj-$(CONFIG_EFI):= efi-init.o riscv-runtime.o
 obj-$(CONFIG_RISCV)+= $(riscv-obj-y)
 obj-$(CONFIG_EFI_CAPSULE_LOADER)   += capsule-loader.o
-obj-$(CONFIG_EFI_EARLYCON) += earlycon.o
 obj-$(CONFIG_UEFI_CPER_ARM)+= cper-arm.o
 obj-$(CONFIG_UEFI_CPER_X86)+= cper-x86.o
diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlycon.c
deleted file mode 100644
index 
a52236e11e5f73ddea5bb1f42ca2ca7c42425dab..
--- a/drivers/firmware/efi/earlycon.c
+++ /dev/null
@@ -1,246 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2013 Intel Corporation; author Matt Fleming
- */
-
-#include 
-#include 
-#include 
-#include