Re: [PATCH 2/2] tpm: Implement tpm_auto_start() for TPMv1.2
Hi Ilias, On Tue, 21 Feb 2023 at 06:03, Ilias Apalodimas wrote: > > Hi Simon, > > On Mon, Feb 20, 2023 at 02:27:36PM -0700, Simon Glass wrote: > > Add an implementation of this, moving the common call to tpm_init() up > > into the common API implementation. > > > > Add a test. > > > > Signed-off-by: Simon Glass > > --- > > > > include/tpm-common.h | 2 +- > > include/tpm-v1.h | 11 +++ > > lib/tpm-v1.c | 16 > > lib/tpm-v2.c | 8 > > lib/tpm_api.c| 19 --- > > test/dm/tpm.c| 45 > > 6 files changed, 89 insertions(+), 12 deletions(-) > > > > diff --git a/include/tpm-common.h b/include/tpm-common.h > > index b2c5404430f..1ba81386ce1 100644 > > --- a/include/tpm-common.h > > +++ b/include/tpm-common.h > > @@ -94,7 +94,7 @@ struct tpm_ops { > >* close(). > >* > >* @dev:Device to open > > - * @return 0 ok OK, -ve on error > > + * @return 0 ok OK, -EBUSY if already opened, other -ve on other error > >*/ > > int (*open)(struct udevice *dev); > > > > diff --git a/include/tpm-v1.h b/include/tpm-v1.h > > index 33d53fb695e..60b71e2a4b6 100644 > > --- a/include/tpm-v1.h > > +++ b/include/tpm-v1.h > > @@ -591,4 +591,15 @@ u32 tpm_set_global_lock(struct udevice *dev); > > */ > > u32 tpm1_resume(struct udevice *dev); > > > > +/** > > + * tpm1_auto_start() - start up the TPM > > + * > > + * This does not do a self test. > > + * > > + * @dev TPM device > > + * Return: TPM2_RC_SUCCESS, on success, or when the TPM returns > > + * TPM_INVALID_POSTINIT; TPM_FAILEDSELFTEST, if the TPM is in failure state > > + */ > > +u32 tpm1_auto_start(struct udevice *dev); > > + > > #endif /* __TPM_V1_H */ > > diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c > > index d0e3ab1b21d..ea3833549bc 100644 > > --- a/lib/tpm-v1.c > > +++ b/lib/tpm-v1.c > > @@ -69,6 +69,22 @@ u32 tpm1_continue_self_test(struct udevice *dev) > > return tpm_sendrecv_command(dev, command, NULL, NULL); > > } > > > > +u32 tpm1_auto_start(struct udevice *dev) > > +{ > > + u32 rc; > > + > > + rc = tpm1_startup(dev, TPM_ST_CLEAR); > > + /* continue on if the TPM is already inited */ > > + if (rc && rc != TPM_INVALID_POSTINIT) > > + return rc; > > + > > + rc = tpm1_self_test_full(dev); > > + if (rc) > > + return rc; > > Mind if I remove this if before merging? Yes that's fine. > > > + > > + return rc; > > +} > > + > > { > > [...] > > > + > > + return 0; > > +} > > +DM_TEST(dm_test_tpm_autostart_reinit, UT_TESTF_SCAN_FDT); > > -- > > 2.39.2.637.g21b0678d19-goog > > > > Other than that > Reviewed-by: Ilias Apalodimas > Regards, Simon
Re: [PATCH 2/2] tpm: Implement tpm_auto_start() for TPMv1.2
Hi Ilias, On Tue, 21 Feb 2023 at 06:10, Ilias Apalodimas wrote: > > Hi Simon, > > Unfortunately, this doesn't apply cleanly over > https://lore.kernel.org/u-boot/20230218152741.528191-1-ilias.apalodi...@linaro.org/ > > I'll have a look at the conflicts, if they are minor i'll fix them up. > Otherwise you'll have to respin this That's strange. I just tried again with going to the patch [1] and downloading the series. I am using -next though...could that be why? Regards, Simon [1] https://patchwork.ozlabs.org/project/uboot/patch/20230218152741.528191-4-ilias.apalodi...@linaro.org/ > > Thanks > /Ilias > > On Tue, 21 Feb 2023 at 15:08, Simon Glass wrote: > > > > Hi Ilias, > > > > On Tue, 21 Feb 2023 at 06:03, Ilias Apalodimas > > wrote: > > > > > > Hi Simon, > > > > > > On Mon, Feb 20, 2023 at 02:27:36PM -0700, Simon Glass wrote: > > > > Add an implementation of this, moving the common call to tpm_init() up > > > > into the common API implementation. > > > > > > > > Add a test. > > > > > > > > Signed-off-by: Simon Glass > > > > --- > > > > > > > > include/tpm-common.h | 2 +- > > > > include/tpm-v1.h | 11 +++ > > > > lib/tpm-v1.c | 16 > > > > lib/tpm-v2.c | 8 > > > > lib/tpm_api.c| 19 --- > > > > test/dm/tpm.c| 45 > > > > 6 files changed, 89 insertions(+), 12 deletions(-) > > > > > > > > diff --git a/include/tpm-common.h b/include/tpm-common.h > > > > index b2c5404430f..1ba81386ce1 100644 > > > > --- a/include/tpm-common.h > > > > +++ b/include/tpm-common.h > > > > @@ -94,7 +94,7 @@ struct tpm_ops { > > > >* close(). > > > >* > > > >* @dev:Device to open > > > > - * @return 0 ok OK, -ve on error > > > > + * @return 0 ok OK, -EBUSY if already opened, other -ve on other > > > > error > > > >*/ > > > > int (*open)(struct udevice *dev); > > > > > > > > diff --git a/include/tpm-v1.h b/include/tpm-v1.h > > > > index 33d53fb695e..60b71e2a4b6 100644 > > > > --- a/include/tpm-v1.h > > > > +++ b/include/tpm-v1.h > > > > @@ -591,4 +591,15 @@ u32 tpm_set_global_lock(struct udevice *dev); > > > > */ > > > > u32 tpm1_resume(struct udevice *dev); > > > > > > > > +/** > > > > + * tpm1_auto_start() - start up the TPM > > > > + * > > > > + * This does not do a self test. > > > > + * > > > > + * @dev TPM device > > > > + * Return: TPM2_RC_SUCCESS, on success, or when the TPM returns > > > > + * TPM_INVALID_POSTINIT; TPM_FAILEDSELFTEST, if the TPM is in failure > > > > state > > > > + */ > > > > +u32 tpm1_auto_start(struct udevice *dev); > > > > + > > > > #endif /* __TPM_V1_H */ > > > > diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c > > > > index d0e3ab1b21d..ea3833549bc 100644 > > > > --- a/lib/tpm-v1.c > > > > +++ b/lib/tpm-v1.c > > > > @@ -69,6 +69,22 @@ u32 tpm1_continue_self_test(struct udevice *dev) > > > > return tpm_sendrecv_command(dev, command, NULL, NULL); > > > > } > > > > > > > > +u32 tpm1_auto_start(struct udevice *dev) > > > > +{ > > > > + u32 rc; > > > > + > > > > + rc = tpm1_startup(dev, TPM_ST_CLEAR); > > > > + /* continue on if the TPM is already inited */ > > > > + if (rc && rc != TPM_INVALID_POSTINIT) > > > > + return rc; > > > > + > > > > + rc = tpm1_self_test_full(dev); > > > > + if (rc) > > > > + return rc; > > > > > > Mind if I remove this if before merging? > > > > Yes that's fine. > > > > > > > > > + > > > > + return rc; > > > > +} > > > > + > > > > { > > > > > > [...] > > > > > > > + > > > > + return 0; > > > > +} > > > > +DM_TEST(dm_test_tpm_autostart_reinit, UT_TESTF_SCAN_FDT); > > > > -- > > > > 2.39.2.637.g21b0678d19-goog > > > > > > > > > > Other than that > > > Reviewed-by: Ilias Apalodimas > > > > > > > Regards, > > Simon
[PATCH v2 2/2] tpm: Implement tpm_auto_start() for TPMv1.2
Add an implementation of this, moving the common call to tpm_init() up into the common API implementation. Add a test. Signed-off-by: Simon Glass --- Changes in v2: - Rebase to master - Drop unnecessary if...return include/tpm-common.h | 2 +- include/tpm-v1.h | 11 +++ lib/tpm-v1.c | 14 ++ lib/tpm-v2.c | 8 lib/tpm_api.c| 19 --- test/dm/tpm.c| 45 6 files changed, 87 insertions(+), 12 deletions(-) diff --git a/include/tpm-common.h b/include/tpm-common.h index b2c5404430f..1ba81386ce1 100644 --- a/include/tpm-common.h +++ b/include/tpm-common.h @@ -94,7 +94,7 @@ struct tpm_ops { * close(). * * @dev:Device to open -* @return 0 ok OK, -ve on error +* @return 0 ok OK, -EBUSY if already opened, other -ve on other error */ int (*open)(struct udevice *dev); diff --git a/include/tpm-v1.h b/include/tpm-v1.h index 33d53fb695e..60b71e2a4b6 100644 --- a/include/tpm-v1.h +++ b/include/tpm-v1.h @@ -591,4 +591,15 @@ u32 tpm_set_global_lock(struct udevice *dev); */ u32 tpm1_resume(struct udevice *dev); +/** + * tpm1_auto_start() - start up the TPM + * + * This does not do a self test. + * + * @devTPM device + * Return: TPM2_RC_SUCCESS, on success, or when the TPM returns + * TPM_INVALID_POSTINIT; TPM_FAILEDSELFTEST, if the TPM is in failure state + */ +u32 tpm1_auto_start(struct udevice *dev); + #endif /* __TPM_V1_H */ diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c index d0e3ab1b21d..60a18ca5040 100644 --- a/lib/tpm-v1.c +++ b/lib/tpm-v1.c @@ -69,6 +69,20 @@ u32 tpm1_continue_self_test(struct udevice *dev) return tpm_sendrecv_command(dev, command, NULL, NULL); } +u32 tpm1_auto_start(struct udevice *dev) +{ + u32 rc; + + rc = tpm1_startup(dev, TPM_ST_CLEAR); + /* continue on if the TPM is already inited */ + if (rc && rc != TPM_INVALID_POSTINIT) + return rc; + + rc = tpm1_self_test_full(dev); + + return rc; +} + u32 tpm1_clear_and_reenable(struct udevice *dev) { u32 ret; diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c index 895b093bcb1..9ab5b46df17 100644 --- a/lib/tpm-v2.c +++ b/lib/tpm-v2.c @@ -48,14 +48,6 @@ u32 tpm2_auto_start(struct udevice *dev) { u32 rc; - /* -* the tpm_init() will return -EBUSY if the init has already happened -* The selftest and startup code can run multiple times with no side -* effects -*/ - rc = tpm_init(dev); - if (rc && rc != -EBUSY) - return rc; rc = tpm2_self_test(dev, TPMI_YES); if (rc == TPM2_RC_INITIALIZE) { diff --git a/lib/tpm_api.c b/lib/tpm_api.c index 5b2c11a277c..3ef5e811794 100644 --- a/lib/tpm_api.c +++ b/lib/tpm_api.c @@ -37,10 +37,23 @@ u32 tpm_startup(struct udevice *dev, enum tpm_startup_type mode) u32 tpm_auto_start(struct udevice *dev) { - if (tpm_is_v2(dev)) - return tpm2_auto_start(dev); + u32 rc; - return -ENOSYS; + /* +* the tpm_init() will return -EBUSY if the init has already happened +* The selftest and startup code can run multiple times with no side +* effects +*/ + rc = tpm_init(dev); + if (rc && rc != -EBUSY) + return rc; + + if (tpm_is_v1(dev)) + return tpm1_auto_start(dev); + else if (tpm_is_v2(dev)) + return tpm2_auto_start(dev); + else + return -ENOSYS; } u32 tpm_resume(struct udevice *dev) diff --git a/test/dm/tpm.c b/test/dm/tpm.c index 7d880012090..3defb3c3da1 100644 --- a/test/dm/tpm.c +++ b/test/dm/tpm.c @@ -79,3 +79,48 @@ static int dm_test_tpm_report_state(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_tpm_report_state, UT_TESTF_SCAN_FDT); + +/** + * test_tpm_autostart() - check the tpm_auto_start() call + * + * @uts: Unit test state + * @version: TPM version to use + * @reinit: true to call tpm_init() first + * Returns 0 if OK, non-zero on failure + */ +static int test_tpm_autostart(struct unit_test_state *uts, + enum tpm_version version, bool reinit) +{ + struct udevice *dev; + + /* check probe success */ + ut_assertok(get_tpm_version(version, &dev)); + + if (reinit) + ut_assertok(tpm_init(dev)); +/* + * tpm_auto_start will rerun tpm_init() if reinit, but handles the + * -EBUSY return code internally. + */ + ut_assertok(tpm_auto_start(dev)); + + return 0; +} + +static int dm_test_tpm_autostart(struct unit_test_state *uts) +{ + ut_assertok(test_tpm_autostart(uts, TPM_V1, false)); + ut_assertok(test_tpm_autostart(uts, TPM_V2, false)); + + return 0; +} +DM_TEST(dm_test_tpm_autostart, UT_TESTF_SCAN_FDT); + +static int dm_test_tpm_autostart_r
[PATCH v2 1/2] tpm: Separate out the TPM tests for v1 and v2
Currently there is only one test and it only works on TPM v2. Update it to work on v1.2 as well, using a new function to pick up the required TPM. Update sandbox to include both a v1.2 and v2 TPM so that this works. Split out the existing test into two pieces, one for init and one for the v2-only report_state feature. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/dts/test.dts | 4 +++ test/dm/tpm.c | 60 +-- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 88d4d3cb983..9717103f108 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1367,6 +1367,10 @@ compatible = "sandbox,tpm2"; }; + tpm { + compatible = "google,sandbox-tpm"; + }; + uart0: serial { compatible = "sandbox,serial"; u-boot,dm-pre-reloc; diff --git a/test/dm/tpm.c b/test/dm/tpm.c index dca540bb561..7d880012090 100644 --- a/test/dm/tpm.c +++ b/test/dm/tpm.c @@ -11,24 +11,66 @@ #include #include -/* Basic test of the TPM uclass */ +/* + * get_tpm_version() - Get a TPM of the given version + * + * @version: Version to get + * @devp: Returns the TPM device + * Returns: 0 if OK, -ENODEV if not found + */ +static int get_tpm_version(enum tpm_version version, struct udevice **devp) +{ + struct udevice *dev; + + /* +* For now we have to probe each TPM, since the version is set up in +* of_to_plat(). We could require TPMs to declare their version when +* probed, to avoid this +*/ + uclass_foreach_dev_probe(UCLASS_TPM, dev) { + if (tpm_get_version(dev) == version) { + *devp = dev; + return 0; + } + } + + return -ENODEV; +} + +/* Basic test of initing a TPM */ +static int test_tpm_init(struct unit_test_state *uts, enum tpm_version version) +{ + struct udevice *dev; + + /* check probe success */ + ut_assertok(get_tpm_version(version, &dev)); + + ut_assertok(tpm_init(dev)); + + return 0; +} + static int dm_test_tpm(struct unit_test_state *uts) +{ + ut_assertok(test_tpm_init(uts, TPM_V1)); + ut_assertok(test_tpm_init(uts, TPM_V2)); + + return 0; +} +DM_TEST(dm_test_tpm, UT_TESTF_SCAN_FDT); + +/* Test report_state */ +static int dm_test_tpm_report_state(struct unit_test_state *uts) { struct udevice *dev; char buf[50]; /* check probe success */ - ut_assertok(uclass_first_device_err(UCLASS_TPM, &dev)); - ut_assert(tpm_is_v2(dev)); + ut_assertok(get_tpm_version(TPM_V2, &dev)); ut_assert(tpm_report_state(dev, buf, sizeof(buf))); ut_asserteq_str("init_done=0", buf); - ut_assertok(tpm_init(dev)); -/* - * tpm_auto_start will rerun tpm_init, but handles the - * -EBUSY return code internally. - */ ut_assertok(tpm_auto_start(dev)); ut_assert(tpm_report_state(dev, buf, sizeof(buf))); @@ -36,4 +78,4 @@ static int dm_test_tpm(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_tpm, UT_TESTF_SCAN_FDT); +DM_TEST(dm_test_tpm_report_state, UT_TESTF_SCAN_FDT); -- 2.39.2.637.g21b0678d19-goog
Re: [PATCH v2] tpm: Allow committing non-volatile data
Hi Ilias, On Tue, 21 Feb 2023 at 06:58, Ilias Apalodimas wrote: > > Hi Simon, > > On Mon, Feb 20, 2023 at 09:31:24AM -0700, Simon Glass wrote: > > Add an option to tell the TPM to commit non-volatile data immediately it > > is changed, rather than waiting until later. This is needed in some > > situations, since if the device reboots it may not write the data. > > > > Add definitions for the rest of the Cr50 commands while we are here. > > This defines a function that's unused. IIRC you said U-Boot doesn't use it, > but some code that run for that laptop does right? Yes it is used by ChromeOS code which is not upstream at present. > In any case the function declaration doesn't belong to the TPMv2 library. > I think we are better off adding it to the cr50 driver itself. I also We cannot call tpm_sendrecv_command() from a TPM driver..it is in lib/ and that would be a violation of the software layers. This is a TPM2 command, even if it is specific to cr50. > assume you compile u-boot in a 'special' way so the linker doesn't get rid > of the emitted code? Does t hat mean we can define it as __unused as well? Nothing special, but this allows the ChromeOS code to build correctly. I could also add a command to use it, if that helps? Regards, Simon > > Thanks > /Ilias > > > > Signed-off-by: Simon Glass > > --- > > I am resending this as I think it got lost. > > > > Changes in v2: > > - Rebase to master > > > > include/tpm-v2.h | 14 ++ > > lib/tpm-v2.c | 20 > > 2 files changed, 34 insertions(+) > > > > diff --git a/include/tpm-v2.h b/include/tpm-v2.h > > index 8e90a616220..0a03994740d 100644 > > --- a/include/tpm-v2.h > > +++ b/include/tpm-v2.h > > @@ -712,4 +712,18 @@ u32 tpm2_submit_command(struct udevice *dev, const u8 > > *sendbuf, > > */ > > u32 tpm2_cr50_report_state(struct udevice *dev, u8 *recvbuf, size_t > > *recv_size); > > > > +/* > > + * tpm2_cr50_enable_nvcommits() - Tell Cr50 to commit NV data immediately > > + * > > + * For Chromium OS verified boot, we may reboot or reset at different > > times, > > + * possibly leaving non-volatile data unwritten by the TPM. > > + * > > + * This vendor command is used to indicate that non-volatile data should be > > + * written to its store immediately. > > + * > > + * @dev TPM device > > + * Return: result of the operation > > + */ > > +u32 tpm2_cr50_enable_nvcommits(struct udevice *dev); > > + > > #endif /* __TPM_V2_H */ > > diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c > > index bdf019b0f93..5fcd3649b74 100644 > > --- a/lib/tpm-v2.c > > +++ b/lib/tpm-v2.c > > @@ -699,3 +699,23 @@ u32 tpm2_cr50_report_state(struct udevice *dev, u8 > > *recvbuf, size_t *recv_size) > > > > return 0; > > } > > + > > +u32 tpm2_cr50_enable_nvcommits(struct udevice *dev) > > +{ > > + u8 command_v2[COMMAND_BUFFER_SIZE] = { > > + /* header 10 bytes */ > > + tpm_u16(TPM2_ST_NO_SESSIONS), /* TAG */ > > + tpm_u32(10 + 2),/* Length */ > > + tpm_u32(TPM2_CR50_VENDOR_COMMAND), /* Command code */ > > + > > + tpm_u16(TPM2_CR50_SUB_CMD_NVMEM_ENABLE_COMMITS), > > + }; > > + int ret; > > + > > + ret = tpm_sendrecv_command(dev, command_v2, NULL, NULL); > > + log_debug("ret=%s, %x\n", dev->name, ret); > > + if (ret) > > + return ret; > > + > > + return 0; > > +} > > -- > > 2.39.2.637.g21b0678d19-goog > >
Re: [PATCH v2] tpm: Allow committing non-volatile data
Hi Ilias, On Tue, 21 Feb 2023 at 07:18, Ilias Apalodimas wrote: > > Hi Simon, > > We had that discussion in the past. > > > On Tue, 21 Feb 2023 at 16:09, Simon Glass wrote: > > > > Hi Ilias, > > > > On Tue, 21 Feb 2023 at 06:58, Ilias Apalodimas > > wrote: > > > > > > Hi Simon, > > > > > > On Mon, Feb 20, 2023 at 09:31:24AM -0700, Simon Glass wrote: > > > > Add an option to tell the TPM to commit non-volatile data immediately it > > > > is changed, rather than waiting until later. This is needed in some > > > > situations, since if the device reboots it may not write the data. > > > > > > > > Add definitions for the rest of the Cr50 commands while we are here. > > > > > > This defines a function that's unused. IIRC you said U-Boot doesn't use > > > it, > > > but some code that run for that laptop does right? > > > > Yes it is used by ChromeOS code which is not upstream at present. > > > > > In any case the function declaration doesn't belong to the TPMv2 library. > > > I think we are better off adding it to the cr50 driver itself. I also > > > > We cannot call tpm_sendrecv_command() from a TPM driver..it is in lib/ > > and that would be a violation of the software layers. This is a TPM2 > > command, even if it is specific to cr50. > > > > > assume you compile u-boot in a 'special' way so the linker doesn't get rid > > > of the emitted code? Does t hat mean we can define it as __unused as > > > well? > > > > Nothing special, but this allows the ChromeOS code to build correctly. > > I could also add a command to use it, if that helps? > > 5208ed187cb6 ("tpm: Allow committing non-volatile data") is what you > need. That uses a generic name and takes the command as an argument. > IOW calling tpm2_enable_nvcommits(dev, > TPM2_CR50_SUB_CMD_NVMEM_ENABLE_COMMITS) will do the right thing for > you. Thanks for the reminder. I'll try to remember to stop asking :-) Regards, Simon
Re: [PATCH v5 1/1] video console: refactoring and optimization
On Mon, 20 Feb 2023 at 03:49, Dzmitry Sankouski wrote: > > - move common code to vidconsole_internal.h and console_core.c > - unite probe functions > - get rid of code duplications in switch across bpp values > - extract common pixel fill logic in two functions one per > horizontal and vertical filling > - rearrange statements in put_xy* methods in unified way > - replace types - uint*_t to u* > > Signed-off-by: Dzmitry Sankouski > --- > Changes for v2: none > Changes for v3: none > Changes for v4: > - move common code to vidconsole_internal.h > - unite probe functions > Changes for v5: > - move common functions to console-core.c file > - remove static keyword from shared functions > > drivers/video/Makefile | 6 + > drivers/video/console_core.c| 141 + > drivers/video/console_normal.c | 150 -- > drivers/video/console_rotate.c | 308 > drivers/video/vidconsole_internal.h | 95 + > 5 files changed, 324 insertions(+), 376 deletions(-) > create mode 100644 drivers/video/console_core.c > create mode 100644 drivers/video/vidconsole_internal.h Reviewed-by: Simon Glass
Re: [PATCH v2 9/9] usb: xhci: Fix root hub descriptor
Hi Mark, On Tue, 21 Feb 2023 at 02:28, Mark Kettenis wrote: > > > Date: Tue, 21 Feb 2023 01:46:22 +0100 > > From: Marek Vasut > > Hi Marek, > > > On 2/21/23 00:45, Simon Glass wrote: > > > On Sat, 21 Jan 2023 at 12:28, Mark Kettenis wrote: > > >> > > >> When a system has multiple XHCI controllers, some of the > > >> properties described in the descriptor of the root hub (such as > > >> the number of ports) might differ between controllers. Fix this > > >> by switching from a single global hub descriptor to a hub > > >> descriptor per controller. > > >> > > >> Signed-off-by: Mark Kettenis > > >> Reviewed-by: Marek Vasut > > >> --- > > >> drivers/usb/host/xhci.c | 15 --- > > >> include/usb/xhci.h | 1 + > > >> 2 files changed, 9 insertions(+), 7 deletions(-) > > > > > > Tested on: Chromebook Brya (Intel Alder Lake): > > > Tested-by: Simon Glass > > > > Mark, do you plan to pick the entire series via some apple tree or shall > > I pick the USB parts via USB tree ? If the later, then please collect > > the AB/RB tags and send me just the two xhci patches separately. If the > > former, no action is needed. > > Tom already merged the whole series into master a few weeks ago. Not > sure why Simon thought it made sense to add his Tested-by tags when > the patch in question is already on master. Because sometimes these things get reverted and I didn't want to have to remember that it fixed my problem. Regards, Simon
Re: rk3399 boards broken, only partially converted to standard boot? (was Re: [PATCH 71/71] rockchip: Convert rockpro64-rk3399 to use standard boot)
Hi Vagrant, On Mon, 20 Feb 2023 at 09:21, Simon Glass wrote: > > Hi Vagrant, > > On Sat, 18 Feb 2023 at 19:19, Vagrant Cascadian wrote: > > > > On 2022-12-07, Simon Glass wrote: > > > Drop the use of scripts and rely on standard boot for all operation. > > > > This patch, applied as 3891c68ef50eda38d78c95ecd03aed030aa6bb53 broke > > booting on pinebook-pro-rk3399, which still tries to "run > > distro_bootcmd" but distro_bootcmd is no longer defined... probably > > several other rk3399 systems are similarly affected? Maybe other > > rockchip systems as well? Reverting the patch fixes booting on the > > pinebook-pro-rk3399, at least. > > > > It seems that rockpro64-rk3399 was used as an example, so that > > presumably works, but in actuality, this commit only modifies common > > files for many rockchip and rk3399 boards and nothing rockpro64-rk3399 > > specific, so the commit message is a bit misleading. > > > > I am not sure what the best way forward is; to quickly convert all the > > other boards in a new patch series, or incrementally shift one system at > > a time over (and somehow restore previous behavior in the > > meantime?)... as it stands it appears we are left with rk3399 boards > > partially converted but broken... > > > > FWIW, I have not confirmed for sure that other boards are broken, so it > > might just be pinebook-pro-rk3399 for some reason. I have a few rk3399 > > based boards I can test to confirm... > > I suspect it needs BOOTSTD_DEFAULTS enabled. Could you try that? I can > send a patch if you like? > > See also this series, in case we should apply patch 1 to -master > > https://patchwork.ozlabs.org/project/uboot/list/?series=342718 It turns out to be boostage, as the IRAM seems to get protected. I'll send a little series for all of this. Regards, Simon
Re: [PATCH v2] binman: bintool: Add support for tool directories
Hi Neha, On Fri, 17 Feb 2023 at 04:46, Neha Malcom Francis wrote: > > Currently, bintool supports external compilable tools as single > executable files. Adding support for git repos that can be used to run > non-compilable scripting tools that cannot otherwise be present in > binman. > > Signed-off-by: Neha Malcom Francis > --- > Changes in v2: > - added parameter to obtain path to download the directory > optionally, enables flexibility to avoid using > DOWNLOAD_DESTDIR > - added test to bintool_test.py > - s/FETCH_NO_BUILD/FETCH_SOURCE > - code reformatting This looks better but I see have some questions and nits. > > tools/binman/bintool.py| 45 -- > tools/binman/bintool_test.py | 22 + > tools/binman/btool/_testing.py | 5 > tools/patman/tools.py | 2 +- > 4 files changed, 66 insertions(+), 8 deletions(-) > > diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py > index 8fda13ff01..04c951fa0b 100644 > --- a/tools/binman/bintool.py > +++ b/tools/binman/bintool.py > @@ -32,12 +32,13 @@ FORMAT = '%-16.16s %-12.12s %-26.26s %s' > modules = {} > > # Possible ways of fetching a tool (FETCH_COUNT is number of ways) > -FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_COUNT = range(4) > +FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_SOURCE, FETCH_COUNT = range(5) > > FETCH_NAMES = { > FETCH_ANY: 'any method', > FETCH_BIN: 'binary download', > -FETCH_BUILD: 'build from source' > +FETCH_BUILD: 'build from source', > +FETCH_SOURCE: 'download source without building' Would this be a script? Should we say 'download script without building' ? > } > > # Status of tool fetching > @@ -201,12 +202,13 @@ class Bintool: > print(f'- trying method: {FETCH_NAMES[try_method]}') > result = try_fetch(try_method) > if result: > +method = try_method > break > else: > result = try_fetch(method) > if not result: > return FAIL > -if result is not True: > +if result is not True and method != FETCH_SOURCE: > fname, tmpdir = result > dest = os.path.join(DOWNLOAD_DESTDIR, self.name) > print(f"- writing to '{dest}'") > @@ -261,7 +263,7 @@ class Bintool: > show_status(col.RED, 'Failures', status[FAIL]) > return not status[FAIL] > > -def run_cmd_result(self, *args, binary=False, raise_on_error=True): > +def run_cmd_result(self, *args, binary=False, raise_on_error=True, > add_name=True): Please update function comment for new param > """Run the bintool using command-line arguments > > Args: > @@ -278,7 +280,10 @@ class Bintool: > if self.name in self.missing_list: > return None > name = os.path.expanduser(self.name) # Expand paths containing ~ > -all_args = (name,) + args > +if add_name: > +all_args = (name,) + args > +else: > +all_args = args > env = tools.get_env_with_path() > tout.detail(f"bintool: {' '.join(all_args)}") > result = command.run_pipe( > @@ -304,7 +309,7 @@ class Bintool: > tout.debug(result.stderr) > return result > > -def run_cmd(self, *args, binary=False): > +def run_cmd(self, *args, binary=False, add_name=True): Please update function comment for new param > """Run the bintool using command-line arguments > > Args: > @@ -315,7 +320,7 @@ class Bintool: > Returns: > str or bytes: Resulting stdout from the bintool > """ > -result = self.run_cmd_result(*args, binary=binary) > +result = self.run_cmd_result(*args, binary=binary, add_name=add_name) > if result: > return result.stdout > > @@ -354,6 +359,32 @@ class Bintool: > return None > return fname, tmpdir > > +@classmethod > +def fetch_from_git(cls, git_repo, name, toolpath=DOWNLOAD_DESTDIR): > +"""Fetch a bintool git repo > + > +This clones the repo and returns > + > +Args: > +git_repo (str): URL of git repo > +name (str): Bintool name assigned as tool directory name missing toolpath arg > + > +Returns: > +str: Directory of fetched repo > +or None on error > +""" > +dir = os.path.join(toolpath, name) > +if os.path.exists(dir): > +print(f"- Repo {dir} already exists") > +return None > +os.mkdir(dir) > +print(f"- clone git repo '{git_repo}' to '{dir}'") > +tools.run('git', 'clone', '--depth', '1', git_repo, dir) doesn't this download directly into the download directory? What if there are other files in the git repo...they will all end up in there, right? Can we instead s
Re: [PATCH] binman: Avoid requiring a home directory on startup
Hi Quentin, On Mon, 20 Feb 2023 at 04:15, Quentin Schulz wrote: > > Hi Simon, > > On 2/18/23 00:49, Simon Glass wrote: > > Hi Quentin, > > > > On Fri, 17 Feb 2023 at 05:21, Quentin Schulz > > wrote: > >> > >> Hi all, > >> > >> On 2/17/23 03:55, Simon Glass wrote: > >>> Hi Tom, > >>> > >>> On Thu, 16 Feb 2023 at 17:19, Tom Rini wrote: > >>>> > >>>> On Thu, Feb 16, 2023 at 05:12:33PM -0700, Simon Glass wrote: > >>>>> Hi Tom, > >>>>> > >>>>> On Tue, 14 Feb 2023 at 13:27, Tom Rini wrote: > >>>>>> > >>>>>> On Tue, Feb 14, 2023 at 03:12:46PM -0500, Mike Frysinger wrote: > >>>>>>> On Tue, Feb 14, 2023 at 3:08 PM Tom Rini wrote: > >>>>>>>> Downloading things from the internet and putting them in to the > >>>>>>>> default > >>>>>>>> PATH always and forever is also kinda not great? > >>>>>>> > >>>>>>> you just described a standard distribution. this is like literally > >>>>>>> how all of them work. not to mention every other language-specific > >>>>>>> distro tool out there (e.g. Python pip, Perl cpan, Go, etc...). > >>>>>>> > >>>>>>> maybe you'd like more guarantees on top (e.g. signature verification) > >>>>>>> which is reasonable. > >>>>>>> > >>>>>>> but to be clear, this script is already merged & in the tree, so your > >>>>>>> feedback doesn't block this patch. > >>>>>> > >>>>>> Yes, exactly. This is a fix on top of what we do today, so it should go > >>>>>> in. But modern distributions only install signed packages, and > >>>>>> language-specific tools tend to be a hive of bad examples. Looking over > >>>>>> binman right now, I see that we're either using apt (and oh, there's > >>>>>> "aot" typo in one spot) or downloading from a known Google drive, for > >>>>>> only a few less common tools. > >>>>>> > >>>>>> So yes, I would like to see some ideas on how to improve things in the > >>>>>> future so we aren't putting the binaries somewhere that's not a default > >>>>>> (or frequently common) PATH location. > >>>>> > >>>>> Are you thinking they should go in ~/.binman-tools or something like > >>>>> that? Then we would need to tell people to add it to their path. But > >>>>> we could make binman look there automatically. > >>>> > >>>> We should document that it's where we're putting stuff, not so much > >>>> "tell" them, unless you mean as a note when downloading. But yes, > >>>> ~/.binman-tools sounds reasonable. Maybe a flag to point elsewhere? > >>> > >>> OK I will take a look. > >>> > >> > >> I think this should be directly put into the output/build directory used > >> by U-Boot, because what happens when you have two U-Boot git repos with > >> different version requirements for those host tools? Then you need to > >> make sure you're not building both at the same time, that you update > >> them properly before each build, etc. > > > > My advice: *Don't do that* > > > > So far as binman is concerned, a tool is a tool. Tools should be > > backwards compatible so updating to the new one should fix all the > > problems. > > > > That's a very bold claim :) > > > The problem with using the output dir is we then have to download them > > for each build, or cache them somewhere. To my mind, the 'binman tool' > > feature is a convenience to reduce the pain involved in obtaining > > tools needed to build. It is a not a panacea for strange situations. > > > > Have the default in the build directory and allow the user to define an > out-of-tree directory if they want to cache them somewhere? Similar to > Yocto with SSTATE_DIR/DL_DIR, Buildroot with BR2_DL_DIR for example. OK, but why do you want to use the build directory at all? It seems like a hassle to set up. With the series I sent it is automatic and all that is needed is to add ~/.binman-tools to your path. Regards, Simon
Re: [PATCH 3/9] binman: Use correct argument name in docstrings
On Sun, 19 Feb 2023 at 15:02, Jonas Karlman wrote: > > Use correct argument name in docstrings. > > Signed-off-by: Jonas Karlman > --- > tools/binman/entry.py | 2 +- > tools/binman/etype/blob.py| 2 +- > tools/binman/etype/section.py | 4 ++-- > 3 files changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Simon Glass
Re: [PATCH 1/9] binman: Remove redundant SetAllowFakeBlob from blob-ext entry
On Sun, 19 Feb 2023 at 15:02, Jonas Karlman wrote: > > Entry_blob_ext contains an implementation of SetAllowFakeBlob that is > identical to the one in the base Entry class, remove it. > > Signed-off-by: Jonas Karlman > --- > tools/binman/etype/blob_ext.py | 8 > 1 file changed, 8 deletions(-) > Reviewed-by: Simon Glass
Re: [PATCH 3/4 v4] tpm: sandbox: Change the return code when device is already open
On Sat, 18 Feb 2023 at 08:27, Ilias Apalodimas wrote: > > All the TPM drivers as well as out TCG TIS API for a TPM2.0 device > return -EBUSY if the device has already been opened. Adjust > the sandbox TPM do return the same error code. > > Signed-off-by: Ilias Apalodimas > --- > Changes since v3: > - New patch. Required for [4/4] > > drivers/tpm/tpm2_tis_sandbox.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass
Re: [PATCH v3 11/95] Correct SPL use of PHY_CADENCE_SIERRA
Hi Tom, On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > On Sun, Feb 12, 2023 at 04:15:14PM -0700, Simon Glass wrote: > > This converts 1 usage of this option to the non-SPL form, since there is > > no SPL_PHY_CADENCE_SIERRA defined in Kconfig > > > > Signed-off-by: Simon Glass > > --- > > > > (no changes since v1) > > > > drivers/phy/cadence/Makefile | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/phy/cadence/Makefile b/drivers/phy/cadence/Makefile > > index af63b32d9f5..c247feb8262 100644 > > --- a/drivers/phy/cadence/Makefile > > +++ b/drivers/phy/cadence/Makefile > > @@ -1,2 +1,2 @@ > > -obj-$(CONFIG_$(SPL_)PHY_CADENCE_SIERRA) += phy-cadence-sierra.o > > +obj-$(CONFIG_PHY_CADENCE_SIERRA) += phy-cadence-sierra.o > > obj-$(CONFIG_$(SPL_)PHY_CADENCE_TORRENT) += phy-cadence-torrent.o > > This, and then PHY_CADENCE_TORRENT take this the wrong direction, both > symbols should be false for non-PPL builds. This one is odd, since the board defines SPL_PHY, presumably for a reason. It could always undefine that if needed. I'll add some more notes in v5. Regards, SImon
Re: [PATCH 4/9] binman: Override CheckOptional in fit entry
On Sun, 19 Feb 2023 at 15:02, Jonas Karlman wrote: > > Missing optional blobs was not reported for generated entries, e.g. > tee-os on rockchip targets. Implement a CheckOptional to fix this. > > After this the following can be shown: > > Image 'simple-bin' is missing external blobs but is still functional: tee-os > > /binman/simple-bin/fit/images/@tee-SEQ/tee-os (tee-os): > See the documentation for your board. You may need to build Open Portable > Trusted Execution Environment (OP-TEE) with TEE=/path/to/tee.bin > > Signed-off-by: Jonas Karlman > --- > tools/binman/etype/fit.py | 7 +++ > 1 file changed, 7 insertions(+) > Reviewed-by: Simon Glass Do we need a test for this?
Re: [PATCH 1/1] sandbox: allow building sandbox_spl with CONFIG_DEBUG
On Sat, 18 Feb 2023 at 01:34, Heinrich Schuchardt wrote: > > Building sandbox_spl with CONFIG_DEBUG leads to errors due to missing > symbols: > > /usr/bin/ld: common/spl/spl_fit.o: in function `spl_fit_upload_fpga': > common/spl/spl_fit.c:595: undefined reference to `fpga_load' > /usr/bin/ld: test/test-main.o: in function `dm_test_post_run': > test/test-main.c:124: undefined reference to `crc8' > /usr/bin/ld: test/test-main.o: in function `dm_test_pre_run': > test/test-main.c:95: undefined reference to `crc8' > collect2: error: ld returned 1 exit status > > This is due to -Og not eliminating unused functions. > > Add FPGA and CRC8 support to the defconfig. Sandbox tests for > SPL_FPGA and CRC8 should be created. So enabling these setting > is advised anyway. > > Signed-off-by: Heinrich Schuchardt > --- > configs/sandbox_spl_defconfig | 4 > 1 file changed, 4 insertions(+) > Reviewed-by: Simon Glass
Re: [PATCH 1/1] sandbox: fix building with CONFIG_SPL_TIMER=y
Hi Heinrich, On Sat, 18 Feb 2023 at 02:34, Heinrich Schuchardt wrote: > > Building sandbox_defconfig with CONFIG_SPL_TIMER=y results in an error > > include/dm/platdata.h:63:33: error: static assertion failed: > "Cannot use U_BOOT_DRVINFO with of-platdata. > Please use devicetree instead" > > Add a missing condition in the sandbox driver. > > Signed-off-by: Heinrich Schuchardt > --- > drivers/timer/sandbox_timer.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/timer/sandbox_timer.c b/drivers/timer/sandbox_timer.c > index c846bfb9f1..278893d1e9 100644 > --- a/drivers/timer/sandbox_timer.c > +++ b/drivers/timer/sandbox_timer.c > @@ -66,6 +66,8 @@ U_BOOT_DRIVER(sandbox_timer) = { > }; > > /* This is here in case we don't have a device tree */ > +#if !CONFIG_IS_ENABLED(OF_PLATDATA) || defined(DT_PLAT_C) Can you drop the second condition? That is an internal thing that must not be used outside a particular file generated by dtoc. > U_BOOT_DRVINFO(sandbox_timer_non_fdt) = { > .name = "sandbox_timer", > }; > +#endif > -- > 2.38.1 > Regards, SImon
Re: [PATCH 3/3] remoteproc: Remove legacy probing method
On Sun, 19 Feb 2023 at 23:13, Samuel Holland wrote: > > This removes code that abused the device's platform data, interpreting > the driver platform data as if it was the uclass platform data. > > Signed-off-by: Samuel Holland > --- > > .../driver-model/remoteproc-framework.rst | 29 --- > drivers/remoteproc/rproc-uclass.c | 18 +--- > drivers/remoteproc/sandbox_testproc.c | 10 --- > include/remoteproc.h | 2 -- > 4 files changed, 1 insertion(+), 58 deletions(-) Reviewed-by: Simon Glass
Re: [PATCH v1 1/1] input: button_kbd: make driver complementary to gpio buttons
On Mon, 20 Feb 2023 at 10:41, Svyatoslav Ryhel wrote: > > Remove need of dts binding for button keyboard since it reuses > gpio-keys binding. Select gpio-keys driver if button keyboard > is selected since button keyboard can not operate on its own. > > Tested-by: Svyatoslav Ryhel # HTC One X T30 > Signed-off-by: Svyatoslav Ryhel > --- > drivers/input/Kconfig | 2 +- > drivers/input/button_kbd.c | 10 -- > 2 files changed, 5 insertions(+), 7 deletions(-) Reviewed-by: Simon Glass
Re: [PATCH 2/9] binman: Fix spelling of nodes in code comments
On Sun, 19 Feb 2023 at 15:02, Jonas Karlman wrote: > > Replace notes with nodes in code comments and docstrings. > > Signed-off-by: Jonas Karlman > --- > tools/binman/etype/fit.py | 2 +- > tools/binman/etype/section.py | 2 +- > tools/binman/state.py | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) Reviewed-by: Simon Glass
Re: [PATCH 4/4 v4] test: add a test for the new tpm_auto_start() function
On Sat, 18 Feb 2023 at 08:27, Ilias Apalodimas wrote: > > A prior patch adds a new API function for TPM2.0, which performs > the full startup sequence of the TPM. Add a selftest for that. > > Signed-off-by: Ilias Apalodimas > --- > Changes since v4: > - New patch > > test/dm/tpm.c | 5 + > 1 file changed, 5 insertions(+) Reviewed-by: Simon Glass (with my patches on top)
Re: [PATCH 1/1] dm: core: revert "Don't inline dev_read...() calls with of-platdata"
Hi Heinrich, On Sat, 18 Feb 2023 at 02:17, Heinrich Schuchardt wrote: > > Compiling sandbox_defconfig with CONFIG_SPL_MMC=y results in > > drivers/mmc/mmc-uclass.c:211: > undefined reference to `dev_read_u32_default' > > Revert the fraudulent patch. > > Fixes: ef79ef21a852 ("dm: core: Don't inline dev_read...() calls with > of-platdata") > Signed-off-by: Heinrich Schuchardt > --- > include/dm/read.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) NAK, sorry You cannot call mmc_of_parse() when OF_REAL is not enabled, since there is no actual devicetree. This is the case with sandbox_spl, since it uses o-platdata. The original patch is actually correct. The real fix is to implement of-platdata in drivers/mmc/sandbox_mmc.c as has been done in rockchip_dw_mmc.c for example. See also: https://u-boot.readthedocs.io/en/latest/develop/driver-model/of-plat.html Regards, SImon > > diff --git a/include/dm/read.h b/include/dm/read.h > index 56ac076c9f..ca1c60e079 100644 > --- a/include/dm/read.h > +++ b/include/dm/read.h > @@ -30,7 +30,7 @@ static inline const struct device_node *dev_np(const struct > udevice *dev) > } > #endif > > -#if !defined(CONFIG_DM_DEV_READ_INLINE) || CONFIG_IS_ENABLED(OF_PLATDATA) > +#ifndef CONFIG_DM_DEV_READ_INLINE > /** > * dev_read_u8() - read a 8-bit integer from a device's DT property > * > -- > 2.38.1 >
Re: [PATCH 1/4 v4] tpm: add a function that performs selftest + startup
On Sat, 18 Feb 2023 at 08:27, Ilias Apalodimas wrote: > > As described in [0] if a command requires use of an untested algorithm > or functional module, the TPM performs the test and then completes the > command actions. > > Since we don't check for TPM_RC_NEEDS_TEST (which is the return code of > the TPM in that case) and even if we would, it would complicate our TPM > code for no apparent reason, add a wrapper function that performs both > the selftest and the startup sequence of the TPM. > > It's worth noting that this is implemented on TPMv2.0. The code for > 1.2 would look similar, but I don't have a device available to test. > > [0] > https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.07-2014-03-13.pdf > §12.3 Self-test modes > > Signed-off-by: Ilias Apalodimas > --- > Changes since v3: > - Limit comments to 80 columns > - drop extra lines from comments > include/tpm-v2.h | 16 > include/tpm_api.h | 8 > lib/tpm-v2.c | 25 +++++ > lib/tpm_api.c | 8 > 4 files changed, 57 insertions(+) Reviewed-by: Simon Glass (with my two patches on top)
Re: [PATCH 1/3] remoteproc: Move rproc_cfg_arr out of the uclass header
On Sun, 19 Feb 2023 at 23:13, Samuel Holland wrote: > > This array is private to the IPU driver, so it should be declared there. > > Signed-off-by: Samuel Holland > --- > > drivers/remoteproc/ipu_rproc.c | 4 +++- > include/remoteproc.h | 1 - > 2 files changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Simon Glass
[PATCH v2 1/4] buildman: Add a note about the out-env file
This file holds the environment used when doing a build. Add a note about it. Signed-off-by: Simon Glass --- (no changes since v1) tools/buildman/buildman.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst index 2a83cb7e4f8..9a2d913c785 100644 --- a/tools/buildman/buildman.rst +++ b/tools/buildman/buildman.rst @@ -1108,6 +1108,8 @@ and 'brppt1_spi', removing a trailing semicolon. 'brppt1_nand' gained an a value for 'altbootcmd', but lost one for ' altbootcmd'. The -U option uses the u-boot.env files which are produced by a build. +Internally, buildman writes out an out-env file into the build directory for +later comparison. Building with clang -- 2.39.2.637.g21b0678d19-goog
[PATCH v2 2/4] buildman: Write out the build command used
It is sometimes useful to see the exact 'make' command used by buildman for a commit. Add an output file for this. Signed-off-by: Simon Glass --- (no changes since v1) tools/buildman/builderthread.py | 13 + tools/buildman/buildman.rst | 8 tools/buildman/func_test.py | 13 + 3 files changed, 34 insertions(+) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 680efae02d7..7ba9a856dd5 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -273,14 +273,19 @@ class BuilderThread(threading.Thread): # If we need to reconfigure, do that now cfg_file = os.path.join(out_dir, '.config') +cmd_list = [] if do_config or adjust_cfg: config_out = '' if self.mrproper: result = self.Make(commit, brd, 'mrproper', cwd, 'mrproper', *args, env=env) config_out += result.combined +cmd_list.append([self.builder.gnu_make, 'mrproper', + *args]) result = self.Make(commit, brd, 'config', cwd, *(args + config_args), env=env) +cmd_list.append([self.builder.gnu_make] + args + +config_args) config_out += result.combined do_config = False # No need to configure next time if adjust_cfg: @@ -290,6 +295,7 @@ class BuilderThread(threading.Thread): args.append('cfg') result = self.Make(commit, brd, 'build', cwd, *args, env=env) +cmd_list.append([self.builder.gnu_make] + args) if (result.return_code == 2 and ('Some images are invalid' in result.stderr)): # This is handled later by the check for output in @@ -303,6 +309,7 @@ class BuilderThread(threading.Thread): result.stderr = result.stderr.replace(src_dir + '/', '') if self.builder.verbose_build: result.stdout = config_out + result.stdout +result.cmd_list = cmd_list else: result.return_code = 1 result.stderr = 'No tool chain for %s\n' % brd.arch @@ -378,6 +385,12 @@ class BuilderThread(threading.Thread): with open(os.path.join(build_dir, 'out-env'), 'wb') as fd: for var in sorted(env.keys()): fd.write(b'%s="%s"' % (var, env[var])) + +with open(os.path.join(build_dir, 'out-cmd'), 'w', + encoding='utf-8') as fd: +for cmd in result.cmd_list: +print(' '.join(cmd), file=fd) + lines = [] for fname in BASE_ELF_FILENAMES: cmd = ['%snm' % self.toolchain.cross, '--size-sort', fname] diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst index 9a2d913c785..11c72141791 100644 --- a/tools/buildman/buildman.rst +++ b/tools/buildman/buildman.rst @@ -1300,6 +1300,14 @@ You should use 'buildman -nv ' instead of greoing the boards.cfg file, since it may be dropped altogether in future. +Checking the command + + +Buildman writes out the toolchain information to a `toolchain` file within the +output directory. It also writes the commands used to build U-Boot in an +`out-cmd` file. You can check these if you suspect something strange is +happening. + TODO diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 559e4edf74b..799c609446e 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -723,3 +723,16 @@ Some images are invalid''' control.get_allow_missing(False, False, 2, True)) self.assertEqual(False, control.get_allow_missing(False, True, 2, True)) + +def testCmdFile(self): +"""Test that the -cmd-out file is produced""" +self._RunControl('-o', self._output_dir) +board0_dir = os.path.join(self._output_dir, 'current', 'board0') +self.assertTrue(os.path.exists(os.path.join(board0_dir, 'done'))) +cmd_fname = os.path.join(board0_dir, 'out-cmd') +self.assertTrue(os.path.exists(cmd_fname)) +data = tools.read_file(cmd_fname) +lines = data.splitlines() +self.assertEqual(2, len(lines)) +self.assertRegex(lines[0], b'make O=/.*board0_defconfig') +self.assertRegex(lines[0], b'make O=/.*-s.*') -- 2.39.2.637.g21b0678d19-goog
[PATCH v2 4/4] buildman: Add a flag for reproducible builds
This is quite a useful thing to use when building since it avoids small size changes between commits. Add a -r flag for it. Also undefine CONFIG_LOCALVERSION_AUTO since this appends the git hash to the version string, causing every build to be slightly different. Signed-off-by: Simon Glass --- Changes in v2: - Drop CONFIG_LOCALVERSION_AUTO also doc/build/reproducible.rst | 2 ++ tools/buildman/builder.py | 4 +++- tools/buildman/builderthread.py | 2 ++ tools/buildman/buildman.rst | 7 +++--- tools/buildman/cmdline.py | 2 ++ tools/buildman/control.py | 11 - tools/buildman/func_test.py | 40 +++-- 7 files changed, 56 insertions(+), 12 deletions(-) diff --git a/doc/build/reproducible.rst b/doc/build/reproducible.rst index 5423080633e..8b030f469d7 100644 --- a/doc/build/reproducible.rst +++ b/doc/build/reproducible.rst @@ -23,3 +23,5 @@ This date is shown when we launch U-Boot: ./u-boot -T U-Boot 2023.01 (Jan 01 2023 - 00:00:00 +) + +The same effect can be obtained with buildman using the `-r` flag. diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 107086cc0e5..7b9be887e55 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -195,6 +195,7 @@ class Builder: don't write to a separate output directory. thread_exceptions: List of exceptions raised by thread jobs no_lto (bool): True to set the NO_LTO flag when building +reproducible_builds (bool): True to set SOURCE_DATE_EPOCH=0 for builds Private members: _base_board_dict: Last-summarised Dict of boards @@ -254,7 +255,7 @@ class Builder: config_only=False, squash_config_y=False, warnings_as_errors=False, work_in_output=False, test_thread_exceptions=False, adjust_cfg=None, - allow_missing=False, no_lto=False): + allow_missing=False, no_lto=False, reproducible_builds=False): """Create a new Builder object Args: @@ -334,6 +335,7 @@ class Builder: self.allow_missing = allow_missing self._ide = False self.no_lto = no_lto +self.reproducible_builds = reproducible_builds if not self.squash_config_y: self.config_filenames += EXTRA_CONFIG_FILENAMES diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index dae3d4ab9ff..8b88c68e5d2 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -257,6 +257,8 @@ class BuilderThread(threading.Thread): args.append('BINMAN_ALLOW_MISSING=1') if self.builder.no_lto: args.append('NO_LTO=1') +if self.builder.reproducible_builds: +args.append('SOURCE_DATE_EPOCH=0') config_args = ['%s_defconfig' % brd.target] config_out = '' args.extend(self.builder.toolchains.GetMakeArguments(brd)) diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst index 800b83a89de..c8b0db3d8b9 100644 --- a/tools/buildman/buildman.rst +++ b/tools/buildman/buildman.rst @@ -1023,14 +1023,15 @@ U-Boot's build system embeds information such as a build timestamp into the final binary. This information varies each time U-Boot is built. This causes various files to be rebuilt even if no source changes are made, which in turn requires that the final U-Boot binary be re-linked. This unnecessary work can -be avoided by turning off the timestamp feature. This can be achieved by -setting the SOURCE_DATE_EPOCH environment variable to 0. +be avoided by turning off the timestamp feature. This can be achieved using +the `-r` flag, which enables reproducible builds by setting +`SOURCE_DATE_EPOCH=0` when building. Combining all of these options together yields the command-line shown below. This will provide the quickest possible feedback regarding the current content of the source tree, thus allowing rapid tested evolution of the code:: -SOURCE_DATE_EPOCH=0 ./tools/buildman/buildman -P tegra +./tools/buildman/buildman -Pr tegra Checking configuration diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index 409013671be..da7f1a99f6b 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -97,6 +97,8 @@ def ParseArgs(): default=False, help="Use full toolchain path in CROSS_COMPILE") parser.add_option('-P', '--per-board-out-dir', action='store_true', default=False, help="Use an O= (output) directory per board rather than per thread") +parser.add_option('-r', '--reproducible-builds', action='store_true', + help='Set SOURCE_DATE_EPOCH=0 to suuport a reproducible bui
[PATCH v2 3/4] buildman: Support disabling LTO
This cuts down build performance considerably and is not always needed, when checking for build errors, etc. Add a flag to disable it. Signed-off-by: Simon Glass --- (no changes since v1) tools/buildman/builder.py | 5 - tools/buildman/builderthread.py | 2 ++ tools/buildman/buildman.rst | 14 ++ tools/buildman/cmdline.py | 2 ++ tools/buildman/control.py | 2 +- tools/buildman/func_test.py | 25 + 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index c2a69027f88..107086cc0e5 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -194,6 +194,7 @@ class Builder: work_in_output: Use the output directory as the work directory and don't write to a separate output directory. thread_exceptions: List of exceptions raised by thread jobs +no_lto (bool): True to set the NO_LTO flag when building Private members: _base_board_dict: Last-summarised Dict of boards @@ -253,7 +254,7 @@ class Builder: config_only=False, squash_config_y=False, warnings_as_errors=False, work_in_output=False, test_thread_exceptions=False, adjust_cfg=None, - allow_missing=False): + allow_missing=False, no_lto=False): """Create a new Builder object Args: @@ -292,6 +293,7 @@ class Builder: C=val to set the value of C (val must have quotes if C is a string Kconfig allow_missing: Run build with BINMAN_ALLOW_MISSING=1 +no_lto (bool): True to set the NO_LTO flag when building """ self.toolchains = toolchains @@ -331,6 +333,7 @@ class Builder: self.adjust_cfg = adjust_cfg self.allow_missing = allow_missing self._ide = False +self.no_lto = no_lto if not self.squash_config_y: self.config_filenames += EXTRA_CONFIG_FILENAMES diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 7ba9a856dd5..dae3d4ab9ff 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -255,6 +255,8 @@ class BuilderThread(threading.Thread): args.append('KCFLAGS=-Werror') if self.builder.allow_missing: args.append('BINMAN_ALLOW_MISSING=1') +if self.builder.no_lto: +args.append('NO_LTO=1') config_args = ['%s_defconfig' % brd.target] config_out = '' args.extend(self.builder.toolchains.GetMakeArguments(brd)) diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst index 11c72141791..800b83a89de 100644 --- a/tools/buildman/buildman.rst +++ b/tools/buildman/buildman.rst @@ -1123,6 +1123,20 @@ toolchain. For example: buildman -O clang-7 --board sandbox +Building without LTO + + +Link-time optimisation (LTO) is designed to reduce code size by globally +optimising the U-Boot build. Unfortunately this can dramatically slow down +builds. This is particularly noticeable when running a lot of builds. + +Use the -L (--no-lto) flag to disable LTO. + +.. code-block:: bash + + buildman -L --board sandbox + + Doing a simple build diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index c485994e9fe..409013671be 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -71,6 +71,8 @@ def ParseArgs(): default=False, help="Don't convert y to 1 in configs") parser.add_option('-l', '--list-error-boards', action='store_true', default=False, help='Show a list of boards next to each error/warning') +parser.add_option('-L', '--no-lto', action='store_true', + default=False, help='Disable Link-time Optimisation (LTO) for builds') parser.add_option('--list-tool-chains', action='store_true', default=False, help='List available tool chains (use -v to see probing detail)') parser.add_option('-m', '--mrproper', action='store_true', diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 87e7d0e2012..13a462ae595 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -351,7 +351,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None, work_in_output=options.work_in_output, test_thread_exceptions=test_thread_exceptions, adjust_cfg=adjust_cfg, -allow_missing=allow_missing) +allow_missing=allow_missing, no_lto=options.no_lto)
Re: [PATCH v2 1/1] spl: allow loading via partition type GUID
Hi Heinrich, On Thu, 16 Feb 2023 at 23:56, Heinrich Schuchardt wrote: > > > > On 2/17/23 03:55, Simon Glass wrote: > > " properHi Heinrich, > > > > On Thu, 16 Feb 2023 at 14:31, Heinrich Schuchardt > > wrote: > >> > >> > >> > >> On 2/16/23 21:17, Simon Glass wrote: > >>> Hi Heinrich, > >>> > >>> On Thu, 16 Feb 2023 at 08:30, Heinrich Schuchardt > >>> wrote: > >>>> > >>>> Some boards provide main U-Boot as a dedicated partition to SPL. > >>>> Currently we can define either a fixed partition number or an MBR > >>>> partition type to define which partition is to be used. > >>>> > >>>> Partition numbers tend to conflict with established partitioning schemes > >>>> of Linux distros. MBR partitioning is more and more replaced by GPT > >>>> partitioning. > >>>> > >>>> Allow defining a partition type GUID identifying the partition to load > >>>> main U-Boot from. > >>>> > >>>> Signed-off-by: Heinrich Schuchardt > >>>> --- > >>>> v2: > >>>> avoid if/endif in Kconfig > >>>> --- > >>>>common/spl/Kconfig | 27 ++- > >>>>common/spl/spl_mmc.c | 13 + > >>>>2 files changed, 35 insertions(+), 5 deletions(-) > >>>> > >>>> diff --git a/common/spl/Kconfig b/common/spl/Kconfig > >>>> index 3c2af453ab..9d12b48297 100644 > >>>> --- a/common/spl/Kconfig > >>>> +++ b/common/spl/Kconfig > >>>> @@ -514,19 +514,36 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION > >>>> used in raw mode > >>>> > >>>>config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE > >>>> - bool "MMC raw mode: by partition type" > >>>> + bool "MMC raw mode: by MBR partition type" > >>>> depends on DOS_PARTITION && > >>>> SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION > >>>> help > >>>> - Use partition type for specifying U-Boot partition on MMC/SD in > >>>> + Use MBR partition type for specifying U-Boot partition on > >>>> MMC/SD in > >>>> raw mode. U-Boot will be loaded from the first partition of > >>>> this > >>>> type to be found. > >>>> > >>>>config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE > >>>> - hex "Partition Type on the MMC to load U-Boot from" > >>>> + hex "MBR Partition Type on the MMC to load U-Boot from" > >>>> depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE > >>>> help > >>>> - Partition Type on the MMC to load U-Boot from, when the MMC is > >>>> being > >>>> - used in raw mode. > >>>> + MBR Partition Type on the MMC to load U-Boot from, when the > >>>> MMC is > >>>> + being used in raw mode. > >>>> + > >>>> +config SYS_MMCSD_RAW_MODE_U_BOOT_USE_GPT_PARTITION_TYPE > >>>> + bool "MMC raw mode: GPT by partition type" > >>>> + depends on PARTITION_TYPE_GUID && > >>>> SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION > >>>> + help > >>>> + Use GPT partition type for specifying U-Boot partition on > >>>> MMC/SD in > >>>> + raw mode. U-Boot will be loaded from the first partition of > >>>> this > >>>> + type to be found. > >>>> + > >>>> +config SYS_MMCSD_RAW_MODE_U_BOOT_GPT_PARTITION_TYPE > >>>> + string "GPT Partition Type on the MMC to load U-Boot from" > >>>> + depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_GPT_PARTITION_TYPE > >>>> + default d2f002f8-e4e7-4269-b8ac-3bb6fabeaff6 > >>> > >>> What is this? Can we have a register of these hideous things and call > >>> them by name? > > > > Further, I don't see any documentation on this in U-Boot. Could you at > > least add a list of these things? > > > >>> > >>>> + help > >>>> +
Re: [PATCH 5/9] binman: Implement missing check functions in mkimage entry
On Sun, 19 Feb 2023 at 15:02, Jonas Karlman wrote: > > The mkimage entry is working like a section entry but inherits from > Entry not Entry_section. Copy implementations of missing Check-functions > from Entry_section and adopt to Entry_mkimage. > > Signed-off-by: Jonas Karlman > --- > tools/binman/etype/mkimage.py | 44 ++- > 1 file changed, 43 insertions(+), 1 deletion(-) Again I suspect this needs a test to make sure it works?
Re: [PATCH 7/9] binman: Fix blank line usage for invalid images warning text
On Sun, 19 Feb 2023 at 15:02, Jonas Karlman wrote: > > There is no blank line between last missing blob help message and the > header line for optional blob help messages. > > Image 'simple-bin' is missing external blobs and is non-functional: atf-bl31 > > /binman/simple-bin/fit/images/@atf-SEQ/atf-bl31: > See the documentation for your board. You may need to build ARM Trusted > Firmware and build with BL31=/path/to/bl31.bin > Image 'simple-bin' is missing external blobs but is still functional: tee-os > > /binman/simple-bin/fit/images/@tee-SEQ/tee-os: > See the documentation for your board. You may need to build Open Portable > Trusted Execution Environment (OP-TEE) with TEE=/path/to/tee.bin > > Some images are invalid > > With this a blank line is inserted to make the text more readable. > > Signed-off-by: Jonas Karlman > --- > tools/binman/control.py | 13 +++-- > 1 file changed, 7 insertions(+), 6 deletions(-) > Reviewed-by: Simon Glass
Re: [PATCH 8/9] binman: Show filename in missing blob help message
On Sun, 19 Feb 2023 at 15:02, Jonas Karlman wrote: > > Show the filename next to the node path in missing blob help messages, > also show a generic missing blob message when there was no help message > for the help tag. > > Signed-off-by: Jonas Karlman > --- > tools/binman/control.py | 13 ++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > Reviewed-by: Simon Glass Test?
Re: [PATCH 9/9] Makefile: Show binman missing blob message
Hi Jonas +Tom Rini On Sun, 19 Feb 2023 at 15:02, Jonas Karlman wrote: > > When binman is invoked during a build of U-Boot and an external blob is > missing, the user is usually presented with a generic file not found in > input path message. > > Invoke binman with --allow-missing so that binman can show relevant > missing blob help messages. Build continue to fail with missing blobs > unless BINMAN_ALLOW_MISSING=1 is used. > > This changes the following error message: > > binman: Filename 'atf-bl31' not found in input path (...) > > to the following: > > Image 'itb' is missing external blobs and is non-functional: atf-blob > > /binman/itb/fit/images/atf/atf-blob (bl31.bin): > See the documentation for your board. You may need to build ARM Trusted > Firmware and build with BL31=/path/to/bl31.bin > > Signed-off-by: Jonas Karlman > --- > Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index 58f8c7a35335..c2860824f6f2 100644 > --- a/Makefile > +++ b/Makefile > @@ -1326,7 +1326,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if > $(BINMAN_DEBUG),-D) \ > --toolpath $(objtree)/tools \ > $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \ > build -u -d u-boot.dtb -O . -m \ > - $(if $(BINMAN_ALLOW_MISSING),--allow-missing > --ignore-missing) \ > + --allow-missing $(if > $(BINMAN_ALLOW_MISSING),--ignore-missing) \ > -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \ > -I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \ > $(foreach f,$(BINMAN_INDIRS),-I $(f)) \ > -- > 2.39.2 > I agree this is better, but we should see what Tom thinks. Reviewed-by: Simon Glass Regards, Simon
Re: [PATCH 2/2] cmd: introduce 'write' command
Hi Rasmus, On Fri, 17 Feb 2023 at 17:59, Rasmus Villemoes wrote: > > It's almost no extra code to hook up a buddy to the 'read' command. In > fact, since the command is passed its own 'struct cmd_tbl', we can use > the exact same callback, and let it figure out for itself whether it > was invoked as "read" or "write". > > Signed-off-by: Rasmus Villemoes > --- > cmd/Kconfig | 5 + > cmd/Makefile | 1 + > cmd/read.c | 29 ++--- > 3 files changed, 28 insertions(+), 7 deletions(-) Great, but please do add a little more code :-) - doc/usage/cmd - test/cmd/write.c For the test you can use sandbox's mmc0 - see dm_test_mmc_blk() for an example of a test that does that. For checking the command response, the acpi.c test is an example, although I suppose there is actually no output. Regards, Simon
Re: [PATCH 1/2] cmd: read: use part_get_info_by_dev_and_name_or_num() instead of open-coded dev_part parsing
On Fri, 17 Feb 2023 at 17:59, Rasmus Villemoes wrote: > > Use the helper part_get_info_by_dev_and_name_or_num() for parsing a > dev[:part] string and obtaining the partition info in one go, instead > of open-coding all that. > > As a bonus, this will automatically allow using the dev#partname > syntax as well, for accessing raw partitions by name. > > Signed-off-by: Rasmus Villemoes > --- > cmd/read.c | 32 > 1 file changed, 8 insertions(+), 24 deletions(-) > Reviewed-by: Simon Glass
Re: [PATCH v3 58/76] Drop ubsha1 tool
Hi Peter, On Mon, 20 Feb 2023 at 03:16, Peter Robinson wrote: > > On Wed, Feb 1, 2023 at 8:46 PM Simon Glass wrote: > > > > This seems to have been used by ppc4xx which was removed a while back. > > The Kconfig does not exist so it is never built. Drop it. > > That assumption isn't entirely correct, it was at least built by the > tools only/all build process. Oh yes, I perhaps meant that it isn't used. Is it OK to delete it? Regards, Simon
Re: [PATCH v3 2/3] kconfig: new macro IF_ENABLED()
Hi Heinrich, On Mon, 20 Feb 2023 at 10:15, Andre Przywara wrote: > > On Sun, 19 Feb 2023 12:36:28 +0100 > Heinrich Schuchardt wrote: > > Hi, > > > We want to move from using #ifdef to using if in our code. A lot of our > > code using #ifdef is structured like: > > > > #ifdef CONFIG_FOO > > fun(CONFIG_FOO_OPT); > > #endif > > > > In Kconfig you will find > > > > config FOO > > bool "enable foo" > > > > config FOO_OPT > > string "value for foo" > > depends on FOO > > > > We cannot use CONFIG_FOO_OPT in our code directly if CONFIG_FOO is not > > defined. > > > > if (IS_ENABLED(CONFIG_FOO) > > fun(CONFIG_FOO_OPT); > > > > This would result in an error due to the undefined symbol CONFIG_FOO_OPT. > > > > The new macro IF_ENABLED(CONFIG_FOO, opt_cfg, def_val) which evaluates > > to opt_cfg if CONFIG_FOO is set to 'y' and to def_val otherwise comes to > > the rescue: > > > > if (IS_ENABLED(CONFIG_FOO) > > fun(IF_ENABLED(CONFIG_FOO, CONFIG_FOO_OPT, ""); > > Ah, yeah, I like this one, this is indeed the most common pattern that > prevents many "#if to if" conversions. > I briefly thought about unifying those two lines, but it's probably > limiting, as it appears more flexible this way: > > > > > If CONFIG_FOO is not defined, the compiler will see > > > > if (0) > > fun(""); > > > > and be happy. > > > > If CONFIG_FOO is defined, the compiler will see > > > > if (1) > > fun(CONFIG_FOO_OPT) > > > > and be equally happy. > > > > Signed-off-by: Heinrich Schuchardt > > Reviewed-by: Andre Przywara > > Cheers, > Andre > > > --- > > v3: > > new patch > > --- > > include/linux/kconfig.h | 7 +++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h > > index 2bc704e110..7fea72da1a 100644 > > --- a/include/linux/kconfig.h > > +++ b/include/linux/kconfig.h > > @@ -28,6 +28,13 @@ > > */ > > #define IS_ENABLED(option) config_enabled(option, 0) > > > > +/* > > + * IF_ENABLED(CONFIG_FOO, opt_cfg, def_val) evalutes to opt_cfg if > > + * CONFIG_FOO is set to 'y' and to def_val otherwise. > > + */ > > +#define IF_ENABLED(option, opt_cfg, def_val) \ > > + config_opt_enabled(IS_ENABLED(option), opt_cfg, def_val) > > + > > /* > > * U-Boot add-on: Helper macros to reference to different macros (prefixed > > by > > * CONFIG_, CONFIG_SPL_, CONFIG_TPL_ or CONFIG_TOOLS_), depending on the > > build > This looks good to me, but what should we do with the existing IF_ENABLED_INT()? Perhaps we should drop that in favour of this one, or do we need both? Regards, Simon
Re: [PATCH 6/9] binman: Mark mkimage entry missing when its subnodes is missing
On Sun, 19 Feb 2023 at 15:02, Jonas Karlman wrote: > > Using the mkimage entry with the multiple-data-files prop and having a > missing external blob result in an unexpected ValueError exception using > the --allow-missing flag. > > ValueError: Filename 'missing.bin' not found in input path (...) > > Fix this by using _pathname that is resolved by ObtainContents for blob > entries, ObtainContents also handles allow missing for external blobs. > > Mark mkimage entry as missing and return without running mkimage when > missing entries is reported by CheckMissing. > > Signed-off-by: Jonas Karlman > --- > tools/binman/etype/mkimage.py | 10 +- > tools/binman/ftest.py | 9 + > .../test/278_mkimage_missing_multiple.dts | 19 +++ > 3 files changed, 37 insertions(+), 1 deletion(-) > create mode 100644 tools/binman/test/278_mkimage_missing_multiple.dts > Reviewed-by: Simon Glass
[PATCH 2/3] rockchip: Disable DISTRO_DEFAULTS for rockpro64
This board has moved to standard boot but the old 'distro_bootcmd' command is still active. Disable DISTRO_DEFAULTS to fix this. Signed-off-by: Simon Glass --- configs/rockpro64-rk3399_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig index 49614236819..fe2415c87c9 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig @@ -19,6 +19,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART=y +# CONFIG_DISTRO_DEFAULTS is not set CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_USE_PREBOOT=y -- 2.39.2.637.g21b0678d19-goog
[PATCH 3/3] bootstd: Enable BOOTSTD_DEFAULTS by default
This is needed to enable the boot command used to start standard boot. Enable it by default. This brings in quite a few features, mostly in common with DISTRO_DEFAULTS Signed-off-by: Simon Glass --- boot/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/boot/Kconfig b/boot/Kconfig index 5f491625c82..8759b863b00 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -409,6 +409,7 @@ if BOOTSTD config BOOTSTD_DEFAULTS bool "Select some common defaults for standard boot" depends on BOOTSTD + default y imply USE_BOOTCOMMAND # Bring in some defaults which are generally needed. Boards can drop # these as needed to save code space. Bootstd does not generally require -- 2.39.2.637.g21b0678d19-goog
[PATCH 1/3] rockchip: Drop bootstage stash in TPL and SPL
Unfortunately the IRAM used to stash the bootstage records in TPL becomes accessible after SPL runs. Presumably this is because of ATF taking it over. We could move the stash to another address in SPL, before passing it to U-Boot proper. But it seems easier to wait until we have support for standard passage[1] which should not be too far away. For now, disable it in TPL and SPL. [1] https://patchwork.ozlabs.org/project/uboot/cover/ 20220117150428.1580273-1-...@chromium.org/ Signed-off-by: Simon Glass --- configs/rockpro64-rk3399_defconfig | 5 - 1 file changed, 5 deletions(-) diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig index dd67f9dff64..49614236819 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig @@ -13,7 +13,6 @@ CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y CONFIG_TARGET_ROCKPRO64_RK3399=y CONFIG_SPL_STACK=0x40 -CONFIG_BOOTSTAGE_STASH_ADDR=0xff8e CONFIG_DEBUG_UART_BASE=0xFF1A CONFIG_DEBUG_UART_CLOCK=2400 CONFIG_SPL_SPI_FLASH_SUPPORT=y @@ -21,11 +20,7 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART=y CONFIG_BOOTSTAGE=y -CONFIG_SPL_BOOTSTAGE=y -CONFIG_TPL_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y -CONFIG_SPL_BOOTSTAGE_RECORD_COUNT=10 -CONFIG_BOOTSTAGE_STASH=y CONFIG_USE_PREBOOT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rockpro64.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y -- 2.39.2.637.g21b0678d19-goog
Re: [PATCH] CI: Update test/nokia_rx51_test.sh to use prebuilt images
On Tue, 21 Feb 2023 at 09:22, Tom Rini wrote: > > From: Pali Rohár > > Now that the Dockerfile creates images which have the binaries we > require included, have CI make symlinks for them and update the existing > script to support this. > > Signed-off-by: Tom Rini > --- > Pali, since you posted this in a thread as untested, can you please > reply with a S-o-b tag? I tweaked it slightly while testing. Thanks. > --- > .azure-pipelines.yml| 9 - > .gitlab-ci.yml | 11 +-- > test/nokia_rx51_test.sh | 24 > 3 files changed, 33 insertions(+), 11 deletions(-) Yippee! Reviewed-by: Simon Glass
Re: rk3399 boards broken, only partially converted to standard boot? (was Re: [PATCH 71/71] rockchip: Convert rockpro64-rk3399 to use standard boot)
Hi Vagrant, On Tue, 21 Feb 2023 at 13:32, Vagrant Cascadian wrote: > > On 2023-02-20, Simon Glass wrote: > > On Sat, 18 Feb 2023 at 19:19, Vagrant Cascadian wrote: > >> On 2022-12-07, Simon Glass wrote: > >> > Drop the use of scripts and rely on standard boot for all operation. > >> > >> This patch, applied as 3891c68ef50eda38d78c95ecd03aed030aa6bb53 broke > >> booting on pinebook-pro-rk3399, which still tries to "run > >> distro_bootcmd" but distro_bootcmd is no longer defined... probably > >> several other rk3399 systems are similarly affected? Maybe other > >> rockchip systems as well? Reverting the patch fixes booting on the > >> pinebook-pro-rk3399, at least. > >> > >> It seems that rockpro64-rk3399 was used as an example, so that > >> presumably works, but in actuality, this commit only modifies common > >> files for many rockchip and rk3399 boards and nothing rockpro64-rk3399 > >> specific, so the commit message is a bit misleading. > >> > >> I am not sure what the best way forward is; to quickly convert all the > >> other boards in a new patch series, or incrementally shift one system at > >> a time over (and somehow restore previous behavior in the > >> meantime?)... as it stands it appears we are left with rk3399 boards > >> partially converted but broken... > >> > >> FWIW, I have not confirmed for sure that other boards are broken, so it > >> might just be pinebook-pro-rk3399 for some reason. I have a few rk3399 > >> based boards I can test to confirm... > > > > I suspect it needs BOOTSTD_DEFAULTS enabled. Could you try that? I can > > send a patch if you like? > > I added CONFIG_BOOTSTD_DEFAULTS=y to > configs/pinebook-pro-rk3399_defconfig but it still had the same issue... > > bootcmd does not get updated to use bootstd instead of distro_bootcmd > ... and distro_bootcmd is not defined, so it fails to boot! At least it > gets as far as a u-boot prompt! > > > As mentioned on irc, I wasn't able to get rockpro64-rk3399 to boot at > all (hanging at SPL), so cannot test if it also needs further changes > for BOOTSTD to work... and for good measure, rock64-rk3328 also fails in > the same way. > > I also have puma-rk3399, firefly-rk3399 and firefly-rk3288 to > test... though might wait on some of those till the dust settles a > bit... Yes, see my note about this a few minutes back. I sent 3 patches at lunchtime too: https://patchwork.ozlabs.org/project/uboot/list/?series=343056 Regards, Simon
Re: [PATCH v3 11/95] Correct SPL use of PHY_CADENCE_SIERRA
Hi Tom, On Tue, 21 Feb 2023 at 16:02, Tom Rini wrote: > > On Tue, Feb 21, 2023 at 12:35:41PM -0700, Simon Glass wrote: > > Hi Tom, > > > > On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > > > > > On Sun, Feb 12, 2023 at 04:15:14PM -0700, Simon Glass wrote: > > > > This converts 1 usage of this option to the non-SPL form, since there is > > > > no SPL_PHY_CADENCE_SIERRA defined in Kconfig > > > > > > > > Signed-off-by: Simon Glass > > > > --- > > > > > > > > (no changes since v1) > > > > > > > > drivers/phy/cadence/Makefile | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/phy/cadence/Makefile b/drivers/phy/cadence/Makefile > > > > index af63b32d9f5..c247feb8262 100644 > > > > --- a/drivers/phy/cadence/Makefile > > > > +++ b/drivers/phy/cadence/Makefile > > > > @@ -1,2 +1,2 @@ > > > > -obj-$(CONFIG_$(SPL_)PHY_CADENCE_SIERRA) += phy-cadence-sierra.o > > > > +obj-$(CONFIG_PHY_CADENCE_SIERRA) += phy-cadence-sierra.o > > > > obj-$(CONFIG_$(SPL_)PHY_CADENCE_TORRENT) += phy-cadence-torrent.o > > > > > > This, and then PHY_CADENCE_TORRENT take this the wrong direction, both > > > symbols should be false for non-PPL builds. > > > > This one is odd, since the board defines SPL_PHY, presumably for a > > reason. It could always undefine that if needed. > > > > I'll add some more notes in v5. > > The platforms in question are fairly complex and I want to say it needs > a PHY for USB in SPL, but not a PHY for networking, in SPL. Ah that makes more sense. OK, will take yet another look. Regards, Simon
Re: [PATCH v1 1/1] input: button_kbd: make driver complementary to gpio buttons
Hi Svyatoslav, If there is no input maintainer, It should just get picked up by Tom at some point. Regards, Simon On Tue, 21 Feb 2023 at 12:51, Svyatoslav Ryhel wrote: > Thanks! Do I need someone else to be able to merge this or your review > is enough? > > Best regards, > Svyatoslav R. > > вт, 21 лют. 2023 р. о 21:37 Simon Glass пише: > > > > On Mon, 20 Feb 2023 at 10:41, Svyatoslav Ryhel > wrote: > > > > > > Remove need of dts binding for button keyboard since it reuses > > > gpio-keys binding. Select gpio-keys driver if button keyboard > > > is selected since button keyboard can not operate on its own. > > > > > > Tested-by: Svyatoslav Ryhel # HTC One X T30 > > > Signed-off-by: Svyatoslav Ryhel > > > --- > > > drivers/input/Kconfig | 2 +- > > > drivers/input/button_kbd.c | 10 -- > > > 2 files changed, 5 insertions(+), 7 deletions(-) > > > > Reviewed-by: Simon Glass >
Re: [PATCH v3 11/95] Correct SPL use of PHY_CADENCE_SIERRA
Hi Tom, On Tue, 21 Feb 2023 at 16:09, Simon Glass wrote: > > Hi Tom, > > On Tue, 21 Feb 2023 at 16:02, Tom Rini wrote: > > > > On Tue, Feb 21, 2023 at 12:35:41PM -0700, Simon Glass wrote: > > > Hi Tom, > > > > > > On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > > > > > > > On Sun, Feb 12, 2023 at 04:15:14PM -0700, Simon Glass wrote: > > > > > This converts 1 usage of this option to the non-SPL form, since there > > > > > is > > > > > no SPL_PHY_CADENCE_SIERRA defined in Kconfig > > > > > > > > > > Signed-off-by: Simon Glass > > > > > --- > > > > > > > > > > (no changes since v1) > > > > > > > > > > drivers/phy/cadence/Makefile | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/drivers/phy/cadence/Makefile > > > > > b/drivers/phy/cadence/Makefile > > > > > index af63b32d9f5..c247feb8262 100644 > > > > > --- a/drivers/phy/cadence/Makefile > > > > > +++ b/drivers/phy/cadence/Makefile > > > > > @@ -1,2 +1,2 @@ > > > > > -obj-$(CONFIG_$(SPL_)PHY_CADENCE_SIERRA) += phy-cadence-sierra.o > > > > > +obj-$(CONFIG_PHY_CADENCE_SIERRA) += phy-cadence-sierra.o > > > > > obj-$(CONFIG_$(SPL_)PHY_CADENCE_TORRENT) += phy-cadence-torrent.o > > > > > > > > This, and then PHY_CADENCE_TORRENT take this the wrong direction, both > > > > symbols should be false for non-PPL builds. > > > > > > This one is odd, since the board defines SPL_PHY, presumably for a > > > reason. It could always undefine that if needed. > > > > > > I'll add some more notes in v5. > > > > The platforms in question are fairly complex and I want to say it needs > > a PHY for USB in SPL, but not a PHY for networking, in SPL. > > Ah that makes more sense. OK, will take yet another look. I'll just drop this patch. Regards, Simon
[PATCH v5 03/44] sh4: Drop unused twl6030 driver
This is not used. Drop the driver and Kconfig option. Signed-off-by: Simon Glass --- (no changes since v1) drivers/input/Makefile | 1 - drivers/input/twl6030.c | 47 - 2 files changed, 48 deletions(-) delete mode 100644 drivers/input/twl6030.c diff --git a/drivers/input/Makefile b/drivers/input/Makefile index 14c0ea73254..71f315adf6f 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -14,5 +14,4 @@ obj-$(CONFIG_APPLE_SPI_KEYB) += apple_spi_kbd.o obj-$(CONFIG_I8042_KEYB) += i8042.o obj-$(CONFIG_TEGRA_KEYBOARD) += input.o tegra-kbc.o obj-$(CONFIG_TWL4030_INPUT) += twl4030.o -obj-$(CONFIG_TWL6030_INPUT) += twl6030.o endif diff --git a/drivers/input/twl6030.c b/drivers/input/twl6030.c deleted file mode 100644 index 76bd3488fc6..000 --- a/drivers/input/twl6030.c +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * TWL6030 input - * - * Copyright (C) 2016 Paul Kocialkowski - */ - -#include - -int twl6030_input_power_button(void) -{ - u8 value; - - twl6030_i2c_read_u8(TWL6030_CHIP_PM, TWL6030_STS_HW_CONDITIONS, &value); - - /* Power button is active low. */ - if (value & TWL6030_STS_HW_CONDITIONS_PWRON) - return 0; - - return 1; -} - -int twl6030_input_charger(void) -{ - u8 value; - - twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, TWL6030_CONTROLLER_STAT1, - &value); - - if (value & TWL6030_CONTROLLER_STAT1_VAC_DET) - return 1; - - return 0; -} - -int twl6030_input_usb(void) -{ - u8 value; - - twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, TWL6030_CONTROLLER_STAT1, - &value); - - if (value & TWL6030_CONTROLLER_STAT1_VBUS_DET) - return 1; - - return 0; -} -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 02/44] mtd: Drop unused CONFIG_ONENAND_U_BOOT
This option does not exist, so the Makefile rule does nothing. Drop it. Signed-off-by: Simon Glass --- (no changes since v1) Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 54f894dab84..20608b6a800 100644 --- a/Makefile +++ b/Makefile @@ -956,7 +956,6 @@ endif # Always append INPUTS so that arch config.mk's can add custom ones INPUTS-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check -INPUTS-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin ifeq ($(CONFIG_SPL_FSL_PBL),y) INPUTS-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin else -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 01/44] mtd: Drop unused kb9202_nand driver
This is not used since time out of mind. Drop the driver and Kconfig option. Signed-off-by: Simon Glass Acked-by: Michael Trimarchi --- (no changes since v1) drivers/mtd/nand/raw/Makefile | 1 - drivers/mtd/nand/raw/kb9202_nand.c | 134 - 2 files changed, 135 deletions(-) delete mode 100644 drivers/mtd/nand/raw/kb9202_nand.c diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile index 666323e2219..add2b4cf655 100644 --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile @@ -56,7 +56,6 @@ obj-$(CONFIG_NAND_DENALI) += denali.o obj-$(CONFIG_NAND_DENALI_DT) += denali_dt.o obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o -obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o obj-$(CONFIG_NAND_LPC32XX_MLC) += lpc32xx_nand_mlc.o diff --git a/drivers/mtd/nand/raw/kb9202_nand.c b/drivers/mtd/nand/raw/kb9202_nand.c deleted file mode 100644 index 9d26532c780..000 --- a/drivers/mtd/nand/raw/kb9202_nand.c +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2006 - * KwikByte - * - * (C) Copyright 2009 - * Matthias Kaehlcke - */ - -#include -#include -#include -#include -#include - -#include - -/* - * hardware specific access to control-lines - */ - -#define MASK_ALE(1 << 22) /* our ALE is A22 */ -#define MASK_CLE(1 << 21) /* our CLE is A21 */ - -#define KB9202_NAND_NCE (1 << 28) /* EN* on D28 */ -#define KB9202_NAND_BUSY (1 << 29) /* RB* on D29 */ - -#define KB9202_SMC2_NWS (1 << 2) -#define KB9202_SMC2_TDF (1 << 8) -#define KB9202_SMC2_RWSETUP (1 << 24) -#define KB9202_SMC2_RWHOLD (1 << 29) - -/* - * Board-specific function to access device control signals - */ -static void kb9202_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) -{ - struct nand_chip *this = mtd_to_nand(mtd); - - if (ctrl & NAND_CTRL_CHANGE) { - ulong IO_ADDR_W = (ulong) this->IO_ADDR_W; - - /* clear ALE and CLE bits */ - IO_ADDR_W &= ~(MASK_ALE | MASK_CLE); - - if (ctrl & NAND_CLE) - IO_ADDR_W |= MASK_CLE; - - if (ctrl & NAND_ALE) - IO_ADDR_W |= MASK_ALE; - - this->IO_ADDR_W = (void *) IO_ADDR_W; - - if (ctrl & NAND_NCE) - writel(KB9202_NAND_NCE, AT91C_PIOC_CODR); - else - writel(KB9202_NAND_NCE, AT91C_PIOC_SODR); - } - - if (cmd != NAND_CMD_NONE) - writeb(cmd, this->IO_ADDR_W); -} - - -/* - * Board-specific function to access the device ready signal. - */ -static int kb9202_nand_ready(struct mtd_info *mtd) -{ - return readl(AT91C_PIOC_PDSR) & KB9202_NAND_BUSY; -} - - -/* - * Board-specific NAND init. Copied from include/linux/mtd/nand.h for reference. - * - * struct nand_chip - NAND Private Flash Chip Data - * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device - * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device - * @hwcontrol: [BOARDSPECIFIC] hardwarespecific function for accesing control-lines - * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line - * If set to NULL no access to ready/busy is available and the ready/busy information - * is read from the chip status register - * @enable_hwecc: [BOARDSPECIFIC] function to enable (reset) hardware ecc generator. Must only - * be provided if a hardware ECC is available - * @eccmode: [BOARDSPECIFIC] mode of ecc, see defines - * @chip_delay:[BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) - * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about - * special functionality. See the defines for further explanation -*/ -/* - * This routine initializes controller and GPIOs. - */ -int board_nand_init(struct nand_chip *nand) -{ - unsigned int value; - - nand->ecc.mode = NAND_ECC_SOFT; - nand->cmd_ctrl = kb9202_nand_hwcontrol; - nand->dev_ready = kb9202_nand_ready; - - /* in case running outside of bootloader */ - writel(1 << AT91C_ID_PIOC, AT91C_PMC_PCER); - - /* setup nand flash access (allow ample margin) */ - /* 4 wait states, 1 setup, 1 hold, 1 float for 8-bit device */ - writel(AT91C_SMC2_WSEN | KB9202_SMC2_NWS | KB9202_SMC2_TDF | - AT91C_SMC2_DBW_8 | KB9202_SMC2_RWSETUP | KB9202_SMC2_RWHOLD, - AT91C_SMC_CSR3); - -
[PATCH v5 06/44] Correct SPL uses of ARCH_MVEBU
This converts 2 usages of this option to the non-SPL form, since there is no SPL_ARCH_MVEBU defined in Kconfig Signed-off-by: Simon Glass --- (no changes since v1) drivers/mmc/mv_sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c index 336ebf14102..20049981473 100644 --- a/drivers/mmc/mv_sdhci.c +++ b/drivers/mmc/mv_sdhci.c @@ -64,7 +64,7 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks) host->ops = &mv_ops; #endif - if (CONFIG_IS_ENABLED(ARCH_MVEBU)) { + if (IS_ENABLED(CONFIG_ARCH_MVEBU)) { /* Configure SDHCI MBUS mbus bridge windows */ sdhci_mvebu_mbus_config((void __iomem *)regbase); } @@ -103,7 +103,7 @@ static int mv_sdhci_probe(struct udevice *dev) if (ret) return ret; - if (CONFIG_IS_ENABLED(ARCH_MVEBU)) { + if (IS_ENABLED(CONFIG_ARCH_MVEBU)) { /* Configure SDHCI MBUS mbus bridge windows */ sdhci_mvebu_mbus_config(host->ioaddr); } -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 10/44] Correct SPL uses of PHY_FIXED
This converts 3 usages of this option to the non-SPL form, since there is no SPL_PHY_FIXED defined in Kconfig Signed-off-by: Simon Glass --- (no changes since v1) drivers/net/mvneta.c | 4 ++-- net/mdio-uclass.c| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index 0fbfad11d45..24933473fa0 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -815,7 +815,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp) mvreg_write(pp, MVNETA_SDMA_CONFIG, val); /* Enable PHY polling in hardware if not in fixed-link mode */ - if (!CONFIG_IS_ENABLED(PHY_FIXED) || + if (!IS_ENABLED(CONFIG_PHY_FIXED) || pp->phydev->phy_id != PHY_FIXED_ID) { mvreg_write(pp, MVNETA_PHY_ADDR, pp->phydev->addr); @@ -1176,7 +1176,7 @@ static void mvneta_adjust_link(struct udevice *dev) * be added). Also, why is ADVERT_FC enabled if we don't enable * inband AN at all? */ - if (CONFIG_IS_ENABLED(PHY_FIXED) && + if (IS_ENABLED(CONFIG_PHY_FIXED) && pp->phydev->phy_id == PHY_FIXED_ID) val = MVNETA_GMAC_IB_BYPASS_AN_EN | MVNETA_GMAC_SET_FC_EN | diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index d80037d0ac7..e758cc66d7e 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -175,7 +175,7 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev, struct phy_device *phy; ofnode phynode; - if (CONFIG_IS_ENABLED(PHY_FIXED) && + if (IS_ENABLED(CONFIG_PHY_FIXED) && ofnode_phy_is_fixed_link(dev_ofnode(ethdev), &phynode)) { phy = phy_connect(NULL, 0, ethdev, interface); goto out; -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 09/44] Correct SPL use of PG_WCOM_UBOOT_UPDATE_SUPPORTED
This converts 1 usage of this option to the non-SPL form, since there is no SPL_PG_WCOM_UBOOT_UPDATE_SUPPORTED defined in Kconfig Signed-off-by: Simon Glass Aleksandar Gerasimovski --- (no changes since v1) board/keymile/common/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 8c282f9952a..991022ac833 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -78,7 +78,7 @@ int set_km_env(void) return 0; } -#if CONFIG_IS_ENABLED(PG_WCOM_UBOOT_UPDATE_SUPPORTED) +#if IS_ENABLED(CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED) #if ((!IS_ENABLED(CONFIG_PG_WCOM_UBOOT_BOOTPACKAGE) && \ !IS_ENABLED(CONFIG_PG_WCOM_UBOOT_UPDATE)) || \ (IS_ENABLED(CONFIG_PG_WCOM_UBOOT_BOOTPACKAGE) && \ -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 11/44] boot: Add Kconfigs for BOOTMETH_VBE_REQUEST
Allow this to be enabled separately in U-Boot proper and in SPL, since it is not needed in SPL. Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - Avoid use of def_bool boot/Kconfig | 20 boot/Makefile | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/boot/Kconfig b/boot/Kconfig index 5f491625c82..b89916c109c 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -528,6 +528,26 @@ config VPL_BOOTMETH_VBE if BOOTMETH_VBE +config BOOTMETH_VBE_REQUEST + bool "Support for serving VBE OS requests" + default y + help + Enables support for looking that the requests made by the + Operating System being booted. These requests result in additions to + the device tree /chosen node, added during the device tree fixup + phase. + +config SPL_BOOTMETH_VBE_REQUEST + bool "Support for serving VBE OS requests (SPL)" + depends on SPL + help + Enables support for looking that the requests made by the + Operating System being booted. These requests result in additions to + the device tree /chosen node, added during the device tree fixup + phase. + + This is only useful if you are booting an OS direct from SPL. + config BOOTMETH_VBE_SIMPLE bool "Bootdev support for VBE 'simple' method" default y diff --git a/boot/Makefile b/boot/Makefile index b9a12236798..88193a1b60e 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -52,7 +52,8 @@ endif obj-$(CONFIG_$(SPL_TPL_)EXPO) += expo.o scene.o scene_menu.o -obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE) += vbe.o vbe_request.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE) += vbe.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_REQUEST) += vbe_request.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE) += vbe_simple.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE_FW) += vbe_simple_fw.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE_OS) += vbe_simple_os.o -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 12/44] Correct SPL use of DM_RNG
This converts 1 usage of this option to the non-SPL form, since there is no SPL_DM_RNG defined in Kconfig Signed-off-by: Simon Glass --- (no changes since v1) boot/vbe_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/vbe_request.c b/boot/vbe_request.c index 45f1d2b7e17..312edfa2bdb 100644 --- a/boot/vbe_request.c +++ b/boot/vbe_request.c @@ -36,7 +36,7 @@ static int handle_random_req(ofnode node, int default_size, u32 size; int ret; - if (!CONFIG_IS_ENABLED(DM_RNG)) + if (!IS_ENABLED(CONFIG_DM_RNG)) return -ENOTSUPP; if (ofnode_read_u32(node, "vbe,size", &size)) { -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 13/44] lib: Add a Kconfig for SPL_BZIP2
This is implicitly used in the source and seems useful, so add it. Signed-off-by: Simon Glass --- (no changes since v1) lib/Kconfig | 6 ++ 1 file changed, 6 insertions(+) diff --git a/lib/Kconfig b/lib/Kconfig index 83e5edd73b0..1c93f523b3a 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -727,6 +727,12 @@ config ZSTD_LIB_MINIFY endif +config SPL_BZIP2 + bool "Enable bzip2 decompression support for SPL build" + depends on SPL + help + This enables support for bzip2 compression algorithm for SPL boot. + config SPL_LZ4 bool "Enable LZ4 decompression support in SPL" depends on SPL -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 14/44] moveconfig: Various minor improvements
It turns out that the conf_noproper file is not neeed, since if an option does not appear in U-Boot proper we can just omit it from the autoconf for that build. Drop it. Also add more control over what is output from the tool. Add this in here. It should be added to the previous series (splb). Signed-off-by: Simon Glass --- (no changes since v1) tools/moveconfig.py | 91 + 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index b3ac2672737..ec2afa92e46 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -1833,13 +1833,20 @@ def scan_src_files(fname_dict, all_uses, fname_uses): MODE_NORMAL, MODE_SPL, MODE_PROPER = range(3) -def do_scan_source(path, do_update, show_conflicts, do_commit): +def do_scan_source(path, do_update, do_update_source, show_conflicts, + do_commit): """Scan the source tree for Kconfig inconsistencies Args: path (str): Path to source tree -do_update (bool): True to write to scripts/kconf_... files -show_conflicts (bool): True to show conflicts +do_update (bool): True to write to scripts/conf_nospl file +do_update_source (bool): True to update source to remove invalid use of + CONFIG_IS_ENABLED() +show_conflicts (bool): True to show conflicts between the source code + and the Kconfig (such as missing options, or options which imply an + SPL option that does not exist) +do_commit (bool): Create commits to remove use of SPL_TPL_ and + CONFIG_IS_ENABLED macros when there is no SPL symbol. """ def is_not_proper(name): for prefix in SPL_PREFIXES: @@ -1977,9 +1984,7 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): dirname, leaf = os.path.split(fname) root, ext = os.path.splitext(leaf) -#if dirname != '' or root != 'Makefile': -#continue -if (dirname.startswith('test') or +if (dirname.startswith('test/') or dirname.startswith('lib/efi_selftest')): # Ignore test code since it is mostly only for sandbox pass @@ -2011,38 +2016,25 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): finish_file(last_fname, rest_list) return mk_dict, src_dict -def check_mk_missing(all_uses, spl_not_found, proper_not_found): +def check_missing(all_uses, spl_not_found, proper_not_found, + show_conflicts): # Make sure we know about all the options in Makefiles -print('\nCONFIG options present in Makefiles but not Kconfig:') not_found = check_not_found(all_uses, MODE_NORMAL) -show_uses(not_found) +if show_conflicts: +print('\nCONFIG options present in source but not Kconfig:') +show_uses(not_found) -print('\nCONFIG options present in Makefiles but not Kconfig (SPL):') not_found = check_not_found(all_uses, MODE_SPL) -show_uses(not_found) spl_not_found |= set(is_not_proper(key) or key for key in not_found.keys()) +if show_conflicts: +print('\nCONFIG options present in source but not Kconfig (SPL):') +show_uses(not_found) -print('\nCONFIG options used as Proper in Makefiles but without a non-SPL_ variant:') not_found = check_not_found(all_uses, MODE_PROPER) -show_uses(not_found) -proper_not_found |= set(key for key in not_found.keys()) - -def check_src_missing(all_uses, spl_not_found, proper_not_found): -# Make sure we know about all the options in source files -print('\nCONFIG options present in source but not Kconfig:') -not_found = check_not_found(all_uses, MODE_NORMAL) -show_uses(not_found) - -print('\nCONFIG options present in source but not Kconfig (SPL):') -not_found = check_not_found(all_uses, MODE_SPL) -show_uses(not_found) -spl_not_found |= set(is_not_proper(key) or key - for key in not_found.keys()) - -print('\nCONFIG options used as Proper in source but without a non-SPL_ variant:') -not_found = check_not_found(all_uses, MODE_PROPER) -show_uses(not_found) proper_not_found |= set(key for key in not_found.keys()) +if show_conflicts: +print('\nCONFIG options used as Proper in source but without a non-SPL_ variant:') +show_uses(not_found) def show_summary(spl_not_found, proper_not_found): print('\nCONFIG options used as SPL but without an SPL_ variant:') @@ -2053,19 +2045,24 @@ def do_scan_source(path, do_update, show_
[PATCH v5 20/44] lib: Add VPL options for SHA1 and SHA256
Add these options so these algorithms can be used in VPL. Signed-off-by: Simon Glass --- (no changes since v1) lib/Kconfig | 20 1 file changed, 20 insertions(+) diff --git a/lib/Kconfig b/lib/Kconfig index 1c93f523b3a..08318843231 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -579,6 +579,26 @@ config SPL_SHA_PROG_HW_ACCEL endif +config VPL_SHA1 + bool "Enable SHA1 support in VPL" + depends on VPL + default y if SHA1 + help + This option enables support of hashing using SHA1 algorithm. + The hash is calculated in software. + The SHA1 algorithm produces a 160-bit (20-byte) hash value + (digest). + +config VPL_SHA256 + bool "Enable SHA256 support in VPL" + depends on VPL + default y if SHA256 + help + This option enables support of hashing using SHA256 algorithm. + The hash is calculated in software. + The SHA256 algorithm produces a 256-bit (32-byte) hash value + (digest). + if SHA_HW_ACCEL config SHA512_HW_ACCEL -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 19/44] env: Allow VPL environment to be nowhere
Add an option to put the VPL environment nowhere (not in storage). Signed-off-by: Simon Glass --- (no changes since v1) env/Kconfig | 10 ++ 1 file changed, 10 insertions(+) diff --git a/env/Kconfig b/env/Kconfig index 6e24eee55f2..2bbe4c466a6 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -860,6 +860,16 @@ config TPL_ENV_IS_IN_FLASH endif +if VPL_ENV_SUPPORT + +config VPL_ENV_IS_NOWHERE + bool "VPL Environment is not stored" + default y if ENV_IS_NOWHERE + help + Similar to ENV_IS_NOWHERE, used for VPL environment. + +endif # VPL_ENV_SUPPORT + config USE_BOOTFILE bool "Add a 'bootfile' environment variable" help -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 16/44] event: Add Kconfig options for SPL
Add options to enable events in SPL. This is mostly so the code can be excluded from SPL builds. Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - Modify to get rid of def_bool - Adjust Kconfig ordering common/Kconfig | 20 1 file changed, 20 insertions(+) diff --git a/common/Kconfig b/common/Kconfig index e3a5e1be1e9..33c3b1dbf0f 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -631,6 +631,26 @@ config EVENT_DEBUG events, such as event-type names. This adds to the code size of U-Boot so can be turned off for production builds. +config SPL_EVENT + bool # General-purpose event-handling mechanism in SPL + depends on SPL + help + This adds a framework for general purpose sending and processing of + events, to allow interested parties to be alerted when something + happens. This is an attempt to stem the flow of weak functions, + hooks, functions in board_f.c and board_r.c and the Kconfig options + below. + + See doc/develop/event.rst for more information. + +config SPL_EVENT_DYNAMIC + bool + depends on SPL_EVENT && EVENT_DYNAMIC + help + Enable this to support adding an event spy at runtime, without adding + it to the EVENT_SPY() linker list. This increases code size slightly + but provides more flexibility for boards and subsystems that need it. + endif # EVENT config ARCH_EARLY_INIT_R -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 30/44] lib: Add an SPL config for LIB_UUID
This is selected by PARTITION_UUIDS which has a separate option for SPL. Add an SPL option for LIB_UUID also, so that we can keep them consistent. Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c which wants to call a uuid function in SPL. Signed-off-by: Simon Glass --- (no changes since v1) disk/Kconfig | 8 lib/Kconfig | 4 2 files changed, 12 insertions(+) diff --git a/disk/Kconfig b/disk/Kconfig index c9b9dbaf1a6..817b7c8c76d 100644 --- a/disk/Kconfig +++ b/disk/Kconfig @@ -149,6 +149,7 @@ config SPL_PARTITION_UUIDS bool "Enable support of UUID for partition in SPL" depends on SPL_PARTITIONS default y if SPL_EFI_PARTITION + select SPL_LIB_UUID config PARTITION_TYPE_GUID bool "Enable support of GUID for partition type" @@ -157,4 +158,11 @@ config PARTITION_TYPE_GUID Activate the configuration of GUID type for EFI partition +config SPL_PARTITION_TYPE_GUID + bool "Enable support of GUID for partition type (SPL)" + depends on SPL_EFI_PARTITION + help + Activate the configuration of GUID type + for EFI partition + endmenu diff --git a/lib/Kconfig b/lib/Kconfig index 08318843231..4278b240554 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -74,6 +74,10 @@ config HAVE_PRIVATE_LIBGCC config LIB_UUID bool +config SPL_LIB_UUID + depends on SPL + bool + config SEMIHOSTING bool "Support semihosting" depends on ARM || RISCV -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 15/44] sandbox: Expand size for VPL image
Allow this to get larger to accommodate more test code with LTO disabled. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/dts/sandbox_vpl.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sandbox/dts/sandbox_vpl.dtsi b/arch/sandbox/dts/sandbox_vpl.dtsi index 1fba537f135..c7dc00a8d2d 100644 --- a/arch/sandbox/dts/sandbox_vpl.dtsi +++ b/arch/sandbox/dts/sandbox_vpl.dtsi @@ -17,8 +17,8 @@ * provide plenty of space for ELF files with debug info so that * gdb can be used */ - offset = <0x40>; - size = <0xdffc00>; + offset = <0x80>; + size = <0x200>; fit { fit,external-offset = <0>; -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 22/44] lib: Fix build condition for tiny-printf
This should be checking for any SPL build. Drop the use of SPL_TPL_ since it is not necessary and will not work with split config. Signed-off-by: Simon Glass --- (no changes since v1) lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index a282e40258c..10aa7ac0298 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -127,7 +127,7 @@ obj-$(CONFIG_LIB_UUID) += uuid.o obj-$(CONFIG_LIB_RAND) += rand.o obj-y += panic.o -ifeq ($(CONFIG_$(SPL_TPL_)BUILD),y) +ifeq ($(CONFIG_SPL_BUILD),y) # SPL U-Boot may use full-printf, tiny-printf or none at all ifdef CONFIG_$(SPL_TPL_)USE_TINY_PRINTF obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += tiny-printf.o -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 25/44] sandbox: Tidy up I2C options
At present we enable the sandbox I2C driver for all builds. Add a separate Kconfig option to control this, so that it can be disabled in TPL, where it is not needed. Signed-off-by: Simon Glass --- (no changes since v1) drivers/i2c/Kconfig | 20 1 file changed, 20 insertions(+) diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 3279fef1eb0..1077c331c30 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -47,6 +47,16 @@ config SPL_DM_I2C device (bus child) info is kept as parent platdata. The interface is defined in include/i2c.h. +config TPL_DM_I2C + bool "Enable Driver Model for I2C drivers in TPL" + depends on TPL_DM && DM_I2C + help + Enable driver model for I2C. The I2C uclass interface: probe, read, + write and speed, is implemented with the bus drivers operations, + which provide methods for bus setting and data transfer. Each chip + device (bus child) info is kept as parent platdata. The interface + is defined in include/i2c.h. + config VPL_DM_I2C bool "Enable Driver Model for I2C drivers in VPL" depends on VPL_DM && DM_I2C @@ -508,6 +518,16 @@ config SYS_I2C_ROCKCHIP config SYS_I2C_SANDBOX bool "Sandbox I2C driver" depends on SANDBOX && DM_I2C + default y + help + Enable I2C support for sandbox. This is an emulation of a real I2C + bus. Devices can be attached to the bus using the device tree + which specifies the driver to use. See sandbox.dts as an example. + +config SPL_SYS_I2C_SANDBOX + bool "Sandbox I2C driver (SPL)" + depends on SPL && SANDBOX && DM_I2C + default y help Enable I2C support for sandbox. This is an emulation of a real I2C bus. Devices can be attached to the bus using the device tree -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 28/44] fixdep: Add some tests for parse_config_line()
Add tests for this code to cover the basic cases. Signed-off-by: Simon Glass --- (no changes since v1) scripts/basic/fixdep.c | 73 ++ 1 file changed, 73 insertions(+) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index a49d35ba5f6..fe8180ab4e7 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -425,11 +425,84 @@ static void parse_dep_file(char *m, const char *target) xprintf("$(deps_%s):\n", target); } +#define CHECKP(expect, got)\ + if (expect != got) { \ + fprintf(stderr, "Test failed at line %d: expect %ld, got %ld\n", \ + __LINE__, expect - buf, got - buf); \ + return 1; \ + } + +#define CHECK(expect, got) \ + if (expect != got) { \ + fprintf(stderr, "Test failed at line %d: expect %p, got %p\n", \ + __LINE__, expect, got); \ + return 1; \ + } + +static int run_tests(void) +{ + const char *out, *end; + char buf_s[40], *buf = buf_s + 1; + + /* make sure the previous char doesn't look like part of the CONFIG */ + buf_s[0] = ' '; + + strcpy(buf, ""); + out = parse_config_line(buf, &end); + CHECK(NULL, out); + CHECK(NULL, end); + + strcpy(buf, "nothing"); + out = parse_config_line(buf, &end); + CHECK(NULL, out); + CHECK(NULL, end); + + strcpy(buf, "CONFIG_OPTION_MORE"); + out = parse_config_line(buf, &end); + CHECKP(buf + 7, out); + CHECKP(buf + 18, end); + + strcpy(buf, "some CONFIG_OPTION_MORE"); + out = parse_config_line(buf, &end); + CHECKP(buf + 12, out); + CHECKP(buf + 23, end); + + strcpy(buf, "some CONFIG_OPTION_MORE here"); + out = parse_config_line(buf, &end); + CHECKP(buf + 12, out); + CHECKP(buf + 23, end); + + strcpy(buf, "CONFIG_OPTION_MODULE"); + out = parse_config_line(buf, &end); + CHECKP(buf + 7, out); + CHECKP(buf + 13, end); + + strcpy(buf, "CONFIG_IS_ENABLED(FRED)"); + out = parse_config_line(buf, &end); + CHECKP(buf + 18, out); + CHECKP(buf + 22, end); + + strcpy(buf, "CONFIG_VAL(MARY)"); + out = parse_config_line(buf, &end); + CHECKP(buf + 11, out); + CHECKP(buf + 15, end); + + return 0; +} + int main(int argc, char *argv[]) { const char *depfile, *target, *cmdline; void *buf; + if (argc == 2 && !strcmp("-t", argv[1])) { + if (run_tests()) { + fprintf(stderr, "Tests failed\n"); + return 1; + } + printf("Tests passed\n"); + return 0; + } if (argc != 4) usage(); -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 29/44] test: Add SPL versions of the TEST_KCONFIG options
These are needed since we need a separate value in SPL and Proper. Signed-off-by: Simon Glass --- (no changes since v1) test/lib/Kconfig | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/lib/Kconfig b/test/lib/Kconfig index dbb03e4a36f..134cbb85b83 100644 --- a/test/lib/Kconfig +++ b/test/lib/Kconfig @@ -18,6 +18,24 @@ config TEST_KCONFIG_VALUE int "Value associated with the option" depends on TEST_KCONFIG_ENABLE help - This is the value whgch is present if TEST_KCONFIG_ENABLE is enabled. + This is the value which is present if TEST_KCONFIG_ENABLE is enabled. + +config SPL_TEST_KCONFIG + bool "Enable detection of Kconfig macro errors (SPL)" + help + This is used to test that the IF_ENABLED_INT() macro causes a build error + if the value is used when the CONFIG Is not enabled. + +config SPL_TEST_KCONFIG_ENABLE + bool "Option to enable (SPL)" + help + This is the option that controls whether the value is present. + +config SPL_TEST_KCONFIG_VALUE + int "Value associated with the option (SPL" + depends on SPL_TEST_KCONFIG_ENABLE + help + This is the value which is present if SPL_TEST_KCONFIG_ENABLE is + enabled. endif # SANDBOX -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 27/44] fixdep: Refactor to make testing easier
Move the config parsing into a separate function so that it is possible to write tests for the function. Signed-off-by: Simon Glass --- (no changes since v1) scripts/basic/fixdep.c | 87 ++ 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 3d40bd7ee25..a49d35ba5f6 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -236,47 +236,68 @@ static int str_ends_with(const char *s, int slen, const char *sub) return !memcmp(s + slen - sublen, sub, sublen); } -static void parse_config_file(const char *p) +static const char *parse_config_line(const char *p, const char **endp) { const char *q, *r; - const char *start = p; - while ((p = strstr(p, "CONFIG_"))) { - if (p > start && (isalnum(p[-1]) || p[-1] == '_')) { - p += 7; - continue; - } - p += 7; + p = strstr(p, "CONFIG_"); + if (!p) { + *endp = NULL; + return NULL; + } + if ((isalnum(p[-1]) || p[-1] == '_')) { + *endp = p + 7; + return NULL; + } + p += 7; + q = p; + while (isalnum(*q) || *q == '_') + q++; + if (str_ends_with(p, q - p, "_MODULE")) + r = q - 7; + else + r = q; + /* +* U-Boot also handles +* CONFIG_IS_ENABLED(...) +* CONFIG_VAL(...) +*/ + if ((q - p == 10 && !memcmp(p, "IS_ENABLED(", 11)) || + (q - p == 3 && !memcmp(p, "VAL(", 4))) { + p = q + 1; q = p; while (isalnum(*q) || *q == '_') q++; - if (str_ends_with(p, q - p, "_MODULE")) - r = q - 7; - else - r = q; - /* -* U-Boot also handles -* CONFIG_IS_ENABLED(...) -* CONFIG_VAL(...) -*/ - if ((q - p == 10 && !memcmp(p, "IS_ENABLED(", 11)) || - (q - p == 3 && !memcmp(p, "VAL(", 4))) { - p = q + 1; - q = p; - while (isalnum(*q) || *q == '_') - q++; - r = q; - if (r > p && tmp_buf[0]) { - memcpy(tmp_buf + 4, p, r - p); - r = tmp_buf + 4 + (r - p); - p = tmp_buf; - } + r = q; + if (r > p && tmp_buf[0]) { + memcpy(tmp_buf + 4, p, r - p); + r = tmp_buf + 4 + (r - p); + p = tmp_buf; } - /* end U-Boot hack */ + } + /* end U-Boot hack */ + *endp = r; + + if (r > p) + return p; - if (r > p) - use_config(p, r - p); - p = q; + return NULL; +} + +static void parse_config_file(const char *base) +{ + const char *p; + + if (!*base) + return; + p = base + 1; + while (p) { + const char *out, *end; + + out = parse_config_line(p, &end); + if (out) + use_config(out, end - out); + p = end; } } -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 32/44] x86: Fix up use of X86_32BIT_INIT and X86_64 options
Drop the invalid SPL_ in a CONFIG_IS_ENABLED() usage. Use the correct X86_64 option in msr.h since SPL may be 32-bit when U-Bout proper is not. Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - Reduce and rename commit arch/x86/cpu/qemu/qemu.c | 2 +- arch/x86/include/asm/msr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c index e54082df7f9..274978c023b 100644 --- a/arch/x86/cpu/qemu/qemu.c +++ b/arch/x86/cpu/qemu/qemu.c @@ -97,7 +97,7 @@ static void qemu_chipset_init(void) } } -#if !CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT) +#if CONFIG_IS_ENABLED(X86_32BIT_INIT) int arch_cpu_init(void) { post_code(POST_CPU_INIT); diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 27764fc56cb..eb3ddde8c07 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h @@ -59,7 +59,7 @@ static inline unsigned long long native_read_tscp(unsigned int *aux) * edx:eax, while for x86_64 it doesn't mean rdx:rax or edx:eax. Instead, * it means rax *or* rdx. */ -#ifdef CONFIG_X86_64 +#if CONFIG_IS_ENABLED(X86_64) #define DECLARE_ARGS(val, low, high) unsigned low, high #define EAX_EDX_VAL(val, low, high)((low) | ((u64)(high) << 32)) #define EAX_EDX_ARGS(val, low, high) "a" (low), "d" (high) -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 21/44] x86: Use string functions for all 32-bit builds
At present these are not included in SPL. They do add to code size but are a bit faster, so adjust the setting to add them. Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/include/asm/string.h | 2 +- arch/x86/lib/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h index c15b264a5c0..0254a022160 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -14,7 +14,7 @@ extern char *strrchr(const char *s, int c); #undef __HAVE_ARCH_STRCHR extern char *strchr(const char *s, int c); -#ifdef CONFIG_X86_64 +#if CONFIG_IS_ENABLED(X86_64) #undef __HAVE_ARCH_MEMCPY extern void *memcpy(void *, const void *, __kernel_size_t); diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index a6f22441474..ea7ff2bcf38 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -4,7 +4,7 @@ # Wolfgang Denk, DENX Software Engineering, w...@denx.de. obj-y += bdinfo.o -ifndef CONFIG_X86_64 +ifndef CONFIG_$(SPL_TPL_)X86_64 ifndef CONFIG_TPL_BUILD obj-y += bios.o obj-y += bios_asm.o -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 37/44] net: Add an SPL config for atheros
Add a new SPL_PHY_ATHEROS to avoid a build error on am335x_evm with split config. Signed-off-by: Simon Glass Reviewed-by: Ramon Fried --- (no changes since v1) drivers/net/phy/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 5eaff053a09..6806e3c0903 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -106,6 +106,9 @@ config PHY_AQUANTIA_FW_NAME config PHY_ATHEROS bool "Atheros Ethernet PHYs support" +config SPL_PHY_ATHEROS + bool "Atheros Ethernet PHYs support (SPL)" + config PHY_BROADCOM bool "Broadcom Ethernet PHYs support" -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 36/44] imx: Use SATA instead of CMD_SATA
This causes a build failure on mx6cuboxi with split config, since CMD_SATA shows up as enabled in SPl (because there is no SPL_CMD_SATA). The condition is wrong anyway, so change it to use SATA instead. Signed-off-by: Simon Glass --- (no changes since v1) board/solidrun/mx6cuboxi/mx6cuboxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c index 7c44379ec4a..cb14c2f30c9 100644 --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c @@ -275,7 +275,7 @@ int board_early_init_f(void) { setup_iomux_uart(); -#ifdef CONFIG_CMD_SATA +#ifdef CONFIG_SATA setup_sata(); #endif setup_fec(); -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 35/44] freescale: Drop old pre-DM_ETH code
This is used by ls1021atwr_sdcard_ifc_SECURE_BOOT with split config, but is not needed anymore, since Ethernet migration is complete. Drop it. Signed-off-by: Simon Glass --- (no changes since v1) arch/arm/cpu/armv7/ls102xa/fdt.c | 12 1 file changed, 12 deletions(-) diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c index 599b7e18ef3..a5c5c780ae8 100644 --- a/arch/arm/cpu/armv7/ls102xa/fdt.c +++ b/arch/arm/cpu/armv7/ls102xa/fdt.c @@ -25,11 +25,7 @@ DECLARE_GLOBAL_DATA_PTR; void ft_fixup_enet_phy_connect_type(void *fdt) { -#ifdef CONFIG_DM_ETH struct udevice *dev; -#else - struct eth_device *dev; -#endif struct tsec_private *priv; const char *enet_path, *phy_path; char enet[16]; @@ -37,12 +33,8 @@ void ft_fixup_enet_phy_connect_type(void *fdt) int phy_node; int i = 0; uint32_t ph; -#ifdef CONFIG_DM_ETH char *name[3] = { "ethernet@2d1", "ethernet@2d5", "ethernet@2d9" }; -#else - char *name[3] = { "eTSEC1", "eTSEC2", "eTSEC3" }; -#endif for (; i < ARRAY_SIZE(name); i++) { dev = eth_get_dev_by_name(name[i]); @@ -53,11 +45,7 @@ void ft_fixup_enet_phy_connect_type(void *fdt) continue; } -#ifdef CONFIG_DM_ETH priv = dev_get_priv(dev); -#else - priv = dev->priv; -#endif if (priv->flags & TSEC_SGMII) continue; -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 34/44] rockchip: Avoid checking environment without ENV_SUPPORT
With split config, this causes a build error in SPL where the environment may not be enabled. It affects two rk3399 boards. Add a condition. Signed-off-by: Simon Glass --- (no changes since v1) board/theobroma-systems/puma_rk3399/puma-rk3399.c | 2 +- board/theobroma-systems/ringneck_px30/ringneck-px30.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index 97f398bd754..34839dcb9f1 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -136,7 +136,7 @@ int mmc_get_env_dev(void) return CONFIG_SYS_MMC_ENV_DEV; } -#if !IS_ENABLED(CONFIG_ENV_IS_NOWHERE) +#if IS_ENABLED(CONFIG_ENV_SUPPORT) && !IS_ENABLED(CONFIG_ENV_IS_NOWHERE) #error Please enable CONFIG_ENV_IS_NOWHERE #endif diff --git a/board/theobroma-systems/ringneck_px30/ringneck-px30.c b/board/theobroma-systems/ringneck_px30/ringneck-px30.c index 47d1a40ef7c..9eb2fcfc48f 100644 --- a/board/theobroma-systems/ringneck_px30/ringneck-px30.c +++ b/board/theobroma-systems/ringneck_px30/ringneck-px30.c @@ -118,7 +118,7 @@ int mmc_get_env_dev(void) return CONFIG_SYS_MMC_ENV_DEV; } -#if !IS_ENABLED(CONFIG_ENV_IS_NOWHERE) +#if IS_ENABLED(CONFIG_ENV_SUPPORT) && !IS_ENABLED(CONFIG_ENV_IS_NOWHERE) #error Please enable CONFIG_ENV_IS_NOWHERE #endif -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 40/44] dm: Add a TPL symbol for simple-bus
This is used in some x86 code, so add a symbol for it. Signed-off-by: Simon Glass --- (no changes since v1) drivers/core/Kconfig | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 6fc8854b574..0f755aa702e 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -301,6 +301,13 @@ config SPL_SIMPLE_BUS Supports the 'simple-bus' driver, which is used on some systems in SPL. +config TPL_SIMPLE_BUS + bool "Support simple-bus driver in TPL" + depends on TPL_DM && TPL_OF_CONTROL + help + Supports the 'simple-bus' driver, which is used on some systems + in TPL. + config SIMPLE_BUS_CORRECT_RANGE bool "Decode the 'simple-bus' by honoring the #address-cells and #size-cells" depends on SIMPLE_BUS -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 41/44] x86: coral: Add missing TPL options
Some options should be enabled which are missing. Fix this. Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - Reduce and rename commit configs/chromebook_coral_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/chromebook_coral_defconfig b/configs/chromebook_coral_defconfig index 401506e2193..f5995f22004 100644 --- a/configs/chromebook_coral_defconfig +++ b/configs/chromebook_coral_defconfig @@ -87,6 +87,7 @@ CONFIG_TFTP_TSIZE=y CONFIG_USE_ROOTPATH=y CONFIG_REGMAP=y CONFIG_SYSCON=y +CONFIG_TPL_SIMPLE_BUS=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_LBA48=y CONFIG_SYS_64BIT_LBA=y @@ -96,6 +97,8 @@ CONFIG_SYS_I2C_DW=y CONFIG_MISC=y CONFIG_CROS_EC=y CONFIG_CROS_EC_LPC=y +CONFIG_SPL_P2SB=y +CONFIG_TPL_P2SB=y CONFIG_SPI_FLASH_WINBOND=y # CONFIG_X86_PCH7 is not set # CONFIG_X86_PCH9 is not set -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 43/44] venice: Simplify conditions for network init
The conditions in this code do not align when doing an SPL build with split config. Use __maybe_unused to avoid needing to be so explicit. Of course a better solution would be to refactor all of this to avoid using #ifdef. Signed-off-by: Simon Glass --- (no changes since v1) board/gateworks/venice/venice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/board/gateworks/venice/venice.c b/board/gateworks/venice/venice.c index c4d86c26a9b..e6fa7eb3d73 100644 --- a/board/gateworks/venice/venice.c +++ b/board/gateworks/venice/venice.c @@ -41,8 +41,7 @@ int board_fit_config_name_match(const char *name) return -1; } -#if (IS_ENABLED(CONFIG_NET)) -static int setup_fec(void) +static int __maybe_unused setup_fec(void) { struct iomuxc_gpr_base_regs *gpr = (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR; @@ -58,7 +57,7 @@ static int setup_fec(void) return 0; } -static int setup_eqos(void) +static int __maybe_unused setup_eqos(void) { struct iomuxc_gpr_base_regs *gpr = (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR; @@ -71,6 +70,7 @@ static int setup_eqos(void) return set_clk_eqos(ENET_125MHZ); } +#if (IS_ENABLED(CONFIG_NET)) int board_phy_config(struct phy_device *phydev) { unsigned short val; -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 31/44] test: Tidy up sandbox handling in test-main
This is pretty messy at present since it relies on a SPL_SANDBOX option that does not exist. Use the normal options instead, so that it will work with split config. Signed-off-by: Simon Glass --- (no changes since v1) test/test-main.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test-main.c b/test/test-main.c index ea959f4e859..b3c30d92937 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -46,14 +46,14 @@ enum fdtchk_t { */ static enum fdtchk_t fdt_action(void) { - /* Do a copy for sandbox (but only the U-Boot build, not SPL) */ - if (CONFIG_IS_ENABLED(SANDBOX)) - return FDTCHK_COPY; - /* For sandbox SPL builds, do nothing */ - if (IS_ENABLED(CONFIG_SANDBOX)) + if (IS_ENABLED(CONFIG_SANDBOX) && IS_ENABLED(CONFIG_SPL_BUILD)) return FDTCHK_NONE; + /* Do a copy for sandbox (but only the U-Boot build, not SPL) */ + if (IS_ENABLED(CONFIG_SANDBOX)) + return FDTCHK_COPY; + /* For all other boards, do a checksum */ return FDTCHK_CHECKSUM; } -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 26/44] fixdep: Add support for VPL
Add VPL files into the mix so that we can fix up the dependencies there. Signed-off-by: Simon Glass --- (no changes since v1) scripts/basic/fixdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 5ced0f6b069..3d40bd7ee25 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -421,6 +421,8 @@ int main(int argc, char *argv[]) strcpy(tmp_buf, "SPL_"); else if (!strncmp(target, "tpl/", 4)) strcpy(tmp_buf, "TPL_"); + else if (!strncmp(target, "vpl/", 4)) + strcpy(tmp_buf, "VPL_"); /* end U-Boot hack */ xprintf("cmd_%s := %s\n\n", target, cmdline); -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 44/44] command: Don't allow commands in SPL
At present we compile commands into U-Boot SPL even though they cannot be used. This wastes space. Adjust the condition to avoid this. Signed-off-by: Simon Glass --- Changes in v5: - Drop FSL_ISBC_KEY_EXT patch as it changes the size - Drop PHY_CADENCE_SIERRA patch as it changes the size Changes in v3: - Add a new patch to disallow commands in SPL include/command.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/command.h b/include/command.h index 0db48980624..1b018cb98e7 100644 --- a/include/command.h +++ b/include/command.h @@ -376,7 +376,7 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname); U_BOOT_SUBCMDS_DO_CMD(_cmdname) \ U_BOOT_SUBCMDS_COMPLETE(_cmdname) -#ifdef CONFIG_CMDLINE +#if CONFIG_IS_ENABLED(CMDLINE) #define U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep, \ _usage, _help, _comp) \ { #_name, _maxargs, _cmd_rep, cmd_discard_repeatable, \ -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 42/44] power: wandboard: Add a missing CONFIG
We should enable pmic in SPL since it is used. Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - Fix 'wanderboard' typo - Reduce and rename commit configs/wandboard_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig index a6baff1e24c..05383f6e47b 100644 --- a/configs/wandboard_defconfig +++ b/configs/wandboard_defconfig @@ -71,6 +71,7 @@ CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_DM_PMIC=y +CONFIG_SPL_DM_PMIC=y CONFIG_DM_PMIC_PFUZE100=y CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 39/44] serial: Support ns16550 driver in TPL
Add options for this since they are needed by P1020RDB-PC_NAND. Signed-off-by: Simon Glass --- (no changes since v1) drivers/serial/Kconfig | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index bb5083201b3..6f40c051604 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -731,6 +731,12 @@ config SPL_SYS_NS16550_SERIAL default y if SYS_NS16550_SERIAL || ARCH_SUNXI || ARCH_OMAP2PLUS select SYS_NS16550 +config TPL_SYS_NS16550_SERIAL + bool "NS16550 UART or compatible legacy driver in TPL" + depends on TPL && !TPL_DM_SERIAL + default y if SYS_NS16550_SERIAL || ARCH_SUNXI || ARCH_OMAP2PLUS + select SYS_NS16550 + config SYS_NS16550 bool "NS16550 UART or compatible" help -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 33/44] Add VPL options for BLOBLIST
We can use this feature in VPL, so add some options for it. Also fix a typo in the SPL help while we are here. Signed-off-by: Simon Glass --- (no changes since v1) common/Kconfig | 31 ++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/common/Kconfig b/common/Kconfig index 33c3b1dbf0f..a6b10a251a0 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1063,7 +1063,7 @@ choice prompt "Bloblist location in TPL" help Select the location of the bloblist, via various means. Typically - you should use the same value for SPL as for U-Boot, since they need + you should use the same value for TPL as for U-Boot, since they need to look in the same place. But if BLOBLIST_ALLOC is used, then a fresh bloblist will be created each time, since there is no shared address (between phases) for the bloblist. @@ -1086,6 +1086,35 @@ endchoice endif # TPL_BLOBLIST +if VPL_BLOBLIST + +choice + prompt "Bloblist location in VPL" + help + Select the location of the bloblist, via various means. Typically + you should use the same value for VPL as for U-Boot, since they need + to look in the same place. But if BLOBLIST_ALLOC is used, then a + fresh bloblist will be created each time, since there is no shared + address (between phases) for the bloblist. + +config VPL_BLOBLIST_FIXED + bool "Place bloblist at a fixed address in memory" + help + Select this to used a fixed memory address for the bloblist. If the + bloblist exists at this address from a previous phase, it used as is. + If not it is created at this address in VPL. + +config VPL_BLOBLIST_ALLOC + bool "Allocate bloblist" + help + Allocate the bloblist using malloc(). This avoids the need to + specify a fixed address on systems where this is unknown or can + change at runtime. + +endchoice + +endif # VPL_BLOBLIST + endmenu source "common/spl/Kconfig" -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 24/44] sandbox: Use the generic VPL option to enable VPL
Avoid using CONFIG_SANDBOX_VPL since we have a generic option which works just as well. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/dts/sandbox.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index e9b6745d2db..12d3eff5fa7 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -103,6 +103,6 @@ #include "cros-ec-keyboard.dtsi" #include "sandbox_pmic.dtsi" -#ifdef CONFIG_SANDBOX_VPL +#if IS_ENABLED(CONFIG_SUPPORT_VPL) #include "sandbox_vpl.dtsi" #endif -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 04/44] moveconfig: Update to detect / correct missing SPL Kconfigs
This adds quite a few more features, all designed to detect problems with Kconfig options and their use. It can find options mentioned in the source code which are not in the Kconfig and vice versa. It can convert SPL usages of non-SPL Kconfig options (i.e. changing CONFIG_IS_ENABLED() to IS_ENABLED() and CONFIG_$(SPL)_FOO to CONFIG_FOO, creating commits automatically if requested. These features are only useful for code clean-up, not for normal development. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Rebase to previous series tools/moveconfig.py | 599 +--- 1 file changed, 456 insertions(+), 143 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index c4d72ede368..b3ac2672737 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -20,6 +20,7 @@ import doctest import filecmp import fnmatch import glob +import io import multiprocessing import os import queue @@ -118,6 +119,16 @@ def check_clean_directory(): if os.path.exists(fname): sys.exit("source tree is not clean, please run 'make mrproper'") +def write_commit(msg): +"""Create a new commit with all modified files + +Args: +msg (str): Commit message +""" +subprocess.call(['git', 'add', '-u']) +rc = subprocess.call(['git', 'commit', '-s', '-m', msg]) +return rc == 0 + def get_make_cmd(): """Get the command name of GNU Make. @@ -1606,30 +1617,59 @@ def prefix_config(cfg): return op + cfg -RE_MK_CONFIGS = re.compile('CONFIG_(\$\(SPL_(?:TPL_)?\))?([A-Za-z0-9_]*)') -RE_IFDEF = re.compile('(ifdef|ifndef)') -RE_C_CONFIGS = re.compile('CONFIG_([A-Za-z0-9_]*)') -RE_CONFIG_IS = re.compile('CONFIG_IS_ENABLED\(([A-Za-z0-9_]*)\)') +RE_MK_CONFIGS = re.compile(r'CONFIG_(\$\(SPL_(?:TPL_)?\))?([A-Za-z0-9_]*)') + +# Makefile ifdefs: this only handles 'else' on its own line, so not +# 'else ifeq ...', for example +RE_IF = re.compile(r'^(ifdef|ifndef|endif|ifeq|ifneq|else)([^,]*,([^,]*)\))?.*$') + +# Normal CONFIG options in C +RE_C_CONFIGS = re.compile(r'CONFIG_([A-Za-z0-9_]*)') + +# CONFIG_IS_ENABLED() construct +RE_CONFIG_IS = re.compile(r'CONFIG_IS_ENABLED\(([A-Za-z0-9_]*)\)') + +# Preprocessor #if/#ifdef directives, etc. +RE_IFDEF = re.compile(r'^\s*#\s*(ifdef|ifndef|endif|if|elif|else)\s*(?:#.*)?(.*)$') class ConfigUse: -def __init__(self, cfg, is_spl, fname, rest): +"""Holds information about a use of a CONFIG option""" +def __init__(self, cfg, is_spl, conds, fname, rest, is_mk): +"""Set up a new use of a CONFIG option + +Args: +cfg (str): Config option, without the CONFIG_ +is_spl (bool): True if it indicates an SPL option, i.e. has a +$(SPL_) or similar, False if not +conds (list of str): List of conditions for this use, e.g. +['SPL_BUILD'] +fname (str): Filename contining the use +rest (str): Entire line from the file +is_mk (bool): True if this is in a Makefile, False if not +""" self.cfg = cfg self.is_spl = is_spl +self.conds = list(c for c in conds if '(NONE)' not in c) self.fname = fname self.rest = rest +self.is_mk = is_mk def __hash__(self): return hash((self.cfg, self.is_spl)) -def scan_makefiles(fnames): +def __str__(self): +return (f'ConfigUse({self.cfg}, is_spl={self.is_spl}, ' +f'is_mk={self.is_mk}, fname={self.fname}, rest={self.rest}') + +def scan_makefiles(fname_dict): """Scan Makefiles looking for Kconfig options Looks for uses of CONFIG options in Makefiles Args: -fnames (list of tuple): -str: Makefile filename where the option was found -str: Line of the Makefile +fname_dict (dict lines): +key: Makefile filename where the option was found +value: List of str lines of the Makefile Returns: tuple: @@ -1646,46 +1686,81 @@ def scan_makefiles(fnames): ('$(SPL_)', 'MARY') >>> RE_MK_CONFIGS.search('CONFIG_$(SPL_TPL_)MARY').groups() ('$(SPL_TPL_)', 'MARY') +>>> RE_IF.match('ifdef CONFIG_SPL_BUILD').groups() +('ifdef', None, None) +>>> RE_IF.match('endif # CONFIG_SPL_BUILD').groups() +('endif', None, None) +>>> RE_IF.match('endif').groups() +('endif', None, None) +>>> RE_IF.match('else').g
[PATCH v5 07/44] Correct SPL uses of DISPLAY_AER_FULL
This converts 2 usages of this option to the non-SPL form, since there is no SPL_DISPLAY_AER_FULL defined in Kconfig Signed-off-by: Simon Glass --- (no changes since v1) drivers/sysreset/sysreset_mpc83xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/sysreset/sysreset_mpc83xx.c b/drivers/sysreset/sysreset_mpc83xx.c index c9a03266595..ca48328f7b5 100644 --- a/drivers/sysreset/sysreset_mpc83xx.c +++ b/drivers/sysreset/sysreset_mpc83xx.c @@ -107,7 +107,7 @@ static int print_83xx_arb_event(bool force, char *buf, int size) if (!force && !gd->arch.arbiter_event_address) return 0; - if (CONFIG_IS_ENABLED(DISPLAY_AER_FULL)) { + if (IS_ENABLED(CONFIG_DISPLAY_AER_FULL)) { res = snprintf(buf, size, "Arbiter Event Status:\n" "%s: 0x%08lX\n" @@ -184,7 +184,7 @@ static int mpc83xx_sysreset_get_status(struct udevice *dev, char *buf, int size) * TODO(mario@gdsys.cc): Move this into a dedicated * arbiter driver */ - if (CONFIG_IS_ENABLED(DISPLAY_AER_FULL) || + if (IS_ENABLED(CONFIG_DISPLAY_AER_FULL) || IS_ENABLED(CONFIG_DISPLAY_AER_BRIEF)) { /* * If there was a bus monitor reset event, we force the arbiter -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 23/44] sandbox: Tidy up RTC options
At present we enable the sandbox RTC driver for all builds. Add a separate Kconfig option to control this, so that it can be disabled in TPL, where it is not needed. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Fix a transitory build error with sandbox_spl arch/sandbox/dts/sandbox.dts | 2 +- arch/sandbox/dts/sandbox.dtsi | 6 +++--- arch/sandbox/include/asm/rtc.h | 2 +- drivers/rtc/Kconfig| 18 ++ drivers/rtc/Makefile | 4 ++-- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index a4c1b8f6cb7..e9b6745d2db 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -76,7 +76,7 @@ clock-frequency = <40>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c0>; - bootph-all; + bootph-pre-ram; }; pcic: pci@0 { diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 1f446e62e16..30a305c4d20 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -115,7 +115,7 @@ reg = <0x43>; compatible = "sandbox-rtc"; sandbox,emul = <&emul0>; - bootph-all; + bootph-pre-ram; }; sandbox_pmic: sandbox_pmic { reg = <0x40>; @@ -126,7 +126,7 @@ }; i2c_emul: emul { - bootph-all; + bootph-pre-ram; reg = <0xff>; compatible = "sandbox,i2c-emul-parent"; emul_eeprom: emul-eeprom { @@ -136,7 +136,7 @@ #emul-cells = <0>; }; emul0: emul0 { - bootph-all; + bootph-pre-ram; compatible = "sandbox,i2c-rtc-emul"; #emul-cells = <0>; }; diff --git a/arch/sandbox/include/asm/rtc.h b/arch/sandbox/include/asm/rtc.h index 025cd6c67cf..bf3ac5ea1ec 100644 --- a/arch/sandbox/include/asm/rtc.h +++ b/arch/sandbox/include/asm/rtc.h @@ -40,7 +40,7 @@ enum { * @reg: Register values */ struct sandbox_i2c_rtc_plat_data { -#if CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_PLATDATA) && IS_ENABLED(CONFIG_RTC_SANDBOX) struct dtd_sandbox_i2c_rtc_emul dtplat; #endif long base_time; diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 35b6ed4d7c7..fcfda2847c8 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -231,6 +231,24 @@ config RTC_M41T62 Enable driver for ST's M41T62 compatible RTC devices (like RV-4162). It is a serial (I2C) real-time clock (RTC) with alarm. +config RTC_SANDBOX + bool "Enable sandbox RTC driver" + depends on SANDBOX && DM_RTC + default y + help + Enable the sandbox RTC driver. This driver connects to the RTC + emulator and is used to test the RTC uclasses and associated code, + as well as the I2C subsystem. + +config SPL_RTC_SANDBOX + bool "Enable sandbox RTC driver (SPL)" + depends on SANDBOX && SPL_DM_RTC + default y + help + Enable the sandbox RTC driver. This driver connects to the RTC + emulator and is used to test the RTC uclasses and associated code, + as well as the I2C subsystem. + config RTC_STM32 bool "Enable STM32 RTC driver" depends on DM_RTC diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 447551e15aa..b6c9029c8f0 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -16,7 +16,7 @@ obj-$(CONFIG_RTC_DS3231) += ds3231.o obj-$(CONFIG_RTC_DS3232) += ds3232.o obj-$(CONFIG_RTC_EMULATION) += emul_rtc.o obj-$(CONFIG_RTC_HT1380) += ht1380.o -obj-$(CONFIG_SANDBOX) += i2c_rtc_emul.o +obj-$(CONFIG_$(SPL_TPL_)RTC_SANDBOX) += i2c_rtc_emul.o obj-$(CONFIG_RTC_ISL1208) += isl1208.o obj-$(CONFIG_RTC_M41T62) += m41t62.o obj-$(CONFIG_RTC_MC13XXX) += mc13xxx-rtc.o @@ -35,6 +35,6 @@ obj-$(CONFIG_RTC_RX8025) += rx8025.o obj-$(CONFIG_RTC_RX8010SJ) += rx8010sj.o obj-$(CONFIG_RTC_S35392A) += s35392a.o obj-$(CONFIG_RTC_STM32) += stm32_rtc.o -obj-$(CONFIG_SANDBOX) += sandbox_rtc.o +obj-$(CONFIG_$(SPL_TPL_)RTC_SANDBOX) += sandbox_rtc.o obj-$(CONFIG_RTC_ABX80X) += abx80x.o obj-$(CONFIG_RTC_ZYNQMP) += zynqmp_rtc.o -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 18/44] env: Avoid checking ENV_IS_IN when env disabled
This check is not needed when the environment is not enabled, e.g. in SPL. Add a condition to handle this. Signed-off-by: Simon Glass --- (no changes since v1) cmd/nvedit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 7cbc3fd573a..277293679df 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -59,11 +59,13 @@ DECLARE_GLOBAL_DATA_PTR; #endif +#if CONFIG_IS_ENABLED(ENV_SUPPORT) #if!defined(ENV_IS_IN_DEVICE) && \ !defined(CONFIG_ENV_IS_NOWHERE) # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\ NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE #endif +#endif /* ENV_SUPPORT */ /* * Maximum expected input data size for import command -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 05/44] bootstd: Disable QFW bootmeth in SPL
Move this Makefile line into the non-SPL area so we don't have to repy on the SPL_TPL_ macro. Signed-off-by: Simon Glass --- Changes in v5: - Fix reply typo Changes in v3: - Add new patch to disable QFW bootmeth in SPL boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/Makefile b/boot/Makefile index 5424b6fafcc..b9a12236798 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o obj-$(CONFIG_PXE_UTILS) += pxe_utils.o +obj-$(CONFIG_QFW) += bootmeth_qfw.o endif @@ -26,7 +27,6 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO) += bootmeth_distro.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO_PXE) += bootmeth_pxe.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o -obj-$(CONFIG_$(SPL_TPL_)QFW) += bootmeth_qfw.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 38/44] freescale: Fix odd use of ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE
This is not a CONFIG option so we should not be using IS_ENABLED() on it, particularly not when it is not defined to anything, so shows up as calling IS_ENABLED() with no arguments. Just check it normally. For fsl_esdhc.c set it to 0 at the top of the file if it is not defined. This sort-of matches the behaviour in fsl_esdhc_mmc.c which seem to have a similar problem. This fixes a build error with split config on T2080QDS. Note: This should be handled in the devicetree. Signed-off-by: Simon Glass --- No size changes on affected boards: aarch64: w+ ls1088aqds ls1088aqds_qspi ls1088aqds_qspi_SECURE_BOOT ls1088aqds_sdcard_ifc ls1088aqds_sdcard_qspi ls1088aqds_tfa ls1088ardb_qspi ls1088ardb_qspi_SECURE_BOOT ls1088ardb_sdcard_qspi ls1088ardb_sdcard_qspi_SECURE_BOOT ls1088ardb_tfa ls1088ardb_tfa_SECURE_BOOT ls2080aqds ls2080aqds_nand ls2080aqds_qspi ls2080aqds_sdcard ls2080aqds_SECURE_BOOT ls2088aqds_tfa arm: w+ am57xx_hs_evm_usb powerpc: w+ P2041RDB P2041RDB_NAND P2041RDB_SDCARD P2041RDB_SPIFLASH T1024RDB T1024RDB_NAND T1024RDB_SDCARD T1024RDB_SPIFLASH T1042D4RDB T1042D4RDB_NAND T1042D4RDB_SDCARD T1042D4RDB_SPIFLASH T2080QDS T2080QDS_NAND T2080QDS_SDCARD T2080QDS_SECURE_BOOT T2080QDS_SPIFLASH T2080QDS_SRIO_PCIE_BOOT T2080RDB T2080RDB_NAND T2080RDB_revD T2080RDB_revD_NAND T2080RDB_revD_SDCARD T2080RDB_revD_SPIFLASH T2080RDB_SDCARD T2080RDB_SPIFLASH kmcent2 Changes in v5: - Change approach and expand notes after more investigation arch/powerpc/include/asm/config_mpc85xx.h | 6 +++--- drivers/mmc/fsl_esdhc.c | 6 +- drivers/mmc/fsl_esdhc_imx.c | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/config_mpc85xx.h b/arch/powerpc/include/asm/config_mpc85xx.h index d990ecff96f..358ccef7f1d 100644 --- a/arch/powerpc/include/asm/config_mpc85xx.h +++ b/arch/powerpc/include/asm/config_mpc85xx.h @@ -134,7 +134,7 @@ #define CFG_FM_PLAT_CLK_DIV1 #define CFG_SYS_FM1_CLKCFG_FM_PLAT_CLK_DIV #define CFG_SYS_FM_MURAM_SIZE 0x3 -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #define QE_MURAM_SIZE 0x6000UL #define MAX_QE_RISC1 #define QE_NUM_OF_SNUM 28 @@ -147,7 +147,7 @@ #define CFG_SYS_FM1_CLK0 #define CFG_QBMAN_CLK_DIV 1 #define CFG_SYS_FM_MURAM_SIZE 0x3 -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #define QE_MURAM_SIZE 0x6000UL #define MAX_QE_RISC1 #define QE_NUM_OF_SNUM 28 @@ -166,7 +166,7 @@ #define CFG_SYS_PME_CLKCFG_PME_PLAT_CLK_DIV #define CFG_SYS_FM1_CLK0 #define CFG_SYS_FM_MURAM_SIZE 0x28000 -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #elif defined(CONFIG_ARCH_C29X) diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index d506698..ecb9c3b30c9 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -34,6 +34,10 @@ DECLARE_GLOBAL_DATA_PTR; +#ifndef ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 +#endif + struct fsl_esdhc { uintdsaddr; /* SDMA system address register */ uintblkattr;/* Block attributes register */ @@ -325,7 +329,7 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc, (timeout == 4 || timeout == 8 || timeout == 12)) timeout++; - if (IS_ENABLED(ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE)) + if (ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE) timeout = 0xE; esdhc_clrsetbits32(®s->sysctl, SYSCTL_TIMEOUT_MASK, timeout << 16); diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 66caf683f74..9d9ffd0990a 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -43,6 +43,8 @@ #ifndef ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE #ifdef CONFIG_FSL_USDHC #define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 1 +#else +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #endif #endif @@ -375,7 +377,7 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc, (timeout == 4 || timeout == 8 || timeout == 12)) timeout++; - if (IS_ENABLED(ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE)) + if (ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE) timeout = 0xE; esdhc_clrsetbits32(®s->sysctl, SYSCTL_TIMEOUT_MASK, timeout << 16); -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 17/44] bootstd: Correct 'VPL' typo
Correct a 'VPL' typo in the Kconfig. Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - Just fix the typo Changes in v3: - Correct 'VPL' typo - Use a consistent format for the comment boot/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/Kconfig b/boot/Kconfig index b89916c109c..d646369f55c 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -385,7 +385,7 @@ config BOOTSTD_FULL as well as the "boot_targets" environment variable config SPL_BOOTSTD - bool "Standard boot support in VPL" + bool "Standard boot support in SPL" depends on SPL && SPL_DM && SPL_OF_CONTROL && SPL_BLK default y if VPL help -- 2.39.2.637.g21b0678d19-goog
[PATCH v5 08/44] Correct SPL uses of MULTIPLEXER
This converts 3 usages of this option to the non-SPL form, since there is no SPL_MULTIPLEXER defined in Kconfig Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- (no changes since v3) Changes in v3: - Move the option down to the non-SPL part of drivers/Makefile drivers/Makefile | 2 +- drivers/mux/Makefile | 2 +- include/mux.h| 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/Makefile b/drivers/Makefile index 15d19d0c8a3..58be410135d 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -18,7 +18,6 @@ obj-$(CONFIG_$(SPL_TPL_)INPUT) += input/ obj-$(CONFIG_$(SPL_TPL_)LED) += led/ obj-$(CONFIG_$(SPL_TPL_)MMC) += mmc/ obj-y += mtd/ -obj-$(CONFIG_$(SPL_)MULTIPLEXER) += mux/ obj-$(CONFIG_$(SPL_TPL_)ETH) += net/ obj-$(CONFIG_$(SPL_TPL_)PCH) += pch/ obj-$(CONFIG_$(SPL_TPL_)PCI) += pci/ @@ -87,6 +86,7 @@ obj-$(CONFIG_FASTBOOT) += fastboot/ obj-$(CONFIG_FWU_MDATA) += fwu-mdata/ obj-y += misc/ obj-$(CONFIG_MMC) += mmc/ +obj-$(CONFIG_MULTIPLEXER) += mux/ obj-$(CONFIG_NVME) += nvme/ obj-$(CONFIG_PCI_ENDPOINT) += pci_endpoint/ obj-y += dfu/ diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile index 78ebf04c7a9..d4e24789d33 100644 --- a/drivers/mux/Makefile +++ b/drivers/mux/Makefile @@ -3,5 +3,5 @@ # (C) Copyright 2019 # Jean-Jacques Hiblot -obj-$(CONFIG_$(SPL_)MULTIPLEXER) += mux-uclass.o +obj-$(CONFIG_MULTIPLEXER) += mux-uclass.o obj-$(CONFIG_$(SPL_)MUX_MMIO) += mmio.o diff --git a/include/mux.h b/include/mux.h index 9f809912742..c92d887591e 100644 --- a/include/mux.h +++ b/include/mux.h @@ -23,7 +23,7 @@ struct udevice; struct mux_control; -#if CONFIG_IS_ENABLED(MULTIPLEXER) +#if IS_ENABLED(CONFIG_MULTIPLEXER) /** * mux_control_states() - Query the number of multiplexer states. * @mux: The mux-control to query. -- 2.39.2.637.g21b0678d19-goog
Re: [PATCH 2/3] rockchip: Disable DISTRO_DEFAULTS for rockpro64
Hi, On Wed, 22 Feb 2023 at 11:56, Jonas Karlman wrote: > > On 2023-02-22 19:24, Tom Rini wrote: > > On Wed, Feb 22, 2023 at 10:19:03AM -0800, Vagrant Cascadian wrote: > >> On 2023-02-21, Vagrant Cascadian wrote: > >>> On 2023-02-21, Simon Glass wrote: > >>>> This board has moved to standard boot but the old 'distro_bootcmd' > >>>> command is still active. Disable DISTRO_DEFAULTS to fix this. > >>> > >>> Works for booting rockpro64-rk3399, thanks! > >> > >> I can also confirm that applying a very similar patch for > >> pinebook-pro-rk3399 works booting with bootstd. > >> > >> Seems worth adding if there is a v2 of the patch series. > >> > >> Alternately, rather than doing this on a board-by-board basis, is there > >> some way to disable CONFIG_DISTRO_DEFAULTS when a board is using > >> BOOTSTD? > > > > I think that's possibly a bit dangerous? DISTRO_DEFAULTS and > > BOOTSTD_DEFAULTS need to be reconciled to a single new symbol, and the > > DISTRO_DEFAULTS method of select not imply for most things is also I > > suspect the right path. > > > > Another option would be to set BOOTSTD_BOOTCOMMAND=y, this is the main > issue with rk3399 at the moment, distro_bootcmd got removed from env, > yet bootcmd is still "run distro_bootcmd" due to DISTRO_DEFAULTS=y. > > > config BOOTCOMMAND > default "bootflow scan -lb" if BOOTSTD_BOOTCOMMAND && > CMD_BOOTFLOW_FULL > default "bootflow scan" if BOOTSTD_BOOTCOMMAND && !CMD_BOOTFLOW_FULL > default "run distro_bootcmd" if !BOOTSTD_BOOTCOMMAND && > DISTRO_DEFAULTS > > config BOOTSTD_BOOTCOMMAND > default y if !DISTRO_DEFAULTS That seems reasonable to me, along with a 'depends on BOOTSTD' At present DISTRO_DEFAULTS is both enabled in defconfig files (about 350) and Kconfig (another 300). For rockchip it is the latter. It doesn't really make sense to use DISTRO_DEFAULTS when using BOOTSTD_DEFAULTS. One is 'run distro_bootcmd' and the other is 'bootflow scan', possibly with -lb flags. But we really don't want people flipping back and forward. At present, if both are enabled, then DISTRO_DEFAULTS takes precedence. I think it makes some sense this way, since DISTRO_DEFAULTS is the status quo and moving to BOOTSTD_DEFAULTS is being done over time. I just sent a rpi3 series. I can perhaps look at doing all of rockchip as well, including pinebook-pro. That would provide some amount of testing once it is in -next. I'd quite like to get rid of DISTRO_DEFAULTS entirely, perhaps in the release after this one? Regards, Simon
Re: [PATCH 2/3] rockchip: Disable DISTRO_DEFAULTS for rockpro64
Hi Tom, On Wed, 22 Feb 2023 at 12:01, Tom Rini wrote: > > On Wed, Feb 22, 2023 at 11:58:37AM -0700, Simon Glass wrote: > > Hi, > > > > On Wed, 22 Feb 2023 at 11:56, Jonas Karlman wrote: > > > > > > On 2023-02-22 19:24, Tom Rini wrote: > > > > On Wed, Feb 22, 2023 at 10:19:03AM -0800, Vagrant Cascadian wrote: > > > >> On 2023-02-21, Vagrant Cascadian wrote: > > > >>> On 2023-02-21, Simon Glass wrote: > > > >>>> This board has moved to standard boot but the old 'distro_bootcmd' > > > >>>> command is still active. Disable DISTRO_DEFAULTS to fix this. > > > >>> > > > >>> Works for booting rockpro64-rk3399, thanks! > > > >> > > > >> I can also confirm that applying a very similar patch for > > > >> pinebook-pro-rk3399 works booting with bootstd. > > > >> > > > >> Seems worth adding if there is a v2 of the patch series. > > > >> > > > >> Alternately, rather than doing this on a board-by-board basis, is there > > > >> some way to disable CONFIG_DISTRO_DEFAULTS when a board is using > > > >> BOOTSTD? > > > > > > > > I think that's possibly a bit dangerous? DISTRO_DEFAULTS and > > > > BOOTSTD_DEFAULTS need to be reconciled to a single new symbol, and the > > > > DISTRO_DEFAULTS method of select not imply for most things is also I > > > > suspect the right path. > > > > > > > > > > Another option would be to set BOOTSTD_BOOTCOMMAND=y, this is the main > > > issue with rk3399 at the moment, distro_bootcmd got removed from env, > > > yet bootcmd is still "run distro_bootcmd" due to DISTRO_DEFAULTS=y. > > > > > > > > > config BOOTCOMMAND > > > default "bootflow scan -lb" if BOOTSTD_BOOTCOMMAND && > > > CMD_BOOTFLOW_FULL > > > default "bootflow scan" if BOOTSTD_BOOTCOMMAND && > > > !CMD_BOOTFLOW_FULL > > > default "run distro_bootcmd" if !BOOTSTD_BOOTCOMMAND && > > > DISTRO_DEFAULTS > > > > > > config BOOTSTD_BOOTCOMMAND > > > default y if !DISTRO_DEFAULTS > > > > That seems reasonable to me, along with a 'depends on BOOTSTD' > > > > At present DISTRO_DEFAULTS is both enabled in defconfig files (about > > 350) and Kconfig (another 300). For rockchip it is the latter. > > > > It doesn't really make sense to use DISTRO_DEFAULTS when using > > BOOTSTD_DEFAULTS. One is 'run distro_bootcmd' and the other is > > 'bootflow scan', possibly with -lb flags. But we really don't want > > people flipping back and forward. > > It doesn't make linguistic sense to have "distro defaults" and "bootstd > defaults" enabled. It makes compute sense to have these two symbols > combined as they're nearly identical and have a similar conceptual need > (make sure we have things like bootz/booti/ext4/etc support). Oh, so you are talking about DISTRO_DEFAULTS, not the actual command? In that case I can do a patch to make them both use a common symbol to bring in most stuff, although bootstd does not need hush and a few other things that are needed by distro_bootcmd. Let me know if that makes sense. Regards, Simon
[PATCH v2 00/13] video: efi: Improve the EFI-app video console
This does not work on some 64-bit machines since only a 32-bit address for the framebuffer is supported in the VESA structure. This series corrects this and makes a few other minor, video-related improvements. Changes in v2: - Obtain copy framebuffer size from EFI instead of using a fixed value - Dropping debugging printf() - use new bootph-xxx tag - Add new patch to show the size of the copy framebuffer with bdinfo Simon Glass (13): efi: video: Move payload code into a function efi: video: Return mode info for app also efi: Support a 64-bit frame buffer address x86: Add a few more items to bdinfo efi: Use a fixed value for the timer clock efi: Support copy framebuffer video: Allow a copy framebuffer with pre-allocated fb bbinfo: Show the size of the copy framebuffer efi: Adjust script to show pre-relocation output on terminal video: Remove duplicate cursor-positioning function video: Clear the vidconsole rather than the video efi: Add dhrystone, dcache and scroll lines to app video: Add a note about the broken implementation arch/x86/dts/efi-x86_app.dts | 1 + arch/x86/lib/bdinfo.c | 4 + arch/x86/lib/fsp/fsp_graphics.c | 2 +- cmd/bdinfo.c | 6 +- cmd/cls.c | 20 +++-- configs/efi-x86_app64_defconfig | 3 + drivers/pci/pci_rom.c | 10 ++- drivers/timer/tsc_timer.c | 4 + drivers/video/coreboot.c | 2 +- drivers/video/efi.c | 137 ++ drivers/video/vidconsole-uclass.c | 48 --- drivers/video/video-uclass.c | 32 +-- include/vesa.h| 16 +++- include/video.h | 2 + include/video_console.h | 9 ++ scripts/build-efi.sh | 2 + 16 files changed, 212 insertions(+), 86 deletions(-) -- 2.39.2.637.g21b0678d19-goog
[PATCH v2 02/13] efi: video: Return mode info for app also
The mode info is currently not initialised for the app. Fix this by returning it from the function. Signed-off-by: Simon Glass --- (no changes since v1) drivers/video/efi.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/video/efi.c b/drivers/video/efi.c index fc37a68b376..0479f207032 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -56,10 +56,12 @@ static void efi_find_pixel_bits(u32 mask, u8 *pos, u8 *size) * Gets info from the graphics-output protocol * * @vesa: Place to put the mode information + * @infop: Returns a pointer to the mode info * Returns: 0 if OK, -ENOSYS if boot services are not available, -ENOTSUPP if * the protocol is not supported by EFI */ -static int get_mode_info(struct vesa_mode_info *vesa) +static int get_mode_info(struct vesa_mode_info *vesa, +struct efi_gop_mode_info **infop) { efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; struct efi_boot_services *boot = efi_get_boot(); @@ -77,6 +79,7 @@ static int get_mode_info(struct vesa_mode_info *vesa) vesa->phys_base_ptr = mode->fb_base; vesa->x_resolution = mode->info->width; vesa->y_resolution = mode->info->height; + *infop = mode->info; return 0; } @@ -118,7 +121,7 @@ static int save_vesa_mode(struct vesa_mode_info *vesa) int ret; if (IS_ENABLED(CONFIG_EFI_APP)) - ret = get_mode_info(vesa); + ret = get_mode_info(vesa, &info); else ret = get_mode_from_entry(vesa, &info); if (ret) { -- 2.39.2.637.g21b0678d19-goog
[PATCH v2 01/13] efi: video: Move payload code into a function
Put this into a function, as we have done for the app implementation. Comment both functions. FOr now the app still does not access it correctly. Signed-off-by: Simon Glass --- (no changes since v1) drivers/video/efi.c | 83 +++-- 1 file changed, 57 insertions(+), 26 deletions(-) diff --git a/drivers/video/efi.c b/drivers/video/efi.c index b11e42c0ebf..fc37a68b376 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -50,6 +50,15 @@ static void efi_find_pixel_bits(u32 mask, u8 *pos, u8 *size) *size = len; } +/** + * get_mode_info() - Ask EFI for the mode information + * + * Gets info from the graphics-output protocol + * + * @vesa: Place to put the mode information + * Returns: 0 if OK, -ENOSYS if boot services are not available, -ENOTSUPP if + * the protocol is not supported by EFI + */ static int get_mode_info(struct vesa_mode_info *vesa) { efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; @@ -72,32 +81,54 @@ static int get_mode_info(struct vesa_mode_info *vesa) return 0; } +/** + * get_mode_from_entry() - Obtain fb info from the EFIET_GOP_MODE payload entry + * + * This gets the mode information provided by the stub to the payload and puts + * it into a vesa structure. It also returns the mode information. + * + * @vesa: Place to put the mode information + * @infop: Returns a pointer to the mode info + * Returns: 0 if OK, -ve on error + */ +static int get_mode_from_entry(struct vesa_mode_info *vesa, + struct efi_gop_mode_info **infop) +{ + struct efi_gop_mode *mode; + int size; + int ret; + + ret = efi_info_get(EFIET_GOP_MODE, (void **)&mode, &size); + if (ret) { + printf("EFI graphics output entry not found\n"); + return ret; + } + vesa->phys_base_ptr = mode->fb_base; + vesa->x_resolution = mode->info->width; + vesa->y_resolution = mode->info->height; + *infop = mode->info; + + return 0; +} + static int save_vesa_mode(struct vesa_mode_info *vesa) { - struct efi_entry_gopmode *mode; const struct efi_framebuffer *fbinfo; - int size; + struct efi_gop_mode_info *info; int ret; - if (IS_ENABLED(CONFIG_EFI_APP)) { + if (IS_ENABLED(CONFIG_EFI_APP)) ret = get_mode_info(vesa); - if (ret) { - printf("EFI graphics output protocol not found\n"); - return -ENXIO; - } - } else { - ret = efi_info_get(EFIET_GOP_MODE, (void **)&mode, &size); - if (ret == -ENOENT) { - printf("EFI graphics output protocol mode not found\n"); - return -ENXIO; - } - vesa->phys_base_ptr = mode->fb_base; - vesa->x_resolution = mode->info->width; - vesa->y_resolution = mode->info->height; + else + ret = get_mode_from_entry(vesa, &info); + if (ret) { + printf("EFI graphics output protocol not found (err=%dE)\n", + ret); + return ret; } - if (mode->info->pixel_format < EFI_GOT_BITMASK) { - fbinfo = &efi_framebuffer_format_map[mode->info->pixel_format]; + if (info->pixel_format < EFI_GOT_BITMASK) { + fbinfo = &efi_framebuffer_format_map[info->pixel_format]; vesa->red_mask_size = fbinfo->red.size; vesa->red_mask_pos = fbinfo->red.pos; vesa->green_mask_size = fbinfo->green.size; @@ -108,29 +139,29 @@ static int save_vesa_mode(struct vesa_mode_info *vesa) vesa->reserved_mask_pos = fbinfo->rsvd.pos; vesa->bits_per_pixel = 32; - vesa->bytes_per_scanline = mode->info->pixels_per_scanline * 4; - } else if (mode->info->pixel_format == EFI_GOT_BITMASK) { - efi_find_pixel_bits(mode->info->pixel_bitmask[0], + vesa->bytes_per_scanline = info->pixels_per_scanline * 4; + } else if (info->pixel_format == EFI_GOT_BITMASK) { + efi_find_pixel_bits(info->pixel_bitmask[0], &vesa->red_mask_pos, &vesa->red_mask_size); - efi_find_pixel_bits(mode->info->pixel_bitmask[1], + efi_find_pixel_bits(info->pixel_bitmask[1], &vesa->green_mask_pos, &vesa->green_mask_size); - efi_find_pixel_bits(mode->info->pixel_bitmask[2], + efi_find_pixel_bits(info->pixel_bitm
[PATCH v2 03/13] efi: Support a 64-bit frame buffer address
The current vesa structure only provides a 32-bit value for the frame buffer. Many modern machines use an address outside the range. It is still useful to have this common struct, but add a separate frame-buffer address as well. Add a comment for vesa_setup_video_priv() while we are here. Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/lib/fsp/fsp_graphics.c | 2 +- drivers/pci/pci_rom.c | 10 ++ drivers/video/coreboot.c| 2 +- drivers/video/efi.c | 34 + include/vesa.h | 16 +++- 5 files changed, 45 insertions(+), 19 deletions(-) diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c index b07c666caf7..2bcc49f6051 100644 --- a/arch/x86/lib/fsp/fsp_graphics.c +++ b/arch/x86/lib/fsp/fsp_graphics.c @@ -106,7 +106,7 @@ static int fsp_video_probe(struct udevice *dev) vesa->phys_base_ptr = dm_pci_read_bar32(dev, 2); gd->fb_base = vesa->phys_base_ptr; - ret = vesa_setup_video_priv(vesa, uc_priv, plat); + ret = vesa_setup_video_priv(vesa, vesa->phys_base_ptr, uc_priv, plat); if (ret) goto err; diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c index 47b6e6e5bcf..f0dfe631490 100644 --- a/drivers/pci/pci_rom.c +++ b/drivers/pci/pci_rom.c @@ -325,7 +325,7 @@ err: return ret; } -int vesa_setup_video_priv(struct vesa_mode_info *vesa, +int vesa_setup_video_priv(struct vesa_mode_info *vesa, u64 fb, struct video_priv *uc_priv, struct video_uc_plat *plat) { @@ -348,9 +348,9 @@ int vesa_setup_video_priv(struct vesa_mode_info *vesa, /* Use double buffering if enabled */ if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->base) - plat->copy_base = vesa->phys_base_ptr; + plat->copy_base = fb; else - plat->base = vesa->phys_base_ptr; + plat->base = fb; log_debug("base = %lx, copy_base = %lx\n", plat->base, plat->copy_base); plat->size = vesa->bytes_per_scanline * vesa->y_resolution; @@ -377,7 +377,9 @@ int vesa_setup_video(struct udevice *dev, int (*int15_handler)(void)) return ret; } - ret = vesa_setup_video_priv(&mode_info.vesa, uc_priv, plat); + ret = vesa_setup_video_priv(&mode_info.vesa, + mode_info.vesa.phys_base_ptr, uc_priv, + plat); if (ret) { if (ret == -ENFILE) { /* diff --git a/drivers/video/coreboot.c b/drivers/video/coreboot.c index d2d87c75c89..c586475e41e 100644 --- a/drivers/video/coreboot.c +++ b/drivers/video/coreboot.c @@ -57,7 +57,7 @@ static int coreboot_video_probe(struct udevice *dev) goto err; } - ret = vesa_setup_video_priv(vesa, uc_priv, plat); + ret = vesa_setup_video_priv(vesa, vesa->phys_base_ptr, uc_priv, plat); if (ret) { ret = log_msg_ret("setup", ret); goto err; diff --git a/drivers/video/efi.c b/drivers/video/efi.c index 0479f207032..169637c2882 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -5,6 +5,8 @@ * EFI framebuffer driver based on GOP */ +#define LOG_CATEGORY LOGC_EFI + #include #include #include @@ -56,11 +58,12 @@ static void efi_find_pixel_bits(u32 mask, u8 *pos, u8 *size) * Gets info from the graphics-output protocol * * @vesa: Place to put the mode information + * @fbp: Returns the address of the frame buffer * @infop: Returns a pointer to the mode info * Returns: 0 if OK, -ENOSYS if boot services are not available, -ENOTSUPP if * the protocol is not supported by EFI */ -static int get_mode_info(struct vesa_mode_info *vesa, +static int get_mode_info(struct vesa_mode_info *vesa, u64 *fbp, struct efi_gop_mode_info **infop) { efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; @@ -74,9 +77,13 @@ static int get_mode_info(struct vesa_mode_info *vesa, ret = boot->locate_protocol(&efi_gop_guid, NULL, (void **)&gop); if (ret) return log_msg_ret("prot", -ENOTSUPP); - mode = gop->mode; + log_debug("maxmode %u, mode %u, info %p, size %lx, fb %lx, fb_size %lx\n", + mode->max_mode, mode->mode, mode->info, mode->info_size, + (ulong)mode->fb_base, (ulong)mode->fb_size); + vesa->phys_base_ptr = mode->fb_base; + *fbp = mode->fb_base; vesa->x_resolution = mode->info->width; vesa->y_resolution = mode->info->height; *infop = mode->info; @@ -91,10 +98,11 @@ static int get_mode_info(struct vesa_mode_info *vesa, * it into a vesa structure. It also r
[PATCH v2 04/13] x86: Add a few more items to bdinfo
Add the timer and vendor/model information. Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/lib/bdinfo.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/x86/lib/bdinfo.c b/arch/x86/lib/bdinfo.c index 0cb79b01bd3..896de37dce4 100644 --- a/arch/x86/lib/bdinfo.c +++ b/arch/x86/lib/bdinfo.c @@ -16,6 +16,10 @@ DECLARE_GLOBAL_DATA_PTR; void arch_print_bdinfo(void) { bdinfo_print_num_l("prev table", gd->arch.table); + bdinfo_print_num_l("clock_rate", gd->arch.clock_rate); + bdinfo_print_num_l("tsc_base", gd->arch.tsc_base); + bdinfo_print_num_l("vendor", gd->arch.x86_vendor); + bdinfo_print_num_l("model", gd->arch.x86_model); if (IS_ENABLED(CONFIG_EFI_STUB)) efi_show_bdinfo(); -- 2.39.2.637.g21b0678d19-goog
[PATCH v2 05/13] efi: Use a fixed value for the timer clock
It is not yet clear how to read the timer via EFI. The current value seems much too high on a Framework laptop I tried. Adjust it to a lower hard-coded value for now. Signed-off-by: Simon Glass --- (no changes since v1) drivers/timer/tsc_timer.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index 192c7b71a5a..1d2a3f20e4e 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c @@ -404,6 +404,10 @@ static void tsc_timer_ensure_setup(bool early) if (!gd->arch.clock_rate) { unsigned long fast_calibrate; + if (IS_ENABLED(CONFIG_EFI_APP)) { + fast_calibrate = 2750; + goto done; + } fast_calibrate = native_calibrate_tsc(); if (fast_calibrate) goto done; -- 2.39.2.637.g21b0678d19-goog
[PATCH v2 06/13] efi: Support copy framebuffer
Add support for this to EFI in case it becomes useful. At present it just slows things down. You can enable CONFIG_VIDEO_COPY to turn it on. Signed-off-by: Simon Glass --- Changes in v2: - Obtain copy framebuffer size from EFI instead of using a fixed value - Dropping debugging printf() - use new bootph-xxx tag arch/x86/dts/efi-x86_app.dts | 1 + drivers/video/efi.c | 25 - 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/x86/dts/efi-x86_app.dts b/arch/x86/dts/efi-x86_app.dts index 6d843a9820b..59e2e402d5e 100644 --- a/arch/x86/dts/efi-x86_app.dts +++ b/arch/x86/dts/efi-x86_app.dts @@ -27,6 +27,7 @@ }; efi-fb { compatible = "efi-fb"; + bootph-some-ram; }; }; diff --git a/drivers/video/efi.c b/drivers/video/efi.c index 169637c2882..a8e9282ab87 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -129,7 +129,6 @@ static int save_vesa_mode(struct vesa_mode_info *vesa, u64 *fbp) struct efi_gop_mode_info *info; int ret; - printf("start\n"); if (IS_ENABLED(CONFIG_EFI_APP)) ret = get_mode_info(vesa, fbp, &info); else @@ -207,6 +206,29 @@ err: return ret; } +static int efi_video_bind(struct udevice *dev) +{ + if (IS_ENABLED(CONFIG_VIDEO_COPY)) { + struct video_uc_plat *plat = dev_get_uclass_plat(dev); + struct vesa_mode_info vesa; + int ret; + u64 fb; + + /* +* Initialise vesa_mode_info structure so we can figure out the +* required framebuffer size. If something goes wrong, just do +* without a copy framebuffer +*/ + ret = save_vesa_mode(&vesa, &fb); + if (!ret) { + plat->copy_size = vesa.bytes_per_scanline * + vesa.y_resolution; + } + } + + return 0; +} + static const struct udevice_id efi_video_ids[] = { { .compatible = "efi-fb" }, { } @@ -216,5 +238,6 @@ U_BOOT_DRIVER(efi_video) = { .name = "efi_video", .id = UCLASS_VIDEO, .of_match = efi_video_ids, + .bind = efi_video_bind, .probe = efi_video_probe, }; -- 2.39.2.637.g21b0678d19-goog