oweals/u-boot.git
6 years agoefi_selftest: missing braces in efi_selftest_textinputex.c
Heinrich Schuchardt [Sat, 15 Sep 2018 19:00:52 +0000 (21:00 +0200)]
efi_selftest: missing braces in efi_selftest_textinputex.c

gcc 4.8.4 wants to see all levels of braces when initializing a
structure to zeros.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: check parameter new_handle of efi_file_open()
Heinrich Schuchardt [Sat, 15 Sep 2018 18:43:46 +0000 (20:43 +0200)]
efi_loader: check parameter new_handle of efi_file_open()

We should not check parameter file twice.
We should check parameter new_handle.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Allow to execute from RAM
Alexander Graf [Fri, 22 Jun 2018 12:44:13 +0000 (14:44 +0200)]
sandbox: Allow to execute from RAM

With efi_loader, we may want to execute payloads from RAM. By default,
permissions on the RAM region don't allow us to execute from there though.

So let's change the default allocation scheme for RAM to also allow
execution from it. That way payloads that live in U-Boot RAM can be
directly executed.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Fix setjmp/longjmp
Alexander Graf [Fri, 22 Jun 2018 12:44:12 +0000 (14:44 +0200)]
sandbox: Fix setjmp/longjmp

In sandbox, longjmp returns to itself in an endless loop because
os_longjmp() calls into longjmp() which is provided by U-Boot which
again calls os_longjmp().

Setjmp on the other hand must not return because otherwise the
return freees up stack elements that we need during longjmp().

The only straight forward fix that doesn't involve nasty hacks I
could find is to directly link against the system setjmp/longjmp
implementations. That means we just provide the compiler with
hints that the symbol will be available and actually fill them
out with versions from libc.

This approach should be reasonably platform agnostic

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: terminal left upper corner is [1, 1]
Heinrich Schuchardt [Fri, 14 Sep 2018 16:49:26 +0000 (18:49 +0200)]
efi_loader: terminal left upper corner is [1, 1]

For the VT102 and the Linux console the left upper corner is [1, 1].
EFI uses [0, 0] as left upper corner.

Check parameters of the SetCursorPosition() service.

Use CSI H like EDK2 for positioning.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: more debug info for efi_file_getinfo()
Heinrich Schuchardt [Fri, 14 Sep 2018 20:46:34 +0000 (22:46 +0200)]
efi_loader: more debug info for efi_file_getinfo()

efi_file_getinfo() is called with a GUID. In EFI_ENTRY use %pUl as
format type. This way the GUID is printed in debug mode.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: sandbox: Enable selftest command
Simon Glass [Sat, 15 Sep 2018 06:51:01 +0000 (00:51 -0600)]
efi: sandbox: Enable selftest command

Enable this for sandbox since it almost passes now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: Correct the operation of efi_file_write()
Simon Glass [Sat, 15 Sep 2018 06:51:00 +0000 (00:51 -0600)]
efi: Correct the operation of efi_file_write()

We should not directly cast between pointers and addresses since it breaks
sandbox. Fix this and simplify the code in file_read().

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Enhance map_to_sysmem() to handle foreign pointers
Simon Glass [Sat, 15 Sep 2018 06:50:56 +0000 (00:50 -0600)]
sandbox: Enhance map_to_sysmem() to handle foreign pointers

At present map_sysmem() maps an address into the sandbox RAM buffer,
return a pointer, while map_to_sysmem() goes the other way.

The mapping is currently just 1:1 since a case was not found where a more
flexible mapping was needed. PCI does have a separate and more complex
mapping, but uses its own mechanism.

However this arrange cannot handle one important case, which is where a
test declares a stack variable and passes a pointer to it into a U-Boot
function which uses map_to_sysmem() to turn it into a address. Since the
pointer is not inside emulated DRAM, this will fail.

Add a mapping feature which can handle any such pointer, mapping it to a
simple tag value which can be passed around in U-Boot as an address.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Add support for calling abort()
Simon Glass [Sat, 15 Sep 2018 06:50:55 +0000 (00:50 -0600)]
sandbox: Add support for calling abort()

