[U-Boot] [BUG] efi_loader: unaligned access in disk/part_efi.c, cmd/bootefi.c, efi_hii_sibt_string_ucs2_block_next()

2019-07-14 Thread Heinrich Schuchardt

Ramon reported the following bug:

[14.07  08:29]  Hey. running unit-tests fails on compilation for
some reason on my setup
[14.07  08:30]  https://pastebin.com/E1YhU71Y
[14.07  08:41]  I have gcc (GCC) 9.1.0

(venv) stdcall@stdcall-pc:~/dev/u-boot (pci_ep) $ make mrproper
(venv) stdcall@stdcall-pc:~/dev/u-boot (pci_ep) $ ./test/py/test.py --bd
sandbox --build -k ut_dm_pci_ep_base
+make O=/home/stdcall/dev/u-boot/build-sandbox -s sandbox_defconfig
+make O=/home/stdcall/dev/u-boot/build-sandbox -s -j8
../disk/part_efi.c: In function ‘gpt_verify_partitions’:
../disk/part_efi.c:737:49: error: taking address of packed member of
‘struct _gpt_entry’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  737 |   gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name,
  | ^~~
cc1: all warnings being treated as errors
make[2]: *** [../scripts/Makefile.build:278: disk/part_efi.o] Error 1
make[1]: *** [/home/stdcall/dev/u-boot/Makefile:1594: disk] Error 2
make[1]: *** Waiting for unfinished jobs
In file included from ../include/efi_loader.h:13,
 from ../common/board_r.c:50:
../include/efi_api.h: In function ‘efi_hii_sibt_string_ucs2_block_next’:
../include/efi_api.h:820:18: error: taking address of packed member of
‘struct efi_hii_sibt_string_ucs2_block’ may result in an unaligned
pointer value [-Werror=address-of-packed-member]
  820 |   (u16_strlen(blk->string_text) + 1) * 2;
  |   ~~~^
In file included from ../include/vxworks.h:10,
 from ../common/bootm_os.c:12:
../include/efi_api.h: In function ‘efi_hii_sibt_string_ucs2_block_next’:
../include/efi_api.h:820:18: error: taking address of packed member of
‘struct efi_hii_sibt_string_ucs2_block’ may result in an unaligned
pointer value [-Werror=address-of-packed-member]
  820 |   (u16_strlen(blk->string_text) + 1) * 2;
  |   ~~~^
cc1: all warnings being treated as errors
In file included from ../include/efi_loader.h:13,
 from ../cmd/bootefi.c:12:
../include/efi_api.h: In function ‘efi_hii_sibt_string_ucs2_block_next’:
../include/efi_api.h:820:18: error: taking address of packed member of
‘struct efi_hii_sibt_string_ucs2_block’ may result in an unaligned
pointer value [-Werror=address-of-packed-member]
  820 |   (u16_strlen(blk->string_text) + 1) * 2;
  |   ~~~^
../cmd/bootefi.c: In function ‘get_config_table’:
../cmd/bootefi.c:189:22: error: taking address of packed member of
‘struct efi_configuration_table’ may result in an unaligned pointer
value [-Werror=address-of-packed-member]
  189 |   if (!guidcmp(guid, &systab.tables[i].guid))
  |  ^~
make[2]: *** [../scripts/Makefile.build:278: common/board_r.o] Error 1
make[2]: *** Waiting for unfinished jobs
cc1: all warnings being treated as errors
make[2]: *** [../scripts/Makefile.build:278: common/bootm_os.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [../scripts/Makefile.build:278: cmd/bootefi.o] Error 1
make[2]: *** Waiting for unfinished jobs
make[1]: *** [/home/stdcall/dev/u-boot/Makefile:1594: cmd] Error 2
make[1]: *** [/home/stdcall/dev/u-boot/Makefile:1594: common] Error 2
make: *** [Makefile:148: sub-make] Error 2
Exit code: 2
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/_pytest/main.py",
line 205, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/_pytest/config/__init__.py",
line 663, in _do_configure
INTERNALERROR>
self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/hooks.py",
line 311, in call_historic
INTERNALERROR> res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/manager.py",
line 68, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/manager.py",
line 62, in 
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if
hook.spec else False,
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/callers.py",
line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/callers.py",
line 81, in get_result
INTERNALERROR> _reraise(*ex)  # noqa
INTERNALERROR>   File
"/home/stdcall/dev/u-boot/venv/lib/python2.7/site-packages/pluggy/callers.py",
line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR>   File "/home/stdcall/dev/u-boot/test/py/conftest.py",

Re: [U-Boot] [PATCH 1/1] efi_loader: allow adding mapped memory at 0x00000000

2019-07-14 Thread Heinrich Schuchardt

On 7/14/19 4:13 AM, Bin Meng wrote:

On Sun, Jul 14, 2019 at 4:02 AM Heinrich Schuchardt  wrote:


As efi_add_memory_map() signals an error by returning NULL and correct
function by returning the requested address we cannot discern an error from
correct functioning for address 0x. This leads to unexpected
warnings on the Raspberry 3.

Use EFI_SUCCESS to signal success and return an error code otherwise.

Reported-by: Bryan O'Donoghue 
Signed-off-by: Heinrich Schuchardt 
---
  cmd/bootefi.c   |  4 ++--
  include/efi_loader.h|  4 ++--
  lib/efi_loader/efi_memory.c | 28 ++--
  3 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index c19256e00d..04d3e3e4a7 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -169,8 +169,8 @@ static void efi_carve_out_dt_rsv(void *fdt)

 pages = efi_size_in_pages(size + (addr & EFI_PAGE_MASK));
 addr &= ~EFI_PAGE_MASK;
-   if (!efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE,
-   false))
+   if (efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE,
+  false) != EFI_SUCCESS)
 printf("FDT memrsv map %d: Failed to add to map\n", i);
 }
  }
diff --git a/include/efi_loader.h b/include/efi_loader.h
index db4763fc9b..6cc6a3835c 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -476,8 +476,8 @@ efi_status_t efi_get_memory_map(efi_uintn_t 
*memory_map_size,
 efi_uintn_t *descriptor_size,
 uint32_t *descriptor_version);
  /* Adds a range into the EFI memory map */
-uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
-   bool overlap_only_ram);
+efi_status_t efi_add_memory_map(uint64_t start, uint64_t pages, int 
memory_type,
+   bool overlap_only_ram);
  /* Called by board init to initialize the EFI drivers */
  efi_status_t efi_driver_init(void);
  /* Called by board init to initialize the EFI memory map */
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 27379381e8..da253fa285 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -223,8 +223,17 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map,
 return EFI_CARVE_LOOP_AGAIN;
  }

-uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
-   bool overlap_only_ram)
+/**
+ * efi_add_memory_map() - add memory area to the memory map
+ *
+ * @start: start address, must be a multiple of EFI_PAGE_SIZE
+ * @pages: number of pages to add
+ * @memory_type:   type of memory added
+ * @overlap_only_ram:  the memory area must overlap existing
+ * Return: status code


nits: @return


Thanks for reviewing. The current version of Sphinx wants "Return:".
Cf.
https://www.kernel.org/doc/html/v5.2/doc-guide/kernel-doc.html#return-values

Best regards

Heinrich



[snip]

Other than that,
Reviewed-by: Bin Meng 



___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] efi_loader: allow adding mapped memory at 0x00000000

2019-07-14 Thread Bin Meng
On Sun, Jul 14, 2019 at 4:08 PM Heinrich Schuchardt  wrote:
>
> On 7/14/19 4:13 AM, Bin Meng wrote:
> > On Sun, Jul 14, 2019 at 4:02 AM Heinrich Schuchardt  
> > wrote:
> >>
> >> As efi_add_memory_map() signals an error by returning NULL and correct
> >> function by returning the requested address we cannot discern an error from
> >> correct functioning for address 0x. This leads to unexpected
> >> warnings on the Raspberry 3.
> >>
> >> Use EFI_SUCCESS to signal success and return an error code otherwise.
> >>
> >> Reported-by: Bryan O'Donoghue 
> >> Signed-off-by: Heinrich Schuchardt 
> >> ---
> >>   cmd/bootefi.c   |  4 ++--
> >>   include/efi_loader.h|  4 ++--
> >>   lib/efi_loader/efi_memory.c | 28 ++--
> >>   3 files changed, 22 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> >> index c19256e00d..04d3e3e4a7 100644
> >> --- a/cmd/bootefi.c
> >> +++ b/cmd/bootefi.c
> >> @@ -169,8 +169,8 @@ static void efi_carve_out_dt_rsv(void *fdt)
> >>
> >>  pages = efi_size_in_pages(size + (addr & EFI_PAGE_MASK));
> >>  addr &= ~EFI_PAGE_MASK;
> >> -   if (!efi_add_memory_map(addr, pages, 
> >> EFI_RESERVED_MEMORY_TYPE,
> >> -   false))
> >> +   if (efi_add_memory_map(addr, pages, 
> >> EFI_RESERVED_MEMORY_TYPE,
> >> +  false) != EFI_SUCCESS)
> >>  printf("FDT memrsv map %d: Failed to add to 
> >> map\n", i);
> >>  }
> >>   }
> >> diff --git a/include/efi_loader.h b/include/efi_loader.h
> >> index db4763fc9b..6cc6a3835c 100644
> >> --- a/include/efi_loader.h
> >> +++ b/include/efi_loader.h
> >> @@ -476,8 +476,8 @@ efi_status_t efi_get_memory_map(efi_uintn_t 
> >> *memory_map_size,
> >>  efi_uintn_t *descriptor_size,
> >>  uint32_t *descriptor_version);
> >>   /* Adds a range into the EFI memory map */
> >> -uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int 
> >> memory_type,
> >> -   bool overlap_only_ram);
> >> +efi_status_t efi_add_memory_map(uint64_t start, uint64_t pages, int 
> >> memory_type,
> >> +   bool overlap_only_ram);
> >>   /* Called by board init to initialize the EFI drivers */
> >>   efi_status_t efi_driver_init(void);
> >>   /* Called by board init to initialize the EFI memory map */
> >> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> >> index 27379381e8..da253fa285 100644
> >> --- a/lib/efi_loader/efi_memory.c
> >> +++ b/lib/efi_loader/efi_memory.c
> >> @@ -223,8 +223,17 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map,
> >>  return EFI_CARVE_LOOP_AGAIN;
> >>   }
> >>
> >> -uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int 
> >> memory_type,
> >> -   bool overlap_only_ram)
> >> +/**
> >> + * efi_add_memory_map() - add memory area to the memory map
> >> + *
> >> + * @start: start address, must be a multiple of EFI_PAGE_SIZE
> >> + * @pages: number of pages to add
> >> + * @memory_type:   type of memory added
> >> + * @overlap_only_ram:  the memory area must overlap existing
> >> + * Return: status code
> >
> > nits: @return
>
> Thanks for reviewing. The current version of Sphinx wants "Return:".
> Cf.
> https://www.kernel.org/doc/html/v5.2/doc-guide/kernel-doc.html#return-values
>

Good point. I thought we were using Doxygen format. Not ware of new
Sphinx format. Are we buidling Sphinx docs for U-Boot?

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] doc: Cope with Sphinx logging deprecations

2019-07-14 Thread Heinrich Schuchardt
From: Jonathan Corbet 

Recent versions of sphinx will emit messages like:

  doc/sphinx/kerneldoc.py:103:
 RemovedInSphinx20Warning: app.warning() is now deprecated.
 Use sphinx.util.logging instead.

Switch to sphinx.util.logging to make this unsightly message go away.
Alas, that interface was only added in version 1.6, so we have to add a
version check to keep things working with older sphinxes.

Signed-off-by: Jonathan Corbet 
Rebased for U-Boot
Signed-off-by: Heinrich Schuchardt 
---
 doc/sphinx/kerneldoc.py | 12 
 doc/sphinx/kernellog.py | 28 
 doc/sphinx/kfigure.py   | 40 +++-
 3 files changed, 59 insertions(+), 21 deletions(-)
 create mode 100644 doc/sphinx/kernellog.py

diff --git a/doc/sphinx/kerneldoc.py b/doc/sphinx/kerneldoc.py
index fbedcc3946..e536360de1 100644
--- a/doc/sphinx/kerneldoc.py
+++ b/doc/sphinx/kerneldoc.py
@@ -39,6 +39,8 @@ from docutils.statemachine import ViewList
 from docutils.parsers.rst import directives, Directive
 from sphinx.ext.autodoc import AutodocReporter

+import kernellog
+
 __version__  = '1.0'

 class KernelDocDirective(Directive):
@@ -86,7 +88,8 @@ class KernelDocDirective(Directive):
 cmd += [filename]

 try:
-env.app.verbose('calling kernel-doc \'%s\'' % (" ".join(cmd)))
+kernellog.verbose(env.app,
+  'calling kernel-doc \'%s\'' % (" ".join(cmd)))

 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
 out, err = p.communicate()
@@ -96,7 +99,8 @@ class KernelDocDirective(Directive):
 if p.returncode != 0:
 sys.stderr.write(err)

-env.app.warn('kernel-doc \'%s\' failed with return code %d' % 
(" ".join(cmd), p.returncode))
+kernellog.warn(env.app,
+   'kernel-doc \'%s\' failed with return code %d' 
% (" ".join(cmd), p.returncode))
 return [nodes.error(None, nodes.paragraph(text = "kernel-doc 
missing"))]
 elif env.config.kerneldoc_verbosity > 0:
 sys.stderr.write(err)
@@ -128,8 +132,8 @@ class KernelDocDirective(Directive):
 return node.children

 except Exception as e:  # pylint: disable=W0703
-env.app.warn('kernel-doc \'%s\' processing failed with: %s' %
- (" ".join(cmd), str(e)))
+kernellog.warn(env.app, 'kernel-doc \'%s\' processing failed with: 
%s' %
+   (" ".join(cmd), str(e)))
 return [nodes.error(None, nodes.paragraph(text = "kernel-doc 
missing"))]

 def setup(app):
diff --git a/doc/sphinx/kernellog.py b/doc/sphinx/kernellog.py
new file mode 100644
index 00..af924f51a7
--- /dev/null
+++ b/doc/sphinx/kernellog.py
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Sphinx has deprecated its older logging interface, but the replacement
+# only goes back to 1.6.  So here's a wrapper layer to keep around for
+# as long as we support 1.4.
+#
+import sphinx
+
+if sphinx.__version__[:3] >= '1.6':
+UseLogging = True
+from sphinx.util import logging
+logger = logging.getLogger('kerneldoc')
+else:
+UseLogging = False
+
+def warn(app, message):
+if UseLogging:
+logger.warning(message)
+else:
+app.warn(message)
+
+def verbose(app, message):
+if UseLogging:
+logger.verbose(message)
+else:
+app.verbose(message)
+
+
diff --git a/doc/sphinx/kfigure.py b/doc/sphinx/kfigure.py
index b97228d2cc..fbfe6693bb 100644
--- a/doc/sphinx/kfigure.py
+++ b/doc/sphinx/kfigure.py
@@ -60,6 +60,8 @@ import sphinx
 from sphinx.util.nodes import clean_astext
 from six import iteritems

+import kernellog
+
 PY3 = sys.version_info[0] == 3

 if PY3:
@@ -171,20 +173,20 @@ def setupTools(app):
 This function is called once, when the builder is initiated.
 """
 global dot_cmd, convert_cmd   # pylint: disable=W0603
-app.verbose("kfigure: check installed tools ...")
+kernellog.verbose(app, "kfigure: check installed tools ...")

 dot_cmd = which('dot')
 convert_cmd = which('convert')

 if dot_cmd:
-app.verbose("use dot(1) from: " + dot_cmd)
+kernellog.verbose(app, "use dot(1) from: " + dot_cmd)
 else:
-app.warn("dot(1) not found, for better output quality install "
- "graphviz from http://www.graphviz.org";)
+kernellog.warn(app, "dot(1) not found, for better output quality 
install "
+   "graphviz from http://www.graphviz.org";)
 if convert_cmd:
-app.verbose("use convert(1) from: " + convert_cmd)
+kernellog.verbose(app, "use convert(1) from: " + convert_cmd)
 else:
-app.warn(
+kernellog.warn(app,
 "convert(1) not found, for SVG to PDF conversion install "
 "ImageMagick (https://www.imagemagick.org)")

@@ -220,12 +222,13 @@ de

[U-Boot] [PATCH v2 0/2] rockchip: make_fit_atf.py Eliminate pyelftools dependency

2019-07-14 Thread Chris Webb
[Sorry for a respin so soon, but this fixes the overzealous documentation
update and also ensures the script's behaviour is identical to the existing
implementation in the case of a completely empty bl31 ELF file.]

Building for Rockchip, make_fit_atf.py depends on pyelftools, a non-bundled
python module that is not used elsewhere in building u-boot or the kernel.

We only use pyelftools to pull out PT_LOAD segments. ELF is very simple, so
doing this manually is easy and spares users the extra dependency. In fact,
a straightforward implementation shrinks make_fit_aft.py rather than adding
complexity.

Andy Yan's patch

  
https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip/commit/619f002db864ef8caa30863bde62df5c651a7312

is a prerequisite for this. The new code does not erroneously count
GNU_STACK sections and therefore without the above patch, the loadables in
the conf section will always be one short, even where GNU_STACK is present.

I have tested this script with python 2 and 3 against all bl31 elf files at

  https://github.com/rockchip-linux/rkbin/tree/master/bin/rk33

as well as an rk3399 bl31.elf built locally from the master branch of

  https://github.com/ARM-software/arm-trusted-firmware

to which my toolchain added the extra GNU_STACK segment.

In each case, identical *.bin files were produced compared to the pyelftools
implementation, and a correct .its configuration (without off-by-one error)
was emitted, with and without dtbs supplied to the script.

Changes in v2:
  - no exception on a valid but completely empty bl31 ELF file
  - restrict documentation updates to the Rockchip docs (!)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/2] rockchip: make_fit_atf.py: Eliminate pyelftools dependency

2019-07-14 Thread Chris Webb
make_fit_aft.py depends on the non-standard library pyelftools to pull
out PT_LOAD segments from ELF files. However, this is as easy to do
manually, without imposing the extra dependency on users.

Structures in the ELF file are unpacked into variables named to exactly
match the ELF spec to ensure the destructuring code is reasonably
self-documenting.

Signed-off-by: Chris Webb 
---
 arch/arm/mach-rockchip/make_fit_atf.py | 75 +++---
 1 file changed, 32 insertions(+), 43 deletions(-)

diff --git a/arch/arm/mach-rockchip/make_fit_atf.py 
b/arch/arm/mach-rockchip/make_fit_atf.py
index db0ae96ca8..9acc1edfc6 100755
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ b/arch/arm/mach-rockchip/make_fit_atf.py
@@ -13,16 +13,7 @@ import os
 import sys
 import getopt
 import logging
-
-# pip install pyelftools
-from elftools.elf.elffile import ELFFile
-
-ELF_SEG_P_TYPE = 'p_type'
-ELF_SEG_P_PADDR = 'p_paddr'
-ELF_SEG_P_VADDR = 'p_vaddr'
-ELF_SEG_P_OFFSET = 'p_offset'
-ELF_SEG_P_FILESZ = 'p_filesz'
-ELF_SEG_P_MEMSZ = 'p_memsz'
+import struct
 
 DT_HEADER = """
 /*
@@ -118,33 +109,19 @@ def append_conf_node(file, dtbs, segments):
 file.write('\n')
 
 def generate_atf_fit_dts_uboot(fit_file, uboot_file_name):
-num_load_seg = 0
-p_paddr = 0x
-with open(uboot_file_name, 'rb') as uboot_file:
-uboot = ELFFile(uboot_file)
-for i in range(uboot.num_segments()):
-seg = uboot.get_segment(i)
-if seg.__getitem__(ELF_SEG_P_TYPE) == 'PT_LOAD':
-p_paddr = seg.__getitem__(ELF_SEG_P_PADDR)
-num_load_seg = num_load_seg + 1
-
-assert (p_paddr != 0x and num_load_seg == 1)
-
+segments = unpack_elf(uboot_file_name)
+if len(segments) != 1:
+raise ValueError("Invalid u-boot ELF image '%s'" % uboot_file_name)
+index, entry, p_paddr, data = segments[0]
 fit_file.write(DT_UBOOT % p_paddr)
 
 def generate_atf_fit_dts_bl31(fit_file, bl31_file_name, dtbs_file_name):
-with open(bl31_file_name, 'rb') as bl31_file:
-bl31 = ELFFile(bl31_file)
-elf_entry = bl31.header['e_entry']
-segments = bl31.num_segments()
-for i in range(segments):
-seg = bl31.get_segment(i)
-if seg.__getitem__(ELF_SEG_P_TYPE) == 'PT_LOAD':
-paddr = seg.__getitem__(ELF_SEG_P_PADDR)
-append_bl31_node(fit_file, i + 1, paddr, elf_entry)
+segments = unpack_elf(bl31_file_name)
+for index, entry, paddr, data in segments:
+append_bl31_node(fit_file, index + 1, paddr, entry)
 append_fdt_node(fit_file, dtbs_file_name)
 fit_file.write(DT_IMAGES_NODE_END)
-append_conf_node(fit_file, dtbs_file_name, segments)
+append_conf_node(fit_file, dtbs_file_name, len(segments))
 
 def generate_atf_fit_dts(fit_file_name, bl31_file_name, uboot_file_name, 
dtbs_file_name):
 # Generate FIT script for ATF image.
@@ -162,17 +139,29 @@ def generate_atf_fit_dts(fit_file_name, bl31_file_name, 
uboot_file_name, dtbs_fi
 fit_file.close()
 
 def generate_atf_binary(bl31_file_name):
-with open(bl31_file_name, 'rb') as bl31_file:
-bl31 = ELFFile(bl31_file)
-
-num = bl31.num_segments()
-for i in range(num):
-seg = bl31.get_segment(i)
-if seg.__getitem__(ELF_SEG_P_TYPE) == 'PT_LOAD':
-paddr = seg.__getitem__(ELF_SEG_P_PADDR)
-file_name = 'bl31_0x%08x.bin' % paddr
-with open(file_name, "wb") as atf:
-atf.write(seg.data())
+for index, entry, paddr, data in unpack_elf(bl31_file_name):
+file_name = 'bl31_0x%08x.bin' % paddr
+with open(file_name, "wb") as atf:
+atf.write(data)
+
+def unpack_elf(filename):
+with open(filename, 'rb') as file:
+elf = file.read()
+if elf[0:7] != b'\x7fELF\x02\x01\x01' or elf[18:20] != b'\xb7\x00':
+raise ValueError("Invalid arm64 ELF file '%s'" % filename)
+
+e_entry, e_phoff = struct.unpack_from('<2Q', elf, 0x18)
+e_phentsize, e_phnum = struct.unpack_from('<2H', elf, 0x36)
+segments = []
+
+for index in range(e_phnum):
+offset = e_phoff + e_phentsize*index
+p_type, p_flags, p_offset = struct.unpack_from('https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/2] rockchip: Remove obsolete references to pyelftools

2019-07-14 Thread Chris Webb
make_fit_atf.py no longer requires pyelftools, and nothing else in the
rockchip build requires it either, so remove references to installing it
from the documentation.

Signed-off-by: Chris Webb 
---
 board/rockchip/evb_rk3399/README | 6 --
 doc/README.rockchip  | 4 
 2 files changed, 10 deletions(-)

diff --git a/board/rockchip/evb_rk3399/README b/board/rockchip/evb_rk3399/README
index 6469821987..ea3258cf37 100644
--- a/board/rockchip/evb_rk3399/README
+++ b/board/rockchip/evb_rk3399/README
@@ -35,12 +35,6 @@ Get the Source and prebuild binary
   > git clone https://github.com/rockchip-linux/rkbin.git
   > git clone https://github.com/rockchip-linux/rkdeveloptool.git
 
-Get some prerequisites
-==
-
-You need the Python elftools.elf.elffile library for make_fit_atf.py to work:
-
-  > sudo apt-get install python-pyelftools
 
 Compile ATF
 ===
diff --git a/doc/README.rockchip b/doc/README.rockchip
index 02e2497b15..8ccbb87264 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -123,10 +123,6 @@ For example:
 
Option 2: Package the image with SPL:
 
-   - We need the Python elftools.elf.elffile library for make_fit_atf.py to 
work
-
- => sudo apt-get install python-pyelftools
-
- Export cross compiler path for aarch64
 
- Compile ATF
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/8] x86: Add new slimbootloader CPU type

2019-07-14 Thread Bin Meng
On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
>
> This slimbootloader cpu type is to enable u-boot as a payload which
> runs on top of Slim Bootloader(https://github.com/slimbootloader).
> The Slim Bootloader is designed with multi-stage architecture for
> the execution from reset vector to OS booting, and supports qemu,
> Apollolake, Whiskeylake and Coffeelake platforms consuming Intel FSP
> (https://github.com/IntelFsp) for silicon initialization including
> CAR and memory initialization.
> The Slim Bootloader generates new HOB(Hand Off Block) which are
> serial port info, memory map info, performance data info and so on,
> and passes it to a Payload. U-boot as a payload will use these HOB

nits: U-Boot

> information for basic initialization such as serial console.
>
> As an initial commit,
> - Add CONFIG_SYS_SLIMBOOTLOADER to enable slimbootloader CPU type
> - Add new arch/x86/cpu/slimbootloader directory with minimum codes
> - Get hob_list pointer from Slim Bootloader
>
> Signed-off-by: Aiden Park 
> ---
>
> Changes in v3:
>   * Add a brief description about Slim Bootloader
>   * Enable USB_KEYBOARD, E1000 and RTL8169 by default
>   * Fix comment from code review
>
>  arch/x86/Kconfig  |  1 +
>  arch/x86/cpu/Makefile |  1 +
>  arch/x86/cpu/slimbootloader/Kconfig   | 26 +++
>  arch/x86/cpu/slimbootloader/Makefile  |  5 +++
>  arch/x86/cpu/slimbootloader/car.S | 43 +++
>  arch/x86/cpu/slimbootloader/slimbootloader.c  | 21 +
>  .../asm/arch-slimbootloader/slimbootloader.h  | 11 +
>  arch/x86/include/asm/global_data.h|  2 +-
>  arch/x86/lib/asm-offsets.c|  2 +-
>  9 files changed, 110 insertions(+), 2 deletions(-)
>  create mode 100644 arch/x86/cpu/slimbootloader/Kconfig
>  create mode 100644 arch/x86/cpu/slimbootloader/Makefile
>  create mode 100644 arch/x86/cpu/slimbootloader/car.S
>  create mode 100644 arch/x86/cpu/slimbootloader/slimbootloader.c
>  create mode 100644 arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 70f939869a..27b7b767b9 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -115,6 +115,7 @@ source "arch/x86/cpu/efi/Kconfig"
>  source "arch/x86/cpu/qemu/Kconfig"
>  source "arch/x86/cpu/quark/Kconfig"
>  source "arch/x86/cpu/queensbay/Kconfig"
> +source "arch/x86/cpu/slimbootloader/Kconfig"
>  source "arch/x86/cpu/tangier/Kconfig"
>
>  # architecture-specific options below
> diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
> index 85fd5e616e..3f1f62da2b 100644
> --- a/arch/x86/cpu/Makefile
> +++ b/arch/x86/cpu/Makefile
> @@ -42,6 +42,7 @@ obj-$(CONFIG_INTEL_BAYTRAIL) += baytrail/
>  obj-$(CONFIG_INTEL_BRASWELL) += braswell/
>  obj-$(CONFIG_INTEL_BROADWELL) += broadwell/
>  obj-$(CONFIG_SYS_COREBOOT) += coreboot/
> +obj-$(CONFIG_SYS_SLIMBOOTLOADER) += slimbootloader/
>  obj-$(CONFIG_EFI) += efi/
>  obj-$(CONFIG_QEMU) += qemu/
>  obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/
> diff --git a/arch/x86/cpu/slimbootloader/Kconfig 
> b/arch/x86/cpu/slimbootloader/Kconfig
> new file mode 100644
> index 00..439e4b1e2c
> --- /dev/null
> +++ b/arch/x86/cpu/slimbootloader/Kconfig
> @@ -0,0 +1,26 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright (C) 2019 Intel Corporation 
> +
> +if TARGET_SLIMBOOTLOADER
> +
> +config SYS_SLIMBOOTLOADER
> +   bool
> +   default y
> +   imply SYS_NS16550
> +   imply AHCI_PCI
> +   imply SCSI
> +   imply SCSI_AHCI
> +   imply MMC
> +   imply MMC_PCI
> +   imply MMC_SDHCI
> +   imply MMC_SDHCI_SDMA
> +   imply USB
> +   imply USB_EHCI_HCD
> +   imply USB_XHCI_HCD
> +   imply USB_STORAGE
> +   imply USB_KEYBOARD
> +   imply E1000
> +   imply RTL8169
> +
> +endif
> diff --git a/arch/x86/cpu/slimbootloader/Makefile 
> b/arch/x86/cpu/slimbootloader/Makefile
> new file mode 100644
> index 00..627a721e8c
> --- /dev/null
> +++ b/arch/x86/cpu/slimbootloader/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright (C) 2019 Intel Corporation 
> +
> +obj-y += car.o slimbootloader.o
> diff --git a/arch/x86/cpu/slimbootloader/car.S 
> b/arch/x86/cpu/slimbootloader/car.S
> new file mode 100644
> index 00..63c5c28b33
> --- /dev/null
> +++ b/arch/x86/cpu/slimbootloader/car.S
> @@ -0,0 +1,43 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (C) 2019 Intel Corporation 
> + */
> +
> +#include 
> +
> +.section .text
> +
> +.globl slimbootloader_start
> +slimbootloader_start:
> +   /* Get hob pointer parameter from previous stage's stack */
> +   mov 0x4(%esp), %esi
> +
> +   /* Set up global data */
> +   mov %esp, %eax
> +   callboard_init_f_alloc_reserve
> +   mov %eax, %esp
> +   callboard_init_f_init_reserve
> +
> +#ifdef CONFIG_DEBUG_UART
> +

