]> git.sur5r.net Git - u-boot/log
u-boot
7 years agopart: extract MBR signature from partitions
Peter Jones [Wed, 13 Sep 2017 22:05:25 +0000 (18:05 -0400)]
part: extract MBR signature from partitions

EFI client programs need the signature information from the partition
table to determine the disk a partition is on, so we need to fill that
in here.

Signed-off-by: Peter Jones <pjones@redhat.com>
[separated from efi_loader part, and fixed build-errors for non-
 CONFIG_EFI_PARTITION case]
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agopart: move efi_guid_t
Rob Clark [Wed, 13 Sep 2017 22:05:24 +0000 (18:05 -0400)]
part: move efi_guid_t

Prep work for next patch.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: check notification of ExitBootServices
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:19 +0000 (10:06 +0200)]
efi_selftest: check notification of ExitBootServices

Check that the notification function of an
EVT_SIGNAL_EXIT_BOOT_SERVICES event is called
exactly once.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: notify when ExitBootServices is invoked
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:18 +0000 (10:06 +0200)]
efi_loader: notify when ExitBootServices is invoked

All events of type EVT_SIGNAL_EXIT_BOOT_SERVICES have to be
notified when ExitBootServices is invoked.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: test task priority levels
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:17 +0000 (10:06 +0200)]
efi_selftest: test task priority levels

Run a 10 ms periodic timer and check that it is called 10 times
while waiting for 100 ms single shot timer.

Raise the TPL level to the level of the 10 ms timer and observe
that the notification function is not called again.

Lower the TPL level and check that the queued notification
function is called.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: implement task priority level (TPL)
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:16 +0000 (10:06 +0200)]
efi_loader: implement task priority level (TPL)

Define variable holding tpl.
Implement RaiseTPL and RestoreTPL.
Implement TPL check in efi_signal_event.
Implement TPL check in efi_wait_for_event.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: provide unit test for event services
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:15 +0000 (10:06 +0200)]
efi_selftest: provide unit test for event services

This unit test uses timer events to check the implementation
of the following boottime services:
CreateEvent, CloseEvent, WaitForEvent, CheckEvent, SetTimer

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_set_timer: reset signaled state
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:14 +0000 (10:06 +0200)]
efi_loader: efi_set_timer: reset signaled state

We should be able to call efi_set_timer repeatedly.
So let us reset the signaled state here.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: implement queueing of the notification function
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:13 +0000 (10:06 +0200)]
efi_loader: implement queueing of the notification function

For the correct implementation of the task priority level (TPL)
calling the notification function must be queued.

Add a status field 'queued' to events.

In function efi_signal_event set status queued if a notification
function exists and reset it after we have called the function.
A later patch will add a check of the TPL here.

In efi_create_event and efi_close_event unset the queued status.

In function efi_wait_for_event and efi_check_event
queue the notification function.

In efi_timer_check call the efi_notify_event
if the status queued is set.
For all timer events set status signaled.

In efi_console_timer_notify set the signaled state of the
WaitForKey event.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agotest/py: add a test calling the EFI selftest
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:12 +0000 (10:06 +0200)]
test/py: add a test calling the EFI selftest

A Python test script is provided that runs the EFI selftest
if CONFIG_CMD_EFI_SELFTEST=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: provide an EFI selftest application
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:11 +0000 (10:06 +0200)]
efi_selftest: provide an EFI selftest application

A testing framework for the EFI API is provided.
It can be executed with the 'bootefi selftest' command.

It is coded in a way that at a later stage we may turn it
into a standalone EFI application. The current build system
does not allow this yet.

All tests use a driver model and are run in three phases:
setup, execute, teardown.

A test may be setup and executed at boottime,
it may be setup at boottime and executed at runtime,
or it may be setup and executed at runtime.

After executing all tests the system is reset.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: allow return value in EFI_CALL
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:10 +0000 (10:06 +0200)]
efi_loader: allow return value in EFI_CALL

Macro EFI_CALL was introduced to call an UEFI function.
Unfortunately it does not support return values.
Most UEFI functions have a return value.

So let's rename EFI_CALL to EFI_CALL_VOID and introduce a
new EFI_CALL macro that supports return values.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: fix typo in include/efi.h
Heinrich Schuchardt [Mon, 18 Sep 2017 05:54:50 +0000 (07:54 +0200)]
efi_loader: fix typo in include/efi.h

Fix typo in teh EFI_BOOT_SERVICES_CODE description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: avoid obscure constants in efi_runtime.c
Heinrich Schuchardt [Mon, 18 Sep 2017 20:11:34 +0000 (22:11 +0200)]
efi_loader: avoid obscure constants in efi_runtime.c

We should use the predefined constants EFI_PAGE_SHIFT
and EFI_PAGE_MASK where applicable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoEFI: find EFI system partition by legacy MBR partition type
Andre Przywara [Thu, 6 Jul 2017 09:14:03 +0000 (10:14 +0100)]
EFI: find EFI system partition by legacy MBR partition type