This function is useful to signal that the application needs to exit
immediate. It can be caught with a debugger (e.g. gdb). Add a stub for it
so that it can be called from within sandbox when an internal error
occurs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Align RAM buffer to the machine page size
Simon Glass [Sat, 15 Sep 2018 06:50:54 +0000 (00:50 -0600)]
sandbox: Align RAM buffer to the machine page size

At present the sandbox RAM buffer is not aligned to any particular
address boundary. This makes the internal pointers somewhat random with
respect to the associated RAM buffer addresses.

Align the buffer to the page size of the machine to help with this. Note
that there is a header at the start of the allocated pointer. To avoid
returning a pointer which is not aligned to a page boundary, we waste
almost an entire page of memory for each allocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: sandbox: Enable EFI loader build for sandbox
Simon Glass [Sat, 15 Sep 2018 06:50:53 +0000 (00:50 -0600)]
efi: sandbox: Enable EFI loader build for sandbox

This allows this feature to build within sandbox. This is useful for
testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: sandbox: Add distroboot support
Simon Glass [Sat, 15 Sep 2018 06:50:52 +0000 (00:50 -0600)]
efi: sandbox: Add distroboot support

With sandbox these values depend on the host system. Let's assume that it
is x86_64 for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: loosen check of parameters of efi_file_open()
Heinrich Schuchardt [Thu, 13 Sep 2018 19:31:49 +0000 (21:31 +0200)]
efi_loader: loosen check of parameters of efi_file_open()

The UEFI spec requires that attributes are only set for when
EFI_FILE_MODE_CREATE is set in open_mode.

The SCT tries to read a directory with EFI_FILE_DIRECTORY.

As EDK2 allows this we should not be more strict.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: unaligned buffers are not an error
Heinrich Schuchardt [Thu, 13 Sep 2018 17:42:47 +0000 (19:42 +0200)]
fs: fat: unaligned buffers are not an error

The FAT driver supports unaligned reads and writes and EFI applications
will make use of these. So a misaligned buffer is only worth a debug
message.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: provide description of file_open()
Heinrich Schuchardt [Wed, 12 Sep 2018 17:00:02 +0000 (19:00 +0200)]
efi_loader: provide description of file_open()

Replace urban slang by proper description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: check parameters of efi_file_open()
Heinrich Schuchardt [Wed, 12 Sep 2018 16:43:58 +0000 (18:43 +0200)]
efi_loader: check parameters of efi_file_open()

Check the parameters of efi_file_open().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: unset CONFIG_EFI_UNICODE_CAPITALIZATION
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:14 +0000 (22:38 +0200)]
efi_loader: unset CONFIG_EFI_UNICODE_CAPITALIZATION

Unset CONFIG_EFI_UNICODE_CAPITALIZATION on boards with tough size
restrictions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: test key notification functions
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:13 +0000 (22:38 +0200)]
efi_selftest: test key notification functions

Use a key notification function to leave the
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL test.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: implement key notify functions
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:12 +0000 (22:38 +0200)]
efi_loader: implement key notify functions

Implement registering and unregistreing key notify functions in the
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:11 +0000 (22:38 +0200)]
test/py: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL

Add a unit test for the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:10 +0000 (22:38 +0200)]
efi_selftest: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL

Provide a unit test for the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: support modifiers for F1 - F4
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:09 +0000 (22:38 +0200)]
efi_loader: support modifiers for F1 - F4

Support modifiers for F1 - F4.
Add support for letters with ALT key.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:08 +0000 (22:38 +0200)]
efi_loader: EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL

This patch implements the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

The implementation of notification functions is postponed to a later
patch.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: rework test_efi_selftest_text_input()
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:07 +0000 (22:38 +0200)]
test/py: rework test_efi_selftest_text_input()

Use more precise regular expressions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: use WaitForKey to test text input
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:06 +0000 (22:38 +0200)]
efi_selftest: use WaitForKey to test text input

We should test the WaitForKey event.
Testing for EFI_NOT_READY can be done after resetting the console.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: rework event handling for console
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:05 +0000 (22:38 +0200)]
efi_loader: rework event handling for console

Preread the next key in the console timer event.

The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL requires to trigger registered key
notification functions based on the prefetched key.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: refactor text input test
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:04 +0000 (22:38 +0200)]
efi_selftest: refactor text input test