Re: [U-Boot] [PATCH v3 2/8] x86: Add a common hob library

2019-07-14 Thread Bin Meng
On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
>
> FSP(CONFIG_HAVE_FSP) and Slim Bootloader(CONFIG_SYS_SLIMBOOTLOADER)
> consume HOB data from the each HOB list pointer.
> Add a common hob library/header in lib/hob.c and include/asm/hob.h.
>
> Signed-off-by: Aiden Park 
> ---
>
> Changes in v3:
>   * Create a common HOB libary from fsp_hob and fsp_support
>
>  arch/x86/include/asm/fsp/fsp_hob.h | 183 +-
>  arch/x86/include/asm/fsp/fsp_support.h |  37 +---
>  arch/x86/include/asm/fsp/fsp_types.h   |   8 -
>  arch/x86/include/asm/hob.h | 250 +
>  arch/x86/lib/Makefile  |   3 +-
>  arch/x86/lib/fsp/fsp_support.c |  78 +---
>  arch/x86/lib/hob.c | 104 ++
>  7 files changed, 361 insertions(+), 302 deletions(-)
>  create mode 100644 arch/x86/include/asm/hob.h
>  create mode 100644 arch/x86/lib/hob.c
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 4/8] x86: slimbootloader: Add serial driver

2019-07-14 Thread Bin Meng
On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
>
> Slim Bootloader provides serial port info thru its HOB list pointer.
> All these HOBs are eligible for Slim Bootloader based board only.
> - Get serial port information from the serial port info hob
> - Leverage ns16550 driver with slimbootloader specific platform data
>
> Signed-off-by: Aiden Park 
> ---
>
> Changes in v3:
>   * Use HOB function from the common HOB library
>
>  arch/x86/cpu/slimbootloader/Makefile  |  2 +-
>  arch/x86/cpu/slimbootloader/serial.c  | 69 +++
>  .../asm/arch-slimbootloader/slimbootloader.h  | 36 ++
>  3 files changed, 106 insertions(+), 1 deletion(-)
>  create mode 100644 arch/x86/cpu/slimbootloader/serial.c
>
> diff --git a/arch/x86/cpu/slimbootloader/Makefile 
> b/arch/x86/cpu/slimbootloader/Makefile
> index 05d0ca4a19..68c4a91955 100644
> --- a/arch/x86/cpu/slimbootloader/Makefile
> +++ b/arch/x86/cpu/slimbootloader/Makefile
> @@ -2,4 +2,4 @@
>  #
>  # Copyright (C) 2019 Intel Corporation 
>
> -obj-y += car.o slimbootloader.o dram.o
> +obj-y += car.o slimbootloader.o dram.o serial.o
> diff --git a/arch/x86/cpu/slimbootloader/serial.c 
> b/arch/x86/cpu/slimbootloader/serial.c
> new file mode 100644
> index 00..84469a2ddf
> --- /dev/null
> +++ b/arch/x86/cpu/slimbootloader/serial.c
> @@ -0,0 +1,69 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2019 Intel Corporation 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/**
> + * The serial port info hob is generated by Slim Bootloader, so eligible for
> + * Slim Bootloader based boards only.
> + */
> +int slimbootloader_serial_ofdata_to_platdata(struct udevice *dev)

This should be static.

> +{
> +   const struct efi_guid guid = LOADER_SERIAL_PORT_INFO_GUID;
> +   struct serial_port_info *serial_info = NULL;
> +   struct ns16550_platdata *plat = dev->platdata;
> +
> +   if (!gd->arch.hob_list)
> +   panic("hob list not found!");
> +

[snip]

Other than that,
Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/8] x86: slimbootloader: Add memory configuration

2019-07-14 Thread Bin Meng
On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
>
> Slim Bootloader provides memory map info thru its HOB list pointer.
> Configure memory size and relocation memory from the HOB data, and
> provide e820 entries as well.
> - Get memory size from the memory map info hob
> - Set ram top for U-Boot relocation lower than 4GB
> - Provide e820 entries from the memory map info hob
>
> Signed-off-by: Aiden Park 
> ---
>
> Changes in v3:
>   * Use HOB function from the common HOB library
>   * Add more description
>
>  arch/x86/cpu/slimbootloader/Makefile  |   2 +-
>  arch/x86/cpu/slimbootloader/dram.c| 146 ++
>  .../asm/arch-slimbootloader/slimbootloader.h  |  44 ++
>  3 files changed, 191 insertions(+), 1 deletion(-)
>  create mode 100644 arch/x86/cpu/slimbootloader/dram.c
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 7/8] board: intel: Add new slimbootloader board

2019-07-14 Thread Bin Meng
On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
>
> Add slimbootloader board to run U-boot as a Slim Bootloader payload
> - Add new board/intel/slimbootloader directory with minimum codes
> - Add slimbootloader configuration files
> - Add README in board/intel/slimbootloader
>
> Signed-off-by: Aiden Park 
> ---
>
> Changes in v3:
>   * Remove VENDOR_SLIMBOOTLOADER
>   * Use VENDOR_INTEL
>   * Move slimbootloader under board/intel/
>   * Enable generic CONFIGs in slimbootloader_defconfig
>   * Add more description in board/intel/slimbootloader/README
>
>  board/intel/Kconfig |  14 +++
>  board/intel/slimbootloader/Kconfig  |  51 
>  board/intel/slimbootloader/Makefile |   5 +
>  board/intel/slimbootloader/README   | 133 
>  board/intel/slimbootloader/slimbootloader.c |  17 +++
>  board/intel/slimbootloader/start.S  |   9 ++
>  configs/slimbootloader_defconfig|  22 
>  include/configs/slimbootloader.h|  59 +
>  8 files changed, 310 insertions(+)
>  create mode 100644 board/intel/slimbootloader/Kconfig
>  create mode 100644 board/intel/slimbootloader/Makefile
>  create mode 100644 board/intel/slimbootloader/README
>  create mode 100644 board/intel/slimbootloader/slimbootloader.c
>  create mode 100644 board/intel/slimbootloader/start.S
>  create mode 100644 configs/slimbootloader_defconfig
>  create mode 100644 include/configs/slimbootloader.h
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 5/8] x86: slimbootloader: Set TSC information for timer driver

2019-07-14 Thread Bin Meng
On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
>
> Slim Bootloader provides TSC clock information in its performance
> info hob. For now, TSC clock information is only used for timer driver
> from the performance info hob.
> - Get TSC frequency from performance info hob
> - Set tsc_base and clock_rate for timer driver
>
> Signed-off-by: Aiden Park 
> ---
>
> Changes in v3:
>   * Use HOB function from the common HOB library
>
>  arch/x86/cpu/slimbootloader/slimbootloader.c  | 34 +++
>  .../asm/arch-slimbootloader/slimbootloader.h  | 30 
>  2 files changed, 64 insertions(+)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 6/8] x86: slimbootloader: Add a slimbootloader device tree

2019-07-14 Thread Bin Meng
On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
>
> Add a new device tree which has very minimum nodes
> - x86 reset
> - x86 tsc_timer
> - x86 pci
> - Slim Bootloader serial
>
> Signed-off-by: Aiden Park 
> ---
>
> Changes in v3:
>   * Move slimbootloader.dtb before baytrail_som-db5800-som-6867.dtb
>
>  arch/x86/dts/Makefile   |  1 +
>  arch/x86/dts/slimbootloader.dts | 27 +++
>  2 files changed, 28 insertions(+)
>  create mode 100644 arch/x86/dts/slimbootloader.dts
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_loader: fix function comments in efi_boottime.c

2019-07-14 Thread Heinrich Schuchardt
scripts/kernel-doc pointed out some errors in the function comments in
efi_boottime.c.

Add missing and remove superfluous parameter descriptions.
Escape * in a function description.
Add empty lines for readability.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 62e4994671..2144e3580c 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -596,7 +596,7 @@ efi_status_t efi_remove_all_protocols(const efi_handle_t 
handle)
 /**
  * efi_delete_handle() - delete handle
  *
- * @obj: handle to delete
+ * @handle: handle to delete
  */
 void efi_delete_handle(efi_handle_t handle)
 {
@@ -628,6 +628,7 @@ static efi_status_t efi_is_event(const struct efi_event 
*event)

 /**
  * efi_create_event() - create an event
+ *
  * @type:type of the event to create
  * @notify_tpl:  task priority level of the event
  * @notify_function: notification function of the event
@@ -1418,9 +1419,9 @@ out:

 /**
  * efi_search() - determine if an EFI handle implements a protocol
+ *
  * @search_type: selection criterion
  * @protocol:GUID of the protocol
- * @search_key:  registration key
  * @handle:  handle
  *
  * See the documentation of the LocateHandle service in the UEFI specification.
@@ -1682,7 +1683,7 @@ static efi_status_t EFIAPI 
efi_install_configuration_table_ext(efi_guid_t *guid,
  * Initialize a loaded_image_info and loaded_image_info object with correct
  * protocols, boot-device, etc.
  *
- * In case of an error *handle_ptr and *info_ptr are set to NULL and an error
+ * In case of an error \*handle_ptr and \*info_ptr are set to NULL and an error
  * code is returned.
  *
  * @device_path:   device path of the loaded image
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_loader: fix comments for efi_update_exit_data()

2019-07-14 Thread Heinrich Schuchardt
Add missing colons after parameter descriptions.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 2144e3580c..4f6e8d1679 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -3048,9 +3048,9 @@ out:
 /**
  * efi_update_exit_data() - fill exit data parameters of StartImage()
  *
- * @image_obj  image handle
- * @exit_data_size size of the exit data buffer
- * @exit_data  buffer with data returned by UEFI payload
+ * @image_obj: image handle
+ * @exit_data_size:size of the exit data buffer
+ * @exit_data: buffer with data returned by UEFI payload
  * Return: status code
  */
 static efi_status_t efi_update_exit_data(struct efi_loaded_image_obj 
*image_obj,
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 0/2] scripts/kernel-doc: update script from Linux 5.2

2019-07-14 Thread Heinrich Schuchardt
Avoid some warnings when running 'make htmldocs'.

Correctly generate documentation for functions with function pointers
as paramaters.

Heinrich Schuchardt (2):
  scripts/kernel-doc: update script from Linux 5.2
  scripts/kernel-doc: fix parsing of function pointers

 scripts/kernel-doc | 39 ---
 1 file changed, 20 insertions(+), 19 deletions(-)

--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/2] scripts/kernel-doc: update script from Linux 5.2

2019-07-14 Thread Heinrich Schuchardt
Update the script from Linux 5.2 to avoid some warnings.

Signed-off-by: Heinrich Schuchardt 
---
 scripts/kernel-doc | 37 +++--
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 3cb6259182..3350e498b4 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -212,7 +212,7 @@ my $anon_struct_union = 0;
 my $type_constant = '\b``([^\`]+)``\b';
 my $type_constant2 = '\%([-_\w]+)';
 my $type_func = '(\w+)\(\)';
-my $type_param = '\@(\w*(\.\w+)*(\.\.\.)?)';
+my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
 my $type_fp_param = '\@(\w+)\(\)';  # Special RST handling for func ptr params
 my $type_env = '(\$\w+)';
 my $type_enum = '\&(enum\s*([_\w]+))';
@@ -1062,7 +1062,7 @@ sub dump_struct($$) {
 my $x = shift;
 my $file = shift;

-if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
+if ($x =~ 
/(struct|union)\s+(\w+)\s*\{(.*)\}(\s*(__packed|__aligned|__attribute__\s*\(\([a-z0-9,_\s\(\)]*\)\)))*/)
 {
my $decl_type = $1;
$declaration_name = $2;
my $members = $3;
@@ -1073,8 +1073,9 @@ sub dump_struct($$) {
# strip comments:
$members =~ s/\/\*.*?\*\///gos;
# strip attributes
-   $members =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i;
-   $members =~ s/__aligned\s*\([^;]*\)//gos;
+   $members =~ s/\s*__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)//gi;
+   $members =~ s/\s*__aligned\s*\([^;]*\)//gos;
+   $members =~ s/\s*__packed\s*//gos;
$members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos;
# replace DECLARE_BITMAP
$members =~ s/DECLARE_BITMAP\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long 
$1\[BITS_TO_LONGS($2)\]/gos;
@@ -1148,20 +1149,20 @@ sub dump_struct($$) {
}
}
}
-   $members =~ 
s/(struct|union)([^\{\};]+)\{([^\{\}]*)}([^\{\}\;]*)\;/$newmember/;
+   $members =~ 
s/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;/$newmember/;
}

# Ignore other nested elements, like enums
-   $members =~ s/({[^\{\}]*})//g;
+   $members =~ s/(\{[^\{\}]*\})//g;

create_parameterlist($members, ';', $file, $declaration_name);
check_sections($file, $declaration_name, $decl_type, $sectcheck, 
$struct_actual);

# Adjust declaration for better display
-   $declaration =~ s/([{;])/$1\n/g;
-   $declaration =~ s/}\s+;/};/g;
+   $declaration =~ s/([\{;])/$1\n/g;
+   $declaration =~ s/\}\s+;/};/g;
# Better handle inlined enums
-   do {} while ($declaration =~ s/(enum\s+{[^}]+),([^\n])/$1,\n$2/);
+   do {} while ($declaration =~ s/(enum\s+\{[^\}]+),([^\n])/$1,\n$2/);