The UEFI spec allows an EFI system partition (ESP, with the bootloader or
kernel EFI apps on it) to reside on a disk using a "legacy" MBR
partitioning scheme.
But in contrast to actual legacy disks the ESP is not marked as
"bootable" using bit 7 in byte 0 of the legacy partition entry, but is
instead using partition *type* 0xef (in contrast to 0x0b or 0x0c for a
normal FAT partition). The EFI spec isn't 100% clear on this, but it even
seems to discourage the use of the bootable flag for ESPs.
Also it seems that some EFI implementations (EDK2?) even seem to ignore
partitions marked as bootable (probably since they believe they contain
legacy boot code).
The Debian installer [1] (*not* mini.iso), for instance, contains such an
MBR, where none of the two partitions are marked bootable, but the ESP
has clearly type 0xef.
Now U-Boot cannot find the ESP on such a disk (USB flash drive) and
fails to load the EFI grub and thus the installer.

Since it all boils down to the distro bootcmds eventually calling
"part list -bootable" to find potential boot partitions, it seems logical
to just add this "partition type is 0xef" condition to the is_bootable()
implementation.

This allows the bog standard arm64 Debian-testing installer to boot from
an USB pen drive on Allwinner A64 boards (Pine64, BananaPi-M64).
(Ubuntu and other distribution installers don't have a legacy MBR, so
U-Boot falls back to El Torito there).

[1] https://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/arm64/iso-cd/
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: usage of always in Makefile
Heinrich Schuchardt [Tue, 5 Sep 2017 01:19:39 +0000 (03:19 +0200)]
efi_loader: usage of always in Makefile

Variable always should only be appended but not overwritten by
lib/efi_loader/Makefile.

Remove variable efiprogs which is not otherwise used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoscripts/Makefile.lib: generalize building built in EFI app
Heinrich Schuchardt [Tue, 5 Sep 2017 14:07:17 +0000 (16:07 +0200)]
scripts/Makefile.lib: generalize building built in EFI app

Replace all occurences of helloworld by generalized forms.
This allows us to build additional EFI applications that are
included into the U-Boot binary without loading
scripts/Makefile.lib with specific filenames.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: rename __efi_hello_world_*
Heinrich Schuchardt [Tue, 5 Sep 2017 01:19:37 +0000 (03:19 +0200)]
efi_loader: rename __efi_hello_world_*

In scripts/Makefile.lib we build section including helloworld.efi.
This allows to load the EFI binary with command 'bootefi hello'.

scripts/Makefile.lib contains explicit references to strings
containing helloworld and hello_world. This makes it impossible
to generalize the coding to accomodate additional built in
EFI binaries.

Let us rename the variables __efi_hello_world_* to
__efi_helloworld_*.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoscripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:
Heinrich Schuchardt [Sun, 3 Sep 2017 06:17:46 +0000 (08:17 +0200)]
scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:

The target
$(obj)/helloworld.so:
exists twice in Makefile.lib.

If you add an echo command to each of the two recipes you get
warnings like:

scripts/Makefile.lib:383: warning:
overriding recipe for target 'drivers/power/battery/helloworld.so'
scripts/Makefile.lib:379: warning:
ignoring old recipe for target 'drivers/power/battery/helloworld.so'

This patch removes the obsolete target.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: Fix efi_exit gd clobbering
Alexander Graf [Sun, 3 Sep 2017 12:14:17 +0000 (14:14 +0200)]
efi_loader: Fix efi_exit gd clobbering

Commit f494950b (efi_loader: call __efi_exit_check in efi_exit) added a call
to __efi_exit_check inside efi_exit to account for the fact that we're exiting
the efi_exit function via a longjmp call.

However, __efi_exit_check also swizzles gd to the application gd while the
longjmp will put us back into EFI context, so we need the efi (u-boot) gd.

This patch fixes that up by explicitly setting gd back to efi_gd before
doing the longjmp. It also adds a few comments on why it does that.

Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: write protocol GUID in OpenProtocol
Heinrich Schuchardt [Fri, 18 Aug 2017 15:45:16 +0000 (17:45 +0200)]
efi_loader: write protocol GUID in OpenProtocol

To understand what is happening in OpenProtocol or LocateProtocol
it is necessary to know the protocol interface GUID.
Let's write a debug message.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: call __efi_exit_check in efi_exit
Heinrich Schuchardt [Fri, 25 Aug 2017 17:53:14 +0000 (19:53 +0200)]
efi_loader: call __efi_exit_check in efi_exit

The calls to __efi_entry_check and __efi_exit_check have to match.
If DEBUG is defined, panic() will be called otherwise.

If debugging is activated some Travis CI builds fail due to an
assertion in EFI_CALL without the patch.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_disk: efi_disk_rw_blocks is not an API function
Heinrich Schuchardt [Sat, 26 Aug 2017 20:33:13 +0000 (22:33 +0200)]
efi_disk: efi_disk_rw_blocks is not an API function