Move reusable utility functions to efi_selftest_util.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: Unicode w/ EFI_SIMPLE_TEXT_INPUT_PROTOCOL
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:03 +0000 (22:38 +0200)]
test/py: Unicode w/ EFI_SIMPLE_TEXT_INPUT_PROTOCOL

Test that the Euro sign is correctly retrieved from the console via the
EFI_SIMPLE_TEXT_INPUT_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: support Unicode text input
Heinrich Schuchardt [Tue, 11 Sep 2018 22:05:32 +0000 (00:05 +0200)]
efi_loader: support Unicode text input

Up to now the EFI_TEXT_INPUT_PROTOCOL only supported ASCII characters.
With the patch it can consume UTF-8 from the console.

Currently only the serial console and the console can deliver UTF-8.
Local consoles are restricted to ASCII.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: fs: add fstest/unlink test
Akashi, Takahiro [Tue, 11 Sep 2018 07:06:03 +0000 (16:06 +0900)]
test/py: fs: add fstest/unlink test

In this commit, test cases for unlink interfaces are added as part of
"test_fs" test suite.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: fs: add fstest/mkdir test
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:21 +0000 (15:59 +0900)]
test/py: fs: add fstest/mkdir test

In this commit, test cases for mkdir interfaces are added as part of
"test_fs" test suite.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: fs: add extended write operation test
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:20 +0000 (15:59 +0900)]
test/py: fs: add extended write operation test

In this commit and the following, test scripts for new filesystem
functionalities introduced by my patch set, "fs: fat: extend FAT write
operations," are provided.

In particular, this patch adds test cases for sub-directory write
and write with non-zero offset.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: convert fs-test.sh to pytest
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:19 +0000 (15:59 +0900)]
test/py: convert fs-test.sh to pytest

In this commit, the same set of test cases as in test/fs/fs-test.sh
is provided using pytest framework.
Actually, fs-test.sh provides three variants:"sb" (sb command), "nonfs"
(fatxx and etc.) and "fs" (hostfs), and this patch currently supports
only "nonfs" variant; So it is not a replacement of fs-test.sh for now.

Simple usage:
  $ py.test test/py/tests/test_fs [<other options>]

You may also specify filesystem types to be tested:
  $ py.test test/py/tests/test_fs --fs-type fat32 [<other options>]

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs-test: update the test result as of v2018.09
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:18 +0000 (15:59 +0900)]
fs-test: update the test result as of v2018.09

As far as this patch series has been applied, all the tests should
pass. So update the test result summary.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs-test: fix false positive error at Test Case 12
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:17 +0000 (15:59 +0900)]
fs-test: fix false positive error at Test Case 12

The error message to be matched is wrong. Fix it.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: implement a file delete
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:16 +0000 (15:59 +0900)]
efi_loader: implement a file delete

'Delete' will be implemented here by calling fs_unlink() which relies on
underlying file system's implementation.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agocmd: fat: add fatrm command
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:15 +0000 (15:59 +0900)]
cmd: fat: add fatrm command

In this patch, a new command, fatrm, is added so as to delete a file
or directory.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: support unlink
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:14 +0000 (15:59 +0900)]
fs: fat: support unlink

In this patch, unlink support is added to FAT file system.
A directory can be deleted only if it is empty.

In this implementation, only a directory entry for a short file name
will be removed. So entries for a long file name can and should be
reclaimed with fsck.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: add unlink interface
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:13 +0000 (15:59 +0900)]
fs: add unlink interface

"unlink" interface is added to file operations.
This is a preparatory change as unlink support for FAT file system
will be added in next patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: file: support creating a directory
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:12 +0000 (15:59 +0900)]
efi_loader: file: support creating a directory

In efi world, there is no obvious "mkdir" interface, instead, Open()
with EFI_FILE_MODE_CREATE in mode parameter and EFI_FILE_DIRECTORY
in attributes parameter creates a directory.

In this patch, efi_file_open() is extended so as to accept such
a combination of parameters and call u-boot's mkdir interface for
expected action.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agocmd: fat: add fatmkdir command
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:11 +0000 (15:59 +0900)]
cmd: fat: add fatmkdir command

In this patch, a new command, fatmkdir, is added.

