]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
14 months agotest/py: always use autostart on tpm2 selftests
Ilias Apalodimas [Wed, 25 Oct 2023 07:25:25 +0000 (10:25 +0300)]
test/py: always use autostart on tpm2 selftests

commit 789ed2784256 ("test/py: replace 'tpm2 init, startup, selftest' sequences")
changed some of the tpm2 init sequences to 'tpm2 autostart' instead of
calling 'tpm init', 'tpm startup TPM2_SU_CLEAR', 'tpm2 self_test full'.

The autostart command calls the afforementioned sequence and on top of
that deals with the 'tpm2 init' return codes if the tpm is already
started. Since we initialize the tpm from various subsystems now,
replace the last remaining instances of 'tpm2 init' with 'tpm2
autostart'.  Since the latter calls 'tpm2 init' anyway we will still be
implicitly testing the validity of that command

It's worth noting that since 'tpm2 autostart' performs the startup and
self tests sequences of the tpm we could drop
'test_tpm2_sandbox_self_test_full' and 'test_tpm2_startup, but let's
keep the since they test tpm commands and options

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
14 months agotest: use a non system PCR for testing PCR extend
Ilias Apalodimas [Tue, 24 Oct 2023 15:43:54 +0000 (10:43 -0500)]
test: use a non system PCR for testing PCR extend

We currently use PCR 0 for testing the PCR read/extend functionality in
our selftests.  How ever those PCRs are defined by the TCG spec for
platform use.  For example if the tests run *after* the efi subsystem
initialization, which extends PCRs 0 & 7 it will give a false positive.

So let's switch over to a PCR which is more suitable and is defined for
OS use.  It's worth noting that we are using PCR10 here, since PCR9 is
used internally by U-Boot if we choose to measure the loaded DTB

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
14 months agoefi_loader: fix EFI_ENTRY point on get_active_pcr_banks
Ilias Apalodimas [Tue, 24 Oct 2023 15:43:53 +0000 (10:43 -0500)]
efi_loader: fix EFI_ENTRY point on get_active_pcr_banks

efi_tcg2_get_active_pcr_banks doesn't immediately call the
EFI_ENTRY() wrapper once it enters the function. Move the call a
few lines above to cover the error cases properly as well.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
14 months agodoc: Add measured boot documentation
Eddie James [Tue, 24 Oct 2023 15:43:52 +0000 (10:43 -0500)]
doc: Add measured boot documentation

Briefly describe the feature and specify the requirements.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
14 months agotest: Add sandbox TPM boot measurement
Eddie James [Tue, 24 Oct 2023 15:43:51 +0000 (10:43 -0500)]
test: Add sandbox TPM boot measurement

Use the sandbox TPM driver to measure some boot images in a unit
test case.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
14 months agobootm: Support boot measurement
Eddie James [Tue, 24 Oct 2023 15:43:50 +0000 (10:43 -0500)]
bootm: Support boot measurement

Add a configuration option to measure the boot through the bootm
function. Add the measurement state to the booti and bootz paths
as well.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Ilias: Added some info on Kconfig explaining this is when booting !EFI
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
14 months agotpm: Support boot measurements
Eddie James [Tue, 24 Oct 2023 15:43:49 +0000 (10:43 -0500)]
tpm: Support boot measurements

Add TPM2 functions to support boot measurement. This includes
starting up the TPM, initializing/appending the event log, and
measuring the U-Boot version. Much of the code was used in the
EFI subsystem, so remove it there and use the common functions.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
For the API moving around from EFI -> u-boot core
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
For EFI testing
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
14 months agotpm: sandbox: Update for needed TPM2 capabilities
Eddie James [Tue, 24 Oct 2023 15:43:48 +0000 (10:43 -0500)]
tpm: sandbox: Update for needed TPM2 capabilities

The driver needs to support getting the PCRs in the capabilities
command. Fix various other things and support the max number
of PCRs for TPM2.
Remove the !SANDBOX dependency for EFI TCG2 as well.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
14 months agotpm: Fix spelling for tpmu_ha union
Eddie James [Tue, 24 Oct 2023 15:43:47 +0000 (10:43 -0500)]
tpm: Fix spelling for tpmu_ha union

tmpu -> tpmu

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
14 months agoMerge branch '2023-09-30-Kconfig-updates' into next
Tom Rini [Sun, 1 Oct 2023 15:54:31 +0000 (11:54 -0400)]
Merge branch '2023-09-30-Kconfig-updates' into next

- Migrate one symbol from CFG to CONFIG and move where another is.

14 months agoMerge branch '2023-09-30-assorted-build-related-changes' into next
Tom Rini [Sun, 1 Oct 2023 15:54:16 +0000 (11:54 -0400)]
Merge branch '2023-09-30-assorted-build-related-changes' into next

- Assorted build cleanups / changes

14 months agocmd: xxd: move xxd into shell commands
Roger Knecht [Thu, 7 Sep 2023 14:51:43 +0000 (14:51 +0000)]
cmd: xxd: move xxd into shell commands

Move xxd into shell command section.

Signed-off-by: Roger Knecht <rknecht@pm.me>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoConvert CFG_SYS_UBOOT_START to Kconfig
Jesse Taube [Fri, 25 Aug 2023 01:59:48 +0000 (21:59 -0400)]
Convert CFG_SYS_UBOOT_START to Kconfig

Commit 65cc0e2a65d2 ("global: Move remaining CONFIG_SYS_* to CFG_SYS_*")
renamed CONFIG_SYS_UBOOT_START to CFG_SYS_UBOOT_START. Unfortunately,
this meant that the value was no longer available to the Makefile. This
caused imxrt to fail to boot. All the other boards that used this
variable were unaffected because they were using the default value
which is CONFIG_TEXT_BASE.

This commit converts CFG_SYS_UBOOT_START to Kconfig and sets the default
value to CONFIG_TEXT_BASE.

Suggested-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Suggested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoCI: allow jobs to be run in merge requests
Andrejs Cainikovs [Wed, 13 Sep 2023 14:15:36 +0000 (16:15 +0200)]
CI: allow jobs to be run in merge requests

Out-of-tree users could run an out-of-tree CI with limited coverage,
however it is convenient to be able to run the upstream CI from time
to time. To enable that we would need to change job rules to be able
to run on any GitLab event. Excerpt from GitLab documentation:

> Jobs with no rules default to except: merge_requests

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
14 months agotest: build dependency for event unit tests
Heinrich Schuchardt [Thu, 7 Sep 2023 16:43:17 +0000 (18:43 +0200)]
test: build dependency for event unit tests