There is no need to use attribute EFIAPI for
efi_disk_rw_blocks. It is not an API function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: bootefi hello should use loadaddr
Heinrich Schuchardt [Mon, 28 Aug 2017 16:54:30 +0000 (18:54 +0200)]
efi_loader: bootefi hello should use loadaddr

Command 'bootefi hello' currently uses CONFIG_SYS_LOAD_ADDR
as loading address.

qemu machines have by default 128 MiB RAM.
CONFIG_SYS_LOAD_ADDR for x86 is 0x20000000 (512 MiB).
This causes 'bootefi hello' to fail.

We should use the environment variable loadaddr if available.
It defaults to 0x1000000 (16 MiB) on qemu_x86.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Sun, 17 Sep 2017 15:46:51 +0000 (11:46 -0400)]
Merge git://git.denx.de/u-boot-x86

7 years agox86: ivybridge: remove unused variables
Heinrich Schuchardt [Tue, 12 Sep 2017 01:40:31 +0000 (03:40 +0200)]
x86: ivybridge: remove unused variables

legacy_hole_base_k and legacy_hole_size_k are defined but
not used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Enable early timer for chromebook_link
Simon Glass [Wed, 6 Sep 2017 01:49:50 +0000 (19:49 -0600)]
x86: Enable early timer for chromebook_link

Enable this option for link so that the timer is available earlier.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agobootstage: Provide a separate record count setting for SPL
Simon Glass [Wed, 6 Sep 2017 01:49:49 +0000 (19:49 -0600)]
bootstage: Provide a separate record count setting for SPL

With SPL we often have limited memory and do not need very many bootstage
records. Add a separate Kconfig option for SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agobootstage: Drop unused options
Simon Glass [Wed, 6 Sep 2017 01:49:48 +0000 (19:49 -0600)]
bootstage: Drop unused options

The CONFIG_BOOTSTAGE_USER_COUNT option is no-longer needed since we can now
support any number of user IDs. Also BOOTSTAGE_ID_COUNT is not needed now.

Drop these unused options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: x86: Allow TSC timer to be used before DM is ready
Simon Glass [Wed, 6 Sep 2017 01:49:46 +0000 (19:49 -0600)]
dm: x86: Allow TSC timer to be used before DM is ready

With bootstage we need access to the timer before driver model is set up.
To handle this, put the required state in global_data and provide a new
function to set up the device, separate from the driver's probe() method.

This will be used by the 'early' timer also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoboard_f: Drop the timer after relocation
Simon Glass [Wed, 6 Sep 2017 01:49:45 +0000 (19:49 -0600)]
board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Support Intel Cherry Hill board
Bin Meng [Wed, 16 Aug 2017 05:42:02 +0000 (22:42 -0700)]
x86: Support Intel Cherry Hill board

This adds support to Intel Cherry Hill board, a board based on
Intel Braswell SoC. The following devices are validated:

- serial port as the serial console
- on-board Realtek 8169 ethernet controller
- SATA AHCI controller
- EMMC/SDHC controller
- USB 3.0 xHCI controller
- PCIe x1 slot with a graphics card
- ICH SPI controller with an 8MB Macronix SPI flash
- Integrated graphics device as the video console

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: braswell: Disable PUNIT power configuration for B0 stepping
Bin Meng [Wed, 16 Aug 2017 05:42:01 +0000 (22:42 -0700)]
x86: braswell: Disable PUNIT power configuration for B0 stepping

FSP's built-in UPD configuration enables PUNIT power configuration,
but on B0 stepping, this causes CPU hangs in fsp_init(). Disable it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: braswell: Add FSP configuration
Bin Meng [Wed, 16 Aug 2017 05:42:00 +0000 (22:42 -0700)]
x86: braswell: Add FSP configuration

Add FSP related configuration for Braswell.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: braswell: Add microcode for B0/C0/D0 stepping SoC
Bin Meng [Wed, 16 Aug 2017 05:41:59 +0000 (22:41 -0700)]
x86: braswell: Add microcode for B0/C0/D0 stepping SoC

This adds microcode device tree fragment for Braswell B0 (406C2),
C0 (406C3) and D0 (406C4) stepping SoC.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: Add Intel Braswell SoC support
Bin Meng [Wed, 16 Aug 2017 05:41:58 +0000 (22:41 -0700)]
x86: Add Intel Braswell SoC support

This adds initial Intel Braswell SoC support. It uses Intel FSP
to initialize the chipset.

Similar to its predecessor BayTrail, there are some work to do to
enable the legacy UART integrated in the Braswell SoC.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: fsp: Update fsp command to show spec 1.1 header
Bin Meng [Wed, 16 Aug 2017 05:41:57 +0000 (22:41 -0700)]
x86: fsp: Update fsp command to show spec 1.1 header

FSP spec 1.1 adds 3 new APIs and their offsets are in the header.
Update the 'fsp hdr' command to show these new entries.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: dm: video: Add a framebuffer driver that utilizes VBT
Bin Meng [Wed, 16 Aug 2017 05:41:56 +0000 (22:41 -0700)]
x86: dm: video: Add a framebuffer driver that utilizes VBT