Please note that, as there is no notion of "current directory" on u-boot,
a directory name specified must contains an absolute directory path as
a parent directory. Otherwise, "/" (root directory) is assumed.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: support mkdir
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:10 +0000 (15:59 +0900)]
fs: fat: support mkdir

In this patch, mkdir support is added to FAT file system.
A newly created directory contains only "." and ".." entries.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: remember the starting cluster number of directory
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:09 +0000 (15:59 +0900)]
fs: fat: remember the starting cluster number of directory

The starting cluster number of directory is needed to initialize ".."
(parent directory) entry when creating a new directory.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: add mkdir interface
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:08 +0000 (15:59 +0900)]
fs: add mkdir interface

"mkdir" interface is added to file operations.
This is a preparatory change as mkdir support for FAT file system
will be added in next patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agocmd: fat: add offset parameter to fatwrite
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:07 +0000 (15:59 +0900)]
cmd: fat: add offset parameter to fatwrite

In this patch, fatwrite command is extended so as to accept an additional
parameter of file offset.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: support write with non-zero offset
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:06 +0000 (15:59 +0900)]
fs: fat: support write with non-zero offset

In this patch, all the necessary code for allowing for a file offset
at write is implemented. What plays a major roll here is get_set_cluster(),
which, in contrast to its counterpart, set_cluster(), only operates on
already-allocated clusters, overwriting with data.

So, with a file offset specified, set_contents() seeks and writes data
with set_get_cluster() until the end of a file, and, once it reaches
there, continues writing with set_cluster() for the rest.

Please note that a file will be trimmed as a result of write operation if
write ends before reaching file's end. This is an intended behavior
in order to maintain compatibility with the current interface.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: refactor write interface for a file offset
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:05 +0000 (15:59 +0900)]
fs: fat: refactor write interface for a file offset

The current write implementation is quite simple: remove existing clusters
and then allocating new ones and filling them with data. This, inevitably,
enforces always writing from the beginning of a file.

As the first step to lift this restriction, fat_file_write() and
set_contents() are modified to accept an additional parameter, file offset
and further re-factored so that, in the next patch, all the necessary code
will be put into set_contents().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: support write with sub-directory path
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:04 +0000 (15:59 +0900)]
fs: fat: support write with sub-directory path

In this patch, write implementation is overhauled and rewritten by
making full use of directory iterator. The obvious bonus is that we are
now able to write to a file with a directory path, like /A/B/C/FILE.

Please note that, as there is no notion of "current directory" on u-boot,
a file name specified must contain an absolute directory path. Otherwise,
"/" (root directory) is assumed.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: write returns error code instead of -1
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:03 +0000 (15:59 +0900)]
fs: fat: write returns error code instead of -1

It would be good that FAT write function return error code instead of
just returning -1 as fat_read_file() does.
This patch attempts to address this issue although it is 'best effort
(or estimate)' for now.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: check and normalize file name
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:02 +0000 (15:59 +0900)]
fs: fat: check and normalize file name

FAT file system's long file name support is a bit complicated and has some
restrictions on its naming. We should be careful about it especially for
write as it may easily end up with wrong file system.

normalize_longname() check for the rules and normalize a file name
if necessary. Please note, however, that this function is yet to be
extended to fully comply with the standard.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoRevert "fs: fat: cannot write to subdirectories"
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:01 +0000 (15:59 +0900)]
Revert "fs: fat: cannot write to subdirectories"

This reverts commit 0dc1bfb7302d220a48364263d5632d6d572b069b.
The succeeding patch series will supersede it.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: assure iterator's ->dent belongs to ->clust
AKASHI Takahiro [Tue, 11 Sep 2018 06:59:00 +0000 (15:59 +0900)]
fs: fat: assure iterator's ->dent belongs to ->clust

In my attempt to re-work write operation, it was revealed that iterator's
"clust" does not always point to a cluster to which a current directory
entry ("dent") belongs.
This patch assures that it is always true by adding "next_clust" which is
used solely for dereferencing a cluster chain.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: handle "." and ".." of root dir correctly with fat_itr_resolve()
AKASHI Takahiro [Tue, 11 Sep 2018 06:58:59 +0000 (15:58 +0900)]
fs: fat: handle "." and ".." of root dir correctly with fat_itr_resolve()