The test_event_base and test_event_probe unit tests use function
event_register() which depends on CONFIG_EVENT_DYNAMIC=y.

Fixes: 7d02645fe4c0 ("event: Add a simple test")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoAdjust gitignore for /build
Rong Tao [Mon, 4 Sep 2023 02:50:04 +0000 (10:50 +0800)]
Adjust gitignore for /build

/build-* can't ignore /build.

Signed-off-by: Rong Tao <rongtao@cestc.cn>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agotest: fix comment indentation on tpm tests
Ilias Apalodimas [Thu, 1 Jun 2023 06:18:44 +0000 (09:18 +0300)]
test: fix comment indentation on tpm tests

One out comments is off by one, adjust it

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agoMerge tag 'dm-next-23sep23' of https://source.denx.de/u-boot/custodians/u-boot-dm...
Tom Rini [Sun, 24 Sep 2023 16:43:00 +0000 (12:43 -0400)]
Merge tag 'dm-next-23sep23' of https://source.denx.de/u-boot/custodians/u-boot-dm into next

buildman file-keeping and build-progress improvements
dm tree enhancement
adjust meaning of bootph-pre-ram/sram

15 months agocommon: Drop linux/printk.h from common header
Simon Glass [Fri, 15 Sep 2023 00:21:46 +0000 (18:21 -0600)]
common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agokontron_sl28: Use u-boot-update.bin instead of u-boot.update
Simon Glass [Thu, 7 Sep 2023 16:00:20 +0000 (10:00 -0600)]
kontron_sl28: Use u-boot-update.bin instead of u-boot.update

A '.update' extension does not get preserved by buildman, so change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Michael Walle <michael@walle.cc>
15 months agobuildman: Start the clock when the build starts
Simon Glass [Thu, 7 Sep 2023 16:00:19 +0000 (10:00 -0600)]
buildman: Start the clock when the build starts

The Kconfig and maintainer processing can take a while, sometimes 5
seconds or more. This skews the timing printed by buildmand when the build
completes. Start the clock when the threads start to avoid this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
15 months agobuildman: Show progress when regenerating the board.cfg file
Simon Glass [Thu, 7 Sep 2023 16:00:18 +0000 (10:00 -0600)]
buildman: Show progress when regenerating the board.cfg file

This can take a while, so show a message when starting.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by Tom Rini <trini@konsulko.com>

15 months agobuildman: Keep all common output files
Simon Glass [Thu, 7 Sep 2023 16:00:17 +0000 (10:00 -0600)]
buildman: Keep all common output files

Make a list of common output extensions and use it to ensure that the -k
option preserves all of these.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
15 months agocmd: dm: allow for selecting uclass and device
AKASHI Takahiro [Wed, 23 Aug 2023 01:49:47 +0000 (10:49 +0900)]
cmd: dm: allow for selecting uclass and device

The output from "dm tree" or "dm uclass" is a bit annoying
if the number of devices available on the system is huge.
(This is especially true on sandbox when I debug some DM code.)

With this patch, we can specify the uclass name or the device
name that we are interested in in order to limit the output.

For instance,

=> dm uclass usb
uclass 121: usb
0     usb@1 @ 0bcff8b0, seq 1

uclass 124: usb

=> dm tree usb:usb@1
 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 usb           0  [   ]   usb_sandbox           usb@1
 usb_hub       0  [   ]   usb_hub               `-- hub
 usb_emul      0  [   ]   usb_sandbox_hub           `-- hub-emul
 usb_emul      1  [   ]   usb_sandbox_flash             |-- flash-stick@0
 usb_emul      2  [   ]   usb_sandbox_flash             |-- flash-stick@1
 usb_emul      3  [   ]   usb_sandbox_flash             |-- flash-stick@2
 usb_emul      4  [   ]   usb_sandbox_keyb              `-- keyb@3

If you want forward-matching against a uclass or udevice name,
you can specify "-e" option.

=> dm uclass -e usb
uclass 15: usb_emul
0     hub-emul @ 0bcffb00, seq 0
1     flash-stick@0 @ 0bcffc30, seq 1
2     flash-stick@1 @ 0bcffdc0, seq 2
3     flash-stick@2 @ 0bcfff50, seq 3
4     keyb@3 @ 0bd000e0, seq 4

uclass 64: usb_mass_storage

uclass 121: usb
0     usb@1 @ 0bcff8b0, seq 1

uclass 122: usb_dev_generic

uclass 123: usb_hub
0     hub @ 0bcff9b0, seq 0

uclass 124: usb

=> dm tree -e usb
 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 usb           0  [   ]   usb_sandbox           usb@1
 usb_hub       0  [   ]   usb_hub               `-- hub
 usb_emul      0  [   ]   usb_sandbox_hub           `-- hub-emul
 usb_emul      1  [   ]   usb_sandbox_flash             |-- flash-stick@0
 usb_emul      2  [   ]   usb_sandbox_flash             |-- flash-stick@1
 usb_emul      3  [   ]   usb_sandbox_flash             |-- flash-stick@2
 usb_emul      4  [   ]   usb_sandbox_keyb              `-- keyb@3

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodm: core: Report bootph-pre-ram/sram node as pre-reloc after relocation
Jonas Karlman [Sun, 20 Aug 2023 22:03:18 +0000 (22:03 +0000)]
dm: core: Report bootph-pre-ram/sram node as pre-reloc after relocation

Nodes with bootph-pre-sram/ram props are bound in multiple phases:
1. At TPL (bootph-pre-sram) or SPL (bootph-pre-ram) phase
2. At U-Boot proper pre-relocation phase
3. At U-Boot proper normal phase

However the binding and U-Boot Driver Model documentation indicate that
only nodes marked with bootph-all or bootph-some-ram should be bound in
the U-Boot proper pre-relocation phase.

Change ofnode_pre_reloc to report a node with bootph-pre-ram/sram prop
with a pre-reloc status only after U-Boot proper pre-relocation phase.
Also update the ofnode_pre_reloc documentation to closer reflect the
binding and driver model documentation.

This changes behavior of what nodes are bound in the U-Boot proper
pre-relocation phase. Change to bootph-all or add bootph-some-ram prop
to restore prior behavior.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agoMerge tag 'x86-pull-20230922' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Fri, 22 Sep 2023 15:16:22 +0000 (11:16 -0400)]
Merge tag 'x86-pull-20230922' of https://source.denx.de/u-boot/custodians/u-boot-x86 into next