When a VBT is given to an FSP that supports graphics initialization,
the FSP will produce a graphics info HOB that contains all necessary
information for the linear frame buffer of the integrated graphics
device. This adds a DM video driver for it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: dts: Include Intel Video BIOS Table in the ROM image
Bin Meng [Wed, 16 Aug 2017 05:41:55 +0000 (22:41 -0700)]
x86: dts: Include Intel Video BIOS Table in the ROM image

Now that binman is able to recognize the Video BIOS Table entry,
add such one in the u-boot.dtsi.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agotools: binman: Add a new entry type for Intel VBT
Bin Meng [Wed, 16 Aug 2017 05:41:54 +0000 (22:41 -0700)]
tools: binman: Add a new entry type for Intel VBT

This adds a new entry type for Intel Video BIOS Table.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: Add Video BIOS Table (VBT) related Kconfig options
Bin Meng [Wed, 16 Aug 2017 05:41:53 +0000 (22:41 -0700)]
x86: Add Video BIOS Table (VBT) related Kconfig options

This adds Kconfig options for Video BIOS Table which is normally
required if you are using an Intel FSP firmware that is complaint
with spec 1.1 or later to initialize the integrated graphics device.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: fsp: Add FSP_GRAPHICS_INFO_HOB
Bin Meng [Wed, 16 Aug 2017 05:41:52 +0000 (22:41 -0700)]
x86: fsp: Add FSP_GRAPHICS_INFO_HOB

This adds a new HOB type for graphics information introduced in FSP
spec 1.1. When graphics capability is included in FSP and enabled,
FSP produces an FSP_GRAPHICS_INFO_HOB as described in the EFI PI
specification which provides information about the graphics mode and
framebuffer.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: fsp: Update struct common_buf for FSP spec 1.1
Bin Meng [Wed, 16 Aug 2017 05:41:51 +0000 (22:41 -0700)]
x86: fsp: Update struct common_buf for FSP spec 1.1

FSP spec 1.1 adds one more member to the struct common_buf to
determine the memory size that can be reserved by FSP below "top
of low usable memory" for bootloader usage. This new member uses
the reserved space so that it is still compatible with previous
FSP spec 1.0.

A new HOB (FSP_HOB_RESOURCE_OWNER_BOOTLOADER_TOLUM_GUID) is also
published when common_buf.tolum_size is valid and non zero.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: tsc: Add Airmont reference clock values
Bin Meng [Wed, 16 Aug 2017 05:41:50 +0000 (22:41 -0700)]
x86: tsc: Add Airmont reference clock values

Per the Intel 64 and IA-32 Architecture Software Developer's Manual,
add the reference clock for Intel Atom Processors based on the Airmont
Microarchitecture (Braswell).

This keeps in sync with Linux kernel commit:
  6fcb41c: x86/tsc_msr: Add Airmont reference clock values

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoMerge git://git.denx.de/u-boot-fdt
Tom Rini [Sat, 16 Sep 2017 02:34:34 +0000 (22:34 -0400)]
Merge git://git.denx.de/u-boot-fdt

7 years agotest/py: gpt: make use of infra-structure
Stephen Warren [Fri, 15 Sep 2017 18:19:38 +0000 (12:19 -0600)]
test/py: gpt: make use of infra-structure

Make various changes to the GPT test:

1) Reference the disk image using an absolute path in all cases. This
allows test/py to operate correctly if it's run from a directory other
than the root of the U-Boot source tree.

2) Store the disk image in the teswt/py persistent data directory. This
removes the need to re-generate it every time the tests are run.

3) Execute sgdisk using u_boot_utils.run_and_log() so that its output is
captured in the test log. This allows debugging any problems running it.

4) Make the disk image a test fixture. This removes the requirement to
always run all GPT tests, and run them in order. The current code doesn't
create the disk image if e.g. just test_gpt_uuid() is executed via the
test.py -k command-line option.

5) Use @pytest.mark.buildconfigspec for all feature dependencies, rather
than manually implementing some of them.

6) Make all tests depend on sandbox, since they use the sandbox-specific
host command.

Fixes: a2f422555fc8 ("add pytests for 'gpt guid' command in sandbox")
Fixes: c5772188ede9 ("add pytests for 'gpt rename' and 'gpt swap'")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Tom Rini <trini@konsulko.com>
7 years agoARM: davinci: Remove CONFIG_SOC_DA830
Adam Ford [Fri, 15 Sep 2017 10:56:48 +0000 (05:56 -0500)]
ARM: davinci: Remove CONFIG_SOC_DA830

Nothing CONFIG_SOC_DA830 anymore, so let's remove it and
the one remaining source file for it. It appears to have been
abandoned a while ago.

Signed-off-by: Adam Ford <aford173@gmail.com>
7 years agoarm: dts: Add missing u-boot specific dtsi for dra7-evm
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:39:41 +0000 (12:39 +0200)]
arm: dts: Add missing u-boot specific dtsi for dra7-evm