FAT's root directory does not have "." nor ".."
So care must be taken when scanning root directory with fat_itr_resolve().
Without this patch, any file path starting with "." or ".." will not be
resolved at all.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: extend get_fs_info() for write use
AKASHI Takahiro [Tue, 11 Sep 2018 06:58:58 +0000 (15:58 +0900)]
fs: fat: extend get_fs_info() for write use

get_fs_info() was introduced in major re-work of read operation by Rob.
We want to reuse this function in write operation by extending it with
additional members in fsdata structure.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: typos in efi_console.c
Heinrich Schuchardt [Sat, 8 Sep 2018 17:57:24 +0000 (19:57 +0200)]
efi_loader: typos in efi_console.c

Fix a few typos.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: SPDX-License-Identifier for efi.h
Heinrich Schuchardt [Sat, 8 Sep 2018 08:57:59 +0000 (10:57 +0200)]
efi_loader: SPDX-License-Identifier for efi.h

Add the missing SPDX-License-Identifier based on Linux kernel commit
b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to
files with no license").

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: SPDX-License-Identifier for efi_api.h
Heinrich Schuchardt [Sat, 8 Sep 2018 08:50:40 +0000 (10:50 +0200)]
efi_loader: SPDX-License-Identifier for efi_api.h

Add the missing SPDX-License-Identifier based on Linux kernel commit
b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to
files with no license").

Correct formatting errors.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: struct efi_simple_text_input_protocol
Heinrich Schuchardt [Sat, 8 Sep 2018 08:20:10 +0000 (10:20 +0200)]
efi_loader: struct efi_simple_text_input_protocol

%s/efi_simple_input_interface/efi_simple_text_input_protocol/

We should be consistent in the naming of the EFI protocol interface
structures. The protocol is called EFI_SIMPLE_TEXT_INPUT_PROTOCOL.

%s/ExtendedVerification/extended_verification/

Use consistent naming of function parameters. Do not use CamelCase.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: typo occured
Heinrich Schuchardt [Thu, 6 Sep 2018 18:29:50 +0000 (20:29 +0200)]
test/py: typo occured

%s/occured/occurred/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: test EFI_SIMPLE_TEXT_INPUT_PROTOCOL
Heinrich Schuchardt [Thu, 6 Sep 2018 18:19:31 +0000 (20:19 +0200)]
test/py: test EFI_SIMPLE_TEXT_INPUT_PROTOCOL

Execute the EFI selftest for the EFI_SIMPLE_TEXT_INPUT_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: EFI_UNICODE_COLLATION_PROTOCOL
Heinrich Schuchardt [Tue, 4 Sep 2018 17:34:59 +0000 (19:34 +0200)]
efi_selftest: EFI_UNICODE_COLLATION_PROTOCOL

Provide a unit test for the EFI_UNICODE_COLLATION_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: EFI_UNICODE_COLLATION_PROTOCOL
Heinrich Schuchardt [Tue, 4 Sep 2018 17:34:58 +0000 (19:34 +0200)]
efi_loader: EFI_UNICODE_COLLATION_PROTOCOL

The patch implements the EFI_UNICODE_COLLATION_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest: tests for utf_to_lower() utf_to_upper().
Heinrich Schuchardt [Tue, 4 Sep 2018 17:34:57 +0000 (19:34 +0200)]
test: tests for utf_to_lower() utf_to_upper().

Provide unit tests for utf_to_lower() utf_to_upper().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agolib: charset: upper/lower case conversion
Heinrich Schuchardt [Tue, 4 Sep 2018 17:34:56 +0000 (19:34 +0200)]
lib: charset: upper/lower case conversion

Provide functions for upper and lower case conversion.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: capitalization table
Heinrich Schuchardt [Tue, 4 Sep 2018 17:34:55 +0000 (19:34 +0200)]
efi_loader: capitalization table

This patch provides a define to initialize a table that maps lower to
capital letters for Unicode code point 0x0000 - 0xffff.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Add console handle references to in/out/err
Alexander Graf [Tue, 4 Sep 2018 12:59:11 +0000 (14:59 +0200)]
efi_loader: Add console handle references to in/out/err