- Add bootstd support to 64-bit efi payload
- Fix a bug of missing setting size of initrd in pxeboot
- Allow Python packages to be dropped
- Reland "x86: Move FACP table into separate functions"
- Fixes for chromebook_link64 and chromebook_samus_tpl
- Fixes and improvements for coreboot
- x86 documentation updates

15 months agox86: doc: coreboot: Mention 64-bit Linux distros
Simon Glass [Wed, 20 Sep 2023 03:00:21 +0000 (21:00 -0600)]
x86: doc: coreboot: Mention 64-bit Linux distros

Add a little more detail as to why coreboot64 is preferred for booting
Linux distros.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Split out manual booting into its own file
Simon Glass [Wed, 20 Sep 2023 03:00:20 +0000 (21:00 -0600)]
x86: doc: Split out manual booting into its own file

Move this out of the main file since for simple users it is easier to
rely on standard boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Update summaries and add links
Simon Glass [Thu, 21 Sep 2023 13:37:45 +0000 (07:37 -0600)]
x86: doc: Update summaries and add links

Refresh the summary information so it is more up-to-date. Add links to
the coreboot and slimbootloader docs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Move into its own directory
Simon Glass [Wed, 20 Sep 2023 03:00:18 +0000 (21:00 -0600)]
x86: doc: Move into its own directory

There is enough material that it makes sense to split this up into
several files. Create an x86/ directory for this purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Record the position of the SMBIOS tables
Simon Glass [Wed, 20 Sep 2023 03:00:17 +0000 (21:00 -0600)]
x86: coreboot: Record the position of the SMBIOS tables

Make a note of where coreboot installed the SMBIOS tables so that we can
pass this on to EFI.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoefi: Use the installed SMBIOS tables
Simon Glass [Wed, 20 Sep 2023 13:29:51 +0000 (07:29 -0600)]
efi: Use the installed SMBIOS tables

U-Boot should set up the SMBIOS tables during startup, as it does on x86.
Ensure that it does this correctly on non-x86 machines too, by creating
an event spy for last-stage init.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoRecord the position of the SMBIOS tables
Simon Glass [Wed, 20 Sep 2023 03:00:15 +0000 (21:00 -0600)]
Record the position of the SMBIOS tables

Remember where these end up so that we can pass this information on to
the EFI layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agobootstd: Keep track of use of usb stop
Simon Glass [Wed, 20 Sep 2023 13:29:49 +0000 (07:29 -0600)]
bootstd: Keep track of use of usb stop

When 'usb stop' is run, doing 'bootflow scan' does not run the USB hunter
again so does not see any devices. Fix this by telling bootstd about the
state of USB.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agox86: smbios: Add a Kconfig indicating SMBIOS-table presence
Simon Glass [Wed, 20 Sep 2023 03:00:13 +0000 (21:00 -0600)]
x86: smbios: Add a Kconfig indicating SMBIOS-table presence

When booted from coreboot, U-Boot does not build the SMBIOS tables, but
it should still pass them on to the OS. Add a new option which indicates
whether SMBIOS tables are present, however they were built.

Flip the ordering so that the dependency is listed first, which is less
confusing.

Adjust GENERATE_SMBIOS_TABLE to depend on this new symbol.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoefi: x86: Correct the condition for installing ACPI tables
Simon Glass [Wed, 20 Sep 2023 03:00:12 +0000 (21:00 -0600)]
efi: x86: Correct the condition for installing ACPI tables

It is not always the case that U-Boot builds the ACPI tables itself. For
example, when booting from coreboot, the ACPI tables are built by
coreboot.

Correct the Makefile condition so that U-Boot can pass on tables built
by a previous firmware stage.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Enable VIDEO_COPY
Simon Glass [Wed, 20 Sep 2023 03:00:11 +0000 (21:00 -0600)]
x86: coreboot: Enable VIDEO_COPY

At least on modern machines the write-back mechanism for the frame buffer
is quite slow when scrolling, since it must read the entire frame buffer
and write it back.

Enable the VIDEO_COPY feature to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Align options between coreboot and coreboot64
Simon Glass [Wed, 20 Sep 2023 03:00:10 +0000 (21:00 -0600)]
x86: coreboot: Align options between coreboot and coreboot64

These two builds are similar but have some different options for not good
reason. Line them up to be as similar as possible.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Drop USB init on startup
Simon Glass [Thu, 21 Sep 2023 13:37:44 +0000 (07:37 -0600)]
x86: coreboot: Drop USB init on startup

This is very annoying as it is quite slow on many machines. Also, U-Boot
has an existing 'preboot' mechanism to enable this feature if desired.

Drop this code so that it is possible to choose whether to init USB or
not.

Use the existing USE_PREBOOT mechanism instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Enable CONFIG_SYS_NS16550_MEM32
Simon Glass [Wed, 20 Sep 2023 03:00:08 +0000 (21:00 -0600)]
x86: coreboot: Enable CONFIG_SYS_NS16550_MEM32

The debug UART on modern machines uses a 32-bit wide transfer. Without
this, setting debug output causes a hang or no output. It is not obvious
(when enabling CONFIG_DEBUG_UART) that this is needed.

Enable 32-bit access to avoid this trap.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Look for DBG2 UART in SPL too
Simon Glass [Wed, 20 Sep 2023 03:00:07 +0000 (21:00 -0600)]
x86: coreboot: Look for DBG2 UART in SPL too

If coreboot does not set up sysinfo for the UART, SPL currently hangs.
Use the DBG2 technique there as well. This allows coreboot64 to boot from
coreboot even if the console info is missing from sysinfo

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Allow APCI in SPL
Simon Glass [Wed, 20 Sep 2023 03:00:06 +0000 (21:00 -0600)]
x86: Allow APCI in SPL

This is needed so we can find the DBG2 table provided by coreboot. Add a
Kconfig so it can be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Set the CPU vendor in SPL
Simon Glass [Wed, 20 Sep 2023 03:00:05 +0000 (21:00 -0600)]
x86: Set the CPU vendor in SPL

We don't read this information in 64-bit mode, since we don't have the
macros for doing it. Set it to Intel by default. This allows the TSC timer
to work correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Rearrange arch_cpu_init()
Simon Glass [Wed, 20 Sep 2023 03:00:04 +0000 (21:00 -0600)]
x86: coreboot: Rearrange arch_cpu_init()

Init errors in SPL are currently ignored by this function.

Change the code to init the CPU, reporting an error if something is wrong.
After that, look for the coreboot table.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Enable standard boot
Simon Glass [Wed, 20 Sep 2023 03:00:03 +0000 (21:00 -0600)]
x86: coreboot: Enable standard boot