commit b63b995 (arm: dts: Add u-boot specific compatibles) separated out
u-boot specific compatibles from dts files.
The u-boot specifics were moved in *-u-boot.dtsi files for all dra7
platforms except dra7-evm.
Without it the SD card is broken on DRA7-evm because the regulator cannot
be enabled.
Fix it by adding the missing dra7-evm-u-boot.dtsi with the needed
properties.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoarm: mach-omap2: Relax checks on OP-TEE location to allow pageable image
Harinarayan Bhatta [Wed, 13 Sep 2017 18:27:44 +0000 (13:27 -0500)]
arm: mach-omap2: Relax checks on OP-TEE location to allow pageable image

When the OP-TEE image is built for secure paging the load address may be
in SRAM, remove checks that prevent this.

Signed-off-by: Harinarayan Bhatta <harinarayan@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agofs/fat: fix fatbuf leak
Rob Clark [Tue, 12 Sep 2017 20:40:01 +0000 (16:40 -0400)]
fs/fat: fix fatbuf leak

A new fatbuf was allocated by get_fs_info() (called by fat_itr_root()),
but not freed, resulting in eventually running out of memory.  Spotted
by running 'ls -r' in a large FAT filesystem from Shell.efi.

fatbuf is mainly used to cache FAT entry lookups (get_fatent())..
possibly once fat_write.c it can move into the iterator to simplify
this.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
7 years agofs/fat: Clean up open-coded sector <-> cluster conversions
Rob Clark [Sat, 9 Sep 2017 17:16:00 +0000 (13:16 -0400)]
fs/fat: Clean up open-coded sector <-> cluster conversions

Use the clust_to_sect() helper that was introduced earlier, and add an
inverse sect_to_clust(), plus update the various spots that open-coded
this conversion previously.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofs/fat: fix case for FAT shortnames
Rob Clark [Sat, 9 Sep 2017 17:15:59 +0000 (13:15 -0400)]
fs/fat: fix case for FAT shortnames

Noticed when comparing our output to linux.  There are some lcase bits
which control whether filename and/or extension should be downcase'd.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofat/fs: move ls to generic implementation
Rob Clark [Sat, 9 Sep 2017 17:15:58 +0000 (13:15 -0400)]
fat/fs: move ls to generic implementation

Add a generic implementation of 'ls' using opendir/readdir/closedir, and
replace fat's custom implementation.  Other filesystems should move to
the generic implementation after they add opendir/readdir/closedir
support.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofat/fs: remove a bunch of dead code
Rob Clark [Sat, 9 Sep 2017 17:15:57 +0000 (13:15 -0400)]
fat/fs: remove a bunch of dead code

Spotted by chance, when trying to remove file_fat_ls(), I noticed there
were some dead users of the API.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofs/fat: implement opendir/readdir/closedir
Rob Clark [Sat, 9 Sep 2017 17:15:56 +0000 (13:15 -0400)]
fs/fat: implement opendir/readdir/closedir

Implement the readdir interface using the directory iterators.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofs: add fs_readdir()
Rob Clark [Sat, 9 Sep 2017 17:15:55 +0000 (13:15 -0400)]
fs: add fs_readdir()

Needed to support efi file protocol.  The fallback.efi loader wants
to be able to read the contents of the /EFI directory to find an OS
to boot.

Modelled after POSIX opendir()/readdir()/closedir().  Unlike the other
fs APIs, this is stateful (ie. state is held in the FS_DIR "directory
stream"), to avoid re-traversing of the directory structure at each
step.  The directory stream must be released with closedir() when it
is no longer needed.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofat/fs: convert to directory iterators
Rob Clark [Sat, 9 Sep 2017 17:15:54 +0000 (13:15 -0400)]
fat/fs: convert to directory iterators

And drop a whole lot of ugly code!

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofs/fat: introduce new director iterators
Rob Clark [Sat, 9 Sep 2017 17:15:53 +0000 (13:15 -0400)]
fs/fat: introduce new director iterators

Untangle directory traversal into a simple iterator, to replace the
existing multi-purpose do_fat_read_at() + get_dentfromdir().

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
7 years agofs/fat: split out helper to init fsdata
Rob Clark [Sat, 9 Sep 2017 17:15:52 +0000 (13:15 -0400)]
fs/fat: split out helper to init fsdata

Want to re-use this in fat dirent iterator in next patch.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoMerge git://git.denx.de/u-boot-ubi
Tom Rini [Fri, 15 Sep 2017 12:45:21 +0000 (08:45 -0400)]
Merge git://git.denx.de/u-boot-ubi

7 years agoMerge git://git.denx.de/u-boot-i2c
Tom Rini [Fri, 15 Sep 2017 12:45:10 +0000 (08:45 -0400)]
Merge git://git.denx.de/u-boot-i2c

7 years agotest/py: u_boot_console_base.py: fix typo
Heinrich Schuchardt [Thu, 14 Sep 2017 10:27:07 +0000 (12:27 +0200)]
test/py: u_boot_console_base.py: fix typo

run_command does not have a parameter wait_for_each.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
7 years agocheckpatch.pl: Add warning for new __packed additions
Heinrich Schuchardt [Wed, 13 Sep 2017 02:59:05 +0000 (04:59 +0200)]
checkpatch.pl: Add warning for new __packed additions

While there are valid reasons to use __packed, often the answer is that
you should be doing something else here instead.

This reintroduces the changes of
f503cc49a570 (Add warning for new __packed additions)

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
7 years agocmd: blk: Use LBAFU in the common block command
Bin Meng [Wed, 13 Sep 2017 02:00:36 +0000 (19:00 -0700)]
cmd: blk: Use LBAFU in the common block command

There is already a macro LBAFU to aid formatted print with lbaint_t
variables. Let's use it in the common block command codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoblk: Remove various places that do flush cache after read
Bin Meng [Wed, 13 Sep 2017 02:00:23 +0000 (19:00 -0700)]
blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>
7 years agotest: overlay: Add unit test for stacked overlay
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:23 +0000 (23:12 +0300)]
test: overlay: Add unit test for stacked overlay