We register the console in/out protocol on the loaded image handle, but
never tell anyone about it in the systab.

Because of this Shell.efi can not find the input protocol. So let's add
a proper reference.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agoefi_loader: use correct documentation style
Heinrich Schuchardt [Mon, 3 Sep 2018 03:00:43 +0000 (05:00 +0200)]
efi_loader: use correct documentation style

We have moved generating html documentation with Sphinx.

%s/Return Value/Return/g

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: description efi_update_capsule()
Heinrich Schuchardt [Mon, 3 Sep 2018 18:59:25 +0000 (20:59 +0200)]
efi_loader: description efi_update_capsule()

Correct the description of efi_update_capsule().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: fix typos in efi_runtime.c
Heinrich Schuchardt [Mon, 3 Sep 2018 17:29:41 +0000 (19:29 +0200)]
efi_loader: fix typos in efi_runtime.c

Fix multiple typos

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: fix typos in efi_boottime.c
Heinrich Schuchardt [Mon, 3 Sep 2018 17:12:24 +0000 (19:12 +0200)]
efi_loader: fix typos in efi_boottime.c

Fix numerous typos.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoRevert "Revert "efi_loader: efi_allocate_pages is too restrictive""
Stephen Warren [Thu, 30 Aug 2018 21:43:45 +0000 (15:43 -0600)]
Revert "Revert "efi_loader: efi_allocate_pages is too restrictive""

This reverts commit ccfc78b820e5e431c5bd73b072e7536a972e1710.

Now that the underlying issue is fixed, we can revert the revert and hence
restore the original EFI code.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoARM: tegra: reserve unmapped RAM so EFI doesn't use it
Stephen Warren [Thu, 30 Aug 2018 21:43:44 +0000 (15:43 -0600)]
ARM: tegra: reserve unmapped RAM so EFI doesn't use it

Tegra U-Boot ensures that board_get_usable_ram_top() never returns a value
over 4GB, since some peripherals can't access such addresses. However, on
systems with more than 2GB of RAM, RAM bank 1 does describe this extra
RAM, so that Linux (or whatever OS) can use it, subject to DMA
limitations. Since board_get_usable_ram_top() points at the top of RAM
bank 0, the memory locations describes by RAM bank 1 are not mapped by
U-Boot's MMU configuration, and so cannot be used for anything.

For some completely inexplicable reason, U-Boot's EFI support ignores the
value returned by board_get_usable_ram_top(), and EFI memory allocation
routines will return values above U-Boot's RAM top. This causes U-Boot to
crash when it accesses that RAM, since it isn't mapped by the MMU. One
use-case where this happens is TFTP download of a file on Jetson TX1
(p2371-2180).

This change explicitly tells the EFI code that this extra RAM should not
be used, thus avoiding the crash.

A previous attempt to make EFI honor board_get_usable_ram_top() was
rejected. So, this patch will need to be replicated for any board that
implements board_get_usable_ram_top().

Fixes: aa909462d018 ("efi_loader: efi_allocate_pages is too restrictive")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: simplify ifdefs
Stephen Warren [Thu, 30 Aug 2018 21:43:43 +0000 (15:43 -0600)]
efi_loader: simplify ifdefs

Use CONFIG_IS_ENABLED(EFI_LOADER) to avoid explicitly checking CONFIG_SPL
too. This simplifies the conditional.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agolib: charset: remove obsolete functions
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:34 +0000 (21:31 +0200)]
lib: charset: remove obsolete functions

Remove functions:
- utf8_to_utf16()
- utf16_strcpy()
- utf16_strdup()

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: buffer size for load options
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:33 +0000 (21:31 +0200)]
efi_loader: buffer size for load options

The number of bytes in an utf-8 string is an upper limit for the number of
words in the equivalent utf-16 string. In so far the inumbant coding works
correctly. For non-ASCII characters the utf-16 string is shorter. With the
patch only the necessary buffer size is allocated for the load options.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: don't use unlimited stack as buffer
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:32 +0000 (21:31 +0200)]
efi_loader: don't use unlimited stack as buffer

The length of a string printed to the console by the
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is not limited by the UEFI spec.
Hence should not allocate a buffer for it on the stack.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: remove limit on variable length
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:31 +0000 (21:31 +0200)]
efi_loader: remove limit on variable length