Enable bootstd options and provide instructions on how to boot a linux
distro using coreboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Add IDE and SATA
Simon Glass [Wed, 20 Sep 2023 03:00:02 +0000 (21:00 -0600)]
x86: coreboot: Add IDE and SATA

Add these options to permit access to more disk types.

Add some documentation as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Update cbmem driver
Simon Glass [Sun, 10 Sep 2023 19:13:02 +0000 (13:13 -0600)]
x86: Update cbmem driver

This driver is not actually built since a Kconfig was never created for
it.

Add a Kconfig (which is already implied by COREBOOT) and update the
implementation to avoid using unnecessary memory. Drop the #ifdef at the
top since we can rely on Kconfig to get that right.

To enable it (in addition to serial and video), use:

   setenv stdout serial,vidconsole,cbmem

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[Modified the comment about overflow a little bit]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Document cbmem console struct
Simon Glass [Sun, 10 Sep 2023 19:13:01 +0000 (13:13 -0600)]
x86: coreboot: Document cbmem console struct

Coreboot changed a few years ago to include an overflow flag. Update the
structure to match this.

This comes from coreboot commit:

   6f5ead14b4 ("mb/google/nissa/var/joxer: Update eMMC DLL settings")

Note: There are several implementations of this in coreboot. I have chosen
to follow the one in src/lib/cbmem_console.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Update the list of supported Chromebooks
Simon Glass [Thu, 7 Sep 2023 15:58:21 +0000 (09:58 -0600)]
x86: doc: Update the list of supported Chromebooks

One is missing, so add it. Also mention the SoC used in each.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: dm: Mark driver model as dead when disabling CAR
Simon Glass [Thu, 7 Sep 2023 15:58:20 +0000 (09:58 -0600)]
x86: dm: Mark driver model as dead when disabling CAR

When turning off CAR, set the flag to make sure that nothing tries to use
driver model in SPL before jumping to U-Bot proper, since its tables are
in CAR.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: broadwell: Set up MTRRs
Simon Glass [Thu, 7 Sep 2023 15:58:19 +0000 (09:58 -0600)]
x86: broadwell: Set up MTRRs

The current condition does not handle the samus_tpl case where it sets
up the RAM in SPL but needs to commit the MTRRs in U-Boot proper.

Add another case to handle this and update the comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: broadwell: Avoid initing the CPU twice
Simon Glass [Thu, 7 Sep 2023 15:58:18 +0000 (09:58 -0600)]
x86: broadwell: Avoid initing the CPU twice

When TPL has already set up the CPU, don't do it again. This existing
code actually has this backwards, so fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: spl: Change the condition for copying U-Boot to RAM
Simon Glass [Thu, 7 Sep 2023 15:58:17 +0000 (09:58 -0600)]
x86: spl: Change the condition for copying U-Boot to RAM

Make this depend on whether the address matches the offset, rather than
a particular board build. For samus_tpl we don't need to copy, for
example.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: samus_tpl: Correct text base and alloc sizes
Simon Glass [Thu, 7 Sep 2023 15:58:16 +0000 (09:58 -0600)]
x86: samus_tpl: Correct text base and alloc sizes

Make sure that CONFIG_X86_OFFSET_U_BOOT is the same as CONFIG_TEXT_BASE
as it is changing CONFIG_X86_OFFSET_U_BOOT

Samus boots into U-Boot proper in flash, not RAM. Also expand the SPL
malloc() size a little, to avoid an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Add some log categories
Simon Glass [Thu, 7 Sep 2023 15:58:15 +0000 (09:58 -0600)]
x86: Add some log categories

Add some missing log categories to a few files.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: broadwell: Show the memory delay
Simon Glass [Thu, 7 Sep 2023 15:58:14 +0000 (09:58 -0600)]
x86: broadwell: Show the memory delay

Samus only takes 7 seconds but it is long enough to think it has hung. Add
a message about what it is doing, similar to the approach on coral.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agodm: core: Allow marking driver model as dead
Simon Glass [Thu, 7 Sep 2023 15:58:13 +0000 (09:58 -0600)]
dm: core: Allow marking driver model as dead

On x86 devices we use CAR (Cache-As-RAM) to hold the malloc() region in
SPL, since SDRAM is not set up yet. This means that driver model stores
its tables in this region.

When preparing to jump from SPL to U-Boot proper, we must disable CAR, so
that the CPU can uses the caches normally. This means that driver model
tables become inaccessible. From there until we jump to U-Boot proper, we
must avoid using driver model.

This is only a problem on boards which operate this way, for example
chromebook_link64

Add a flag to indicate that driver model is dead and should not be used.
It can be used in SPL to avoid hanging the machine.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Document the -cdrom issues I ran into
Simon Glass [Fri, 1 Sep 2023 18:08:23 +0000 (12:08 -0600)]
x86: doc: Document the -cdrom issues I ran into

Add a note about using -cdrom with QEMU.

Suggested-by: Bin Meng <bmeng@tinylab.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
15 months agox86: Prevent from missing the FADT chaining
Andy Shevchenko [Fri, 1 Sep 2023 17:27:10 +0000 (11:27 -0600)]
x86: Prevent from missing the FADT chaining

Recent approach with FADT writer shows that there is
a room for subtle errors. Prevent this from happening
again by introducing acpi_add_fadt() helper.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoReland "x86: Move FACP table into separate functions""
Simon Glass [Fri, 1 Sep 2023 17:27:09 +0000 (11:27 -0600)]
Reland "x86: Move FACP table into separate functions""

Each board has its own way of creating this table. Rather than calling the
acpi_create_fadt() function for each one from a common acpi_write_fadt()
function, just move the writer into the board-specific code.

Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
15 months agox86: coreboot: Avoid a declaration after a label
Simon Glass [Thu, 31 Aug 2023 17:20:53 +0000 (11:20 -0600)]
x86: coreboot: Avoid a declaration after a label

Declare the global_data pointer at the top of the file, to avoid an
error:

   arch/x86/include/asm/global_data.h:143:35: error: a label can
      only be part of a statement and a declaration is not a statement
   board/coreboot/coreboot/coreboot.c:60:2: note: in expansion of macro
      â€˜DECLARE_GLOBAL_DATA_PTR’

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoAllow Python packages to be dropped
Simon Glass [Thu, 31 Aug 2023 17:20:52 +0000 (11:20 -0600)]
Allow Python packages to be dropped

When building in a portage chroot, we do not have the environment needed
to build pylibfdt. It is instead build as a separate package.