Verify that stacked overlays work.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agout: fix fdt_getprop_u32() change
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:22 +0000 (23:12 +0300)]
ut: fix fdt_getprop_u32() change

fdt_getprop_u32 is not exported and it's different than what the
unit test uses. Rename u32 prop access methods to something that's
unit test specific.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agoconfig: sandbox: Add unit tests
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:21 +0000 (23:12 +0300)]
config: sandbox: Add unit tests

Add unit tests for sandbox default config.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agodtbo: make dtbos special
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:20 +0000 (23:12 +0300)]
dtbo: make dtbos special

Special rule for dtbo generation

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agodoc: overlays: Tweak documentation regarding overlays
Franklin S Cooper Jr [Mon, 4 Sep 2017 20:12:19 +0000 (23:12 +0300)]
doc: overlays: Tweak documentation regarding overlays

Pull some information regarding overlays from commit messages and
put them directly within the documentation. Also add some information
regarding required dtc version to properly use overlays.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agodoc: Document how to apply fdt overlays
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:18 +0000 (23:12 +0300)]
doc: Document how to apply fdt overlays

We have the capability to apply overlays on the command line but
we didn't have a document explaining how.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Reviewed-by: Łukasz Majewski
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofit: fdt overlays doc
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:17 +0000 (23:12 +0300)]
fit: fdt overlays doc

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Reviewed-by: Łukasz Majewski
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofit: Introduce methods for applying overlays on fit-load
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:16 +0000 (23:12 +0300)]
fit: Introduce methods for applying overlays on fit-load

Introduce an overlay based method for constructing a base DT blob
to pass to the kernel.

It is based on a specific method now to get the FDT from a FIT image
named boot_get_fdt_fit().

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofit: Do not throw away extra configuration on fit_image_load()
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:15 +0000 (23:12 +0300)]
fit: Do not throw away extra configuration on fit_image_load()

fit_image_load() threw away the extra configuration parts when
loading. We need them around for applying extra overlays for
building the boot fdt.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofit: Allow multiple images per property
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:14 +0000 (23:12 +0300)]
fit: Allow multiple images per property

As part of the fdt overlay support which need it, allow
a list of configurations per property.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofdt: Allow stacked overlays phandle references
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:13 +0000 (23:12 +0300)]
fdt: Allow stacked overlays phandle references

This patch enables an overlay to refer to a previous overlay's
labels by performing a merge of symbol information at application
time.

In a nutshell it allows an overlay to refer to a symbol that a previous
overlay has defined. It requires both the base and all the overlays
to be compiled with the -@ command line switch so that symbol
information is included.

base.dts
--------

/dts-v1/;
/ {
foo: foonode {
foo-property;
};
};

$ dtc -@ -I dts -O dtb -o base.dtb base.dts

bar.dts
-------

/dts-v1/;
/plugin/;
/ {
fragment@1 {
target = <&foo>;
__overlay__ {
overlay-1-property;
bar: barnode {
bar-property;
};
};
};
};

$ dtc -@ -I dts -O dtb -o bar.dtb bar.dts

baz.dts
-------

/dts-v1/;
/plugin/;
/ {
fragment@1 {
target = <&bar>;
__overlay__ {
overlay-2-property;
baz: baznode {
baz-property;
};
};
};
};

$ dtc -@ -I dts -O dtb -o baz.dtb baz.dts

Applying the overlays:

$ fdtoverlay -i base.dtb -o target.dtb bar.dtb baz.dtb

Dumping:

$ fdtdump target.dtb
/ {
            foonode {
                overlay-1-property;
                foo-property;
                linux,phandle = <0x00000001>;
                phandle = <0x00000001>;
                barnode {
                    overlay-2-property;
                    phandle = <0x00000002>;
                    linux,phandle = <0x00000002>;
                    bar-property;
                    baznode {
                        phandle = <0x00000003>;
                        linux,phandle = <0x00000003>;
                        baz-property;
                    };
                };
            };
            __symbols__ {
                baz = "/foonode/barnode/baznode";
                bar = "/foonode/barnode";
                foo = "/foonode";
            };
};

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofdt: Switch to using the verbose overlay application method
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:12 +0000 (23:12 +0300)]
fdt: Switch to using the verbose overlay application method

