Re: [U-Boot] [PATCH v4 03/29] Convert CONSOLE_PRE_CONSOLE_BUFFER options to Kconfig

2016-10-20 Thread Jagan Teki
On Tue, Oct 18, 2016 at 7:42 AM, Simon Glass  wrote:
> Move these option to Kconfig and tidy up existing uses.
>
> Signed-off-by: Simon Glass 

Reviewed-by: Jagan Teki 

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 03/29] Convert CONSOLE_PRE_CONSOLE_BUFFER options to Kconfig

2016-10-17 Thread Simon Glass
Move these option to Kconfig and tidy up existing uses.

Signed-off-by: Simon Glass 
---

Changes in v4: None
Changes in v3: None
Changes in v2:
- Change CONFIG_PRE_CON_BUF_SZ default to 4096
- Change CONFIG_PRE_CON_BUF_SZ to 'int' type
- Drop the depend clause on the CONFIG_PRE_CON_BUF_SZ default
- Move CONFIG_PRE_CON_BUF_ADDR default to common/Kconfig

 README| 17 
 board/sunxi/Kconfig   |  3 +++
 common/Kconfig| 42 +++
 common/console.c  |  6 +++---
 configs/tbs2910_defconfig |  2 ++
 include/asm-generic/global_data.h |  2 +-
 include/configs/sunxi-common.h|  6 --
 include/configs/tbs2910.h |  4 
 scripts/config_whitelist.txt  |  3 ---
 9 files changed, 51 insertions(+), 34 deletions(-)

diff --git a/README b/README
index cc75700..0614a60 100644
--- a/README
+++ b/README
@@ -832,23 +832,6 @@ The following options need to be configured:
must be defined, to setup the maximum idle timeout for
the SMC.
 
-- Pre-Console Buffer:
-   Prior to the console being initialised (i.e. serial UART
-   initialised etc) all console output is silently discarded.
-   Defining CONFIG_PRE_CONSOLE_BUFFER will cause U-Boot to
-   buffer any console messages prior to the console being
-   initialised to a buffer of size CONFIG_PRE_CON_BUF_SZ
-   bytes located at CONFIG_PRE_CON_BUF_ADDR. The buffer is
-   a circular buffer, so if more than CONFIG_PRE_CON_BUF_SZ
-   bytes are output before the console is initialised, the
-   earlier bytes are discarded.
-
-   Note that when printing the buffer a copy is made on the
-   stack so CONFIG_PRE_CON_BUF_SZ must fit on the stack.
-
-   'Sane' compilers will generate smaller code if
-   CONFIG_PRE_CON_BUF_SZ is a power of 2
-
 - Autoboot Command:
CONFIG_BOOTCOMMAND
Only needed when CONFIG_BOOTDELAY is enabled;
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index b139d1c..c0ffeb3 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -3,6 +3,9 @@ if ARCH_SUNXI
 config IDENT_STRING
default " Allwinner Technology"
 
+config PRE_CONSOLE_BUFFER
+   default y
+
 config SPL_GPIO_SUPPORT
default y
 
diff --git a/common/Kconfig b/common/Kconfig
index a8dfd7c..7988de2 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -246,6 +246,48 @@ config SILENT_CONSOLE_UPDATE_ON_RELOC
  (e.g. NAND). This option makes the value of the 'silent'
  environment variable take effect at relocation.
 
+config PRE_CONSOLE_BUFFER
+   bool "Buffer characters before the console is available"
+   help
+ Prior to the console being initialised (i.e. serial UART
+ initialised etc) all console output is silently discarded.
+ Defining CONFIG_PRE_CONSOLE_BUFFER will cause U-Boot to
+ buffer any console messages prior to the console being
+ initialised to a buffer. The buffer is a circular buffer, so
+ if it overflows, earlier output is discarded.
+
+ Note that this is not currently supported in SPL. It would be
+ useful to be able to share the pre-console buffer with SPL.
+
+config PRE_CON_BUF_SZ
+   int "Sets the size of the pre-console buffer"
+   depends on PRE_CONSOLE_BUFFER
+   default 4096
+   help
+ The size of the pre-console buffer affects how much console output
+ can be held before it overflows and starts discarding earlier
+ output. Normally there is very little output at this early stage,
+ unless debugging is enabled, so allow enough for ~10 lines of
+ text.
+
+ This is a useful feature if you are using a video console and
+ want to see the full boot output on the console. Without this
+ option only the post-relocation output will be displayed.
+
+config PRE_CON_BUF_ADDR
+   hex "Address of the pre-console buffer"
+   depends on PRE_CONSOLE_BUFFER
+   default 0x2f00 if ARCH_SUNXI && MACH_SUN9I
+   default 0x4f00 if ARCH_SUNXI && !MACH_SUN9I
+   help
+ This sets the start address of the pre-console buffer. This must
+ be in available memory and is accessed before relocation and
+ possibly before DRAM is set up. Therefore choose an address
+ carefully.
+
+ We should consider removing this option and allocating the memory
+ in board_init_f_init_reserve() instead.
+
 endmenu
 
 config SYS_NO_FLASH
diff --git a/common/console.c b/common/console.c
index c7f3243..f0f9bab 100644
--- a/common/console.c
+++ b/common/console.c
@@ -201,7 +201,7 @@ static void console_putc(int file, const char c)
}
 }
 
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
+#if