Provide a build option to tell U-Boot to skip this part of the build. We
still need it to use binman, etc. but don't need it to build its
dependencies.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
[s/build bytes/builds bytes in tools.rst]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: pxeboot: bugfix: Set variable for size of initrd
Thomas Mittelstaedt [Thu, 4 May 2023 13:42:55 +0000 (13:42 +0000)]
x86: pxeboot: bugfix: Set variable for size of initrd

The problem was, that zboot() didn't work because of missing
ramdisc size.

Signed-off-by: Thomas Mittelstaedt <thomas.mittelstaedt@de.bosch.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agox86: efi-payload64: Add bootstd support
Thomas Mittelstaedt [Thu, 4 May 2023 13:42:54 +0000 (13:42 +0000)]
x86: efi-payload64: Add bootstd support

Enable bootstd support for U-Boot at VirtualBox described at
https://source.denx.de/u-boot/u-boot/-/blob/master/doc/develop/bootstd.rst

This is used to boot system images at Virtualbox via
- distroboot (extlinux.conf)
- boot script

Signed-off-by: Thomas Mittelstaedt <thomas.mittelstaedt@bosch.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[Added 'efi-payload64' tag]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: efi-payload64: Add support for SCSI devices
Thomas Mittelstaedt [Thu, 4 May 2023 13:42:53 +0000 (13:42 +0000)]
x86: efi-payload64: Add support for SCSI devices

U-Boot at VirtualBox must load Linux and boot configuration from disk devices.
Here the discs at AHCI (scsi) bus are used to load the needed boot data.

Signed-off-by: Thomas Mittelstaedt <thomas.mittelstaedt@de.bosch.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[Added 'efi-payload64' tag and rebased on top of u-boot/master]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)
Troy Kisky [Mon, 13 Mar 2023 21:31:43 +0000 (14:31 -0700)]
x86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)

This avoids an error when ifdef CONFIG_PCI is changed to
if CONFIG_IS_ENABLED(PCI)

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
[Rebased on top of u-boot/master]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoMerge tag 'xilinx-for-v2024.01-rc1-v2' of https://source.denx.de/u-boot/custodians...
Tom Rini [Thu, 21 Sep 2023 14:51:58 +0000 (10:51 -0400)]
Merge tag 'xilinx-for-v2024.01-rc1-v2' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2024.01-rc1

clk:
- Dont return error when assigned-clocks is empty or missing

dm:
- Support reading a single indexed u64 value
- Add support for reading bootscript address/flash address from DT

cmd:
- Fix flash_is_unlocked API

fpga:
- Define fpga_load() for debug build

global:
- U-Boot project name cleanup (next2)

net:
- zynq_gem: Use generic_phy_valid() helper
- axienet: Convert to ofnode functions
- gmii2rgmii: Read bridge address from DT

pytest:
- skip tpm2_startup when env__tpm_device_test_skip=True

spi-nor:
- Add mx25u25635f support
- zynqmp_qspi: Tune cache behavior

trace:
- Fix flyrecord alignment issue

xilinx:
- Move scriptaddr to DT as bootscr-address
- Pick script_offset_f/script_size_f from DT as bootscr-flash-offset/size
- Do not generate distro boot variables if disabled

versal:
- Extend memory ranges to cover HBM
- Enable TPM, sha1sum and KASLRSEED
- Fix distroboot prioritization in connection to available devices
- Clean mini targets bootcommand
- Fix clock driver

versal-net:
- Enable TPM, sha1sum and KASLRSEED
- Fix distroboot prioritization in connection to available devices

zynqmp;
- Allow AES to run from SPL
- Enable CMD_KASLRSEED
- Add proper dependencies for USB and remove ZYNQMP_USB
- Fix user si570 default frequency for zcu* boards
- Cover SOM rev2 revision
- Various DT changes
- Add firmware and pinctrl support for tristate configuration
  (high impedance/output enable)
- Add output-enable pins to SOMs
- Fix distroboot prioritization in connection to available devices
- Read bootscript address/flash address from DT
- Fix pcap_prog address

15 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-riscv into...
Tom Rini [Thu, 21 Sep 2023 14:51:15 +0000 (10:51 -0400)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-riscv into next

+ Add NVMe & USB boot devices for VisionFive2
+ Add StarFive SPL image support in mkimage tool

15 months agospi: zynqmp_qspi: Workaround for small data cache issue
Venkatesh Yadav Abbarapu [Fri, 15 Sep 2023 03:17:59 +0000 (08:47 +0530)]
spi: zynqmp_qspi: Workaround for small data cache issue

Cache related issues are seen with small sized data reads.
Due to this, proper data is not read. Also some times sf probe
fails randomly. To workaround this issue, invalidate dcache after read DMA
is triggered.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230915031759.28889-3-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agospi: zynqmp_qspi: Change flush cache to invalidate cache
Ashok Reddy Soma [Fri, 15 Sep 2023 03:17:58 +0000 (08:47 +0530)]
spi: zynqmp_qspi: Change flush cache to invalidate cache

Before DMA read, ideally cache should be invalidated, so that data from
memory will be updated to cache after DMA is completed. But
flush_dcache_range is being used which is incorrect. Change
flush_dcache_range to invalidate_dcache_range.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230915031759.28889-2-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agotrace: Fix alignment logic in flyrecord header
Michal Simek [Fri, 15 Sep 2023 12:12:05 +0000 (14:12 +0200)]
trace: Fix alignment logic in flyrecord header

Current alignment which is using 16 bytes is not correct in connection to
trace_clocks description and it's length.
That's why use start_addr variable and record proper size based on used
entries.

Fixes: be16fc81b2ed ("trace: Update proftool to use new binary format").
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/691dad64df80993ca4cfb6d0e33964ed26f50bee.1694779918.git.michal.simek@amd.com
15 months agotrace: Move trace_clocks description above record offset calculation
Michal Simek [Fri, 15 Sep 2023 12:12:04 +0000 (14:12 +0200)]
trace: Move trace_clocks description above record offset calculation

Flyrecord tracing data are page aligned that's why it is necessary to
calculate alignment properly. Because trace_clocks description is the part
of record length it is necessary to have information about length earlier.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/d3853d91b6fa7e3a1e5c24dd3c17335cf0041b5b.1694779918.git.michal.simek@amd.com
15 months agotrace: Use 64bit variable for start and len
Michal Simek [Fri, 15 Sep 2023 12:12:03 +0000 (14:12 +0200)]
trace: Use 64bit variable for start and len

tputq() requires variables to have 64bit width that's why make them 64bit
to clean alignment requirement.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/6edb34ef1f10010d2380f964fb6b4fb3dc257799.1694779918.git.michal.simek@amd.com
15 months agocmd: sf: Fix the flash_is_unlocked api size parameter
Venkatesh Yadav Abbarapu [Wed, 20 Sep 2023 02:54:50 +0000 (08:24 +0530)]
cmd: sf: Fix the flash_is_unlocked api size parameter

When flash erase is called with size parameter, code is checking
if sectors are locked or not. But for checking, the whole device
length minus offset is used instead of actual size which should
be erased. That's why when only some sectors are locked it is
not possible to erase unlocked sectors.

The length is calculated as "length = max_chipsize - offset",
flash_is_unlocked() api is getting updated with length which is
incorrect. Fix this flash_is_unlocked() api by passing the size
parameter.

ZynqMP> sf erase 0 100000
len=0x8000000 which is flash size
size=0x100000

We need to update the size in the flash_is_unlocked() api and not
the length.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20230920025450.6281-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agozynqmp: config: Add proper dependencies for USB
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:15:28 +0000 (08:45 +0530)]
zynqmp: config: Add proper dependencies for USB