The EFI spec does not provide a length limit for variables.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest: test printing Unicode
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:30 +0000 (21:31 +0200)]
test: test printing Unicode

Test printing of Unicode strings

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agolib: vsprintf: correct printing of Unicode strings
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:29 +0000 (21:31 +0200)]
lib: vsprintf: correct printing of Unicode strings

The width and precision of the printf() function refer to the number of
characters not to the number of bytes printed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest: unit tests for Unicode functions
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:28 +0000 (21:31 +0200)]
test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agolib: charset: utility functions for Unicode
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:27 +0000 (21:31 +0200)]
lib: charset: utility functions for Unicode

utf8_get() - get next UTF-8 code point from buffer
utf8_put() - write UTF-8 code point to buffer
utf8_utf16_strnlen() - length of a utf-8 string after conversion to utf-16
utf8_utf16_strncpy() - copy a utf-8 string to utf-16
utf16_get() - get next UTF-16 code point from buffer
utf16_put() - write UTF-16 code point to buffer
utf16_strnlen() - number of codes points in a utf-16 string
utf16_utf8_strnlen() - length of a utf-16 string after conversion to utf-8
utf16_utf8_strncpy() - copy a utf-16 string to utf-8

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: rename utf16_strlen, utf16_strnlen
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:26 +0000 (21:31 +0200)]
efi_loader: rename utf16_strlen, utf16_strnlen

The function names utf16_strlen() and utf16_strnlen() are misnomers.
The functions do not count utf-16 characters but non-zero words.
So let's rename them to u16_strlen and u16_strnlen().

In utf16_dup() avoid assignment in if clause.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agolib: build charset.o only if needed
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:25 +0000 (21:31 +0200)]
lib: build charset.o only if needed

charset.o is only needed for the EFI subsystem

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest: print_ut.c use #if CONFIG_IS_ENABLED(EFI_LOADER)
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:24 +0000 (21:31 +0200)]
test: print_ut.c use #if CONFIG_IS_ENABLED(EFI_LOADER)

Using CONFIG_IS_ENABLED(EFI_LOADER) allows to simply the #if statements.

Suggested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agovsprintf.c: use #if CONFIG_IS_ENABLED(EFI_LOADER)
Heinrich Schuchardt [Fri, 31 Aug 2018 19:31:23 +0000 (21:31 +0200)]
vsprintf.c: use #if CONFIG_IS_ENABLED(EFI_LOADER)

Using CONFIG_IS_ENABLED(EFI_LOADER) allows to simply the #if statements.

Suggested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Pass address to fs_read()
Alexander Graf [Wed, 8 Aug 2018 09:54:32 +0000 (03:54 -0600)]
efi_loader: Pass address to fs_read()

The fs_read() function wants to get an address rather than the
pointer to a buffer.

So let's convert the passed buffer from pointer back a the address
to make efi_loader on sandbox happier.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: sandbox: Tidy up copy_fdt() to work with sandbox
Simon Glass [Wed, 8 Aug 2018 09:54:30 +0000 (03:54 -0600)]
efi: sandbox: Tidy up copy_fdt() to work with sandbox

At present this function takes a pointer as its argument, then passes this
to efi_allocate_pages(), which actually takes an address. It uses casts,
which are not supported on sandbox.

Also the function calculates the FDT size rounded up to the neared EFI
page size, then its caller recalculates the size and adds a bit more to
it.

This function is much better written as something that works with
addresses only, and returns both the address and the size of the relocated
FDT.

Also, copy_fdt() returns NULL on error, but really should propagate the
error from efi_allocate_pages(). To do this it needs to return an
efi_status_t, not a void *.

Update the code in this way, so that it is easier to follow, and also
supports sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: Relocate FDT to 127MB instead of 128MB
Simon Glass [Wed, 8 Aug 2018 09:54:29 +0000 (03:54 -0600)]
efi: Relocate FDT to 127MB instead of 128MB

Sandbox only has 128MB of memory so we cannot relocate the device tree up
to start at 128MB. Use 127MB instead, which should be safe.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: test for loaded image protocol
Heinrich Schuchardt [Sun, 26 Aug 2018 13:31:53 +0000 (15:31 +0200)]
efi_selftest: test for loaded image protocol