The verbose overlay application method prints out more helpful
messages, so switch to it.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofdt: Introduce helper method fdt_overlay_apply_verbose()
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:11 +0000 (23:12 +0300)]
fdt: Introduce helper method fdt_overlay_apply_verbose()

Introduce fdt_overlay_apply_verbose, a method that applies an
overlay but in the case of an error produces a helpful message.

In addition if a base tree is found to be missing the __symbols__
node the message will point out that the probable reason is that
the base tree was miscompiled without the -@ option.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agolibfdt: Initialize the stack variable
Tien Fong Chee [Wed, 30 Aug 2017 05:15:42 +0000 (13:15 +0800)]
libfdt: Initialize the stack variable

Report Coverity log:
The code uses a variable that has not
been initialized, leading to unpredictable
or unintended results.

Reported-by: Coverity (CID: 60519)
Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
7 years agodtoc: Add a header to the generated files
Simon Glass [Tue, 29 Aug 2017 20:16:01 +0000 (14:16 -0600)]
dtoc: Add a header to the generated files

Add a header that indicates that the files generated by dtoc should not be
modified.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Rename the auto-generated dt-structs.h file
Simon Glass [Tue, 29 Aug 2017 20:16:00 +0000 (14:16 -0600)]
dtoc: Rename the auto-generated dt-structs.h file

The filename of the auto-generated file is the same as the file that
includes it. Even though the form is in the generated/ subdirectory, this
could be confused.

Rename the generated file to something that makes it clear it is
auto-generated.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Support properties containing multiple phandle values
Simon Glass [Tue, 29 Aug 2017 20:15:59 +0000 (14:15 -0600)]
dtoc: Support properties containing multiple phandle values

At present dtoc has a very simplistic view of phandles. It assumes that
a property has only a single phandle with a single argument (i.e. two
cells per property).

This is not true in many cases. Enhance the implementation to scan all
phandles in a property and to use the correct number of arguments (which
can be 0, 1, 2 or more) when generating the C code. For the struct
definitions, use a struct which can hold the maximum number of arguments
used by the property.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Put phandle args in an array
Simon Glass [Tue, 29 Aug 2017 20:15:58 +0000 (14:15 -0600)]
dtoc: Put phandle args in an array

We want to support more than one phandle argument. It makes sense to use
an array for this rather than discrete struct members. Adjust the code to
support this. Rename the member to 'arg' instead of 'id'.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Put each phandle on a separate line
Simon Glass [Tue, 29 Aug 2017 20:15:57 +0000 (14:15 -0600)]
dtoc: Put each phandle on a separate line

When writing values from properties which contain phandles, dtoc currently
writes 8 phandles per line. Change this to write one phandle per line.
This helps reduce line length, since phandles are generally longer and may
have arguments.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Rename the phandle struct
Simon Glass [Tue, 29 Aug 2017 20:15:56 +0000 (14:15 -0600)]
dtoc: Rename the phandle struct

Rather than naming the phandle struct according to the number of cells it
uses (e.g. struct phandle_2_cell) name it according to the number of
arguments it has (e.g. struct phandle_1_arg). This is a more intuitive
naming.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Rename is_phandle() and adjust it to return more detail
Simon Glass [Tue, 29 Aug 2017 20:15:55 +0000 (14:15 -0600)]
dtoc: Rename is_phandle() and adjust it to return more detail

Update this function to return more detail about a property that contains
phandles. This will allow (in a future commit) more accurate handling of
these properties.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Make is_phandle() a member function
Simon Glass [Tue, 29 Aug 2017 20:15:54 +0000 (14:15 -0600)]
dtoc: Make is_phandle() a member function

This function will need to have access to class members once we enhance it
to support multiple phandle values. In preparation for that, move it into
the class.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Use the Fdt's class's phandle map
Simon Glass [Tue, 29 Aug 2017 20:15:53 +0000 (14:15 -0600)]
dtoc: Use the Fdt's class's phandle map

Now that the Fdt class can map phandles to the associated nodes, use that
instead of a separate implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Update the Fdt class to record phandles
Simon Glass [Tue, 29 Aug 2017 20:15:52 +0000 (14:15 -0600)]
dtoc: Update the Fdt class to record phandles

Add a map from phandles to nodes. This can be used by clients of the the
class instead of maintaining this themselves.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Handle 'reg' properties with unusual sizes
Simon Glass [Tue, 29 Aug 2017 20:15:51 +0000 (14:15 -0600)]
dtoc: Handle 'reg' properties with unusual sizes

At present dtoc assumes that all 'reg' properties have both an address and
a size. For I2C devices we do not have this. Adjust dtoc to cope.