When CONFIG_CMD_USB and CONFIG_USB are disabled, still some compilation
errors are seen as below.

In file included from include/configs/xilinx_zynqmp.h:173,
                 from include/config.h:3,
                 from include/common.h:16,
                 from env/common.c:10:
include/config_distro_bootcmd.h:302:9: error: expected '}' before 'BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB'
  302 |         BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/config_distro_bootcmd.h:302:9: note: in definition of macro
'BOOTENV_DEV_NAME_USB'
  302 |         BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/configs/xilinx_zynqmp.h:77:41: note: in expansion of macro
'BOOTENV_DEV_NAME'
   77 | # define BOOT_TARGET_DEVICES_USB(func)  func(USB, usb, 0)
   func(USB, usb, 1)
      |                                         ^~~~
include/configs/xilinx_zynqmp.h:168:9: note: in expansion of macro
'BOOT_TARGET_DEVICES_USB'
  168 |         BOOT_TARGET_DEVICES_USB(func) \
      |         ^~~~~~~~~~~~~~~~~~~~~~~
include/config_distro_bootcmd.h:454:25: note: in expansion of macro
'BOOT_TARGET_DEVICES'
  454 |         "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
      |                         ^~~~~~~~~~~~~~~~~~~
include/config_distro_bootcmd.h:474:9: note: in expansion of macro
'BOOTENV_BOOT_TARGETS'
  474 |         BOOTENV_BOOT_TARGETS \
      |         ^~~~~~~~~~~~~~~~~~~~
include/configs/xilinx_zynqmp.h:179:9: note: in expansion of macro
'BOOTENV'
  179 |         BOOTENV
      |         ^~~~~~~
include/env_default.h:120:9: note: in expansion of macro
'CFG_EXTRA_ENV_SETTINGS'
  120 |         CFG_EXTRA_ENV_SETTINGS
      |         ^~~~~~~~~~~~~~~~~~~~~~
In file included from env/common.c:32:
include/env_default.h:27:36: note: to match this '{'
   27 | const char default_environment[] = {
      |                                    ^
scripts/Makefile.build:256: recipe for target 'env/common.o' failed
make[1]: *** [env/common.o] Error 1
Makefile:1853: recipe for target 'env' failed
make: *** [env] Error 2
make: *** Waiting for unfinished jobs....

Add CONFIG_USB_STORAGE as dependency for USB related macro's such as
BOOT_TARGET_DEVICES_USB() and DFU_DEFAULT_POLL_TIMEOUT and
CONFIG_THOR_RESET_OFF.

Remove CONFIG_ZYNQMP_USB from Kconfig and also from defconfig since it
is not used anywhere else.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230904031528.11817-3-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agocmd: thordown: Add proper dependency for CMD_THOR_DOWNLOAD
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:15:27 +0000 (08:45 +0530)]
cmd: thordown: Add proper dependency for CMD_THOR_DOWNLOAD

When CONFIG_CMD_USB and CONFIG_USB are disabled some compilation errors are seen as below.

cmd/thordown.o: in function `usb_gadget_initialize':
include/linux/usb/gadget.h:981: undefined reference to `board_usb_init'
cmd/thordown.o: in function `do_thor_down':
cmd/thordown.c:68: undefined reference to `g_dnl_unregister'
cmd/thordown.o: in function `usb_gadget_release':
include/linux/usb/gadget.h:986: undefined reference to `board_usb_cleanup'
cmd/thordown.o: in function `do_thor_down':
cmd/thordown.c:41: undefined reference to `g_dnl_register'
cmd/thordown.c:48: undefined reference to `thor_init'
cmd/thordown.c:56: undefined reference to `thor_handle'
gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ld.bfd: line 4:  8485
Segmentation fault      (core dumped) $CC --sysroot=$LIBC
--no-warn-rwx-segment "$@"
Makefile:1779: recipe for target 'u-boot' failed
make: *** [u-boot] Error 139
make: *** Deleting file 'u-boot'

Add dependency of USB_GADGET_DOWNLOAD for CONFIG_CMD_THOR_DOWNLOAD to fix the errors.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Link: https://lore.kernel.org/r/20230904031528.11817-2-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoclk: versal: Fix the function versal_clock_ref
Venkatesh Yadav Abbarapu [Tue, 12 Sep 2023 03:30:55 +0000 (09:00 +0530)]
clk: versal: Fix the function versal_clock_ref

For reference clocks, PM_CLK_GET_PARENT call is not allowed.
PM_CLK_GET_PARENT only allowed for MUX clocks. Rename the
versal_clock_ref() with versal_clock_get_ref_rate() for better
readability. Fix the versal_clock_get_ref_rate function by
passing the parent_id, and check whether the parent_id
belongs to ref_clk or pl_alt_ref_clk.
Also adding the function versal_clock_get_fixed_factor_rate()
if the clk_id belongs to the fixed factor clock.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230912033055.2549-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoarm64: zynqmp: Update ECAM size to discover up to 256 buses
Thippeswamy Havalige [Mon, 11 Sep 2023 14:10:50 +0000 (16:10 +0200)]
arm64: zynqmp: Update ECAM size to discover up to 256 buses

Update ECAM size to discover up to 256 buses

Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
Acked-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/087391c3e1f60b0a765fca081d47ce632fda8f06.1694441445.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Add resets property for CAN nodes
Srinivas Neeli [Mon, 11 Sep 2023 14:10:49 +0000 (16:10 +0200)]
arm64: zynqmp: Add resets property for CAN nodes