my @def_args = split /\n/, $declaration;
my $level = 1;
@@ -1171,12 +1172,12 @@ sub dump_struct($$) {
$clause =~ s/\s+$//;
$clause =~ s/\s+/ /;
next if (!$clause);
-   $level-- if ($clause =~ m/(})/ && $level > 1);
+   $level-- if ($clause =~ m/(\})/ && $level > 1);
if (!($clause =~ m/^\s*#/)) {
$declaration .= "\t" x $level;
}
$declaration .= "\t" . $clause . "\n";
-   $level++ if ($clause =~ m/({)/ && !($clause =~m/}/));
+   $level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/));
}
output_declaration($declaration_name,
   'struct',
@@ -1244,7 +1245,7 @@ sub dump_enum($$) {
 # strip #define macros inside enums
 $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;

-if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
+if ($x =~ /enum\s+(\w+)\s*\{(.*)\}/) {
$declaration_name = $1;
my $members = $2;
my %_members;
@@ -1473,7 +1474,7 @@ sub push_parameter() {
if (!defined $parameterdescs{$param} && $param !~ /^#/) {
$parameterdescs{$param} = $undescribed;

-   if (show_warnings($type, $declaration_name)) {
+   if (show_warnings($type, $declaration_name) && $param !~ /\./) {
print STDERR
  "${file}:$.: warning: Function parameter or 
member '$param' not described in '$declaration_name'\n";
++$warnings;
@@ -1785,7 +1786,7 @@ sub process_proto_type($$) {
 }

 while (1) {
-   if ( $x =~ /([^{};]*)([{};])(.*)/ ) {
+   if ( $x =~ /([^\{\};]*)([\{\};])(.*)/ ) {
 if( length $prototype ) {
 $prototype .= " "
 }
@@ -1904,13 +1905,13 @@ sub process_name($$) {
++$warnings;
}

-   if ($identifier =~ m/^struct/) {
+   if ($identifier =~ m/^struct\b/) {
$decl_type = 'struct';
-   } elsif ($identifier =~ m/^union/) {
+   } elsif ($identifier =~ m/^union\b/) {
$decl_type = 'union';
-   } elsif ($identifier =~ m/^enum/) {
+   } elsif ($identifier =

[U-Boot] [PATCH 2/2] scripts/kernel-doc: fix parsing of function pointers

2019-07-14 Thread Heinrich Schuchardt
kernel-doc fails to parse function definitions like the one below

efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
  void (EFIAPI *notify_function) (
struct efi_event *event,
void *context),
  void *notify_context, efi_guid_t *group,
  struct efi_event **event)
{

due to the "EFIAPI" attribute preceding the function name.

cf. https://lkml.org/lkml/2018/9/3/1185

Signed-off-by: Heinrich Schuchardt 
---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 3350e498b4..516cf1db32 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1382,7 +1382,7 @@ sub create_parameterlist() {
} elsif ($arg =~ m/\(.+\)\s*\(/) {
# pointer-to-function
$arg =~ tr/#/,/;
-   $arg =~ m/[^\(]+\(\*?\s*([\w\.]*)\s*\)/;
+   $arg =~ m/[^\(]+\([\w\s]*\*?\s*([\w\.]*)\s*\)/;
$param = $1;
$type = $arg;
$type =~ s/([^\(]+\(\*?)\s*$param/$1/;
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_driver: use Sphinx style comments

2019-07-14 Thread Heinrich Schuchardt
Use Sphinx style comments for describing function parameters.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_driver/efi_block_device.c | 39 ---
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/lib/efi_driver/efi_block_device.c 
b/lib/efi_driver/efi_block_device.c
index 3f147cf608..cf02341931 100644
--- a/lib/efi_driver/efi_block_device.c
+++ b/lib/efi_driver/efi_block_device.c
@@ -43,14 +43,14 @@ struct efi_blk_platdata {
struct efi_block_io *io;
 };

-/*
+/**
  * Read from block device
  *
- * @devdevice
- * @blknr  first block to be read
- * @blkcnt number of blocks to read
- * @buffer output buffer
- * @return number of blocks transferred
+ * @dev:   device
+ * @blknr: first block to be read
+ * @blkcnt:number of blocks to read
+ * @buffer:output buffer
+ * Return: number of blocks transferred
  */
 static ulong efi_bl_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
 void *buffer)
@@ -72,14 +72,14 @@ static ulong efi_bl_read(struct udevice *dev, lbaint_t 
blknr, lbaint_t blkcnt,
return blkcnt;
 }

-/*
+/**
  * Write to block device
  *
- * @devdevice
- * @blknr  first block to be write
- * @blkcnt number of blocks to write
- * @buffer input buffer
- * @return number of blocks transferred
+ * @dev:   device
+ * @blknr: first block to be write
+ * @blkcnt:number of blocks to write
+ * @buffer:input buffer
+ * Return: number of blocks transferred
  */
 static ulong efi_bl_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
  const void *buffer)
@@ -102,11 +102,12 @@ static ulong efi_bl_write(struct udevice *dev, lbaint_t 
blknr, lbaint_t blkcnt,
return blkcnt;
 }

-/*
+/**
  * Create partions for the block device.
  *
- * @handle EFI handle of the block device
- * @devudevice of the block device
+ * @handle:EFI handle of the block device
+ * @dev:   udevice of the block device
+ * Return: number of partitions created
  */
 static int efi_bl_bind_partitions(efi_handle_t handle, struct udevice *dev)
 {
@@ -120,12 +121,12 @@ static int efi_bl_bind_partitions(efi_handle_t handle, 
struct udevice *dev)
  desc->devnum, dev->name);
 }

-/*
+/**
  * Create a block device for a handle
  *
- * @handle handle
- * @interface  block io protocol
- * @return 0 = success
+ * @handle:handle
+ * @interface: block io protocol
+ * Return: 0 = success
  */
 static int efi_bl_bind(efi_handle_t handle, void *interface)
 {
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 6/8] arm: ls1021atwr: Convert to use driver model TSEC driver

2019-07-14 Thread Vladimir Oltean
On Sun, 14 Jul 2019 at 04:55, Bin Meng  wrote:
>
> Hi Vladimir,
>
> On Sat, Jul 13, 2019 at 5:39 PM Vladimir Oltean  wrote:
> >
> > Hi Joe,
> >
> > On Fri, 12 Jul 2019 at 23:46, Joe Hershberger  
> > wrote:
> > >
> > > On Sun, Jun 23, 2019 at 12:53 PM Vladimir Oltean  
> > > wrote:
> > > >
> > > > From: Bin Meng 
> > > >
> > > > Now that we have added driver model support to the TSEC driver,
> > > > convert ls1021atwr board to use it.
> > > >
> > > > This depends on previous DM series for ls1021atwr:
> > > > http://patchwork.ozlabs.org/patch/561855/
> > > >
> > > > Signed-off-by: Bin Meng 
> > >
> > > Generally looks good, but a few nits below...
> > >
> > > Acked-by: Joe Hershberger 
> > >
> > > > [Vladimir] Made the following changes:
> > > > - Added 'status = "disabled";' for all Ethernet ports in ls1021a.dtsi
> > > > - Fixed the confusion between the SGMII/TBI PCS for enet0 and enet1 -
> > > >   a mistake ported over from Linux. Each SGMII PCS lies on the private
> > > >   MDIO bus of the interface (and the RGMII enet2 has no SGMII PCS).
> > > >
> > > > Signed-off-by: Vladimir Oltean 
> > > > ---
> > > >  arch/arm/cpu/armv7/ls102xa/cpu.c|  2 +-
> > > >  arch/arm/cpu/armv7/ls102xa/fdt.c| 10 
> > > >  arch/arm/dts/ls1021a-twr.dtsi   | 32 +
> > > >  arch/arm/dts/ls1021a.dtsi   | 28 --
> > > >  board/freescale/ls1021atwr/ls1021atwr.c |  2 +-
> > > >  configs/ls1021atwr_nor_defconfig|  1 +
> > > >  configs/ls1021atwr_nor_lpuart_defconfig |  1 +
> > > >  include/configs/ls1021atwr.h|  4 
> > > >  8 files changed, 76 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/arch/arm/cpu/armv7/ls102xa/cpu.c 
> > > > b/arch/arm/cpu/armv7/ls102xa/cpu.c
> > > > index ecf9e869855e..9ccfe1042ce5 100644
> > > > --- a/arch/arm/cpu/armv7/ls102xa/cpu.c
> > > > +++ b/arch/arm/cpu/armv7/ls102xa/cpu.c
> > > > @@ -296,7 +296,7 @@ int cpu_mmc_init(bd_t *bis)
> > > >
> > > >  int cpu_eth_init(bd_t *bis)
> > > >  {
> > > > -#ifdef CONFIG_TSEC_ENET
> > > > +#if defined(CONFIG_TSEC_ENET) && !defined(CONFIG_DM_ETH)
> > > > tsec_standard_init(bis);
> > > >  #endif
> > > >
> > > > diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c 
> > > > b/arch/arm/cpu/armv7/ls102xa/fdt.c
> > > > index 8bf9c42b2260..90cf7958f257 100644
> > > > --- a/arch/arm/cpu/armv7/ls102xa/fdt.c
> > > > +++ b/arch/arm/cpu/armv7/ls102xa/fdt.c
> > > > @@ -16,12 +16,17 @@
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > >
> > > >  DECLARE_GLOBAL_DATA_PTR;
> > > >
> > > >  void ft_fixup_enet_phy_connect_type(void *fdt)
> > > >  {
> > > > +#ifndef CONFIG_DM_ETH
> > >
> > > Please use positive logic where convenient. I.e. #ifdef CONFIG_DM_ETH
> > > and swap cases.
> > >
> >
> > To be honest I don't know why keep compatibility with non-DM ETH at
> > all for the TWR board. On the LS1021A-TSN I'm not doing that.
> > Bin, is there any particular reason? If not, I'll just completely
> > remove your #ifdef's for v2.
>
> I remember at that time there were some PowerPC 83xx/85xx boards that
> were not converted to DM but still used TSEC driver. If this is not a
> concern now, I am all for it to remove the non-DM TSEC support.
>

For the TSEC driver code, sure, there are still non-DM users out there
and we're still keeping them for now.
I was talking about the board code for LS1021A-TWR when I replied to Joe.

> Regards,
> Bin

Thanks,
-Vladimir
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_loader: fix comments for variable services

2019-07-14 Thread Heinrich Schuchardt
Add missing parameter descriptions.
Remove an invalid link.
Correct the formatting of a function comment.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_variable.c | 27 +++
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index bc8ed678c9..889a7f2ba0 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -263,8 +263,8 @@ static char *efi_cur_variable;
  * is the size of variable name including NULL.
  *
  * Return: EFI_SUCCESS if parsing is OK, EFI_NOT_FOUND when
-   the entire variable list has been returned,
-   otherwise non-zero status code
+ * the entire variable list has been returned,
+ * otherwise non-zero status code
  */
 static efi_status_t parse_uboot_variable(char *variable,
 efi_uintn_t *variable_name_size,
@@ -315,6 +315,7 @@ static efi_status_t parse_uboot_variable(char *variable,

 /**
  * efi_get_next_variable_name() - enumerate the current variable names
+ *
  * @variable_name_size:size of variable_name buffer in byte
  * @variable_name: name of uefi variable's name in u16
  * @vendor:vendor's guid
@@ -322,8 +323,7 @@ static efi_status_t parse_uboot_variable(char *variable,
  * This function implements the GetNextVariableName service.
  *
  * See the Unified Extensible Firmware Interface (UEFI) specification for
- * details: http://wiki.phoenix.com/wiki/index.php/
- * EFI_RUNTIME_SERVICES#GetNextVariableName.28.29
+ * details.
  *
  * Return: status code
  */
@@ -550,6 +550,13 @@ efi_status_t __efi_runtime EFIAPI efi_query_variable_info(

 /**
  * efi_get_variable_runtime() - runtime implementation of GetVariable()
+ *
+ * @variable_name: name of the variable
+ * @vendor:vendor GUID
+ * @attributes:attributes of the variable
+ * @data_size: size of the buffer to which the variable value is copied
+ * @data:  buffer to which the variable value is copied
+ * Return: status code
  */
 static efi_status_t __efi_runtime EFIAPI
 efi_get_variable_runtime(u16 *variable_name, const efi_guid_t *vendor,
@@ -561,6 +568,11 @@ efi_get_variable_runtime(u16 *variable_name, const 
efi_guid_t *vendor,
 /**
  * efi_get_next_variable_name_runtime() - runtime implementation of
  *   GetNextVariable()
+ *
+ * @variable_name_size:size of variable_name buffer in byte
+ * @variable_name: name of uefi variable's name in u16
+ * @vendor:vendor's guid
+ * Return: status code
  */
 static efi_status_t __efi_runtime EFIAPI
 efi_get_next_variable_name_runtime(efi_uintn_t *variable_name_size,
@@ -571,6 +583,13 @@ efi_get_next_variable_name_runtime(efi_uintn_t 
*variable_name_size,

 /**
  * efi_set_variable_runtime() - runtime implementation of SetVariable()
+ *
+ * @variable_name: name of the variable
+ * @vendor:vendor GUID
+ * @attributes:attributes of the variable
+ * @data_size: size of the buffer with the variable value
+ * @data:  buffer with the variable value
+ * Return: status code
  */
 static efi_status_t __efi_runtime EFIAPI
 efi_set_variable_runtime(u16 *variable_name, const efi_guid_t *vendor,
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_loader: fix comment for struct efi_pool_allocation

2019-07-14 Thread Heinrich Schuchardt
Change comment for struct efi_pool_allocation to match Sphinx style.
Describe all structure fields.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_memory.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index da253fa285..72b86d9b18 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -37,17 +37,21 @@ void *efi_bounce_buffer;
 #endif

 /**
- * efi_pool_allocation - memory block allocated from pool
+ * struct efi_pool_allocation - memory block allocated from pool
  *
  * @num_pages: number of pages allocated
  * @checksum:  checksum
+ * @data:  allocated pool memory
  *
- * U-Boot services each EFI AllocatePool request as a separate
- * (multiple) page allocation.  We have to track the number of pages
+ * U-Boot services each UEFI AllocatePool() request as a separate
+ * (multiple) page allocation. We have to track the number of pages
  * to be able to free the correct amount later.
+ *
+ * The checksum calculated in function checksum() is used in FreePool() to 
avoid
+ * freeing memory not allocated by AllocatePool() and duplicate freeing.
+ *
  * EFI requires 8 byte alignment for pool allocations, so we can
- * prepend each allocation with an 64 bit header tracking the
- * allocation size, and hand out the remainder to the caller.
+ * prepend each allocation with these header fields.
  */
 struct efi_pool_allocation {
u64 num_pages;
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_loader: fix function comments in cmd/bootefi.c

2019-07-14 Thread Heinrich Schuchardt
Describe efi_set_bootdev().

Change function descriptions to Sphinx style.

Signed-off-by: Heinrich Schuchardt 
---
 cmd/bootefi.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 04d3e3e4a7..a45bfd139f 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -24,7 +24,7 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct efi_device_path *bootefi_image_path;
 static struct efi_device_path *bootefi_device_path;

-/*
+/**
  * Set the load options of an image from an environment variable.
  *
  * @handle:the image handle
@@ -143,7 +143,7 @@ done:
return ret;
 }

-/*
+/**
  * efi_carve_out_dt_rsv() - Carve out DT reserved memory ranges
  *
  * The mem_rsv entries of the FDT are added to the memory map. Any failures are
@@ -342,7 +342,7 @@ static int do_efibootmgr(void)
return CMD_RET_SUCCESS;
 }

-/*
+/**
  * do_bootefi_image() - execute EFI binary
  *
  * Set up memory image for the binary to be loaded, prepare device path, and
@@ -612,6 +612,16 @@ U_BOOT_CMD(
bootefi_help_text
 );

+/**
+ * efi_set_bootdev() - set boot device
+ *
+ * This function is called when a file is loaded, e.g. via the 'load' command.
+ * We use the path to this file to inform the UEFI binary about the boot 
device.
+ *
+ * @dev:   device, e.g. "MMC"
+ * @devnr: number of the device, e.g. "1:2"
+ * @path:  path to file loaded
+ */
 void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
 {
struct efi_device_path *device, *image;
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_loader: function comments efi_bootmgr.c

2019-07-14 Thread Heinrich Schuchardt
Convert function descriptions to Sphinx style.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_bootmgr.c | 47 ++--
 1 file changed, 40 insertions(+), 7 deletions(-)

diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index b2102c5b5a..2ea21448f0 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -27,7 +27,15 @@ static const struct efi_runtime_services *rs;
  */


-/* Parse serialized data and transform it into efi_load_option structure */
+/**
+ * efi_deserialize_load_option() - parse serialized data
+ *
+ * Parse serialized data describing a load option and transform it to the
+ * efi_load_option structure.
+ *
+ * @lo:pointer to target
+ * @data:  serialized data
+ */
 void efi_deserialize_load_option(struct efi_load_option *lo, u8 *data)
 {
lo->attributes = get_unaligned_le32(data);
@@ -47,9 +55,14 @@ void efi_deserialize_load_option(struct efi_load_option *lo, 
u8 *data)
lo->optional_data = data;
 }

-/*
+/**
+ * efi_serialize_load_option() - serialize load option
+ *
  * Serialize efi_load_option structure into byte stream for Boot.
- * Return a size of allocated data.
+ *
+ * @data:  buffer for serialized data
+ * @lo:load option
+ * Return: size of allocated buffer
  */
 unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data)
 {
@@ -92,7 +105,16 @@ unsigned long efi_serialize_load_option(struct 
efi_load_option *lo, u8 **data)
return size;
 }

-/* free() the result */
+/**
+ * get_var() - get UEFI variable
+ *
+ * It is the caller's duty to free the returned buffer.
+ *
+ * @name:  name of variable
+ * @vendor:vendor GUID of variable
+ * @size:  size of allocated buffer
+ * Return: buffer with variable data or NULL
+ */
 static void *get_var(u16 *name, const efi_guid_t *vendor,
 efi_uintn_t *size)
 {
@@ -116,10 +138,16 @@ static void *get_var(u16 *name, const efi_guid_t *vendor,
return buf;
 }

-/*
+/**
+ * try_load_entry() - try to load image for boot option
+ *
  * Attempt to load load-option number 'n', returning device_path and file_path
- * if successful.  This checks that the EFI_LOAD_OPTION is active (enabled)
+ * if successful. This checks that the EFI_LOAD_OPTION is active (enabled)
  * and that the specified file to boot exists.
+ *
+ * @n: number of the boot option, e.g. 0x0a13 for Boot0A13
+ * @handle:on return handle for the newly installed image
+ * Return: status code
  */
 static efi_status_t try_load_entry(u16 n, efi_handle_t *handle)
 {
@@ -180,10 +208,15 @@ error:
return ret;
 }

-/*
+/**
+ * efi_bootmgr_load() - try to load from BootNext or BootOrder
+ *
  * Attempt to load from BootNext or in the order specified by BootOrder
  * EFI variable, the available load-options, finding and returning
  * the first one that can be loaded successfully.
+ *
+ * @handle:on return handle for the newly installed image
+ * Return: status code
  */
 efi_status_t efi_bootmgr_load(efi_handle_t *handle)
 {
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_loader: function comments cmd/efi_debug.c

2019-07-14 Thread Heinrich Schuchardt
Adjust comments for Sphinx.

Signed-off-by: Heinrich Schuchardt 
---
 cmd/efidebug.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index cb152b3339..02dc491a68 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -394,6 +394,7 @@ static const struct efi_mem_attrs {

 /**
  * print_memory_attributes() - print memory map attributes
+ *
  * @attributes:Attribute value
  *
  * Print memory map attributes
@@ -487,9 +488,9 @@ static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag,
  * Return: CMD_RET_SUCCESS on success,
  * CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure
  *
- * Implement efidebug "boot add" sub-command.
- * Create or change UEFI load option.
- *   - boot add[:]  
+ * Implement efidebug "boot add" sub-command. Create or change UEFI load 
option.
+ *
+ * efidebug boot add[:]  

  */
 static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
   int argc, char * const argv[])
@@ -587,7 +588,8 @@ out:
  *
  * Implement efidebug "boot rm" sub-command.
  * Delete UEFI load options.
- *   - boot rm  ...
+ *
+ * efidebug boot rm  ...
  */
 static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag,
  int argc, char * const argv[])
@@ -890,7 +892,8 @@ out:
  *
  * Implement efidebug "boot next" sub-command.
  * Set BootNext variable.
- *   - boot next 
+ *
+ * efidebug boot next 
  */
 static int do_efi_boot_next(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
@@ -938,7 +941,8 @@ out:
  *
  * Implement efidebug "boot order" sub-command.
  * Show order of UEFI load options, or change it in BootOrder variable.
- *   - boot order [ ...]
+ *
+ * efidebug boot order [ ...]
  */
 static int do_efi_boot_order(cmd_tbl_t *cmdtp, int flag,
 int argc, char * const argv[])
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [BUG] efi: stalled execution state

2019-07-14 Thread Matwey V. Kornilov
Hello,

I am running u-boot 2019.07 with rk3328-rock64 configuration in the
two following setups:

1) TFTP loaded EFI GRUB

In this setup, I deploy u-boot loader onto the empty microsd card
(without any partitions), GRUB EFI binary is served by TFTP. Please,
find full log attached in u-boot-tftp.txt.
With this setup, u-boot works as expected: it finds the server address
announced by DHCP and downloads /bootaa64.efi, then GRUB is executed
and Linux OS is successfully booted!

2) TFTP loaded EFI GRUB, after microsd card EFI GRUB.

In this setup, I deploy the same u-boot loader binaries onto the
microsd with preinstalled Linux OS and GRUB EFI.
u-boot successfully loads GRUB EFI binary from to EFI partition and
then preinstalled Linux OS is booted from microsd card.

However, If I use the command line for GRUB loaded from microsd card,
and run `exit' command, then I get back to u-boot:

grub> exit
## Application terminated, r = 0
EFI LOAD FAILED: continuing...

Then, u-boot tries to find another way to boot the system and finally
loads another one GRUB EFI executable obtained from TFTP server.
It is the same GRUB EFI binary as in the first scenario. However, now
It behaves completely different. Instead of GRUB menu I see the
command line, because GRUB is failing to obtain configuration from
TFTP server.
Please, find the full log in u-boot-sd.txt

In the first setup, ${prefix} variable is the following:

grub> echo ${prefix}
(tftp,192.168.185.80)
grub>

It is correct prefix variable. While in the second setup, ${prefix}
variable is empty:

grub> echo ${prefix}

grub>

I believe that there is a bug, and TFTP GRUB execution environment
should not rely on previously run EFI applications.


-- 
With best regards,
Matwey V. Kornilov
DDR version 1.16 20190528
ID:0x805 Y
In
SRX
LPDDR3
333MHz
Bus Width=32 Col=10 Bank=8 Row=15/15 CS=2 Die Bus-Width=32 Size=2048MB
ddrconfig:6
OUT

U-Boot SPL 2019.07 (Jul 10 2019 - 22:57:15 +)
Trying to boot from MMC1
NOTICE:  BL31: v2.1(debug):
NOTICE:  BL31: Built : 16:00:26, Jun 16 2019
ERROR:   over or zero region, nr=3145987, max=10
NOTICE:  BL31:Rockchip release version: v1.2
INFO:ARM GICv2 driver initialized
INFO:plat_rockchip_pmu_init: pd status 0xe
INFO:BL31: Initializing runtime services
WARNING: BL31: cortex_a53: CPU workaround for 819472 was missing!
WARNING: BL31: cortex_a53: CPU workaround for 824069 was missing!
WARNING: BL31: cortex_a53: CPU workaround for 827319 was missing!
WARNING: BL31: cortex_a53: CPU workaround for 855873 was missing!
INFO:BL31: Preparing for EL3 exit to normal world
INFO:Entry point address = 0x20
INFO:SPSR = 0x3c9


U-Boot 2019.07 (Jul 10 2019 - 22:57:15 +)

Model: Pine64 Rock64
DRAM:  2 GiB
MMC:   rksdmmc@ff50: 1, rksdmmc@ff52: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:serial@ff13
Out:   serial@ff13
Err:   serial@ff13
Model: Pine64 Rock64
Net:   
Warning: ethernet@ff54 (eth0) using random MAC address - 16:a5:e2:e4:54:76
eth0: ethernet@ff54
Hit any key to stop autoboot:  0 
Card did not respond to voltage select!
switch to partitions #0, OK
mmc1 is current device
** No partition table - mmc 1 **
** No partition table - mmc 1 **
** No partition table - mmc 1 **
starting USB...
Bus usb@ff5c: USB EHCI 1.00
Bus usb@ff5d: USB OHCI 1.0
Bus usb@ff58: scanning bus usb@ff5c for devices... 1 USB Device(s) found
scanning bus usb@ff5d for devices... 1 USB Device(s) found
scanning bus usb@ff58 for devices... 1 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found

Device 0: unknown device
Speed: 1000, full duplex
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
DHCP client bound to address 192.168.185.61 (3053 ms)
*** Warning: no boot file name; using 'C0A8B93D.img'
Using ethernet@ff54 device
TFTP from server 192.168.185.253; our IP address is 192.168.185.61
Filename 'C0A8B93D.img'.
Load address: 0x800800
Loading: *
TFTP error: 'file /srv/tftpboot/C0A8B93D.img not found' (1)
Not retrying...
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A8B93D
Speed: 1000, full duplex
Using ethernet@ff54 device
TFTP from server 192.168.185.253; our IP address is 192.168.185.61
Filename 'pxelinux.cfg/C0A8B93D'.
Load address: 0x60
Loading: *
TFTP error: 'file /srv/tftpboot/pxelinux.cfg/C0A8B93D not found' (1)
Not retrying...
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A8B93
Speed: 1000, full duplex
Using ethernet@ff54 device
TFTP from server 192.168.185.253; our IP address is 192.168.185.61
Filename 'pxelinux.cfg/C0A8B93'.
Load address: 0x60
Loading: *
TFTP error: 'file /srv/tftpboot/pxelinux.cfg/C0A8B93 not found' (1)
Not retrying...
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A8B9
Speed: 1000, full duplex
Using ethernet@ff54 device
TFTP from server 

[U-Boot] [PATCH 1/1] rockchip: video: rk3288_hdmi: Add missing call to dw_hdmi_enable()

2019-07-14 Thread Niklas Schulze
The RK3288 HDMI driver's rk3288_hdmi_enable() currently lacks a call to
dw_hdmi_enable(). Thus, the HDMI output never gets enabled.

Signed-off-by: Niklas Schulze 
Cc: Philipp Tomsich 
---
 drivers/video/rockchip/rk3288_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/rockchip/rk3288_hdmi.c 
b/drivers/video/rockchip/rk3288_hdmi.c
index 315d3adf27..3d25ce924c 100644
--- a/drivers/video/rockchip/rk3288_hdmi.c
+++ b/drivers/video/rockchip/rk3288_hdmi.c
@@ -33,7 +33,7 @@ static int rk3288_hdmi_enable(struct udevice *dev, int 
panel_bpp,
/* hdmi data from vop id */
rk_clrsetreg(&grf->soc_con6, 1 << 4, (vop_id == 1) ? (1 << 4) : 0);
 
-   return 0;
+   return dw_hdmi_enable(&priv->hdmi, edid);
 }
 
 static int rk3288_hdmi_ofdata_to_platdata(struct udevice *dev)
-- 
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_loader: add more sources to Sphinx documentation

2019-07-14 Thread Heinrich Schuchardt
Add more C files as sources to the Sphinx generated documentaton
(make htmldocs).

Signed-off-by: Heinrich Schuchardt 
---
 doc/efi.rst | 87 +++--
 1 file changed, 85 insertions(+), 2 deletions(-)

diff --git a/doc/efi.rst b/doc/efi.rst
index 5337a55c3b..39e2dbae0b 100644
--- a/doc/efi.rst
+++ b/doc/efi.rst
@@ -1,7 +1,64 @@
 .. SPDX-License-Identifier: GPL-2.0+

-EFI subsystem
-=
+UEFI subsystem
+==
+
+Lauching UEFI images
+
+
+Bootefi command
+~~~
+
+The bootefi command is used to start UEFI applications or to install UEFI
+drivers. It takes two parameters
+
+bootefi  [fdt address]
+
+* image address - the memory address of the UEFI binary
+* fdt address - the memory address of the flattened device tree
+
+The environment variable 'bootargs' is passed as load options in the UEFI 
system
+table. The Linux kernel EFI stub uses the load options as command line
+arguments.
+
+.. kernel-doc:: cmd/bootefi.c
+   :internal:
+
+Boot manager
+
+
+The UEFI specification foresees to define boot entries and boot sequence via 
UEFI
+variables. Booting according to these variables is possible via
+
+bootefi bootmgr [fdt address]
+
+* fdt address - the memory address of the flattened device tree
+
+The relevant variables are:
+
+* Boot-Boot define boot entries
+* BootNext specifies next boot option to be booted
+* BootOrder specifies in which sequence the boot options shall be tried if
+  BootNext is not defined or booting via BootNext fails
+
+.. kernel-doc:: lib/efi_loader/efi_bootmgr.c
+   :internal:
+
+Efidebug command
+
+
+The efidebug command is used to set and display boot options as well as to
+display information about internal data of the UEFI subsystem (devices,
+drivers, handles, loaded images, and the memory map).
+
+.. kernel-doc:: cmd/efidebug.c
+   :internal:
+
+Initialization of the UEFI sub-system
+-
+
+.. kernel-doc:: lib/efi_loader/efi_setup.c
+   :internal:

 Boot services
 -
@@ -15,8 +72,34 @@ Image relocation
 .. kernel-doc:: lib/efi_loader/efi_image_loader.c
:internal:

+Memory services
+~~~
+
+.. kernel-doc:: lib/efi_loader/efi_memory.c
+   :internal:
+
 Runtime services
 

 .. kernel-doc:: lib/efi_loader/efi_runtime.c
:internal:
+
+Variable services
+~
+
+.. kernel-doc:: lib/efi_loader/efi_variable.c
+   :internal:
+
+UEFI drivers
+
+
+UEFI driver uclass
+~~
+.. kernel-doc:: lib/efi_driver/efi_uclass.c
+   :internal:
+
+Block device driver
+~~~
+
+.. kernel-doc:: lib/efi_driver/efi_block_device.c
+   :internal:
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] test: Disable pci_ep test for now

2019-07-14 Thread Tom Rini
This test is currently broken so disable it for now.

Cc: Ramon Fried 
Cc: Simon Glass 
Signed-off-by: Tom Rini 
---
 .travis.yml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 6662ca126ab5..c21ca463 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -365,11 +365,13 @@ matrix:
 - name: "test/py sandbox"
   env:
 - TEST_PY_BD="sandbox"
+  TEST_PY_TEST_SPEC="not pci"
   BUILDMAN="^sandbox$"
   TOOLCHAIN="i386"
 - name: "test/py sandbox with clang"
   env:
 - TEST_PY_BD="sandbox"
+  TEST_PY_TEST_SPEC="not pci"
   BUILDMAN="^sandbox$"
   OVERRIDE="clang-7"
 - name: "test/py sandbox_spl"
@@ -382,6 +384,7 @@ matrix:
 - name: "test/py sandbox_flattree"
   env:
 - TEST_PY_BD="sandbox_flattree"
+  TEST_PY_TEST_SPEC="not pci"
   BUILDMAN="^sandbox_flattree$"
   TOOLCHAIN="i386"
 - name: "test/py vexpress_ca15_tc2"
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] board: pm9261: Convert to CONFIG_DM_USB and CONFIG_DM_VIDEO

2019-07-14 Thread Tom Rini
On Mon, Mar 11, 2019 at 01:06:24PM +0100, Ilko Iliev wrote:

> Convert the board to support the USB and video driver model and remove
> the unnecessary code.

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH V2 2/3] test: dm: usb: use the real device name

2019-07-14 Thread Tom Rini
On Wed, May 22, 2019 at 07:08:12AM +, Peng Fan wrote:

> "keyb" is not the real device name, "keyb@3" is.
> 
> Signed-off-by: Peng Fan 
> Reviewed-by: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] board: pm9263: Convert to CONFIG_DM_USB and CONFIG_DM_VIDEO

2019-07-14 Thread Tom Rini
On Mon, Mar 11, 2019 at 01:06:25PM +0100, Ilko Iliev wrote:

> Convert the board to support the USB and video driver model and remove
> the unnecessary code.

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH u-boot] pci: ensure enumeration of all devices in pci_init

2019-07-14 Thread Tom Rini
On Tue, May 21, 2019 at 12:04:31PM +0200, Marek Behún wrote:

> Use the uclass_first_device_check and uclass_next_device_check functions
> instead of uclass_first_device and uclass_next_device in pci_init. This
> ensures that all PCI devices are tried to be probed. Currently if a
> device fails to probe, the enumeration stops and the devices which come
> after the failed device are not probed.
> 
> Signed-off-by: Marek Behún 
> Cc: Stefan Roese 
> Cc: Anton Schubert 
> Cc: Dirk Eibach 
> Cc: Mario Six 
> Cc: Chris Packham 
> Cc: Phil Sutter 
> Cc: VlaoMao 
> Cc: Tom Rini 
> Reviewed-by: Stefan Roese 
> Reviewed-by: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] rtc: ds1307: add support for m41t11

2019-07-14 Thread Tom Rini
On Mon, May 27, 2019 at 08:13:41AM +0200, Heiko Schocher wrote:

> add m41t11 support in ds1307 driver. changes:
> 
> - add compatible string for m41t11
> - check if RTC clock is running, if not
>   enable the clock
> 
> Signed-off-by: Heiko Schocher 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH V2 1/3] test: dm: adc: use the real device name

2019-07-14 Thread Tom Rini
On Wed, May 22, 2019 at 07:08:09AM +, Peng Fan wrote:

> "adc" is not the real device name, "adc@0" is.
> 
> Signed-off-by: Peng Fan 
> Reviewed-by: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] spl: Move SPL_MMC_TINY option to appear under SPL menu

2019-07-14 Thread Tom Rini
On Sat, May 25, 2019 at 07:25:21PM -0300, Ezequiel Garcia wrote:

> The SPL_MMC_TINY implements feature-reduced MMC support
> on SPL, and as such, it's more consistent and convenient
> to find it as part of the SPL configuration.
> 
> Signed-off-by: Ezequiel Garcia 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd: nvedit: Add sub-command 'env info'

2019-07-14 Thread Tom Rini
On Fri, May 24, 2019 at 05:20:19PM +0200, Mark Jonas wrote:

> From: Leo Ruan 
> 
> Add sub-command 'env info' to display environment information:
> - env_valid : is environment valid
> - env_ready : is environment imported into hash table
> - env_use_default : is default environment using
> 
> This command can be optionally used for evaluation in scripts:
> [-d] : evaluate whether default environment is used
> [-p] : evaluate whether environment can be persisted
> The result of multiple evaluations will be combined with AND.
> 
> Signed-off-by: Leo Ruan 
> Signed-off-by: Mark Jonas 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] ARM: omap3: evm: Enable DM_USB in defconfig

2019-07-14 Thread Tom Rini
On Mon, May 27, 2019 at 09:20:50PM -0500, Derald D. Woods wrote:

> This addresses the following warning message:
> 
> = WARNING ==
> This board does not use CONFIG_DM_USB. Please update
> the board to use CONFIG_DM_USB before the v2019.07 release.
> Failure to update by the deadline may result in board removal.
> See doc/driver-model/MIGRATION.txt for more info.
> 
> 
> As USB support for older OMAP3 SoC's improves, OMAP3 EVM can be
> readily adapted. There is some additional 'gpio-hog' support
> needed to fully setup USB in a similar manner to Linux.
> 
> Signed-off-by: Derald D. Woods 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: dts: logicpd-som-lv: Resync with Kernel 5.1.9

2019-07-14 Thread Tom Rini
On Tue, Jun 11, 2019 at 08:40:42PM -0500, Adam Ford wrote:

> The MMC card-detect pin was incorrectly defined which was fixed.
> This patch resync's the dts and removes the u-boot specific fix.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi 
> b/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi
> index b3da8b1a73..956199a2b4 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] mmc: Register only the first MMC device on MMC_TINY

2019-07-14 Thread Tom Rini
On Sat, May 25, 2019 at 07:25:22PM -0300, Ezequiel Garcia wrote:

> When MMC_TINY is enabled, support for only one MMC device
> is provided. Boards that register more than one device,
> will just write over mmc_static keeping only the last one
> registered.
> 
> This commit prevents this, keeping only the first MMC
> device created. A debug warning message is added, if nothing
> else, as a hint/documentation for developers.
> 
> Signed-off-by: Ezequiel Garcia 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] ARM: dts: omap3-evm: Sync dts(i) files from Linux 5.1.5

2019-07-14 Thread Tom Rini
On Mon, May 27, 2019 at 09:19:38PM -0500, Derald D. Woods wrote:

> Signed-off-by: Derald D. Woods 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: dts: logicpd som-lvs and torpedos: Shrink SPL DTB

2019-07-14 Thread Tom Rini
On Wed, Jun 12, 2019 at 03:26:26PM -0500, Adam Ford wrote:

> Since we have limited resources in SPL, it is the best interest
> to keep the SPL as small as possible and that includes the DTB.
> There are a few items in the device tree that can be removed,
> because these boards don't use them.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi 
> b/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi
> index 956199a2b4..1abd9a3887 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH V2 3/3] drivers: core: use strcmp when find device by name

2019-07-14 Thread Tom Rini
On Wed, May 22, 2019 at 07:08:14AM +, Peng Fan wrote:

> `if (!strncmp(dev->name, name, strlen(name)))` might find out
> the wrong device, it might find out `dram_pll_ref_sel`, when name is
> `dram_pll`. So use strcmp to avoid such issue.
> 
> Signed-off-by: Peng Fan 
> Reviewed-by: Simon Glass 
> Reviewed-by: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/2] power: regulator: Kconfig: Add SPL_DM_REGULATOR configs for palmas/lp873x/lp87565

2019-07-14 Thread Tom Rini
On Thu, Jun 06, 2019 at 04:06:56PM +0530, Keerthy wrote:

> Add SPL_DM_REGULATOR configs for palmas/lp873x/lp87565. These were missing
> and the Makefile already assumes them to be defined. Add the corresponding
> SPL config options. This enables the regulator support in SPL.
> 
> Signed-off-by: Keerthy 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: legoev3: convert to driver model

2019-07-14 Thread Tom Rini
On Tue, May 28, 2019 at 08:56:42PM -0500, David Lechner wrote:

> This converts LEGO MINDSTORMS EV3 to the driver model. MMC, SERIAL, SPI
> and SPI_FLASH are converted.
> 
> The device tree contains only the minimal nodes required by U-Boot
> since the size of U-Boot is limited to 256K on this device.
> 
> Signed-off-by: David Lechner 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] pinctrl: pinctrl-single: Add 'pinctrl-single, bits' support

2019-07-14 Thread Tom Rini
On Mon, Jun 10, 2019 at 01:15:55PM -0500, Adam Ford wrote:

> The TI Davinci (da850/l138/am1808) use pinctrl-single,bits for
> pinmuxing peripherals.  This patch allosw the pinctrl-single
> driver to parse the pinctrl-single,bits options and correctly
> setup devices.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/drivers/pinctrl/pinctrl-single.c 
> b/drivers/pinctrl/pinctrl-single.c
> index 9dec88c1aa..1e3ad974a1 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] regulator: Allow autosetting fixed regulators

2019-07-14 Thread Tom Rini
On Wed, Jun 12, 2019 at 08:32:38AM +0200, Sven Schwermer wrote:

> Fixed regulators don't have a set_value method. Therefore, trying to
> set their value will always return -ENOSYS.
> 
> Signed-off-by: Sven Schwermer 
> Cc: Jaehoon Chung 
> Cc: Peng Fan 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

2019-07-14 Thread Tom Rini
On Mon, May 27, 2019 at 09:22:00PM -0500, Derald D. Woods wrote:

> This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:
> 
> [...]
>   CC  drivers/usb/gadget/f_mass_storage.o
>   CC  drivers/usb/musb-new/omap2430.o
>   CC  drivers/usb/gadget/f_fastboot.o
>   CC  env/common.o
>   CC  env/env.o
> /src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In 
> function ‘omap2430_musb_probe’:
> /src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: 
> warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer 
> without a cast [-Wint-conversion]
>   ret = musb_register(&platdata->plat,
>   ^
>   LD  drivers/usb/host/built-in.o
>   CC  drivers/usb/gadget/f_sdp.o
>   CC  fs/ext4/ext4fs.o
> [...]
> 
> Signed-off-by: Derald D. Woods 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

2019-07-14 Thread Tom Rini
On Sat, Jun 08, 2019 at 12:46:18PM -0400, Tom Rini wrote:

> The USE_TINY_PRINTF symbol only changes things within SPL and TPL
> builds, so make it depend on that support.  Next, make it default as
> within these cases we should rarely have need of more advanced print
> formats outside of the debug context.
> 
> To do this, in a few cases we need to correct our Kconfig dependencies
> as we had cases of non-SPL targets select'ing this symbol.  Finally, in
> the case of a few boards we really do need the full printf
> functionality.
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/2] power: pmic: Kconfig: Add SPL_PMIC configs for palmas/lp873x/lp87565

2019-07-14 Thread Tom Rini
On Thu, Jun 06, 2019 at 04:06:55PM +0530, Keerthy wrote:

> Add SPL_PMIC configs for palmas/lp873x/lp87565. These were missing
> and the Makefile already assumes them to be defined. Add the corresponding
> SPL config options. This enables the pmics in SPL.
> 
> Signed-off-by: Keerthy 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v4] gpio: add gpio-hog support

2019-07-14 Thread Tom Rini
On Wed, Jun 12, 2019 at 06:11:46AM +0200, Heiko Schocher wrote:

> add gpio-hog support. GPIO hogging is a mechanism
> providing automatic GPIO request and configuration
> as part of the gpio-controller's driver probe function.
> 
> for more infos see:
> doc/device-tree-bindings/gpio/gpio.txt
> 
> Signed-off-by: Heiko Schocher 
> Tested-by: Michal Simek  (zcu102)
> Tested-by: Patrick Delaunay 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] test: Disable pci_ep test for now

2019-07-14 Thread Tom Rini
On Sun, Jul 14, 2019 at 09:05:10AM -0400, Tom Rini wrote:

> This test is currently broken so disable it for now.
> 
> Cc: Ramon Fried 
> Cc: Simon Glass 
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: dts: da850: Resync with Linux 5.1.9

2019-07-14 Thread Tom Rini
On Tue, Jun 11, 2019 at 08:28:44PM -0500, Adam Ford wrote:

> The da850.dtsi file had some changes.  This patch pulls in the
> changes from Kernel 5.1.9
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/arch/arm/dts/da850.dtsi b/arch/arm/dts/da850.dtsi
> index 47aa53ba6b..559659b399 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: davinci: da850: Manual pinmux only when PINCTRL not available

2019-07-14 Thread Tom Rini
On Mon, Jun 10, 2019 at 01:25:08PM -0500, Adam Ford wrote:

> With a recent update to the pinctrl-single driver and the fact
> that the da850evm has both DM and OF_CONTROL working in both SPL
> and U-Boot, some of the manual pinmuxing can be setup to only
> be activated when either the driver doesn't have DM for it, or
> when CONFIG_PINMUX isn't available (only during SPL).  If the
> code ever shrinks enough to support PINCTRL in SPL, a lot of this
> can go away.  This also remove some manual pinmuxing not needed
> by SPL to give SPL a little more breathing room.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/board/davinci/da8xxevm/da850evm.c 
> b/board/davinci/da8xxevm/da850evm.c
> index a90b7a3538..5180128db4 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7] ARM: am335x: Add phyCORE AM335x R2 support

2019-07-14 Thread Tom Rini
On Mon, Jun 03, 2019 at 03:31:17PM +0200, Parthiban Nallathambi wrote:

> From: Niel Fourie 
> 
> Support for Phytech phyCORE AM335x R2 SOM (PCL060) on the Phytec
> phyBOARD-Wega AM335x.
> 
> CPU  : AM335X-GP rev 2.1
> Model: Phytec AM335x phyBOARD-WEGA
> DRAM:  256 MiB
> NAND:  256 MiB
> MMC:   OMAP SD/MMC: 0
> eth0: ethernet@4a10
> 
> Working:
>  - Eth0
>  - i2C
>  - MMC/SD
>  - NAND
>  - UART
>  - USB (host)
> 
> Device trees were taken from Linux mainline:
> commit 37624b58542f ("Linux 5.1-rc7")
> 
> Signed-off-by: Niel Fourie 
> Signed-off-by: Parthiban Nallathambi 
> Reviewed-by: Heiko Schocher 
> Reviewed-by: Tom Rini 
> Tested-by: Marek Vasut 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] rtc: add Microcrystal RV-8803 driver

2019-07-14 Thread Tom Rini
On Wed, May 29, 2019 at 01:29:58AM +0200, Michael Walle wrote:

> Signed-off-by: Michael Walle 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2] spl: sata: support U-Boot load from raw sata disk

2019-07-14 Thread Baruch Siach
Support load of the U-Boot image from raw SATA disk sector. This is
equivalent to load from MMC raw sector.

Signed-off-by: Baruch Siach 
---
v2:
  Fix build when CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR is not defined
  (Stefan Roese)
---
 common/spl/Kconfig| 14 ++
 common/spl/spl_sata.c | 34 ++
 2 files changed, 48 insertions(+)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index a48617ddcd0b..9fe99681305c 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -888,6 +888,20 @@ config SPL_SATA_SUPPORT
  expense and power consumption. This enables loading from SATA
  using a configured device.
 
+config SPL_SATA_RAW_U_BOOT_USE_SECTOR
+   bool "SATA raw mode: by sector"
+   depends on SPL_SATA_SUPPORT
+   help
+ Use sector number for specifying U-Boot location on SATA disk in
+ raw mode.
+
+config SPL_SATA_RAW_U_BOOT_SECTOR
+   hex "Sector on the SATA disk to load U-Boot from"
+   depends on SPL_SATA_RAW_U_BOOT_USE_SECTOR
+   help
+ Sector on the SATA disk to load U-Boot from, when the SATA disk is 
being
+ used in raw mode. Units: SATA disk sectors (1 sector = 512 bytes).
+
 config SPL_SERIAL_SUPPORT
bool "Support serial"
select SPL_PRINTF
diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
index f0af9f38d19f..e108af0576aa 100644
--- a/common/spl/spl_sata.c
+++ b/common/spl/spl_sata.c
@@ -25,6 +25,37 @@
 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME"u-boot.img"
 #endif
 
+#ifndef CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR
+/* Dummy value to make the compiler happy */
+#define CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR 0x100
+#endif
+
+static int spl_sata_load_image_raw(struct spl_image_info *spl_image,
+   struct blk_desc *stor_dev, unsigned long sector)
+{
+   struct image_header *header;
+   unsigned long count;
+   u32 image_size_sectors;
+   int ret;
+
+   header = spl_get_load_buffer(-sizeof(*header), stor_dev->blksz);
+   count = blk_dread(stor_dev, sector, 1, header);
+   if (count == 0)
+   return -EIO;
+
+   ret = spl_parse_image_header(spl_image, header);
+   if (ret)
+   return ret;
+
+   image_size_sectors = DIV_ROUND_UP(spl_image->size, stor_dev->blksz);
+   count = blk_dread(stor_dev, sector, image_size_sectors,
+   (void *)spl_image->load_addr);
+   if (count != image_size_sectors)
+   return -EIO;
+
+   return 0;
+}
+
 static int spl_sata_load_image(struct spl_image_info *spl_image,
   struct spl_boot_device *bootdev)
 {
@@ -59,6 +90,9 @@ static int spl_sata_load_image(struct spl_image_info 
*spl_image,
err = spl_load_image_fat(spl_image, stor_dev,
CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
+   } else if (IS_ENABLED(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR)) {
+   err = spl_sata_load_image_raw(spl_image, stor_dev,
+   CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR);
}
}
if (err) {
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] test: Disable pci_ep test for now

2019-07-14 Thread Ramon Fried
Hi Tom,
Eventually, I managed to reproduce this on my setup.
Hopefully I'll find the problem and get back to you on that one.
Sorry,
Ramon.

On Sun, Jul 14, 2019 at 4:05 PM Tom Rini  wrote:
>
> This test is currently broken so disable it for now.
>
> Cc: Ramon Fried 
> Cc: Simon Glass 
> Signed-off-by: Tom Rini 
> ---
>  .travis.yml | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/.travis.yml b/.travis.yml
> index 6662ca126ab5..c21ca463 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -365,11 +365,13 @@ matrix:
>  - name: "test/py sandbox"
>env:
>  - TEST_PY_BD="sandbox"
> +  TEST_PY_TEST_SPEC="not pci"
>BUILDMAN="^sandbox$"
>TOOLCHAIN="i386"
>  - name: "test/py sandbox with clang"
>env:
>  - TEST_PY_BD="sandbox"
> +  TEST_PY_TEST_SPEC="not pci"
>BUILDMAN="^sandbox$"
>OVERRIDE="clang-7"
>  - name: "test/py sandbox_spl"
> @@ -382,6 +384,7 @@ matrix:
>  - name: "test/py sandbox_flattree"
>env:
>  - TEST_PY_BD="sandbox_flattree"
> +  TEST_PY_TEST_SPEC="not pci"
>BUILDMAN="^sandbox_flattree$"
>TOOLCHAIN="i386"
>  - name: "test/py vexpress_ca15_tc2"
> --
> 2.7.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] net/macb: increase RX buffer size for GEM

2019-07-14 Thread Ramon Fried
On Sat, Jul 13, 2019 at 3:47 AM Joe Hershberger  wrote:
>
> On Mon, Jun 24, 2019 at 2:02 PM Ramon Fried  wrote:
> >
> > Macb Ethernet controller requires a RX buffer of 128 bytes. It is
> > highly sub-optimal for Gigabit-capable GEM that is able to use
> > a bigger DMA buffer. Change this constant and associated macros
> > with data stored in the private structure.
> > RX DMA buffer size has to be multiple of 64 bytes as indicated in
> > DMA Configuration Register specification.
> >
> > Signed-off-by: Ramon Fried 
>
> Mostly good, but please address the nit below.
Will do.
>
> Acked-by: Joe Hershberger 
>
> > ---
> >  drivers/net/macb.c | 29 +
> >  1 file changed, 21 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > index c072f99d8f..8eb6977fa9 100644
> > --- a/drivers/net/macb.c
> > +++ b/drivers/net/macb.c
> > @@ -45,10 +45,16 @@
> >
> >  DECLARE_GLOBAL_DATA_PTR;
> >
> > -#define MACB_RX_BUFFER_SIZE4096
> > -#define MACB_RX_RING_SIZE  (MACB_RX_BUFFER_SIZE / 128)
> > +/* These buffer sizes must be power of 2 and divisible
>
> Please correct the multi-line comment format.
>
> > + * by RX_BUFFER_MULTIPLE
> > + */
> > +#define MACB_RX_BUFFER_SIZE128
> > +#define GEM_RX_BUFFER_SIZE 2048
> >  #define RX_BUFFER_MULTIPLE 64
> > +
> > +#define MACB_RX_RING_SIZE  32
> >  #define MACB_TX_RING_SIZE  16
> > +
> >  #define MACB_TX_TIMEOUT1000
> >  #define MACB_AUTONEG_TIMEOUT   500
> >
> > @@ -95,6 +101,7 @@ struct macb_device {
> > void*tx_buffer;
> > struct macb_dma_desc*rx_ring;
> > struct macb_dma_desc*tx_ring;
> > +   size_t  rx_buffer_size;
> >
> > unsigned long   rx_buffer_dma;
> > unsigned long   rx_ring_dma;
> > @@ -395,15 +402,16 @@ static int _macb_recv(struct macb_device *macb, uchar 
> > **packetp)
> > }
> >
> > if (status & MACB_BIT(RX_EOF)) {
> > -   buffer = macb->rx_buffer + 128 * macb->rx_tail;
> > +   buffer = macb->rx_buffer +
> > +   macb->rx_buffer_size * macb->rx_tail;
> > length = status & RXBUF_FRMLEN_MASK;
> >
> > macb_invalidate_rx_buffer(macb);
> > if (macb->wrapped) {
> > unsigned int headlen, taillen;
> >
> > -   headlen = 128 * (MACB_RX_RING_SIZE
> > -- macb->rx_tail);
> > +   headlen = macb->rx_buffer_size *
> > +   (MACB_RX_RING_SIZE - macb->rx_tail);
> > taillen = length - headlen;
> > memcpy((void *)net_rx_packets[0],
> >buffer, headlen);
> > @@ -701,7 +709,7 @@ static void gmac_configure_dma(struct macb_device *macb)
> > u32 buffer_size;
> > u32 dmacfg;
> >
> > -   buffer_size = 128 / RX_BUFFER_MULTIPLE;
> > +   buffer_size = macb->rx_buffer_size / RX_BUFFER_MULTIPLE;
> > dmacfg = gem_readl(macb, DMACFG) & ~GEM_BF(RXBS, -1L);
> > dmacfg |= GEM_BF(RXBS, buffer_size);
> >
> > @@ -746,7 +754,7 @@ static int _macb_init(struct macb_device *macb, const 
> > char *name)
> > paddr |= MACB_BIT(RX_WRAP);
> > macb->rx_ring[i].addr = paddr;
> > macb->rx_ring[i].ctrl = 0;
> > -   paddr += 128;
> > +   paddr += macb->rx_buffer_size;
> > }
> > macb_flush_ring_desc(macb, RX);
> > macb_flush_rx_buffer(macb);
> > @@ -957,8 +965,13 @@ static void _macb_eth_initialize(struct macb_device 
> > *macb)
> > int id = 0; /* This is not used by functions we call */
> > u32 ncfgr;
> >
> > +   if (macb_is_gem(macb))
> > +   macb->rx_buffer_size = GEM_RX_BUFFER_SIZE;
> > +   else
> > +   macb->rx_buffer_size = MACB_RX_BUFFER_SIZE;
> > +
> > /* TODO: we need check the rx/tx_ring_dma is dcache line aligned */
> > -   macb->rx_buffer = dma_alloc_coherent(MACB_RX_BUFFER_SIZE,
> > +   macb->rx_buffer = dma_alloc_coherent(macb->rx_buffer_size * 
> > MACB_RX_RING_SIZE,
> >  &macb->rx_buffer_dma);
> > macb->rx_ring = dma_alloc_coherent(MACB_RX_DMA_DESC_SIZE,
> >&macb->rx_ring_dma);
> > --
> > 2.22.0
> >
> > ___
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2] net/macb: increase RX buffer size for GEM

2019-07-14 Thread Ramon Fried
Macb Ethernet controller requires a RX buffer of 128 bytes. It is
highly sub-optimal for Gigabit-capable GEM that is able to use
a bigger DMA buffer. Change this constant and associated macros
with data stored in the private structure.
RX DMA buffer size has to be multiple of 64 bytes as indicated in
DMA Configuration Register specification.

Signed-off-by: Ramon Fried 
---
v2: Fix multi-line comment style
 drivers/net/macb.c | 30 ++
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index c072f99d8f..3c8b9722b3 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -45,10 +45,17 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define MACB_RX_BUFFER_SIZE4096
-#define MACB_RX_RING_SIZE  (MACB_RX_BUFFER_SIZE / 128)
+/*
+ * These buffer sizes must be power of 2 and divisible
+ * by RX_BUFFER_MULTIPLE
+ */
+#define MACB_RX_BUFFER_SIZE128
+#define GEM_RX_BUFFER_SIZE 2048
 #define RX_BUFFER_MULTIPLE 64
+
+#define MACB_RX_RING_SIZE  32
 #define MACB_TX_RING_SIZE  16
+
 #define MACB_TX_TIMEOUT1000
 #define MACB_AUTONEG_TIMEOUT   500
 
@@ -95,6 +102,7 @@ struct macb_device {
void*tx_buffer;
struct macb_dma_desc*rx_ring;
struct macb_dma_desc*tx_ring;
+   size_t  rx_buffer_size;
 
unsigned long   rx_buffer_dma;
unsigned long   rx_ring_dma;
@@ -395,15 +403,16 @@ static int _macb_recv(struct macb_device *macb, uchar 
**packetp)
}
 
if (status & MACB_BIT(RX_EOF)) {
-   buffer = macb->rx_buffer + 128 * macb->rx_tail;
+   buffer = macb->rx_buffer +
+   macb->rx_buffer_size * macb->rx_tail;
length = status & RXBUF_FRMLEN_MASK;
 
macb_invalidate_rx_buffer(macb);
if (macb->wrapped) {
unsigned int headlen, taillen;
 
-   headlen = 128 * (MACB_RX_RING_SIZE
-- macb->rx_tail);
+   headlen = macb->rx_buffer_size *
+   (MACB_RX_RING_SIZE - macb->rx_tail);
taillen = length - headlen;
memcpy((void *)net_rx_packets[0],
   buffer, headlen);
@@ -701,7 +710,7 @@ static void gmac_configure_dma(struct macb_device *macb)
u32 buffer_size;
u32 dmacfg;
 
-   buffer_size = 128 / RX_BUFFER_MULTIPLE;
+   buffer_size = macb->rx_buffer_size / RX_BUFFER_MULTIPLE;
dmacfg = gem_readl(macb, DMACFG) & ~GEM_BF(RXBS, -1L);
dmacfg |= GEM_BF(RXBS, buffer_size);
 
@@ -746,7 +755,7 @@ static int _macb_init(struct macb_device *macb, const char 
*name)
paddr |= MACB_BIT(RX_WRAP);
macb->rx_ring[i].addr = paddr;
macb->rx_ring[i].ctrl = 0;
-   paddr += 128;
+   paddr += macb->rx_buffer_size;
}
macb_flush_ring_desc(macb, RX);
macb_flush_rx_buffer(macb);
@@ -957,8 +966,13 @@ static void _macb_eth_initialize(struct macb_device *macb)
int id = 0; /* This is not used by functions we call */
u32 ncfgr;
 
+   if (macb_is_gem(macb))
+   macb->rx_buffer_size = GEM_RX_BUFFER_SIZE;
+   else
+   macb->rx_buffer_size = MACB_RX_BUFFER_SIZE;
+
/* TODO: we need check the rx/tx_ring_dma is dcache line aligned */
-   macb->rx_buffer = dma_alloc_coherent(MACB_RX_BUFFER_SIZE,
+   macb->rx_buffer = dma_alloc_coherent(macb->rx_buffer_size * 
MACB_RX_RING_SIZE,
 &macb->rx_buffer_dma);
macb->rx_ring = dma_alloc_coherent(MACB_RX_DMA_DESC_SIZE,
   &macb->rx_ring_dma);
-- 
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 1/3] x86: acpi: Introduce a stub to generate CSRT

2019-07-14 Thread Andy Shevchenko
Here is a stub function that generates an empty CSRT. If the target platform
provides acpi_fill_csrt() function, it will be used to populate the table.

Signed-off-by: Andy Shevchenko 
---
 arch/x86/include/asm/acpi_table.h |  1 +
 arch/x86/lib/acpi_table.c | 32 +++
 2 files changed, 33 insertions(+)

diff --git a/arch/x86/include/asm/acpi_table.h 
b/arch/x86/include/asm/acpi_table.h
index a70abd5d75..02aea127c1 100644
--- a/arch/x86/include/asm/acpi_table.h
+++ b/arch/x86/include/asm/acpi_table.h
@@ -401,6 +401,7 @@ u32 acpi_fill_madt(u32 current);
 int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, u32 base,
  u16 seg_nr, u8 start, u8 end);
 u32 acpi_fill_mcfg(u32 current);
+u32 acpi_fill_csrt(u32 current);
 void acpi_create_gnvs(struct acpi_global_nvs *gnvs);
 ulong write_acpi_tables(ulong start);
 
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index e80e968b50..efc4edf801 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -337,6 +337,30 @@ static void acpi_create_mcfg(struct acpi_mcfg *mcfg)
header->checksum = table_compute_checksum((void *)mcfg, header->length);
 }
 
+__weak u32 acpi_fill_csrt(u32 current)
+{
+   return current;
+}
+
+static void acpi_create_csrt(struct acpi_csrt *csrt)
+{
+   struct acpi_table_header *header = &(csrt->header);
+   u32 current = (u32)csrt + sizeof(struct acpi_csrt);
+
+   memset((void *)csrt, 0, sizeof(struct acpi_csrt));
+
+   /* Fill out header fields */
+   acpi_fill_header(header, "CSRT");
+   header->length = sizeof(struct acpi_csrt);
+   header->revision = 0;
+
+   current = acpi_fill_csrt(current);
+
+   /* (Re)calculate length and checksum */
+   header->length = current - (u32)csrt;
+   header->checksum = table_compute_checksum((void *)csrt, header->length);
+}
+
 static void acpi_create_spcr(struct acpi_spcr *spcr)
 {
struct acpi_table_header *header = &(spcr->header);
@@ -440,6 +464,7 @@ ulong write_acpi_tables(ulong start)
struct acpi_fadt *fadt;
struct acpi_mcfg *mcfg;
struct acpi_madt *madt;
+   struct acpi_csrt *csrt;
struct acpi_spcr *spcr;
int i;
 
@@ -529,6 +554,13 @@ ulong write_acpi_tables(ulong start)
acpi_add_table(rsdp, mcfg);
current = ALIGN(current, 16);
 
+   debug("ACPI:* CSRT\n");
+   csrt = (struct acpi_csrt *)current;
+   acpi_create_csrt(csrt);
+   current += csrt->header.length;
+   acpi_add_table(rsdp, csrt);
+   current = ALIGN(current, 16);
+
debug("ACPI:* SPCR\n");
spcr = (struct acpi_spcr *)current;
acpi_create_spcr(spcr);
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 2/3] x86: acpi: Enable ACPI companion for Intel iDMA 32-bit

2019-07-14 Thread Andy Shevchenko
ACPI has a capability to specify DMA parameters for DMA channel consumers.
To enable this for Intel Edison, describe GP DMA device in ACPI table
in order to get an ACPI handle to it in OS.

This works in conjunction with CSRT, which must be in align with DSDT.

Signed-off-by: Andy Shevchenko 
---
 .../asm/arch-tangier/acpi/southcluster.asl| 22 +++
 1 file changed, 22 insertions(+)

diff --git a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl 
b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
index 241d4ac801..0ec195b51b 100644
--- a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
+++ b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
@@ -431,6 +431,28 @@ Device (PCI0)
 }
 }
 }
+
+Device (GDMA)
+{
+Name (_ADR, 0x0015)
+Name (_HID, "808611A2")
+Name (_UID, Zero)
+
+Method (_STA, 0, NotSerialized)
+{
+Return (STA_VISIBLE)
+}
+
+Method (_CRS, 0, Serialized)
+{
+Name (RBUF, ResourceTemplate ()
+{
+Memory32Fixed(ReadWrite, 0xFF192000, 0x1000)
+Interrupt(ResourceConsumer, Level, ActiveHigh, Shared, ,, 
) { 32 }
+})
+Return (RBUF)
+}
+}
 }
 
 Device (FLIS)
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 3/3] x86: tangier: Populate CSRT for shared DMA controller

2019-07-14 Thread Andy Shevchenko
Intel Tangier has a shared DMA controller that, according to Microsoft spec,
has to be presented in CSRT table.

Signed-off-by: Andy Shevchenko 
---
 arch/x86/cpu/tangier/acpi.c | 38 +
 1 file changed, 38 insertions(+)

diff --git a/arch/x86/cpu/tangier/acpi.c b/arch/x86/cpu/tangier/acpi.c
index 0e4f961c53..61b2642aa9 100644
--- a/arch/x86/cpu/tangier/acpi.c
+++ b/arch/x86/cpu/tangier/acpi.c
@@ -68,6 +68,44 @@ u32 acpi_fill_mcfg(u32 current)
return current;
 }
 
+static u32 acpi_fill_csrt_dma(struct acpi_csrt_group *grp)
+{
+   struct acpi_csrt_shared_info *si = (struct acpi_csrt_shared_info 
*)&grp[1];
+
+   /* Fill the Resource Group with Shared Information attached */
+   memset(grp, 0, sizeof(*grp));
+   grp->shared_info_length = sizeof(struct acpi_csrt_shared_info);
+   grp->length = sizeof(struct acpi_csrt_group) + grp->shared_info_length;
+   /* TODO: All values below should come from U-Boot DT somehow */
+   sprintf((char *)&grp->vendor_id, "%04X", 0x8086);
+   grp->device_id = 0x11a2;
+
+   /* Fill the Resource Group Shared Information */
+   memset(si, 0, sizeof(*si));
+   si->major_version = 1;
+   si->minor_version = 0;
+   /* TODO: All values below should come from U-Boot DT somehow */
+   si->mmio_base_low = 0xff192000;
+   si->mmio_base_high = 0;
+   si->gsi_interrupt = 32;
+   si->interrupt_polarity = 1;
+   si->interrupt_mode = 0;
+   si->num_channels = 8;
+   si->dma_address_width = 32;
+   si->base_request_line = 0;
+   si->num_handshake_signals = 16;
+   si->max_block_size = 0x2;
+
+   return grp->length;
+}
+
+u32 acpi_fill_csrt(u32 current)
+{
+   current += acpi_fill_csrt_dma((struct acpi_csrt_group *)current);
+
+   return current;
+}
+
 void acpi_create_gnvs(struct acpi_global_nvs *gnvs)
 {
struct udevice *dev;
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/4] x86: acpi: Introduce a stub to generate CSRT

2019-07-14 Thread Andy Shevchenko
Here is a stub function that generates an empty CSRT. If the target platform
provides acpi_fill_csrt() function, it will be used to populate the table.

Signed-off-by: Andy Shevchenko 
---
 arch/x86/include/asm/acpi_table.h |  1 +
 arch/x86/lib/acpi_table.c | 32 +++
 2 files changed, 33 insertions(+)

diff --git a/arch/x86/include/asm/acpi_table.h 
b/arch/x86/include/asm/acpi_table.h
index a70abd5d75..02aea127c1 100644
--- a/arch/x86/include/asm/acpi_table.h
+++ b/arch/x86/include/asm/acpi_table.h
@@ -401,6 +401,7 @@ u32 acpi_fill_madt(u32 current);
 int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, u32 base,
  u16 seg_nr, u8 start, u8 end);
 u32 acpi_fill_mcfg(u32 current);
+u32 acpi_fill_csrt(u32 current);
 void acpi_create_gnvs(struct acpi_global_nvs *gnvs);
 ulong write_acpi_tables(ulong start);
 
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index e80e968b50..efc4edf801 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -337,6 +337,30 @@ static void acpi_create_mcfg(struct acpi_mcfg *mcfg)
header->checksum = table_compute_checksum((void *)mcfg, header->length);
 }
 
+__weak u32 acpi_fill_csrt(u32 current)
+{
+   return current;
+}
+
+static void acpi_create_csrt(struct acpi_csrt *csrt)
+{
+   struct acpi_table_header *header = &(csrt->header);
+   u32 current = (u32)csrt + sizeof(struct acpi_csrt);
+
+   memset((void *)csrt, 0, sizeof(struct acpi_csrt));
+
+   /* Fill out header fields */
+   acpi_fill_header(header, "CSRT");
+   header->length = sizeof(struct acpi_csrt);
+   header->revision = 0;
+
+   current = acpi_fill_csrt(current);
+
+   /* (Re)calculate length and checksum */
+   header->length = current - (u32)csrt;
+   header->checksum = table_compute_checksum((void *)csrt, header->length);
+}
+
 static void acpi_create_spcr(struct acpi_spcr *spcr)
 {
struct acpi_table_header *header = &(spcr->header);
@@ -440,6 +464,7 @@ ulong write_acpi_tables(ulong start)
struct acpi_fadt *fadt;
struct acpi_mcfg *mcfg;
struct acpi_madt *madt;
+   struct acpi_csrt *csrt;
struct acpi_spcr *spcr;
int i;
 
@@ -529,6 +554,13 @@ ulong write_acpi_tables(ulong start)
acpi_add_table(rsdp, mcfg);
current = ALIGN(current, 16);
 
+   debug("ACPI:* CSRT\n");
+   csrt = (struct acpi_csrt *)current;
+   acpi_create_csrt(csrt);
+   current += csrt->header.length;
+   acpi_add_table(rsdp, csrt);
+   current = ALIGN(current, 16);
+
debug("ACPI:* SPCR\n");
spcr = (struct acpi_spcr *)current;
acpi_create_spcr(spcr);
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 3/4] x86: acpi: Enable ACPI companion for Intel iDMA 32-bit

2019-07-14 Thread Andy Shevchenko
ACPI has a capability to specify DMA parameters for DMA channel consumers.
To enable this for Intel Edison, describe GP DMA device in ACPI table
in order to get an ACPI handle to it in OS.

This works in conjunction with CSRT, which must be in align with DSDT.

Signed-off-by: Andy Shevchenko 
---
 .../asm/arch-tangier/acpi/southcluster.asl| 22 +++
 1 file changed, 22 insertions(+)

diff --git a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl 
b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
index 241d4ac801..0ec195b51b 100644
--- a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
+++ b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
@@ -431,6 +431,28 @@ Device (PCI0)
 }
 }
 }
+
+Device (GDMA)
+{
+Name (_ADR, 0x0015)
+Name (_HID, "808611A2")
+Name (_UID, Zero)
+
+Method (_STA, 0, NotSerialized)
+{
+Return (STA_VISIBLE)
+}
+
+Method (_CRS, 0, Serialized)
+{
+Name (RBUF, ResourceTemplate ()
+{
+Memory32Fixed(ReadWrite, 0xFF192000, 0x1000)
+Interrupt(ResourceConsumer, Level, ActiveHigh, Shared, ,, 
) { 32 }
+})
+Return (RBUF)
+}
+}
 }
 
 Device (FLIS)
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/4] x86: acpi: Add CSRT description

2019-07-14 Thread Andy Shevchenko
Add CSRT [1] description as it provided in Linux kernel.

[1]: http://www.uefi.org/sites/default/files/resources/CSRT%20v2.pdf

Signed-off-by: Andy Shevchenko 
---
 arch/x86/include/asm/acpi_table.h | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/arch/x86/include/asm/acpi_table.h 
b/arch/x86/include/asm/acpi_table.h
index e3b65cff66..a70abd5d75 100644
--- a/arch/x86/include/asm/acpi_table.h
+++ b/arch/x86/include/asm/acpi_table.h
@@ -303,6 +303,37 @@ struct acpi_mcfg_mmconfig {
 /* ACPI global NVS structure */
 struct acpi_global_nvs;
 
+/* CSRT (Core System Resource Table) */
+struct acpi_csrt {
+   struct acpi_table_header header;
+};
+
+struct acpi_csrt_group {
+   u32 length;
+   u32 vendor_id;
+   u32 subvendor_id;
+   u16 device_id;
+   u16 subdevice_id;
+   u16 revision;
+   u16 reserved;
+   u32 shared_info_length;
+};
+
+struct acpi_csrt_shared_info {
+   u16 major_version;
+   u16 minor_version;
+   u32 mmio_base_low;
+   u32 mmio_base_high;
+   u32 gsi_interrupt;
+   u8 interrupt_polarity;
+   u8 interrupt_mode;
+   u8 num_channels;
+   u8 dma_address_width;
+   u16 base_request_line;
+   u16 num_handshake_signals;
+   u32 max_block_size;
+};
+
 /* DBG2 definitions are partially used for SPCR interface_type */
 
 /* Types for port_type field */
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 4/4] x86: tangier: Populate CSRT for shared DMA controller

2019-07-14 Thread Andy Shevchenko
Intel Tangier has a shared DMA controller that, according to Microsoft spec,
has to be presented in CSRT table.

Signed-off-by: Andy Shevchenko 
---
 arch/x86/cpu/tangier/acpi.c | 38 +
 1 file changed, 38 insertions(+)

diff --git a/arch/x86/cpu/tangier/acpi.c b/arch/x86/cpu/tangier/acpi.c
index 0e4f961c53..61b2642aa9 100644
--- a/arch/x86/cpu/tangier/acpi.c
+++ b/arch/x86/cpu/tangier/acpi.c
@@ -68,6 +68,44 @@ u32 acpi_fill_mcfg(u32 current)
return current;
 }
 
+static u32 acpi_fill_csrt_dma(struct acpi_csrt_group *grp)
+{
+   struct acpi_csrt_shared_info *si = (struct acpi_csrt_shared_info 
*)&grp[1];
+
+   /* Fill the Resource Group with Shared Information attached */
+   memset(grp, 0, sizeof(*grp));
+   grp->shared_info_length = sizeof(struct acpi_csrt_shared_info);
+   grp->length = sizeof(struct acpi_csrt_group) + grp->shared_info_length;
+   /* TODO: All values below should come from U-Boot DT somehow */
+   sprintf((char *)&grp->vendor_id, "%04X", 0x8086);
+   grp->device_id = 0x11a2;
+
+   /* Fill the Resource Group Shared Information */
+   memset(si, 0, sizeof(*si));
+   si->major_version = 1;
+   si->minor_version = 0;
+   /* TODO: All values below should come from U-Boot DT somehow */
+   si->mmio_base_low = 0xff192000;
+   si->mmio_base_high = 0;
+   si->gsi_interrupt = 32;
+   si->interrupt_polarity = 1;
+   si->interrupt_mode = 0;
+   si->num_channels = 8;
+   si->dma_address_width = 32;
+   si->base_request_line = 0;
+   si->num_handshake_signals = 16;
+   si->max_block_size = 0x2;
+
+   return grp->length;
+}
+
+u32 acpi_fill_csrt(u32 current)
+{
+   current += acpi_fill_csrt_dma((struct acpi_csrt_group *)current);
+
+   return current;
+}
+
 void acpi_create_gnvs(struct acpi_global_nvs *gnvs)
 {
struct udevice *dev;
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 1/3] x86: acpi: Introduce a stub to generate CSRT

2019-07-14 Thread Andy Shevchenko
On Sun, Jul 14, 2019 at 07:20:45PM +0300, Andy Shevchenko wrote:
> Here is a stub function that generates an empty CSRT. If the target platform
> provides acpi_fill_csrt() function, it will be used to populate the table.

Please, discard this version (just had sent v2) due to missed first patch.

JFYI: I have tested it on v5.2 kernel and it works fine, no need to
patch the kernel anyhow (okay, there is one bug in the kernel code, but
it can be fixed separately).

-- 
With Best Regards,
Andy Shevchenko


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] dm: core: device: switch off power domain after device removal

2019-07-14 Thread Anatolij Gustschin
Hi Simon,

On Fri, 12 Jul 2019 15:05:06 -0600
Simon Glass s...@chromium.org wrote:
...
> >
> > +   if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN 
> > &&  
> 
> Putting my code-size hat on, what do you think about adding an
> IF_ENABLED(POWER_DOMAIN) as the first arg?

Good point, I'll add it in v2 patch.

Thanks,
Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] disk: efi: avoid unaligned pointer error

2019-07-14 Thread Heinrich Schuchardt
When building with GCC 9.1 an error occurs:

disk/part_efi.c: In function ‘gpt_verify_partitions’:
disk/part_efi.c:737:49: error: taking address of packed member of
‘struct _gpt_entry’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  737 |   gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name,
  | ^~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:279: disk/part_efi.o] Error 1
make: *** [Makefile:1594: disk] Error 2

Adjust gpt_convert_efi_name_to_char() to accept unaligned strings.

Reported-by: Ramon Fried 
Signed-off-by: Heinrich Schuchardt 
---
 Makefile|  2 +-
 disk/part_efi.c | 13 +++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 73fdf70cdd..a0e521363e 100644
--- a/Makefile
+++ b/Makefile
@@ -665,7 +665,7 @@ endif
 endif

 # Prohibit date/time macros, which would make the build non-deterministic
-KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
+KBUILD_CFLAGS   += $(call cc-option,-Werror)

 include scripts/Makefile.extrawarn

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 3e026697db..359b55a818 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -670,9 +670,18 @@ err:
return ret;
 }

-static void gpt_convert_efi_name_to_char(char *s, efi_char16_t *es, int n)
+/**
+ * gpt_convert_efi_name_to_char() - convert u16 string to char string
+ *
+ * TODO: this conversion only supports ANSI characters
+ *
+ * @s: target buffer
+ * @es:u16 string to be converted
+ * @n: size of target buffer
+ */
+static void gpt_convert_efi_name_to_char(char *s, void *es, int n)
 {
-   char *ess = (char *)es;
+   char *ess = es;
int i, j;

memset(s, '\0', n);
--
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/5] doc: Move README.android-fastboot-protocol to doc/android/

2019-07-14 Thread Tom Rini
On Sat, Jul 13, 2019 at 10:39:19AM +0200, Eugeniu Rosca wrote:

> Superseded by https://patchwork.ozlabs.org/patch/1131355/
> ("[v2,1/5] doc: Move README.android-fastboot-protocol to doc/android/")

Thanks!  This does help me avoid cases where I put up the old versions
of series (and thanks also for doing the v3->v4 fixup stuff for me).

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] disk: efi: avoid unaligned pointer error

2019-07-14 Thread Ramon Fried
On Sun, Jul 14, 2019 at 7:44 PM Heinrich Schuchardt  wrote:
>
> When building with GCC 9.1 an error occurs:
>
> disk/part_efi.c: In function ‘gpt_verify_partitions’:
> disk/part_efi.c:737:49: error: taking address of packed member of
> ‘struct _gpt_entry’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>   737 |   gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name,
>   | ^~~
> cc1: all warnings being treated as errors
> make[1]: *** [scripts/Makefile.build:279: disk/part_efi.o] Error 1
> make: *** [Makefile:1594: disk] Error 2
>
> Adjust gpt_convert_efi_name_to_char() to accept unaligned strings.
>
> Reported-by: Ramon Fried 
> Signed-off-by: Heinrich Schuchardt 
> ---
>  Makefile|  2 +-
>  disk/part_efi.c | 13 +++--
>  2 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 73fdf70cdd..a0e521363e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -665,7 +665,7 @@ endif
>  endif
>
>  # Prohibit date/time macros, which would make the build non-deterministic
> -KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
> +KBUILD_CFLAGS   += $(call cc-option,-Werror)
Is this part of the patch or commited by mistake ?
>
>  include scripts/Makefile.extrawarn
>
> diff --git a/disk/part_efi.c b/disk/part_efi.c
> index 3e026697db..359b55a818 100644
> --- a/disk/part_efi.c
> +++ b/disk/part_efi.c
> @@ -670,9 +670,18 @@ err:
> return ret;
>  }
>
> -static void gpt_convert_efi_name_to_char(char *s, efi_char16_t *es, int n)
> +/**
> + * gpt_convert_efi_name_to_char() - convert u16 string to char string
> + *
> + * TODO: this conversion only supports ANSI characters
> + *
> + * @s: target buffer
> + * @es:u16 string to be converted
> + * @n: size of target buffer
> + */
> +static void gpt_convert_efi_name_to_char(char *s, void *es, int n)
>  {
> -   char *ess = (char *)es;
> +   char *ess = es;
> int i, j;
>
> memset(s, '\0', n);
> --
> 2.22.0
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] disk: efi: avoid unaligned pointer error

2019-07-14 Thread Heinrich Schuchardt



On 14.07.19 20:48, Ramon Fried wrote:

On Sun, Jul 14, 2019 at 7:44 PM Heinrich Schuchardt  wrote:


When building with GCC 9.1 an error occurs:

disk/part_efi.c: In function ‘gpt_verify_partitions’:
disk/part_efi.c:737:49: error: taking address of packed member of
‘struct _gpt_entry’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
   737 |   gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name,
   | ^~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:279: disk/part_efi.o] Error 1
make: *** [Makefile:1594: disk] Error 2

Adjust gpt_convert_efi_name_to_char() to accept unaligned strings.

Reported-by: Ramon Fried 
Signed-off-by: Heinrich Schuchardt 
---
  Makefile|  2 +-
  disk/part_efi.c | 13 +++--
  2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 73fdf70cdd..a0e521363e 100644
--- a/Makefile
+++ b/Makefile
@@ -665,7 +665,7 @@ endif
  endif

  # Prohibit date/time macros, which would make the build non-deterministic
-KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
+KBUILD_CFLAGS   += $(call cc-option,-Werror)

Is this part of the patch or commited by mistake ?


This got in by mistake. Sorry.

Heinrich



  include scripts/Makefile.extrawarn

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 3e026697db..359b55a818 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -670,9 +670,18 @@ err:
 return ret;
  }

-static void gpt_convert_efi_name_to_char(char *s, efi_char16_t *es, int n)
+/**
+ * gpt_convert_efi_name_to_char() - convert u16 string to char string
+ *
+ * TODO: this conversion only supports ANSI characters
+ *
+ * @s: target buffer
+ * @es:u16 string to be converted
+ * @n: size of target buffer
+ */
+static void gpt_convert_efi_name_to_char(char *s, void *es, int n)
  {
-   char *ess = (char *)es;
+   char *ess = es;
 int i, j;

 memset(s, '\0', n);
--
2.22.0




___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] dm: device: make power domain calls optional

2019-07-14 Thread Anatolij Gustschin
Reduce power domain calls when CONFIG_POWER_DOMAIN is disabled.
With gcc v8.2, this change saves 104 bytes.

Signed-off-by: Anatolij Gustschin 
---
 drivers/core/device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 0d15e5062b..8ec0f02bde 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -388,7 +388,8 @@ int device_probe(struct udevice *dev)
if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
pinctrl_select_state(dev, "default");
 
-   if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
+   if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
+   device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
if (!power_domain_get(dev, &pd))
power_domain_on(&pd);
}
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] net: assign maintainer for include/net.h

2019-07-14 Thread Heinrich Schuchardt
include/net.h currently has no maintainer.

Assign include/net.h to the maintainer of the NET subsystem.

Signed-off-by: Heinrich Schuchardt 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index e91684191f..ee93078451 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -614,6 +614,7 @@ M:  Joe Hershberger 
 S: Maintained
 T: git https://gitlab.denx.de/u-boot/custodians/u-boot-net.git
 F: drivers/net/
+F: include/net.h
 F: net/

 NIOS
--
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/2] serial: lpuart: request dm device removal when booting OS

2019-07-14 Thread Anatolij Gustschin
Extend the driver to allow dm device removal, but always let the
console serial device power domain enabled, so that U-Boot doesn't
crash when i. e. the serial output is enabled for debugging.

Signed-off-by: Anatolij Gustschin 
---
Changes in v2:
 - None

 drivers/serial/serial_lpuart.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 57dd4a72c6..b028f4b35f 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -489,6 +489,13 @@ static int lpuart_serial_probe(struct udevice *dev)
return _lpuart_serial_init(dev);
 }
 
+static int lpuart_serial_remove(struct udevice *dev)
+{
+   if (dev == gd->cur_serial_dev)
+   dev->flags |= DM_FLAG_REMOVE_WITH_PD_ON;
+   return 0;
+}
+
 static int lpuart_serial_ofdata_to_platdata(struct udevice *dev)
 {
struct lpuart_serial_platdata *plat = dev->platdata;
@@ -543,5 +550,7 @@ U_BOOT_DRIVER(serial_lpuart) = {
.ofdata_to_platdata = lpuart_serial_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata),
.probe = lpuart_serial_probe,
+   .remove = lpuart_serial_remove,
.ops= &lpuart_serial_ops,
+   .flags  = DM_FLAG_OS_PREPARE,
 };
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/2] dm: core: device: switch off power domain after device removal

2019-07-14 Thread Anatolij Gustschin
The power domain associated with a device is enabled when probing,
but currently the domain remains enabled when the device is removed.
Some boards started to disable power domains for selected devices
via custom board_quiesce_devices(), but it doesn't work in many
cases, i. e. because devices still can be accessed later in
.remove() callback on behalf of dm_remove_devices_flags().

Utilize the DM core to power off the device power domain, but add a
device flag to be able to selectively let the power domain enabled
after device removal. This might be required for devices that must
remain enabled when booting OS, i. e. serial console for debug
output, etc.

Signed-off-by: Anatolij Gustschin 
---
Changes in v2:
 - use CONFIG_IS_ENABLED(POWER_DOMAIN) to reduce code size

 drivers/core/device-remove.c | 9 +
 include/dm/device.h  | 6 ++
 2 files changed, 15 insertions(+)

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 586fadee0a..abed84a652 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 int device_chld_unbind(struct udevice *dev, struct driver *drv)
 {
@@ -154,6 +155,7 @@ static bool flags_remove(uint flags, uint drv_flags)
 
 int device_remove(struct udevice *dev, uint flags)
 {
+   struct power_domain pd;
const struct driver *drv;
int ret;
 
@@ -192,6 +194,13 @@ int device_remove(struct udevice *dev, uint flags)
}
}
 
+   if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
+   device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN &&
+   !(dev->flags & DM_FLAG_REMOVE_WITH_PD_ON)) {
+   if (!power_domain_get(dev, &pd))
+   power_domain_off(&pd);
+   }
+
if (flags_remove(flags, drv->flags)) {
device_free(dev);
 
diff --git a/include/dm/device.h b/include/dm/device.h
index 27a6d7b9fd..9a98a4a39e 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -61,6 +61,12 @@ struct driver_info;
  */
 #define DM_FLAG_OS_PREPARE (1 << 10)
 
+/*
+ * Device is removed without switching off its power domain. This might
+ * be required, i. e. for serial console (debug) output when booting OS.
+ */
+#define DM_FLAG_REMOVE_WITH_PD_ON  (1 << 11)
+
 /*
  * One or multiple of these flags are passed to device_remove() so that
  * a selective device removal as specified by the remove-stage and the
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] net: unaligned copying of unsigned long

2019-07-14 Thread Heinrich Schuchardt
The inline functions net_read_u32() and net_copy_u32() have been created to
copy unaligned u32. But this is not obvious to the compiler. GCC 9.1
introduces a check -Werror=address-of-packed-member which leads to a build
error on Travis CI:

net/bootp.c: In function ‘dhcp_send_request_packet’:
net/bootp.c:1011:27: error: taking address of packed member of
‘struct bootp_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
 1011 |  net_copy_u32(&bp->bp_id, &bp_offer->bp_id);

Change the type of the function parameters to void * to avoid the build
error.

Reported-by: Ramon Fried 
Signed-off-by: Heinrich Schuchardt 
---
 include/net.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net.h b/include/net.h
index 44b32385c4..7684076af6 100644
--- a/include/net.h
+++ b/include/net.h
@@ -728,7 +728,7 @@ static inline struct in_addr net_read_ip(void *from)
 }

 /* return ulong *in network byteorder* */
-static inline u32 net_read_u32(u32 *from)
+static inline u32 net_read_u32(void *from)
 {
u32 l;

@@ -749,7 +749,7 @@ static inline void net_copy_ip(void *to, void *from)
 }

 /* copy ulong */
-static inline void net_copy_u32(u32 *to, u32 *from)
+static inline void net_copy_u32(void *to, void *from)
 {
memcpy((void *)to, (void *)from, sizeof(u32));
 }
--
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 8/8] Add support for the NXP LS1021A-TSN board

2019-07-14 Thread Vladimir Oltean
Hi Bin,

On Sat, 13 Jul 2019 at 08:05, Bin Meng  wrote:
>
> Hi Vladimir,
>
> On Mon, Jun 24, 2019 at 1:50 AM Vladimir Oltean  wrote:
> >
> > From: Jianchao Wang 
> >
> > The LS1021A-TSN is a development board built by VVDN/Argonboards in
> > partnership with NXP.
> >
> > It features the LS1021A SoC and the first-generation SJA1105T Ethernet
> > switch for prototyping implementations of a subset of IEEE 802.1 TSN
> > standards.
> >
> > Supported boot media: microSD card (via SPL), QSPI flash.
> >
> > Rev. A of the board uses a Spansion S25FL512S_256K serial flash, which
> > is 64 MB in size and has an erase sector size of 256KB (therefore,
> > flashing the RCW would erase part of U-boot).
>
> nits: U-Boot
>

Why don't you add a rule to scripts/checkpatch.pl that warns on
improper spelling of U-Boot? It would save a lot of time on both ends.

> >
> > Rev. B and C of the board use a Spansion S25FL256S1 serial flash, which
> > is only 32 MB in size but has an erase sector size of 64KB (therefore
> > the RCW image can be flashed without erasing U-boot).
>
> ditto
>
> >
> > To avoid the problems above, the U-boot base address has been selected
>
> ditto
>

[snip]

> > +The LS1021A-TSN board comes along with a microSD card with OpenIL U-boot.
>
> nits: U-Boot
>
> > +That will be used to update the internal QSPI flash, as well as
> > +
> > +To compile and flash an SD card image::
> > +
> > +  make ls1021atsn_sdcard_defconfig && make -j 8 && sudo cp 
> > u-boot-with-spl-pbl.bin /srv/tftpboot/
> > +  => tftp 0x8200 u-boot-with-spl-pbl.bin && mmc rescan && mmc erase 8 
> > 0x1100 && mmc write 0x8200 8 0x1100
> > +
> > +For the QSPI flash, first obtain the Reset Configuration Word binary for
> > +bootimg from the QSPI flash from the rcw project
> > +(https://source.codeaurora.org/external/qoriq/qoriq-components/rcw)::
> > +
> > +  make -j 8 && sudo cp ls1021atsn/SSR_PNS_30/rcw_1200_qspiboot.bin.swapped 
> > /srv/tftpboot/
> > +
> > +The above RCW binary takes care of swapping the QSPI AMBA memory, so that 
> > the
> > +U-boot binary does not need to be swapped when flashing it.
>
> nits: U-Boot
>
> > +
> > +To compile and flash a U-boot image for QSPI::
>
> ditto
>
> > +
> > +  make ls1021atsn_qspi_defconfig && make -j 8 && sudo cp u-boot.bin 
> > /srv/tftpboot/
> > +
> > +Then optionally create a custom uboot-env.txt file (although the default
> > +environment already supports distro boot) and convert it to binary format::
> > +
> > +  mkenvimage -s 2M -o /srv/tftpboot/uboot-env.bin uboot-env.txt
> > +
> > +To program the QSPI flash with the images::
> > +
> > +  => tftp 0x8200 rcw_1000_qspiboot.bin.swapped && sf probe && sf erase 
> > 0x0 +${filesize} && sf write 0x8200 0x0 ${filesize}
> > +  => tftp 0x8200 u-boot.bin && sf probe && sf erase 0x10 
> > +${filesize} && sf write 0x8200 0x10 ${filesize}
> > +  => tftp 0x8200 uboot-env.bin && sf probe && sf erase 0x40 
> > +${filesize} && sf write 0x8200 0x40 ${filesize}
> > +
> > +The boards contain an AT24 I2C EEPROM that is supposed to hold the MAC
> > +addresses of the Ethernet interfaces, however the EEPROM comes blank out of
> > +the factory, and the MAC addresses are printed on a label on the bottom of
> > +the boards.
> > +
> > +To write the MAC addresses to the EEPROM, the following needs to be done 
> > once::
> > +
> > +  => mac id
> > +  => mac 0 00:1F:7B:xx:xx:xx
> > +  => mac 1 00:1F:7B:xx:xx:xx
> > +  => mac 2 00:1F:7B:xx:xx:xx
> > +  => mac save
> > +
> > +The switch ports do not have their own MAC address - they inherit it from 
> > the
> > +master enet2 port.
> > +
> > +Known issues and limitations
> > +
> > +
> > +- The 4 SJA1105 switch ports are not functional in U-boot for now.
>
> nits: U-Boot
>

[snip]

>
> Regards,
> Bin

Thanks,
-Vladimir
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/8] x86: Add new slimbootloader CPU type

2019-07-14 Thread Park, Aiden
Hi Bin,

> -Original Message-
> From: Bin Meng [mailto:bmeng...@gmail.com]
> Sent: Sunday, July 14, 2019 1:49 AM
> To: Park, Aiden 
> Cc: U-Boot Mailing List ; Simon Glass
> 
> Subject: Re: [PATCH v3 1/8] x86: Add new slimbootloader CPU type
> 
> On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
> >
> > This slimbootloader cpu type is to enable u-boot as a payload which
> > runs on top of Slim Bootloader(https://github.com/slimbootloader).
> > The Slim Bootloader is designed with multi-stage architecture for the
> > execution from reset vector to OS booting, and supports qemu,
> > Apollolake, Whiskeylake and Coffeelake platforms consuming Intel FSP
> > (https://github.com/IntelFsp) for silicon initialization including CAR
> > and memory initialization.
> > The Slim Bootloader generates new HOB(Hand Off Block) which are serial
> > port info, memory map info, performance data info and so on, and
> > passes it to a Payload. U-boot as a payload will use these HOB
> 
> nits: U-Boot
Let me change it.
> 
> > information for basic initialization such as serial console.
> >
> > As an initial commit,
> > - Add CONFIG_SYS_SLIMBOOTLOADER to enable slimbootloader CPU type
> > - Add new arch/x86/cpu/slimbootloader directory with minimum codes
> > - Get hob_list pointer from Slim Bootloader
> >
> > Signed-off-by: Aiden Park 
> > ---
> >
> > Changes in v3:
> >   * Add a brief description about Slim Bootloader
> >   * Enable USB_KEYBOARD, E1000 and RTL8169 by default
> >   * Fix comment from code review
> >
> >  arch/x86/Kconfig  |  1 +
> >  arch/x86/cpu/Makefile |  1 +
> >  arch/x86/cpu/slimbootloader/Kconfig   | 26 +++
> >  arch/x86/cpu/slimbootloader/Makefile  |  5 +++
> >  arch/x86/cpu/slimbootloader/car.S | 43 +++
> >  arch/x86/cpu/slimbootloader/slimbootloader.c  | 21 +
> > .../asm/arch-slimbootloader/slimbootloader.h  | 11 +
> >  arch/x86/include/asm/global_data.h|  2 +-
> >  arch/x86/lib/asm-offsets.c|  2 +-
> >  9 files changed, 110 insertions(+), 2 deletions(-)  create mode
> > 100644 arch/x86/cpu/slimbootloader/Kconfig
> >  create mode 100644 arch/x86/cpu/slimbootloader/Makefile
> >  create mode 100644 arch/x86/cpu/slimbootloader/car.S  create mode
> > 100644 arch/x86/cpu/slimbootloader/slimbootloader.c
> >  create mode 100644
> > arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
> >
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index
> > 70f939869a..27b7b767b9 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -115,6 +115,7 @@ source "arch/x86/cpu/efi/Kconfig"
> >  source "arch/x86/cpu/qemu/Kconfig"
> >  source "arch/x86/cpu/quark/Kconfig"
> >  source "arch/x86/cpu/queensbay/Kconfig"
> > +source "arch/x86/cpu/slimbootloader/Kconfig"
> >  source "arch/x86/cpu/tangier/Kconfig"
> >
> >  # architecture-specific options below diff --git
> > a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile index
> > 85fd5e616e..3f1f62da2b 100644
> > --- a/arch/x86/cpu/Makefile
> > +++ b/arch/x86/cpu/Makefile
> > @@ -42,6 +42,7 @@ obj-$(CONFIG_INTEL_BAYTRAIL) += baytrail/
> >  obj-$(CONFIG_INTEL_BRASWELL) += braswell/
> >  obj-$(CONFIG_INTEL_BROADWELL) += broadwell/
> >  obj-$(CONFIG_SYS_COREBOOT) += coreboot/
> > +obj-$(CONFIG_SYS_SLIMBOOTLOADER) += slimbootloader/
> >  obj-$(CONFIG_EFI) += efi/
> >  obj-$(CONFIG_QEMU) += qemu/
> >  obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/ diff --git
> > a/arch/x86/cpu/slimbootloader/Kconfig
> > b/arch/x86/cpu/slimbootloader/Kconfig
> > new file mode 100644
> > index 00..439e4b1e2c
> > --- /dev/null
> > +++ b/arch/x86/cpu/slimbootloader/Kconfig
> > @@ -0,0 +1,26 @@
> > +# SPDX-License-Identifier: GPL-2.0+
> > +#
> > +# Copyright (C) 2019 Intel Corporation 
> > +
> > +if TARGET_SLIMBOOTLOADER
> > +
> > +config SYS_SLIMBOOTLOADER
> > +   bool
> > +   default y
> > +   imply SYS_NS16550
> > +   imply AHCI_PCI
> > +   imply SCSI
> > +   imply SCSI_AHCI
> > +   imply MMC
> > +   imply MMC_PCI
> > +   imply MMC_SDHCI
> > +   imply MMC_SDHCI_SDMA
> > +   imply USB
> > +   imply USB_EHCI_HCD
> > +   imply USB_XHCI_HCD
> > +   imply USB_STORAGE
> > +   imply USB_KEYBOARD
> > +   imply E1000
> > +   imply RTL8169
> > +
> > +endif
> > diff --git a/arch/x86/cpu/slimbootloader/Makefile
> > b/arch/x86/cpu/slimbootloader/Makefile
> > new file mode 100644
> > index 00..627a721e8c
> > --- /dev/null
> > +++ b/arch/x86/cpu/slimbootloader/Makefile
> > @@ -0,0 +1,5 @@
> > +# SPDX-License-Identifier: GPL-2.0+
> > +#
> > +# Copyright (C) 2019 Intel Corporation 
> > +
> > +obj-y += car.o slimbootloader.o
> > diff --git a/arch/x86/cpu/slimbootloader/car.S
> > b/arch/x86/cpu/slimbootloader/car.S
> > new file mode 100644
> > index 00..63c5c28b33
> > --- /dev/null
> > +++ b/arch/x86/cpu/slimbootloader/car.S
> > @@ -0,0 +1,43 @@
> > +/* S

Re: [U-Boot] [PATCH v3 4/8] x86: slimbootloader: Add serial driver

2019-07-14 Thread Park, Aiden
Hi Bin,

> -Original Message-
> From: Bin Meng [mailto:bmeng...@gmail.com]
> Sent: Sunday, July 14, 2019 1:49 AM
> To: Park, Aiden 
> Cc: U-Boot Mailing List ; Simon Glass
> 
> Subject: Re: [PATCH v3 4/8] x86: slimbootloader: Add serial driver
> 
> On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
> >
> > Slim Bootloader provides serial port info thru its HOB list pointer.
> > All these HOBs are eligible for Slim Bootloader based board only.
> > - Get serial port information from the serial port info hob
> > - Leverage ns16550 driver with slimbootloader specific platform data
> >
> > Signed-off-by: Aiden Park 
> > ---
> >
> > Changes in v3:
> >   * Use HOB function from the common HOB library
> >
> >  arch/x86/cpu/slimbootloader/Makefile  |  2 +-
> >  arch/x86/cpu/slimbootloader/serial.c  | 69 +++
> >  .../asm/arch-slimbootloader/slimbootloader.h  | 36 ++
> >  3 files changed, 106 insertions(+), 1 deletion(-)  create mode 100644
> > arch/x86/cpu/slimbootloader/serial.c
> >
> > diff --git a/arch/x86/cpu/slimbootloader/Makefile
> > b/arch/x86/cpu/slimbootloader/Makefile
> > index 05d0ca4a19..68c4a91955 100644
> > --- a/arch/x86/cpu/slimbootloader/Makefile
> > +++ b/arch/x86/cpu/slimbootloader/Makefile
> > @@ -2,4 +2,4 @@
> >  #
> >  # Copyright (C) 2019 Intel Corporation 
> >
> > -obj-y += car.o slimbootloader.o dram.o
> > +obj-y += car.o slimbootloader.o dram.o serial.o
> > diff --git a/arch/x86/cpu/slimbootloader/serial.c
> > b/arch/x86/cpu/slimbootloader/serial.c
> > new file mode 100644
> > index 00..84469a2ddf
> > --- /dev/null
> > +++ b/arch/x86/cpu/slimbootloader/serial.c
> > @@ -0,0 +1,69 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2019 Intel Corporation   */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/**
> > + * The serial port info hob is generated by Slim Bootloader, so
> > +eligible for
> > + * Slim Bootloader based boards only.
> > + */
> > +int slimbootloader_serial_ofdata_to_platdata(struct udevice *dev)
> 
> This should be static.
Thanks. Let me add 'static'.
> 
> > +{
> > +   const struct efi_guid guid = LOADER_SERIAL_PORT_INFO_GUID;
> > +   struct serial_port_info *serial_info = NULL;
> > +   struct ns16550_platdata *plat = dev->platdata;
> > +
> > +   if (!gd->arch.hob_list)
> > +   panic("hob list not found!");
> > +
> 
> [snip]
> 
> Other than that,
> Reviewed-by: Bin Meng 

Best Regards,
Aiden
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] lib: uuid: alignment error in gen_rand_uuid()

2019-07-14 Thread Heinrich Schuchardt
Packed structures like struct uuid are not aligned. GCC 9.1 therefore
throws an error when trying to compile gen_rand_uuid().

lib/uuid.c: In function ‘gen_rand_uuid’:
lib/uuid.c:244:2: error: converting a packed ‘struct uuid’ pointer
(alignment 1) to a ‘unsigned int’ pointer (alignment 4) may result in
an unaligned pointer value [-Werror=address-of-packed-member]
  244 |  unsigned int *ptr = (unsigned int *)&uuid;
  |  ^~~~

Generate the uuid in a properly aligned buffer.

The byte order of a random number should not matter. Do not call
cpu_to_be32() to change the byte order.

Reported-by: Ramon Fried 
Signed-off-by: Heinrich Schuchardt 
---
 lib/uuid.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/uuid.c b/lib/uuid.c
index 7d7a2749b6..c18014171c 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -240,25 +240,25 @@ void uuid_bin_to_str(unsigned char *uuid_bin, char 
*uuid_str, int str_format)
 #if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID)
 void gen_rand_uuid(unsigned char *uuid_bin)
 {
-   struct uuid uuid;
-   unsigned int *ptr = (unsigned int *)&uuid;
+   u32 ptr[4];
+   struct uuid *uuid = (struct uuid *)ptr;
int i;

srand(get_ticks() + rand());

/* Set all fields randomly */
-   for (i = 0; i < sizeof(struct uuid) / sizeof(*ptr); i++)
-   *(ptr + i) = cpu_to_be32(rand());
+   for (i = 0; i < 4; i++)
+   ptr[i] = rand();

-   clrsetbits_be16(&uuid.time_hi_and_version,
+   clrsetbits_be16(&uuid->time_hi_and_version,
UUID_VERSION_MASK,
UUID_VERSION << UUID_VERSION_SHIFT);

-   clrsetbits_8(&uuid.clock_seq_hi_and_reserved,
+   clrsetbits_8(&uuid->clock_seq_hi_and_reserved,
 UUID_VARIANT_MASK,
 UUID_VARIANT << UUID_VARIANT_SHIFT);

-   memcpy(uuid_bin, &uuid, sizeof(struct uuid));
+   memcpy(uuid_bin, uuid, 16);
 }

 /*
--
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v4 0/8] x86: Add basic Slim Bootloader payload support

2019-07-14 Thread Park, Aiden
This patch is to enable U-Boot as a payload which runs on top of Slim 
Bootloader(https://github.com/slimbootloader/slimbootloader) boot firmware for 
x86 platforms.

The Slim Bootloader is designed with multi-stage architecture for the execution 
from reset vector to OS hand-off, and supports qemu, Apollolake, Whiskeylake 
and Coffeelake platforms consuming Intel FSP(https://github.com/IntelFsp/FSP) 
for silicon initialization including CAR and memory initialization.
As multi-stage architecture, the Slim Bootloader adopts payload concept which 
is responsible for OS load from media devices and boot OS and it supports 
32-bit PE32, EFI FV, ELF and RAW format payloads.
The Slim Bootloader generate HOB(Hand Off Block) list pointer, which has debug 
serial port info, memory map info, performance data info and etc., and passes 
it to a payload. U-Boot configures serial port, dram, pci, tsc and others with 
the information from the HOB.

The compiled U-Boot supports usb, sata and sd/mmc boot which have been verified 
on qemu and other supported platforms.

Changes in v4:
  * Use arch/x86/cpu/start.S with CONFIG_SYS_SLIMBOOTLOADER condition
  * Update U-boot or u-boot to U-Boot in commit message
  * Add static keyword in static function

Changes in v3:
  * Add a brief description about Slim Bootloader in 1st patch
  * Add a common HOB library to be used by both FSP and Slim Bootloader
  * Move board/slimbootloader/slimbootloader to board/intel/slimbootloader
  * Add more description board/intel/slimbootloader/README
  * Fix comments from the code review

Changes in v2:
  * Split a single patch to 8 patches
  * Add more comment for each structure and functions

Aiden Park (8):
  x86: Add new slimbootloader CPU type
  x86: Add a common hob library
  x86: slimbootloader: Add memory configuration
  x86: slimbootloader: Add serial driver
  x86: slimbootloader: Set TSC information for timer driver
  x86: slimbootloader: Add a slimbootloader device tree
  board: intel: Add new slimbootloader board
  x86: Skip setting up MTRRs in slimbootloader

 arch/x86/Kconfig  |   1 +
 arch/x86/cpu/Makefile |   1 +
 arch/x86/cpu/slimbootloader/Kconfig   |  26 ++
 arch/x86/cpu/slimbootloader/Makefile  |   5 +
 arch/x86/cpu/slimbootloader/car.S |  14 +
 arch/x86/cpu/slimbootloader/dram.c| 151 +++
 arch/x86/cpu/slimbootloader/serial.c  |  69 +
 arch/x86/cpu/slimbootloader/slimbootloader.c  |  55 
 arch/x86/cpu/start.S  |   6 +-
 arch/x86/dts/Makefile |   1 +
 arch/x86/dts/slimbootloader.dts   |  27 ++
 .../asm/arch-slimbootloader/slimbootloader.h  | 121 +
 arch/x86/include/asm/fsp/fsp_hob.h| 183 +
 arch/x86/include/asm/fsp/fsp_support.h|  37 +--
 arch/x86/include/asm/fsp/fsp_types.h  |   8 -
 arch/x86/include/asm/global_data.h|   2 +-
 arch/x86/include/asm/hob.h| 250 ++
 arch/x86/lib/Makefile |   3 +-
 arch/x86/lib/asm-offsets.c|   2 +-
 arch/x86/lib/fsp/fsp_support.c|  78 +-
 arch/x86/lib/hob.c| 104 
 arch/x86/lib/init_helpers.c   |   3 +-
 board/intel/Kconfig   |  14 +
 board/intel/slimbootloader/Kconfig|  51 
 board/intel/slimbootloader/Makefile   |   5 +
 board/intel/slimbootloader/README | 133 ++
 board/intel/slimbootloader/slimbootloader.c   |  17 ++
 board/intel/slimbootloader/start.S|   9 +
 configs/slimbootloader_defconfig  |  22 ++
 include/configs/slimbootloader.h  |  59 +
 30 files changed, 1150 insertions(+), 307 deletions(-)
 create mode 100644 arch/x86/cpu/slimbootloader/Kconfig
 create mode 100644 arch/x86/cpu/slimbootloader/Makefile
 create mode 100644 arch/x86/cpu/slimbootloader/car.S
 create mode 100644 arch/x86/cpu/slimbootloader/dram.c
 create mode 100644 arch/x86/cpu/slimbootloader/serial.c
 create mode 100644 arch/x86/cpu/slimbootloader/slimbootloader.c
 create mode 100644 arch/x86/dts/slimbootloader.dts
 create mode 100644 arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
 create mode 100644 arch/x86/include/asm/hob.h
 create mode 100644 arch/x86/lib/hob.c
 create mode 100644 board/intel/slimbootloader/Kconfig
 create mode 100644 board/intel/slimbootloader/Makefile
 create mode 100644 board/intel/slimbootloader/README
 create mode 100644 board/intel/slimbootloader/slimbootloader.c
 create mode 100644 board/intel/slimbootloader/start.S
 create mode 100644 configs/slimbootloader_defconfig
 create mode 100644 include/configs/slimbootloader.h

--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v4 1/8] x86: Add new slimbootloader CPU type

2019-07-14 Thread Park, Aiden
This slimbootloader cpu type is to enable U-Boot as a payload which
runs on top of Slim Bootloader(https://github.com/slimbootloader).
The Slim Bootloader is designed with multi-stage architecture for
the execution from reset vector to OS booting, and supports qemu,
Apollolake, Whiskeylake and Coffeelake platforms consuming Intel FSP
(https://github.com/IntelFsp) for silicon initialization including
CAR and memory initialization.
The Slim Bootloader generates new HOB(Hand Off Block) which are
serial port info, memory map info, performance data info and so on,
and passes it to a Payload. U-Boot as a payload will use these HOB
information for basic initialization such as serial console.

As an initial commit,
- Add CONFIG_SYS_SLIMBOOTLOADER to enable slimbootloader CPU type
- Add new arch/x86/cpu/slimbootloader directory with minimum codes
- Get hob_list pointer from Slim Bootloader

Signed-off-by: Aiden Park 
---

Changes in v4:
  * Use common arch/x86/cpu/start.S
  * Update U-boot or u-boot to U-Boot in commit message

Changes in v3:
  * Add a brief description about Slim Bootloader
  * Enable USB_KEYBOARD, E1000 and RTL8169 by default
  * Fix comment from code review

 arch/x86/Kconfig  |  1 +
 arch/x86/cpu/Makefile |  1 +
 arch/x86/cpu/slimbootloader/Kconfig   | 26 +++
 arch/x86/cpu/slimbootloader/Makefile  |  5 
 arch/x86/cpu/slimbootloader/car.S | 14 ++
 arch/x86/cpu/slimbootloader/slimbootloader.c  | 21 +++
 arch/x86/cpu/start.S  |  6 +++--
 .../asm/arch-slimbootloader/slimbootloader.h  | 11 
 arch/x86/include/asm/global_data.h|  2 +-
 arch/x86/lib/asm-offsets.c|  2 +-
 10 files changed, 85 insertions(+), 4 deletions(-)
 create mode 100644 arch/x86/cpu/slimbootloader/Kconfig
 create mode 100644 arch/x86/cpu/slimbootloader/Makefile
 create mode 100644 arch/x86/cpu/slimbootloader/car.S
 create mode 100644 arch/x86/cpu/slimbootloader/slimbootloader.c
 create mode 100644 arch/x86/include/asm/arch-slimbootloader/slimbootloader.h

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 70f939869a..27b7b767b9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -115,6 +115,7 @@ source "arch/x86/cpu/efi/Kconfig"
 source "arch/x86/cpu/qemu/Kconfig"
 source "arch/x86/cpu/quark/Kconfig"
 source "arch/x86/cpu/queensbay/Kconfig"
+source "arch/x86/cpu/slimbootloader/Kconfig"
 source "arch/x86/cpu/tangier/Kconfig"

 # architecture-specific options below
diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
index 85fd5e616e..3f1f62da2b 100644
--- a/arch/x86/cpu/Makefile
+++ b/arch/x86/cpu/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_INTEL_BAYTRAIL) += baytrail/
 obj-$(CONFIG_INTEL_BRASWELL) += braswell/
 obj-$(CONFIG_INTEL_BROADWELL) += broadwell/
 obj-$(CONFIG_SYS_COREBOOT) += coreboot/
+obj-$(CONFIG_SYS_SLIMBOOTLOADER) += slimbootloader/
 obj-$(CONFIG_EFI) += efi/
 obj-$(CONFIG_QEMU) += qemu/
 obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/
diff --git a/arch/x86/cpu/slimbootloader/Kconfig 
b/arch/x86/cpu/slimbootloader/Kconfig
new file mode 100644
index 00..439e4b1e2c
--- /dev/null
+++ b/arch/x86/cpu/slimbootloader/Kconfig
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019 Intel Corporation 
+
+if TARGET_SLIMBOOTLOADER
+
+config SYS_SLIMBOOTLOADER
+   bool
+   default y
+   imply SYS_NS16550
+   imply AHCI_PCI
+   imply SCSI
+   imply SCSI_AHCI
+   imply MMC
+   imply MMC_PCI
+   imply MMC_SDHCI
+   imply MMC_SDHCI_SDMA
+   imply USB
+   imply USB_EHCI_HCD
+   imply USB_XHCI_HCD
+   imply USB_STORAGE
+   imply USB_KEYBOARD
+   imply E1000
+   imply RTL8169
+
+endif
diff --git a/arch/x86/cpu/slimbootloader/Makefile 
b/arch/x86/cpu/slimbootloader/Makefile
new file mode 100644
index 00..627a721e8c
--- /dev/null
+++ b/arch/x86/cpu/slimbootloader/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019 Intel Corporation 
+
+obj-y += car.o slimbootloader.o
diff --git a/arch/x86/cpu/slimbootloader/car.S 
b/arch/x86/cpu/slimbootloader/car.S
new file mode 100644
index 00..6e0304333c
--- /dev/null
+++ b/arch/x86/cpu/slimbootloader/car.S
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Intel Corporation 
+ */
+
+#include 
+
+.section .text
+
+.globl car_init
+car_init:
+   /* Get hob pointer parameter from previous stage's stack */
+   mov 0x4(%esp), %esi
+   jmp car_init_ret
diff --git a/arch/x86/cpu/slimbootloader/slimbootloader.c 
b/arch/x86/cpu/slimbootloader/slimbootloader.c
new file mode 100644
index 00..9f3a61ec61
--- /dev/null
+++ b/arch/x86/cpu/slimbootloader/slimbootloader.c
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Intel Corporation 
+ */
+
+#include 
+
+int arch_cpu_init(voi

[U-Boot] [PATCH v4 2/8] x86: Add a common hob library

2019-07-14 Thread Park, Aiden
FSP(CONFIG_HAVE_FSP) and Slim Bootloader(CONFIG_SYS_SLIMBOOTLOADER)
consume HOB data from the each HOB list pointer.
Add a common hob library/header in lib/hob.c and include/asm/hob.h.

Signed-off-by: Aiden Park 
Reviewed-by: Bin Meng 
---

Changes in v3:
  * Create a common HOB libary from fsp_hob and fsp_support

 arch/x86/include/asm/fsp/fsp_hob.h | 183 +-
 arch/x86/include/asm/fsp/fsp_support.h |  37 +---
 arch/x86/include/asm/fsp/fsp_types.h   |   8 -
 arch/x86/include/asm/hob.h | 250 +
 arch/x86/lib/Makefile  |   3 +-
 arch/x86/lib/fsp/fsp_support.c |  78 +---
 arch/x86/lib/hob.c | 104 ++
 7 files changed, 361 insertions(+), 302 deletions(-)
 create mode 100644 arch/x86/include/asm/hob.h
 create mode 100644 arch/x86/lib/hob.c

diff --git a/arch/x86/include/asm/fsp/fsp_hob.h 
b/arch/x86/include/asm/fsp/fsp_hob.h
index 00657b62c7..2e29de3af5 100644
--- a/arch/x86/include/asm/fsp/fsp_hob.h
+++ b/arch/x86/include/asm/fsp/fsp_hob.h
@@ -7,124 +7,7 @@
 #ifndef __FSP_HOB_H__
 #define __FSP_HOB_H__

-#include 
-
-/* Type of HOB Header */
-#define HOB_TYPE_MEM_ALLOC 0x0002
-#define HOB_TYPE_RES_DESC  0x0003
-#define HOB_TYPE_GUID_EXT  0x0004
-#define HOB_TYPE_UNUSED0xFFFE
-#define HOB_TYPE_EOH   0x
-
-/*
- * Describes the format and size of the data inside the HOB.
- * All HOBs must contain this generic HOB header.
- */
-struct hob_header {
-   u16 type;   /* HOB type */
-   u16 len;/* HOB length */
-   u32 reserved;   /* always zero */
-};
-
-/*
- * Describes all memory ranges used during the HOB producer phase that
- * exist outside the HOB list. This HOB type describes how memory is used,
- * not the physical attributes of memory.
- */
-struct hob_mem_alloc {
-   struct hob_header   hdr;
-   /*
-* A GUID that defines the memory allocation region's type and purpose,
-* as well as other fields within the memory allocation HOB. This GUID
-* is used to define the additional data within the HOB that may be
-* present for the memory allocation HOB. Type efi_guid is defined in
-* InstallProtocolInterface() in the UEFI 2.0 specification.
-*/
-   struct efi_guid name;
-   /*
-* The base address of memory allocated by this HOB.
-* Type phys_addr_t is defined in AllocatePages() in the UEFI 2.0
-* specification.
-*/
-   phys_addr_t mem_base;
-   /* The length in bytes of memory allocated by this HOB */
-   phys_size_t mem_len;
-   /*
-* Defines the type of memory allocated by this HOB.
-* The memory type definition follows the EFI_MEMORY_TYPE definition.
-* Type EFI_MEMORY_TYPE is defined in AllocatePages() in the UEFI 2.0
-* specification.
-*/
-   enum efi_mem_type   mem_type;
-   /* padding */
-   u8  reserved[4];
-};
-
-/* Value of ResourceType in HOB_RES_DESC */
-#define RES_SYS_MEM0x
-#define RES_MMAP_IO0x0001
-#define RES_IO 0x0002
-#define RES_FW_DEVICE  0x0003
-#define RES_MMAP_IO_PORT   0x0004
-#define RES_MEM_RESERVED   0x0005
-#define RES_IO_RESERVED0x0006
-#define RES_MAX_MEM_TYPE   0x0007
-
-/*
- * These types can be ORed together as needed.
- *
- * The first three enumerations describe settings
- * The rest of the settings describe capabilities
- */
-#define RES_ATTR_PRESENT   0x0001
-#define RES_ATTR_INITIALIZED   0x0002
-#define RES_ATTR_TESTED0x0004
-#define RES_ATTR_SINGLE_BIT_ECC0x0008
-#define RES_ATTR_MULTIPLE_BIT_ECC  0x0010
-#define RES_ATTR_ECC_RESERVED_10x0020
-#define RES_ATTR_ECC_RESERVED_20x0040
-#define RES_ATTR_READ_PROTECTED0x0080
-#define RES_ATTR_WRITE_PROTECTED   0x0100
-#define RES_ATTR_EXECUTION_PROTECTED   0x0200
-#define RES_ATTR_UNCACHEABLE   0x0400
-#define RES_ATTR_WRITE_COMBINEABLE 0x0800
-#define RES_ATTR_WRITE_THROUGH_CACHEABLE   0x1000
-#define RES_ATTR_WRITE_BACK_CACHEABLE  0x2000
-#define RES_ATTR_16_BIT_IO 0x4000
-#define RES_ATTR_32_BIT_IO 0x8000
-#define RES_ATTR_64_BIT_IO 0x0001
-#define RES_ATTR_UNCACHED_EXPORTED 0x0002
-
-/*
- * Describes the resource properties of all fixed, nonrelocatable resource
- * ranges found on the processor host bus during the HOB producer phase.
- */
-struct hob_res_desc {
-   struct hob_header   hdr;
-   /*
-* A GUID repr

[U-Boot] [PATCH v4 3/8] x86: slimbootloader: Add memory configuration

2019-07-14 Thread Park, Aiden
Slim Bootloader provides memory map info thru its HOB list pointer.
Configure memory size and relocation memory from the HOB data, and
provide e820 entries as well.
- Get memory size from the memory map info hob
- Set ram top for U-Boot relocation lower than 4GB
- Provide e820 entries from the memory map info hob

Signed-off-by: Aiden Park 
Reviewed-by: Bin Meng 
---

Changes in v3:
  * Use HOB function from the common HOB library
  * Add more description

 arch/x86/cpu/slimbootloader/Makefile  |   2 +-
 arch/x86/cpu/slimbootloader/dram.c| 146 ++
 .../asm/arch-slimbootloader/slimbootloader.h  |  44 ++
 3 files changed, 191 insertions(+), 1 deletion(-)
 create mode 100644 arch/x86/cpu/slimbootloader/dram.c

diff --git a/arch/x86/cpu/slimbootloader/Makefile 
b/arch/x86/cpu/slimbootloader/Makefile
index 627a721e8c..05d0ca4a19 100644
--- a/arch/x86/cpu/slimbootloader/Makefile
+++ b/arch/x86/cpu/slimbootloader/Makefile
@@ -2,4 +2,4 @@
 #
 # Copyright (C) 2019 Intel Corporation 

-obj-y += car.o slimbootloader.o
+obj-y += car.o slimbootloader.o dram.o
diff --git a/arch/x86/cpu/slimbootloader/dram.c 
b/arch/x86/cpu/slimbootloader/dram.c
new file mode 100644
index 00..48740c301f
--- /dev/null
+++ b/arch/x86/cpu/slimbootloader/dram.c
@@ -0,0 +1,151 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Intel Corporation 
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/**
+ * This returns a data pointer of memory map info from the guid hob.
+ *
+ * @return: A data pointer of memory map info hob
+ */
+static void *get_memory_map_info(void)
+{
+   const struct efi_guid guid = LOADER_MEMORY_MAP_INFO_GUID;
+
+   if (!gd->arch.hob_list)
+   return NULL;
+
+   return hob_get_guid_hob_data(gd->arch.hob_list, NULL, &guid);
+}
+
+/**
+ * This is to give usable memory region information for u-boot relocation.
+ * so search usable memory region lower than 4GB.
+ * The memory map entries from Slim Bootloader hob are already sorted.
+ *
+ * @total_size: The memory size that u-boot occupies
+ * @return: The top available memory address lower than 4GB
+ */
+ulong board_get_usable_ram_top(ulong total_size)
+{
+   struct memory_map_info *data = NULL;
+   int i = 0;
+   phys_addr_t addr_start = 0;
+   phys_addr_t addr_end = 0;
+   ulong ram_top = 0;
+
+   data = (struct memory_map_info *)get_memory_map_info();
+   if (!data)
+   panic("memory map info hob not found\n");
+
+   /**
+* sorted memory map entries from Slim Bootloader based on physical
+* start memory address, from low to high. So do reversed search to
+* get highest usable, suitable size, 4KB aligned available memory
+* under 4GB.
+*/
+   for (i = data->count - 1; i >= 0; i--) {
+   if (data->entry[i].type != E820_RAM)
+   continue;
+
+   addr_start = data->entry[i].addr;
+   addr_end = addr_start + data->entry[i].size;
+
+   if (addr_start > SZ_4G)
+   continue;
+
+   if (addr_end > SZ_4G)
+   addr_end = SZ_4G;
+
+   if (addr_end < total_size)
+   continue;
+
+   /* to relocate u-boot at 4K aligned memory */
+   addr_end = rounddown(addr_end - total_size, SZ_4K);
+   if (addr_end >= addr_start) {
+   ram_top = (ulong)addr_end + total_size;
+   break;
+   }
+   }
+
+   if (!ram_top)
+   panic("failed to find available memory for relocation!");
+
+   return ram_top;
+}
+
+/**
+ * The memory initialization has already been done in previous Slim Bootloader
+ * stage thru FSP-M. Instead, this sets the ram_size from the memory map info
+ * hob.
+ */
+int dram_init(void)
+{
+   struct memory_map_info *data = NULL;
+   int i = 0;
+   phys_size_t ram_size = 0;
+
+   data = (struct memory_map_info *)get_memory_map_info();
+   if (!data)
+   panic("memory map info hob not found\n");
+
+   /**
+* sorted memory map entries from Slim Bootloader based on physical
+* start memory address, from low to high. So do reversed search to
+* simply get highest usable memory address as ram size
+*/
+   for (i = data->count - 1; i >= 0; i--) {
+   if (data->entry[i].type != E820_RAM)
+   continue;
+
+   /* simply use the highest usable memory address as ram size */
+   ram_size = data->entry[i].addr + data->entry[i].size;
+   break;
+   }
+
+   if (!ram_size)
+   panic("failed to detect memory size");
+
+   gd->ram_size = ram_size;
+   return 0;
+}
+
+int dram_init_banksize(void)
+{
+   /* simply use a single bank to have whole size for now */
+   if (CONFI

[U-Boot] [PATCH v4 5/8] x86: slimbootloader: Set TSC information for timer driver

2019-07-14 Thread Park, Aiden
Slim Bootloader provides TSC clock information in its performance
info hob. For now, TSC clock information is only used for timer driver
from the performance info hob.
- Get TSC frequency from performance info hob
- Set tsc_base and clock_rate for timer driver

Signed-off-by: Aiden Park 
Reviewed-by: Bin Meng 
---

Changes in v3:
  * Use HOB function from the common HOB library

 arch/x86/cpu/slimbootloader/slimbootloader.c  | 34 +++
 .../asm/arch-slimbootloader/slimbootloader.h  | 30 
 2 files changed, 64 insertions(+)

diff --git a/arch/x86/cpu/slimbootloader/slimbootloader.c 
b/arch/x86/cpu/slimbootloader/slimbootloader.c
index 9f3a61ec61..2153d2ac66 100644
--- a/arch/x86/cpu/slimbootloader/slimbootloader.c
+++ b/arch/x86/cpu/slimbootloader/slimbootloader.c
@@ -4,9 +4,43 @@
  */

 #include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/**
+ * This sets tsc_base and clock_rate for early_timer and tsc_timer.
+ * The performance info guid hob has all performance timestamp data, but
+ * the only tsc frequency info is used for the timer driver for now.
+ */
+static void tsc_init(void)
+{
+   struct performance_info *data = NULL;
+   const struct efi_guid guid = LOADER_PERFORMANCE_INFO_GUID;
+
+   if (!gd->arch.hob_list)
+   panic("hob list not found!");
+
+   gd->arch.tsc_base = rdtsc();
+   debug("tsc_base=0x%llx\n", gd->arch.tsc_base);
+
+   data = (struct performance_info *)
+   hob_get_guid_hob_data(gd->arch.hob_list, NULL, &guid);
+
+   if (!data) {
+   debug("performance info hob not found\n");
+   return;
+   }
+
+   /* frequency is in KHz, so to Hz */
+   gd->arch.clock_rate = data->frequency * 1000;
+   debug("freq=0x%lx\n", gd->arch.clock_rate);
+}

 int arch_cpu_init(void)
 {
+   tsc_init();
+
return x86_cpu_init_f();
 }

diff --git a/arch/x86/include/asm/arch-slimbootloader/slimbootloader.h 
b/arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
index 5a0994544a..e0edbdddf5 100644
--- a/arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
+++ b/arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
@@ -27,6 +27,15 @@
{ 0xbb, 0x98, 0x95, 0x8d, 0x62, 0xde, 0x87, 0xf1 } \
}

+/**
+ * A GUID to get boot performance info hob which is provided by Slim Bootloader
+ */
+#define LOADER_PERFORMANCE_INFO_GUID \
+   { \
+   0x868204be, 0x23d0, 0x4ff9, \
+   { 0xac, 0x34, 0xb9, 0x95, 0xac, 0x04, 0xb1, 0xb9 } \
+   }
+
 /**
  * A single entry of memory map information
  *
@@ -71,6 +80,27 @@ struct serial_port_info {
u32 rsvd1;
 } __packed;

+/**
+ * This includes timestamp data which has been collected in Slim Bootloader
+ * stages from the reset vector. In addition, this has TSC frequency in KHz to
+ * calculate each timestamp.
+ *
+ * @rev   : revision of performance_info structure. currently 1.
+ * @rsvd  : padding for alignment
+ * @count : the number of collected timestamp data
+ * @flags : only used in Slim Bootloader
+ * @frequency: tsc frequency in KHz
+ * @timestamp: the array of timestamp data which has 64-bit tsc value
+ */
+struct performance_info {
+   u8  rev;
+   u8  rsvd[3];
+   u16 count;
+   u16 flags;
+   u32 frequency;
+   u64 timestamp[0];
+} __packed;
+
 /**
  * This includes all memory map entries which is sorted based on physical start
  * address, from low to high, and carved out reserved, acpi nvs, acpi reclaim
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v4 6/8] x86: slimbootloader: Add a slimbootloader device tree

2019-07-14 Thread Park, Aiden
Add a new device tree which has very minimum nodes
- x86 reset
- x86 tsc_timer
- x86 pci
- Slim Bootloader serial

Signed-off-by: Aiden Park 
Reviewed-by: Bin Meng 
---

Changes in v3:
  * Move slimbootloader.dtb before baytrail_som-db5800-som-6867.dtb

 arch/x86/dts/Makefile   |  1 +
 arch/x86/dts/slimbootloader.dts | 27 +++
 2 files changed, 28 insertions(+)
 create mode 100644 arch/x86/dts/slimbootloader.dts

diff --git a/arch/x86/dts/Makefile b/arch/x86/dts/Makefile
index fa717bc096..d4bdf62be6 100644
--- a/arch/x86/dts/Makefile
+++ b/arch/x86/dts/Makefile
@@ -18,6 +18,7 @@ dtb-y += bayleybay.dtb \
qemu-x86_i440fx.dtb \
qemu-x86_q35.dtb \
theadorable-x86-dfi-bt700.dtb \
+   slimbootloader.dtb \
baytrail_som-db5800-som-6867.dtb

 targets += $(dtb-y)
diff --git a/arch/x86/dts/slimbootloader.dts b/arch/x86/dts/slimbootloader.dts
new file mode 100644
index 00..d04095c4f8
--- /dev/null
+++ b/arch/x86/dts/slimbootloader.dts
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Intel Corporation 
+ */
+
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+/include/ "reset.dtsi"
+/include/ "tsc_timer.dtsi"
+
+/ {
+   model = "slimbootloader x86 payload";
+   compatible = "slimbootloader,x86-payload";
+
+   chosen {
+   stdout-path = &serial;
+   };
+
+   serial: serial {
+   compatible = "intel,slimbootloader-uart";
+   };
+
+   pci {
+   compatible = "pci-x86";
+   };
+};
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v4 8/8] x86: Skip setting up MTRRs in slimbootloader

2019-07-14 Thread Park, Aiden
The setting up MTRRs have already been done in previous
Slim Bootloader stages.

Signed-off-by: Aiden Park 
Reviewed-by: Bin Meng 
---
 arch/x86/lib/init_helpers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 0481f453ca..5e19f13720 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -18,7 +18,8 @@ __weak ulong board_get_usable_ram_top(ulong total_size)

 int init_cache_f_r(void)
 {
-#if CONFIG_IS_ENABLED(X86_32BIT_INIT) && !defined(CONFIG_HAVE_FSP)
+#if CONFIG_IS_ENABLED(X86_32BIT_INIT) && !defined(CONFIG_HAVE_FSP) && \
+   !defined(CONFIG_SYS_SLIMBOOTLOADER)
int ret;

ret = mtrr_commit(false);
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v4 4/8] x86: slimbootloader: Add serial driver

2019-07-14 Thread Park, Aiden
Slim Bootloader provides serial port info thru its HOB list pointer.
All these HOBs are eligible for Slim Bootloader based board only.
- Get serial port information from the serial port info hob
- Leverage ns16550 driver with slimbootloader specific platform data

Signed-off-by: Aiden Park 
Reviewed-by: Bin Meng 
---

Changes in v4:
  * Add static keyword in static function

Changes in v3:
  * Use HOB function from the common HOB library

 arch/x86/cpu/slimbootloader/Makefile  |  2 +-
 arch/x86/cpu/slimbootloader/serial.c  | 69 +++
 .../asm/arch-slimbootloader/slimbootloader.h  | 36 ++
 3 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 arch/x86/cpu/slimbootloader/serial.c

diff --git a/arch/x86/cpu/slimbootloader/Makefile 
b/arch/x86/cpu/slimbootloader/Makefile
index 05d0ca4a19..68c4a91955 100644
--- a/arch/x86/cpu/slimbootloader/Makefile
+++ b/arch/x86/cpu/slimbootloader/Makefile
@@ -2,4 +2,4 @@
 #
 # Copyright (C) 2019 Intel Corporation 

-obj-y += car.o slimbootloader.o dram.o
+obj-y += car.o slimbootloader.o dram.o serial.o
diff --git a/arch/x86/cpu/slimbootloader/serial.c 
b/arch/x86/cpu/slimbootloader/serial.c
new file mode 100644
index 00..5a8591889f
--- /dev/null
+++ b/arch/x86/cpu/slimbootloader/serial.c
@@ -0,0 +1,69 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Intel Corporation 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * The serial port info hob is generated by Slim Bootloader, so eligible for
+ * Slim Bootloader based boards only.
+ */
+static int slimbootloader_serial_ofdata_to_platdata(struct udevice *dev)
+{
+   const struct efi_guid guid = LOADER_SERIAL_PORT_INFO_GUID;
+   struct serial_port_info *serial_info = NULL;
+   struct ns16550_platdata *plat = dev->platdata;
+
+   if (!gd->arch.hob_list)
+   panic("hob list not found!");
+
+   serial_info = (struct serial_port_info *)
+   hob_get_guid_hob_data(gd->arch.hob_list, NULL, &guid);
+
+   if (!serial_info) {
+   debug("failed to get serial port information\n");
+   return -ENOENT;
+   }
+   debug("type:%d base=0x%08x baudrate=%d stride=%d clk=%d\n",
+ serial_info->type,
+ serial_info->base,
+ serial_info->baud,
+ serial_info->stride,
+ serial_info->clk);
+
+   /*
+* The serial_info->type provides port io or mmio access type info,
+* but the access type will be controlled by
+* CONFIG_SYS_NS16550_PORT_MAPPED or CONFIG_SYS_NS16550_MEM32.
+*
+* TBD: ns16550 access type configuration in runtime.
+*  ex) plat->access_type = serial_info->type
+*/
+   plat->base = serial_info->base;
+   /* ns16550 uses reg_shift, then covert stride to shift */
+   plat->reg_shift = (serial_info->stride >> 1);
+   plat->clock = serial_info->clk;
+
+   return 0;
+}
+
+static const struct udevice_id slimbootloader_serial_ids[] = {
+   { .compatible = "intel,slimbootloader-uart" },
+   {}
+};
+
+U_BOOT_DRIVER(serial_slimbootloader) = {
+   .name   = "serial_slimbootloader",
+   .id = UCLASS_SERIAL,
+   .of_match = slimbootloader_serial_ids,
+   .ofdata_to_platdata = slimbootloader_serial_ofdata_to_platdata,
+   .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
+   .priv_auto_alloc_size = sizeof(struct NS16550),
+   .probe  = ns16550_serial_probe,
+   .ops= &ns16550_serial_ops,
+};
diff --git a/arch/x86/include/asm/arch-slimbootloader/slimbootloader.h 
b/arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
index d9265ac534..5a0994544a 100644
--- a/arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
+++ b/arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
@@ -18,6 +18,15 @@
{ 0xa9, 0xe4, 0x92, 0xf3, 0x57, 0xd1, 0x28, 0x32 } \
}

+/**
+ * A GUID to get SerialPort info hob which is provided by Slim Bootloader
+ */
+#define LOADER_SERIAL_PORT_INFO_GUID \
+   { \
+   0x6c6872fe, 0x56a9, 0x4403, \
+   { 0xbb, 0x98, 0x95, 0x8d, 0x62, 0xde, 0x87, 0xf1 } \
+   }
+
 /**
  * A single entry of memory map information
  *
@@ -35,6 +44,33 @@ struct memory_map_entry {
u8  rsvd[6];
 } __packed;

+/**
+ * This includes serial port info which has already been initialized in 
previous
+ * Slim Bootloader stage.
+ * The Slim Bootloader initializes serial port regardless of debug/release 
build
+ * modes, and it passes the information to a payload thru hob. So, a payload 
can
+ * re-use the serial information without re-initializing serial port.
+ *
+ * @rev   : revision of serial_port_info structure. currently 1.
+ * @rsvd  : padding for alignment
+ * @type  : port io: 1, mmio: 2
+ * @base  : io base address. ex) 0x3f8, 0x80001000
+ * @baud  : uart baud rate
+ * @stride: register stride in Bytes
+ * @clk   : uart frequency in Hz
+ * @

[U-Boot] [PATCH v4 7/8] board: intel: Add new slimbootloader board

2019-07-14 Thread Park, Aiden





















Add slimbootloader board to run U-boot as a Slim Bootloader payload
- Add new board/intel/slimbootloader directory with minimum codes
- Add slimbootloader configuration files
- Add README in board/intel/slimbootloader

Signed-off-by: Aiden Park 
Reviewed-by: Bin Meng 
---

Changes in v3:
  * Remove VENDOR_SLIMBOOTLOADER
  * Use VENDOR_INTEL
  * Move slimbootloader under board/intel/
  * Enable generic CONFIGs in slimbootloader_defconfig
  * Add more description in board/intel/slimbootloader/README

 board/intel/Kconfig |  14 +++
 board/intel/slimbootloader/Kconfig  |  51 
 board/intel/slimbootloader/Makefile |   5 +
 board/intel/slimbootloader/README   | 133 
 board/intel/slimbootloader/slimbootloader.c |  17 +++
 board/intel/slimbootloader/start.S  |   9 ++
 configs/slimbootloader_defconfig|  22 
 include/configs/slimbootloader.h|  59 +
 8 files changed, 310 insertions(+)
 create mode 100644 board/intel/slimbootloader/Kconfig
 create mode 100644 board/intel/slimbootloader/Makefile
 create mode 100644 board/intel/slimbootloader/README
 create mode 100644 board/intel/slimbootloader/slimbootloader.c
 create mode 100644 board/intel/slimbootloader/start.S
 create mode 100644 configs/slimbootloader_defconfig
 create mode 100644 include/configs/slimbootloader.h

diff --git a/board/intel/Kconfig b/board/intel/Kconfig
index 5131836cb0..01702ae502 100644
--- a/board/intel/Kconfig
+++ b/board/intel/Kconfig
@@ -73,6 +73,19 @@ config TARGET_MINNOWMAX
  Note that PCIE_ECAM_BASE is set up by the FSP so the value used
  by U-Boot matches that value.

+config TARGET_SLIMBOOTLOADER
+   bool "slimbootloader"
+   help
+ This target is used for running U-Boot on top of Slim Bootloader
+ boot firmware as a payload. Slim Bootloader does memory initialization
+ and silicon initialization, and it passes necessary information in
+ HOB(Hand Off Block) to a payload. The payload consumes HOB data
+ which is generated by Slim Bootloader for its driver initialization.
+ Slim Bootloader consumes FSP and its HOB, but FSP HOB is cleared
+ Before launching a payload. Instead, Slim Bootloader generates its
+ HOB data such as memory info, serial port info and so on.
+ Refer to board/intel/slimbootloader/README for the details.
+
 endchoice

 source "board/intel/bayleybay/Kconfig"
@@ -82,5 +95,6 @@ source "board/intel/crownbay/Kconfig"
 source "board/intel/edison/Kconfig"
 source "board/intel/galileo/Kconfig"
 source "board/intel/minnowmax/Kconfig"
+source "board/intel/slimbootloader/Kconfig"

 endif
diff --git a/board/intel/slimbootloader/Kconfig 
b/board/intel/slimbootloader/Kconfig
new file mode 100644
index 00..b0c15f4ba2
--- /dev/null
+++ b/board/intel/slimbootloader/Kconfig
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019 Intel Corporation 
+
+if TARGET_SLIMBOOTLOADER
+
+config SYS_BOARD
+   default "slimbootloader"
+
+config SYS_VENDOR
+   default "intel"
+
+config SYS_SOC
+   default "slimbootloader"
+
+config SYS_TEXT_BASE
+   default 0x0010
+
+comment "slimbootloader-specific options"
+
+config SYS_CONFIG_NAME
+   string "Board configuration file"
+   default "slimbootloader"
+   help
+ This option selects the board configuration file in include/configs/
+ directory to be used to build U-Boot for Slim Bootloader.
+
+config DEFAULT_DEVICE_TREE
+   string "Board Device Tree Source (dts) file"
+   default "slimbootloader"
+   help
+ This option selects the board Device Tree Source (dts) file in
+ arch/x86/dts/ directory to be used to build U-Boot for Slim 
Bootloader.
+
+config SYS_CAR_ADDR
+   hex "Board specific Cache-As-RAM (CAR) address"
+   default 0x
+   help
+ This option specifies the board specific Cache-As-RAM (CAR) address.
+ But, CAR is not required for Slim Bootloader environment since it
+ has already initialized memory and launched u-boot as a payload.
+
+config SYS_CAR_SIZE
+   hex "Board specific Cache-As-RAM (CAR) size"
+   default 0x
+   help
+ This option specifies the board specific Cache-As-RAM (CAR) size.
+ But, CAR is not required for Slim Bootloader environment since it
+ has already initialized memory and launched u-boot as a payload.
+
+endif
diff --git a/board/intel/slimbootloader/Makefile 
b/board/intel/slimbootloader/Makefile
new file mode 100644
index 00..fd8fa98a8d
--- /dev/null
+++ b/board/intel/slimbootloader/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019 Intel Corporation 
+
+obj-y  += start.o slimbootloader.o
diff --git a/board/intel/slimbootloader/README 
b/board/intel/slimbootloader/README
new file mode 100644
index 

Re: [U-Boot] [PATCH v3 1/8] x86: Add new slimbootloader CPU type

2019-07-14 Thread Park, Aiden
Hi Bin,

> -Original Message-
> From: Park, Aiden
> Sent: Sunday, July 14, 2019 2:16 PM
> To: Bin Meng 
> Cc: U-Boot Mailing List ; Simon Glass
> 
> Subject: RE: [PATCH v3 1/8] x86: Add new slimbootloader CPU type
> 
> Hi Bin,
> 
> > -Original Message-
> > From: Bin Meng [mailto:bmeng...@gmail.com]
> > Sent: Sunday, July 14, 2019 1:49 AM
> > To: Park, Aiden 
> > Cc: U-Boot Mailing List ; Simon Glass
> > 
> > Subject: Re: [PATCH v3 1/8] x86: Add new slimbootloader CPU type
> >
> > On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden  wrote:
> > >
> > > This slimbootloader cpu type is to enable u-boot as a payload which
> > > runs on top of Slim Bootloader(https://github.com/slimbootloader).
> > > The Slim Bootloader is designed with multi-stage architecture for
> > > the execution from reset vector to OS booting, and supports qemu,
> > > Apollolake, Whiskeylake and Coffeelake platforms consuming Intel FSP
> > > (https://github.com/IntelFsp) for silicon initialization including
> > > CAR and memory initialization.
> > > The Slim Bootloader generates new HOB(Hand Off Block) which are
> > > serial port info, memory map info, performance data info and so on,
> > > and passes it to a Payload. U-boot as a payload will use these HOB
> >
> > nits: U-Boot
> Let me change it.
> >
> > > information for basic initialization such as serial console.
> > >
> > > As an initial commit,
> > > - Add CONFIG_SYS_SLIMBOOTLOADER to enable slimbootloader CPU type
> > > - Add new arch/x86/cpu/slimbootloader directory with minimum codes
> > > - Get hob_list pointer from Slim Bootloader
> > >
> > > Signed-off-by: Aiden Park 
> > > ---
> > >
> > > Changes in v3:
> > >   * Add a brief description about Slim Bootloader
> > >   * Enable USB_KEYBOARD, E1000 and RTL8169 by default
> > >   * Fix comment from code review
> > >
> > >  arch/x86/Kconfig  |  1 +
> > >  arch/x86/cpu/Makefile |  1 +
> > >  arch/x86/cpu/slimbootloader/Kconfig   | 26 +++
> > >  arch/x86/cpu/slimbootloader/Makefile  |  5 +++
> > >  arch/x86/cpu/slimbootloader/car.S | 43 +++
> > >  arch/x86/cpu/slimbootloader/slimbootloader.c  | 21 +
> > > .../asm/arch-slimbootloader/slimbootloader.h  | 11 +
> > >  arch/x86/include/asm/global_data.h|  2 +-
> > >  arch/x86/lib/asm-offsets.c|  2 +-
> > >  9 files changed, 110 insertions(+), 2 deletions(-)  create mode
> > > 100644 arch/x86/cpu/slimbootloader/Kconfig
> > >  create mode 100644 arch/x86/cpu/slimbootloader/Makefile
> > >  create mode 100644 arch/x86/cpu/slimbootloader/car.S  create mode
> > > 100644 arch/x86/cpu/slimbootloader/slimbootloader.c
> > >  create mode 100644
> > > arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
> > >
> > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index
> > > 70f939869a..27b7b767b9 100644
> > > --- a/arch/x86/Kconfig
> > > +++ b/arch/x86/Kconfig
> > > @@ -115,6 +115,7 @@ source "arch/x86/cpu/efi/Kconfig"
> > >  source "arch/x86/cpu/qemu/Kconfig"
> > >  source "arch/x86/cpu/quark/Kconfig"
> > >  source "arch/x86/cpu/queensbay/Kconfig"
> > > +source "arch/x86/cpu/slimbootloader/Kconfig"
> > >  source "arch/x86/cpu/tangier/Kconfig"
> > >
> > >  # architecture-specific options below diff --git
> > > a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile index
> > > 85fd5e616e..3f1f62da2b 100644
> > > --- a/arch/x86/cpu/Makefile
> > > +++ b/arch/x86/cpu/Makefile
> > > @@ -42,6 +42,7 @@ obj-$(CONFIG_INTEL_BAYTRAIL) += baytrail/
> > >  obj-$(CONFIG_INTEL_BRASWELL) += braswell/
> > >  obj-$(CONFIG_INTEL_BROADWELL) += broadwell/
> > >  obj-$(CONFIG_SYS_COREBOOT) += coreboot/
> > > +obj-$(CONFIG_SYS_SLIMBOOTLOADER) += slimbootloader/
> > >  obj-$(CONFIG_EFI) += efi/
> > >  obj-$(CONFIG_QEMU) += qemu/
> > >  obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/ diff --git
> > > a/arch/x86/cpu/slimbootloader/Kconfig
> > > b/arch/x86/cpu/slimbootloader/Kconfig
> > > new file mode 100644
> > > index 00..439e4b1e2c
> > > --- /dev/null
> > > +++ b/arch/x86/cpu/slimbootloader/Kconfig
> > > @@ -0,0 +1,26 @@
> > > +# SPDX-License-Identifier: GPL-2.0+ # # Copyright (C) 2019 Intel
> > > +Corporation 
> > > +
> > > +if TARGET_SLIMBOOTLOADER
> > > +
> > > +config SYS_SLIMBOOTLOADER
> > > +   bool
> > > +   default y
> > > +   imply SYS_NS16550
> > > +   imply AHCI_PCI
> > > +   imply SCSI
> > > +   imply SCSI_AHCI
> > > +   imply MMC
> > > +   imply MMC_PCI
> > > +   imply MMC_SDHCI
> > > +   imply MMC_SDHCI_SDMA
> > > +   imply USB
> > > +   imply USB_EHCI_HCD
> > > +   imply USB_XHCI_HCD
> > > +   imply USB_STORAGE
> > > +   imply USB_KEYBOARD
> > > +   imply E1000
> > > +   imply RTL8169
> > > +
> > > +endif
> > > diff --git a/arch/x86/cpu/slimbootloader/Makefile
> > > b/arch/x86/cpu/slimbootloader/Makefile
> > > new file mode 100644
> > > index 00..627a721e8c
> > > ---

[U-Boot] [PATCH v2 0/7] efi_loader: Fix inconsistencies in efi_add_memory_map usage

2019-07-14 Thread Bryan O'Donoghue
V2:

Following on from a discussion with Heinrich Schuchardt, please find a
reworked set of patches updating efi_add_memory_map() to

- Return efi_status_t
- Return EFI_SUCCESS where appropriate
- Return EFI_NO_MAPPING in two cases where zero was returned to indicate an
  error
- Updating of users of efi_add_memory_map() to parse for
  EFI_SUCCESS/efi_status_t

I've opted to maintain other returned status codes propogated by functions
that call efi_add_memory_map(). For example efi_add_runtime_mmio()
continues return EFI_OUT_OF_RESOURCES instead of directly returning the
result code of efi_add_memory_map(). The idea being that other users of the
EFI layer such as Linux or grub would not be affected by this internal
u-boot change.

V1:

https://patchwork.ozlabs.org/patch/1129402/
https://patchwork.ozlabs.org/patch/1129403/

These two patches fix some inconsistent usage around efi_add_memory_map().

The first patch fixes the case where there is a mapping for an address
starting at 0 as is the case on RPI3. We should not print an error for
this. efi_add_memory_map(start = 0, ...) succeeds but
efi_carve_out_dt_rsv() does not properly parse the result code.

The second patch fixes the result code returned by efi_add_memory_map() in
two instances. Returing zero is the same as returning EFI_SUCCESS, we
should return one of the error codes from include/efi.h only, not zero to
indicate failure.

Bryan O'Donoghue (7):
  efi_loader: Change return type of efi_add_memory_map()
  efi_loader: Change efi_add_memory_map() to return EFI_SUCCESS
  efi_loader: Return non-zero for error in efi_add_memory_map()
  efi_loader: Update efi_allocate_pages() to new efi_add_memory_map()
  efi_loader: Update efi_free_pages() to new efi_add_memory_map()
  efi_loader: Treat the result of efi_add_memory_map as efi_status_t
  efi_loader: Capture efi_add_memory_map() result efi_add_runtime_mmio()

 cmd/bootefi.c|  4 ++--
 include/efi_loader.h |  4 ++--
 lib/efi_loader/efi_memory.c  | 24 +++-
 lib/efi_loader/efi_runtime.c |  6 +++---
 4 files changed, 18 insertions(+), 20 deletions(-)

-- 
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/7] efi_loader: Change return type of efi_add_memory_map()

2019-07-14 Thread Bryan O'Donoghue
We currently have some inconsistent use of efi_add_memory_map()
throughout the code. In particular the return value of efi_add_memory_map()
is not interpreted the same way by various users in the codebase.

This patch changes efi_add_memory_map() to return efi_status_t. A
subsequent set of patches will change the internal values themselves and
finally the users of efi_add_memory_map().

Signed-off-by: Bryan O'Donoghue 
Suggested-by: Heinrich Schuchardt 
---
 include/efi_loader.h| 4 ++--
 lib/efi_loader/efi_memory.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index b07155cecb..69255f40ea 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -470,8 +470,8 @@ efi_status_t efi_get_memory_map(efi_uintn_t 
*memory_map_size,
efi_uintn_t *descriptor_size,
uint32_t *descriptor_version);
 /* Adds a range into the EFI memory map */
-uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
-   bool overlap_only_ram);
+efi_status_t efi_add_memory_map(uint64_t start, uint64_t pages, int 
memory_type,
+   bool overlap_only_ram);
 /* Called by board init to initialize the EFI drivers */
 efi_status_t efi_driver_init(void);
 /* Called by board init to initialize the EFI memory map */
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 27379381e8..c5a8f3ab29 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -223,8 +223,8 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map,
return EFI_CARVE_LOOP_AGAIN;
 }
 
-uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
-   bool overlap_only_ram)
+efi_status_t efi_add_memory_map(uint64_t start, uint64_t pages, int 
memory_type,
+   bool overlap_only_ram)
 {
struct list_head *lhandle;
struct efi_mem_list *newlist;
-- 
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 3/7] efi_loader: Return non-zero for error in efi_add_memory_map()

2019-07-14 Thread Bryan O'Donoghue
The previous implementation of efi_add_memory_map() returned the passed
address on success, instead of an efi_status_t.

With the new function signature instead of returning zero, return
EFI_NO_MAPPING on carve-out errors.

Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map")
Fixes: 74c16acce30b ("efi_loader: Don't allocate from memory holes")
Cc: Heinrich Schuchardt 
Cc: Alexander Graf 
Signed-off-by: Bryan O'Donoghue 
---
 lib/efi_loader/efi_memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index b513553fa4..c1d7b88997 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -277,7 +277,7 @@ efi_status_t efi_add_memory_map(uint64_t start, uint64_t 
pages, int memory_type,
 * The user requested to only have RAM overlaps,
 * but we hit a non-RAM region. Error out.
 */
-   return 0;
+   return EFI_NO_MAPPING;
case EFI_CARVE_NO_OVERLAP:
/* Just ignore this list entry */
break;
@@ -307,7 +307,7 @@ efi_status_t efi_add_memory_map(uint64_t start, uint64_t 
pages, int memory_type,
 * The payload wanted to have RAM overlaps, but we overlapped
 * with an unallocated region. Error out.
 */
-   return 0;
+   return EFI_NO_MAPPING;
}
 
/* Add our new map */
-- 
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/7] efi_loader: Change efi_add_memory_map() to return EFI_SUCCESS

2019-07-14 Thread Bryan O'Donoghue
efi_add_memory_map() wants to return 0 to indicate success in two places.
Instead of returning zero we should return the defined efi_status_t return
value EFI_SUCCESS.

Signed-off-by: Bryan O'Donoghue 
---
 lib/efi_loader/efi_memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index c5a8f3ab29..b513553fa4 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -239,7 +239,7 @@ efi_status_t efi_add_memory_map(uint64_t start, uint64_t 
pages, int memory_type,
return EFI_INVALID_PARAMETER;
 
if (!pages)
-   return start;
+   return EFI_SUCCESS;
 
++efi_memory_map_key;
newlist = calloc(1, sizeof(*newlist));
@@ -326,7 +326,7 @@ efi_status_t efi_add_memory_map(uint64_t start, uint64_t 
pages, int memory_type,
}
}
 
-   return start;
+   return EFI_SUCCESS;
 }
 
 /**
-- 
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 7/7] efi_loader: Capture efi_add_memory_map() result efi_add_runtime_mmio()

2019-07-14 Thread Bryan O'Donoghue
efi_add_runtime_mmio() does an efi_add_memory_map() call. We have recently
changed the return value of efi_add_memory_map() to return an efi_status_t
code.

This patch captures the result code of efi_add_memory_map() and if that
result code is not EFI_SUCCESS returns EFI_OUT_OF_RESOURCES;

Signed-off-by: Bryan O'Donoghue 
---
 lib/efi_loader/efi_runtime.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 40fdc0ea92..12ee6faadd 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -659,10 +659,10 @@ efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
struct efi_runtime_mmio_list *newmmio;
u64 pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
uint64_t addr = *(uintptr_t *)mmio_ptr;
-   uint64_t retaddr;
+   efi_status_t ret;
 
-   retaddr = efi_add_memory_map(addr, pages, EFI_MMAP_IO, false);
-   if (retaddr != addr)
+   ret = efi_add_memory_map(addr, pages, EFI_MMAP_IO, false);
+   if (ret != EFI_SUCCESS)
return EFI_OUT_OF_RESOURCES;
 
newmmio = calloc(1, sizeof(*newmmio));
-- 
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 4/7] efi_loader: Update efi_allocate_pages() to new efi_add_memory_map()

2019-07-14 Thread Bryan O'Donoghue
efi_add_memory_map() now returns efi_status_t not the passed uint64_t
address on success. We need to capture that change in efi_allocate_pages().

Signed-off-by: Bryan O'Donoghue 
---
 lib/efi_loader/efi_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index c1d7b88997..4ce3dd8f8c 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -455,7 +455,7 @@ efi_status_t efi_allocate_pages(int type, int memory_type,
}
 
/* Reserve that map in our memory maps */
-   if (efi_add_memory_map(addr, pages, memory_type, true) != addr)
+   if (efi_add_memory_map(addr, pages, memory_type, true) != EFI_SUCCESS)
/* Map would overlap, bail out */
return  EFI_OUT_OF_RESOURCES;
 
-- 
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 5/7] efi_loader: Update efi_free_pages() to new efi_add_memory_map()

2019-07-14 Thread Bryan O'Donoghue
efi_add_memory_map() now returns efi_status_t not the passed uint64_t
address on success. We need to capture that change in efi_free_pages().

Signed-off-by: Bryan O'Donoghue 
---
 lib/efi_loader/efi_memory.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 4ce3dd8f8c..57016a393b 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -501,13 +501,11 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t 
pages)
return EFI_INVALID_PARAMETER;
}
 
-   r = efi_add_memory_map(memory, pages, EFI_CONVENTIONAL_MEMORY, false);
-   /* Merging of adjacent free regions is missing */
-
-   if (r == memory)
-   return EFI_SUCCESS;
+   ret = efi_add_memory_map(memory, pages, EFI_CONVENTIONAL_MEMORY, false);
+   if (ret != EFI_SUCCESS)
+   return EFI_NOT_FOUND;
 
-   return EFI_NOT_FOUND;
+   return ret;
 }
 
 /**
-- 
2.22.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


  1   2   >