Reported-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Add support for 32 or 64-bit addresses
Simon Glass [Tue, 29 Aug 2017 20:15:50 +0000 (14:15 -0600)]
dtoc: Add support for 32 or 64-bit addresses

When using 32-bit addresses dtoc works correctly. For 64-bit addresses it
does not since it ignores the #address-cells and #size-cells properties.

Update the tool to use fdt64_t as the element type for reg properties when
either the address or size is larger than one cell. Use the correct value
so that C code can obtain the information from the device tree easily.

Alos create a new type, fdt_val_t, which is defined to either fdt32_t or
fdt64_t depending on the word size of the machine. This type corresponds
to fdt_addr_t and fdt_size_t. Unfortunately we cannot just use those types
since they are defined to phys_addr_t and phys_size_t which use
'unsigned long' in the 32-bit case, rather than 'unsigned int'.

Add tests for the four combinations of address and size values (32/32,
64/64, 32/64, 64/32). Also update existing uses for rk3399 and rk3368
which now need to use the new fdt_val_t type.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heiko Stuebner <heiko@sntech.de>
Reported-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Avoid very long lines in output
Simon Glass [Tue, 29 Aug 2017 20:15:49 +0000 (14:15 -0600)]
dtoc: Avoid very long lines in output

Large arrays can result in lines with hundreds or thousands of characters
which is not very editor-friendly. To avoid this, addjust the tool to
group values 8 per line.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Add a 64-bit type and a way to convert cells into 64 bits
Simon Glass [Tue, 29 Aug 2017 20:15:48 +0000 (14:15 -0600)]
dtoc: Add a 64-bit type and a way to convert cells into 64 bits

When dealing with multi-cell values we need a type that can hold this
value. Add this and a function to process it from a list of cell values.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Adjust Node to record its parent
Simon Glass [Tue, 29 Aug 2017 20:15:47 +0000 (14:15 -0600)]
dtoc: Adjust Node to record its parent

We need to be able to search back up the tree for #address-cells and
 #size-cells. Record the parent of each node to make this easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agofdt: Sync libfdt up to upstream
Simon Glass [Tue, 29 Aug 2017 20:15:46 +0000 (14:15 -0600)]
fdt: Sync libfdt up to upstream

Add upstream changes to U-Boot:

- new pylibfdt functions
- fdt_setprop_placeholder()

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoTravis-CI: Switch back to using the top of tree dtc
Tom Rini [Thu, 14 Sep 2017 15:29:33 +0000 (11:29 -0400)]
Travis-CI: Switch back to using the top of tree dtc

In a0f3e3df4adc we switched to using the Ubuntu-provided dtc as travis
was having a problem with the number of warnings that were generated by
the newer dtc.  This is no longer a concern as we now have the same
logic as Linux to enable/disable additional more stringent warnings.  Go
back to building dtc from source.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on travis-ci:
Tested-by: Simon Glass <sjg@chromium.org>
7 years agocheckpatch: update from Linux v4.13-rc6
Heinrich Schuchardt [Tue, 12 Sep 2017 07:57:45 +0000 (09:57 +0200)]
checkpatch: update from Linux v4.13-rc6

Checkpatch produces the following warning:

Unescaped left brace in regex is deprecated here
(and will be fatal in Perl 5.30), passed through in regex;
marked by <-- HERE in m/^(\+.*(?:do|\))){ <-- HERE /
at scripts/checkpatch.pl line 3348.

The curent checkpatch of the Linux kernel corrects this
bug and many others.

It provides improved colored output.

So replace checkpatch by the current Linux version.

Add an empty file scripts/const_structs.checkpatch.
We can later fill it according to our needs.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
7 years agolib: strto: fix incorrect handling of specified base
Rob Clark [Mon, 11 Sep 2017 20:53:08 +0000 (16:53 -0400)]
lib: strto: fix incorrect handling of specified base

The strto functions should honor the specified base (if non-zero) rather
than permitting a hex or octal string when the user wanted (for example)
base 10.

This has been fixed somewhere along the way in the upstream linux kernel
src tree, at some point after these was copied in to u-boot.  And also
in a way that duplicates less code.  So port _parse_integer_fixup_radix()
to u-boot.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoadd pytests for 'gpt rename' and 'gpt swap'
Alison Chaiken [Sun, 10 Sep 2017 06:54:51 +0000 (23:54 -0700)]
add pytests for 'gpt rename' and 'gpt swap'

Add unit tests for the 'gpt rename' and 'gpt swap' commands that
rely on the block device created by test/py/make_test_disk.py.
Add CONFIG_CMD_GPT_RENAME to the sandbox_defconfig.  Remove the
testdisk.raw test device at the end of the tests.

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoadd pytests for 'gpt guid' command in sandbox
Alison Chaiken [Sun, 10 Sep 2017 06:47:13 +0000 (23:47 -0700)]
add pytests for 'gpt guid' command in sandbox

Run unit tests for the 'gpt guid' command, making use of the block
device created by test/py/make_test_disk.py.  Remove this device at
the end of the tests.

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>