Added resets property for CAN nodes.

Signed-off-by: Srinivas Neeli <srinivas.neeli@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c4efb7ac361eec591a2f775e161ec446c4dc04c1.1694441445.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Fix i2c address for si570_user1 clock
Saeed Nowshadi [Mon, 11 Sep 2023 14:10:48 +0000 (16:10 +0200)]
arm64: zynqmp: Fix i2c address for si570_user1 clock

Correct the i2c address for si570 oscillator that generates the si570_user1
clock. i2c address was changed by commit b6a8c603d680 ("arm64: zynqmp: Fix
i2c addresses for vck190 SC") because address in node name wasn't aligned
with reg property. But actual 0x5f address is correct which is quite rare
because all other si570s are at 0x5d.

Signed-off-by: Saeed Nowshadi <saeed.nowshadi@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/6f31881b0e2dd657f0d4ff0869c009c2e1224f22.1694441445.git.michal.simek@amd.com
15 months agoarm64: versal: Add no-wp DT property in OSPI flash node
Amit Kumar Mahapatra [Mon, 11 Sep 2023 14:10:47 +0000 (16:10 +0200)]
arm64: versal: Add no-wp DT property in OSPI flash node

Added no-wp DT property in OSPI flash node for all board dts & dtsi files
on which the WP# signal of the OSPI flash device is not connected. If this
property is set, then the software will avoid setting the status register
write disable (SRWD) bit in status register during status register
write operation.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/7e88dd7b9306bdf0738b2248bf9017e1997d25dc.1694441445.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Rename xlnx, mio_bank to xlnx, mio-bank for DLC21
Michal Simek [Mon, 11 Sep 2023 14:10:46 +0000 (16:10 +0200)]
arm64: zynqmp: Rename xlnx, mio_bank to xlnx, mio-bank for DLC21

xlnx,mio_bank was used in past but it was renamed to xlnx,mio-bank because
'_' in property shoudln't be used. There is no impact on the platform
because if the properly is not defined bank 0 is default. Bank 0 and 1 have
the same configuration that's why there shouldn't be any issue.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ace68d4b7701d1606a85cb18242409fce941b363.1694441445.git.michal.simek@amd.com
15 months agodm: core: ofnode: Fix error message in ofnode_read_bootscript_address/flash()
Michal Simek [Mon, 11 Sep 2023 13:30:01 +0000 (15:30 +0200)]
dm: core: ofnode: Fix error message in ofnode_read_bootscript_address/flash()

Missing u-boot node shouldn't be visible in bootlog without debug enabled
that's why change message from printf to debug.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ff62e980237ab271cf05facfbc306e85914a8c6e.1694438999.git.michal.simek@amd.com
15 months agonet: phy: xilinx-gmii2rgmii: Removed hardcoded phy address 0 for bridge
Tejas Bhumkar [Fri, 15 Sep 2023 04:50:43 +0000 (10:20 +0530)]
net: phy: xilinx-gmii2rgmii: Removed hardcoded phy address 0 for bridge

Current code expects bridge phy address at 0 which is not correct
expectation because bridge phy address is configurable.
That's why update the code to read reg property to figure it out
where bridge is and use it in phy creation code.

Signed-off-by: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230915045043.4167628-1-tejas.arvind.bhumkar@amd.com
15 months agoarm64: zynqmp: Corrected pcap_prog register address
Lukas Funke [Fri, 15 Sep 2023 09:39:01 +0000 (11:39 +0200)]
arm64: zynqmp: Corrected pcap_prog register address

Currently the pcap_prog struct variable is pointing to 0x3004 which is
incorrect according to [1]. The variable should point to 0x3000.

[1] https://www.xilinx.com/htmldocs/registers/ug1087/ug1087-zynq-ultrascale-registers.html#csu___pcap_prog.html

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Link: https://lore.kernel.org/r/20230915093901.1062825-1-lukas.funke-oss@weidmueller.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoglobal: Use proper project name U-Boot (next2)
Michal Simek [Fri, 8 Sep 2023 07:11:31 +0000 (09:11 +0200)]
global: Use proper project name U-Boot (next2)

Use proper project name in README, rst and comment.
Done in connection to commit bb922ca3eb4b ("global: Use proper project name
U-Boot (next)").

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexander Graf <graf@csgraf.de> (ppce500)
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/536af05e7061982f15b668e87f941cdabfa25392.1694157084.git.michal.simek@amd.com
15 months agonet: axi_emac: Convert to ofnode functions
Maxim Kochetkov [Fri, 11 Aug 2023 07:43:51 +0000 (10:43 +0300)]
net: axi_emac: Convert to ofnode functions

FDT functions is not working when OF_LIVE is enabled.
Convert fdt parsing functions to ofnode parsing functions.

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Link: https://lore.kernel.org/r/20230811074351.26916-1-fido_max@inbox.ru
15 months agoarm64: xilinx: Guard distro boot variable generation
Michal Simek [Tue, 5 Sep 2023 11:30:07 +0000 (13:30 +0200)]
arm64: xilinx: Guard distro boot variable generation

When distro boot is disabled there is no reason to generate variables for
it. Also do not update boot_targets variable because it would be unused.

It is useful for example when standard boot is enabled and distro boot
is disabled.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/570c51435da59831ec245cddceda078afa58a550.1693913398.git.michal.simek@amd.com
15 months agoarm64: versal: Do not define boot command for mini configurations
Michal Simek [Tue, 5 Sep 2023 08:23:36 +0000 (10:23 +0200)]
arm64: versal: Do not define boot command for mini configurations

Mini configuration is not design to boot anything that's why there is no
reason to setup boot command. CONFIG_DISTRO_DEFAULTS is disabled anyway.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/41ac52d946ac53d162c407094dc215e6a932af92.1693902205.git.michal.simek@amd.com
15 months agoxilinx: zynqmp: Do not setup boot_targets if driver is not enabled
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:20:35 +0000 (08:50 +0530)]
xilinx: zynqmp: Do not setup boot_targets if driver is not enabled

SOC can boot in the device which is not accessible from APU and running
this is detected as error which ends up in stopping boot process.
Boot mode detection and logic around is present to setup priority on boot
devices that SOC boot device is likely also used for booting OS.
Change logic to detect this case with showing message about it but don't fail
in boot process and don't prioritize boot device in this case.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230904032035.11926-4-venkatesh.abbarapu@amd.com
15 months agoxilinx: versal: Do not setup boot_targets if driver is not enabled
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:20:34 +0000 (08:50 +0530)]
xilinx: versal: Do not setup boot_targets if driver is not enabled