Verify that the loaded image protocol is installed on the image handle.
Verify that the loaded image protocol points to the system table.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: pass system table in loaded image protocol
Heinrich Schuchardt [Sun, 26 Aug 2018 13:31:52 +0000 (15:31 +0200)]
efi_loader: pass system table in loaded image protocol

The system table must be passed as a pointer in the loaded image
protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: memory leak testing manage protocols
Heinrich Schuchardt [Sun, 26 Aug 2018 12:58:16 +0000 (14:58 +0200)]
efi_selftest: memory leak testing manage protocols

Remove memory leak in efi_selftest_manageprotocols.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-mips
Tom Rini [Sun, 23 Sep 2018 19:14:12 +0000 (15:14 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-mips

6 years agomips: mt7628a.dtsi: Add SPI clock-frequency property
Stefan Roese [Thu, 16 Aug 2018 13:27:33 +0000 (15:27 +0200)]
mips: mt7628a.dtsi: Add SPI clock-frequency property

This patch adds the clock-frequency property to the SPI controller
DT node. It will be used by the SPI driver to calculate the baud rate.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: mt76xx: Add sysreset support
Stefan Roese [Thu, 16 Aug 2018 13:27:32 +0000 (15:27 +0200)]
mips: mt76xx: Add sysreset support

This patch adds the necessary sysreset DT node and enables the required
drivers via Kconfig.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: Add Gardena Smart-Gateway board support
Stefan Roese [Thu, 16 Aug 2018 13:27:31 +0000 (15:27 +0200)]
mips: Add Gardena Smart-Gateway board support

The Gardena Smart-Gateway boards have a MT7688 SoC with 128 MiB of RAM
and 8 MiB of flash (SPI NOR) and additional 128MiB SPI NAND storage.

This patch also includes 2 targets. One is the target that can be
programmed into the SPI NOR flash and a 2nd target "xxx-ram" is
added to support loading and booting via an already running U-Boot
version. This allows easy development and testing without the
need to flash the image each time.

Signed-off-by: Stefan Roese <sr@denx.de>
[fixed and regenerated defconfig files]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: Add LinkIt Smart 7688 support
Stefan Roese [Thu, 16 Aug 2018 13:27:30 +0000 (15:27 +0200)]
mips: Add LinkIt Smart 7688 support

The LinkIt Smart 7688 modules have a MT7688 SoC with 128 MiB of RAM
and 32 MiB of flash (SPI NOR).

This patch also includes 2 targets. One is the target that can be
programmed into the SPI NOR flash and a 2nd target "xxx-ram" is
added to support loading and booting via an already running U-Boot
version. This allows easy development and testing without the
need to flash the image each time.

Signed-off-by: Stefan Roese <sr@denx.de>
[fixed and regenerated defconfig files]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: Add basic MediaTek MT7620/88 support
Stefan Roese [Wed, 5 Sep 2018 13:12:35 +0000 (15:12 +0200)]
mips: Add basic MediaTek MT7620/88 support

This patch adds basic support for the MediaTek MT7620/88 SoCs. Parts of
the code is copied from the MediaTek GitHub repository:

https://github.com/MediaTek-Labs/linkit-smart-uboot.git

The mt7628a.dtsi file is imported from Linux v4.17.

Support for the LinkIt Smart 7688 module and the Gardena Smart Gateway
both based on the MT7688 will be added in further patches.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: Add arch/mips/include/asm/atomic.h
Stefan Roese [Thu, 16 Aug 2018 13:27:29 +0000 (15:27 +0200)]
mips: Add arch/mips/include/asm/atomic.h

This is needed for the UBIFS support. The file is a copy of
arch/xtensa/include/asm/atomic.h

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agoMIPS: cache: remove config option CONFIG_SYS_MIPS_CACHE_MODE
Daniel Schwierzeck [Fri, 7 Sep 2018 17:02:06 +0000 (19:02 +0200)]
MIPS: cache: remove config option CONFIG_SYS_MIPS_CACHE_MODE

Caches should be configured to mode CONF_CM_CACHABLE_NONCOHERENT
(or CONF_CM_CACHABLE_COW when a CM is available). There is no
need to make this configurable.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>