SOC can boot in the device which is not accessible from APU and running
this is detected as error which ends up in stopping boot process.
Boot mode detection and logic around is present to setup priority on boot
devices that SOC boot device is likely also used for booting OS.
Change logic to detect this case with showing message about it but don't fail
in boot process and don't prioritize boot device in this case.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230904032035.11926-3-venkatesh.abbarapu@amd.com
15 months agoxilinx: versal-net: Do not setup boot_targets if driver is not enabled
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:20:33 +0000 (08:50 +0530)]
xilinx: versal-net: Do not setup boot_targets if driver is not enabled

SOC can boot in the device which is not accessible from APU and running
this is detected as error which ends up in stopping boot process.
Boot mode detection and logic around is present to setup priority
on boot devices that SOC boot device is likely also used for booting OS.
Change logic to detect this case with showing message about it but don't
fail in boot process and don't prioritize boot device in this case.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230904032035.11926-2-venkatesh.abbarapu@amd.com
15 months agoxilinx: board: Add support to pick bootscr flash offset/size from DT
Michal Simek [Thu, 31 Aug 2023 07:04:28 +0000 (09:04 +0200)]
xilinx: board: Add support to pick bootscr flash offset/size from DT

Location of bootscript in flash can be specified via /options/u-boot DT
node by using bootscr-flash-offset and bootscr-flash-size properties.
Values should be saved to script_offset_f and script_size_f variables.
Variables are described in doc/develop/bootstd.rst as:
script_offset_f
    SPI flash offset from which to load the U-Boot script, e.g. 0xffe000

script_size_f
    Size of the script to load, e.g. 0x2000

Both of them are used by sf_get_bootflow() in drivers/mtd/spi/sf_bootdev.c
to identify bootscript location inside flash.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/60a84405f3fefabb8b48a4e1ce84431483a729f3.1693465465.git.michal.simek@amd.com
15 months agodm: core: ofnode: Add ofnode_read_bootscript_flash()
Michal Simek [Thu, 31 Aug 2023 07:04:27 +0000 (09:04 +0200)]
dm: core: ofnode: Add ofnode_read_bootscript_flash()

ofnode_read_bootscript_flash() reads bootscript address from
/options/u-boot DT node. bootscr-flash-offset and bootscr-flash-size
properties are read and values are filled. When bootscr-flash-size is not
defined, bootscr-flash-offset property is unusable that's why cleaned.
Both of these properties should be defined to function properly.

Also add test to cover this new function.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/08a3e6c09cce13287c69ad370e409e7f1766b406.1693465465.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Add output-enable pins to SOMs
Neal Frager [Thu, 31 Aug 2023 14:27:53 +0000 (16:27 +0200)]
arm64: zynqmp: Add output-enable pins to SOMs

Now that the zynqmp pinctrl driver supports the tri-state registers, make
sure that the pins requiring output-enable are configured appropriately for
SOMs.

Without it, all tristate setting for MIOs, which are not related to SOM
itself, are using default configuration which is not correct setting.
It means SDs, USBs, ethernet, etc. are not working properly.

In past it was fixed through calling tristate configuration via bootcmd:
usb_init=mw 0xFF180208 2020
kv260_gem3=mw 0xFF18020C 0xFC0 && gpio toggle gpio@ff0a000038 && \
  gpio toggle gpio@ff0a000038

Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/7ecd98b2a302c5c6628e0234482f23c38e721fd6.1693492064.git.michal.simek@amd.com
15 months agoxilinx: board: Add support to pick bootscr address from DT
Algapally Santosh Sagar [Thu, 31 Aug 2023 06:59:06 +0000 (08:59 +0200)]
xilinx: board: Add support to pick bootscr address from DT

The bootscript is expected at a default address specific to each
platform.
When high speed memory like Programmable Logic Double Data Rate RAM
(PL DDR RAM) or Higher Bandwidth Memory RAM (HBM) is used the boot.scr
may be loaded at a different offset. The offset needs to be set through
setenv. Due to the default values in some cases the boot.scr is falling
in between the kernel partition.

The bootscript address or the bootscript offset is fetched directly from
the DT and updated in the environment making it easier for automated
flows.

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/fac7020b31e1f150b021d666f0d588579ea671ad.1693465140.git.michal.simek@amd.com
15 months agodm: core: ofnode: Add ofnode_read_bootscript_address()
Michal Simek [Thu, 31 Aug 2023 06:59:05 +0000 (08:59 +0200)]
dm: core: ofnode: Add ofnode_read_bootscript_address()

ofnode_read_bootscript_address() reads bootscript address from
/options/u-boot DT node. bootscr-address or bootscr-ram-offset properties
are read and values are filled. bootscr-address has higher priority than
bootscr-ram-offset and the only one should be described in DT.

Also add test to cover this new function.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/23be3838502efef61803c90ef6e8b32bbd6ede41.1693465140.git.michal.simek@amd.com
15 months agoclk: Dont return error when assigned-clocks is empty or missing
Ashok Reddy Soma [Wed, 30 Aug 2023 08:31:42 +0000 (10:31 +0200)]
clk: Dont return error when assigned-clocks is empty or missing

There is a chance that assigned-clock-rates is given and assigned-clocks
could be empty. Dont return error in that case, because the probe of the
corresponding driver will not be called at all if this fails.
Better to continue to look for it and return 0.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a9a9d853e0ac396cd9b3577cce26279a75765711.1693384296.git.michal.simek@amd.com
15 months agoarm64: versal-net: Enable the config CMD_KASLRSEED
Venkatesh Yadav Abbarapu [Thu, 31 Aug 2023 03:16:58 +0000 (08:46 +0530)]
arm64: versal-net: Enable the config CMD_KASLRSEED

Kernel Address Space Layout Randomization (KASLR) is a hardening
feature that aims to make it more difficult to take advantage
of known exploits in the kernel, by placing kernel data
structures at a random address at each boot.The bootloader
supports randomizing the virtual address at which the kernel image
is loaded. The bootloader must provide entropy by passing a random
u64 value in the /chosen/kaslr-seed device tree node.
When we run "kaslrseed" command from U-Boot, the bootloader will
genarate the kaslr-seed and update the /chosen/kaslr-seed DT property.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230831031658.2203-4-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoarm64: versal-net: Enable sha1sum command
Venkatesh Yadav Abbarapu [Thu, 31 Aug 2023 03:16:57 +0000 (08:46 +0530)]
arm64: versal-net: Enable sha1sum command

Enable it for TPM usage.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230831031658.2203-3-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>