Re: [U-Boot] [PATCH v2 6/9] efi_selftest: allow to select a single test for exexution
On 17.10.17 22:11, Heinrich Schuchardt wrote: > On 10/17/2017 09:48 AM, Alexander Graf wrote: >> >> >> On 13.10.17 19:33, Heinrich Schuchardt wrote: >>> Environment variable efi_selftest is passed as load options >>> to the selftest application. It is used to select a single >>> test to be executed. >>> >>> Special value 'list' displays a list of all available tests. >>> >>> Tests get an on_request property. If this property is set >>> the tests are only executed if explicitly requested. >>> >>> The invocation of efi_selftest is changed to reflect that >>> bootefi selftest with efi_selftest = 'list' will call the >>> Exit bootservice. >>> >>> Environment variable bootargs is used as load options >>> for all other bootefi payloads. >>> >>> Signed-off-by: Heinrich Schuchardt >>> --- >>> v2 >>> use an environment variable to choose a test >>> --- >>> cmd/bootefi.c | 46 - >>> include/efi_selftest.h | 18 +++ >>> lib/efi_selftest/efi_selftest.c | 90 >>> +++-- >>> lib/efi_selftest/efi_selftest_console.c | 10 >>> lib/efi_selftest/efi_selftest_util.c| 11 +++- >>> 5 files changed, 168 insertions(+), 7 deletions(-) >>> >>> diff --git a/cmd/bootefi.c b/cmd/bootefi.c >>> index 18176a1266..2d70137482 100644 >>> --- a/cmd/bootefi.c >>> +++ b/cmd/bootefi.c >>> @@ -6,10 +6,12 @@ >>> * SPDX-License-Identifier: GPL-2.0+ >>> */ >>> >>> +#include >>> #include >>> #include >>> #include >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -50,6 +52,32 @@ static void efi_init_obj_list(void) >>> efi_get_time_init(); >>> } >>> >>> +/* >>> + * Set the load options of an image from an environment variable. >>> + * >>> + * @loaded_image_info: the image >>> + * @env_var: name of the environment variable >>> + */ >>> +static void set_load_options(struct efi_loaded_image *loaded_image_info, >>> +const char *env_var) >>> +{ >>> + size_t size; >>> + const char *env = env_get(env_var); >>> + >>> + loaded_image_info->load_options = NULL; >>> + loaded_image_info->load_options_size = 0; >>> + if (!env) >>> + return; >>> + size = strlen(env) + 1; >>> + loaded_image_info->load_options = calloc(size, sizeof(u16)); >>> + if (!loaded_image_info->load_options) { >>> + printf("ERROR: Out of memory\n"); >>> + return; >>> + } >>> + utf8_to_utf16(loaded_image_info->load_options, (u8 *)env, size); >>> + loaded_image_info->load_options_size = size * 2; >>> +} >>> + >>> static void *copy_fdt(void *fdt) >>> { >>> u64 fdt_size = fdt_totalsize(fdt); >>> @@ -190,6 +218,8 @@ static unsigned long do_bootefi_exec(void *efi, void >>> *fdt, >>> efi_install_configuration_table(&fdt_guid, NULL); >>> } >>> >>> + /* Transfer environment variable bootargs as load options */ >>> + set_load_options(&loaded_image_info, "bootargs"); >> >> While I really want to see that change, please try not to sneak it in >> with the selftest one :). >> >> Just split that hunk out to a following patch and give it its own patch >> description. In case something goes wrong, we'd only need to revert a >> small patch then. >> >>> /* Load the EFI payload */ >>> entry = efi_load_pe(efi, &loaded_image_info); >>> if (!entry) { >>> @@ -237,6 +267,7 @@ static unsigned long do_bootefi_exec(void *efi, void >>> *fdt, >>> >>> exit: >>> /* image has returned, loaded-image obj goes *poof*: */ >>> + free(loaded_image_info.load_options); >> >> This too is a change that doesn't fit the patch description? >> >>> list_del(&loaded_image_info_obj.link); >>> >>> return ret; >>> @@ -301,17 +332,26 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int >>> argc, char * const argv[]) >>> >>> efi_setup_loaded_image(&loaded_image_info, >>>&loaded_image_info_obj, >>> - bootefi_device_path, bootefi_image_path); >>> + NULL, NULL); >> >> Why? >> >>> /* >>> * gd lives in a fixed register which may get clobbered while we >>> * execute the payload. So save it here and restore it on every >>> * callback entry >>> */ >>> efi_save_gd(); >>> + loaded_image_info.image_code_type = EFI_LOADER_CODE; >>> + loaded_image_info.image_data_type = EFI_LOADER_DATA; >> >> Also unrelated? Please split it out. >> >>> /* Initialize and populate EFI object list */ >>> if (!efi_obj_list_initalized) >>> efi_init_obj_list(); >>> - return efi_selftest(&loaded_image_info, &systab); >>> + /* Transfer environment variable efi_selftest as load options */ >>> + set_load_options(&loaded_image_info, "efi_selftest"); >>> + /* Execute the
Re: [U-Boot] [PATCH v5] cmd: usb: add blk, emulation devices to ignore list as needed
On Tue, Oct 17, 2017 at 6:22 PM, Marek Vasut wrote: > On 10/18/2017 01:50 AM, Suneel Garapati wrote: >> On Tue, Oct 17, 2017 at 5:43 AM, Marek Vasut wrote: >>> On 10/17/2017 05:21 AM, Bin Meng wrote: +Marek, Tom, >>> >>> Well, if the author CCed me in the first place, that'd be useful. >>> On Tue, Oct 17, 2017 at 11:14 AM, Suneel Garapati wrote: > Hi Bin/Simon, > > Request to know if this will be applied for v2017.11 > Not sure which of you should pick this up for v2017.11. >>> >>> The commit message makes no sense, can you explain to me what this patch >>> tries to achieve ? >> usb tree/info commands for DM_USB should ignore blk child under mass >> storage and usb_emul devices >> otherwise u-boot crashes. > > And it crashes because ... why ? I am sure you analyzed the problem and > that analysis/explanation should be in the commit message too. It crashes because the next call of tree graph on blk device will try to fetch config interface class descriptors assuming it as usb_device structure. I will add the above to commit message and send v6. Regards, Suneel > > -- > Best regards, > Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v5] cmd: usb: add blk, emulation devices to ignore list as needed
On 10/18/2017 01:50 AM, Suneel Garapati wrote: > On Tue, Oct 17, 2017 at 5:43 AM, Marek Vasut wrote: >> On 10/17/2017 05:21 AM, Bin Meng wrote: >>> +Marek, Tom, >> >> Well, if the author CCed me in the first place, that'd be useful. >> >>> On Tue, Oct 17, 2017 at 11:14 AM, Suneel Garapati >>> wrote: Hi Bin/Simon, Request to know if this will be applied for v2017.11 >>> >>> Not sure which of you should pick this up for v2017.11. >> >> The commit message makes no sense, can you explain to me what this patch >> tries to achieve ? > usb tree/info commands for DM_USB should ignore blk child under mass > storage and usb_emul devices > otherwise u-boot crashes. And it crashes because ... why ? I am sure you analyzed the problem and that analysis/explanation should be in the commit message too. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1] Document padding between GPT header and partition entries
On Dienstag, 17. Oktober 2017 20:05:40 CEST you wrote: > > On 17 Oct 2017, at 19:55, Stefan Brüns > > wrote: > > > > Commit 02e43537b322 ("part_efi: support padding between the GPT > > header and partition entries") added support for deviating from > > the typical GPT layout. > > > > Explicitly state deviations are allowed/possible, and mention when > > (SoC SPL) and when not (compatibility) deviations are useful. Also > > mention support for non-standard layouts in gdisk 1.0.3. > > There is nothing in the GPT specification that mandates that the > partition entries are to follow immediately after the header and it > is even assumed that this does not have to be the case (i.e. the > address needs to be computed from the info in the header). > > So I object to the “non-standard”. non-standard != non-compliant > > Signed-off-by: Stefan Brüns > > Reviewed-by: Philipp Tomsich > > > --- > > > > doc/README.gpt | 33 + > > 1 file changed, 29 insertions(+), 4 deletions(-) > > > > diff --git a/doc/README.gpt b/doc/README.gpt > > index d3db8bce1c..7134f3b3cf 100644 > > --- a/doc/README.gpt > > +++ b/doc/README.gpt > > @@ -44,8 +44,8 @@ uuid command line tool). > > GPT brief explanation: > > == > > > > - Layout: > > - --- > > + Default layout: > > + --- > > > > -- > > LBA 0 |Protective MBR | > > > > @@ -82,7 +82,29 @@ For a legacy reasons, GPT's LBA 0 sector has a MBR > > structure. It is called Its first partition entry ID has 0xEE value, and > > disk software, which is not handling the GPT sees it as a storage device > > without free space. > > > > -It is possible to define 128 linearly placed partition entries. > > +By default, the first partition entry of the primary GPT is stored in LBA > > 2, > The “default" is merely the most compact representation (i.e. tries to waste > no space). I would not even call this “default” (it is a common behaviour > found “in the wild”, but in no way a “default”). It is the default for gdisk, parted, u-boots gpt command, likely also for the partitioners in MacOS and Windows. It also matches the example in the UEFI specification. > > +although this is not explicitly mandated by the UEFI specification. The > > +start LBAs of the partition entries are given in the corresponding GPT > > +headers (Primary/Backup) (offset 72 bytes). > > + > > +The UEFI specification mandates at least 128 contigously stored partition > > +entries, the number is specified in the GPT headers (offset 80). > > + > > +As several SoCs require the SPL to be located at a fixed position, often > > +below LBA 34 (17 kByte for 512 byte blocks), it is possible to deviate > > +from the standard layout: > > + > > +1. Lower the number of partition entries. This violates the UEFI/GPT > > + specification, but usually works. > > If you deviate from the UEFI/GPT specification, then you don’t have a > GPT partition table. So this is not a permissible change and thus should > not be listed here. It is commonly used. E.g. with gdisk prior to version 1.0.2, it was the only option to use a GPT on one of the problematic SoCs. > > +2. Insert a gap between Primary GPT Header and partition entries. This > > + is in line with the specification, but may cause problems with tools > > + or operating systems hardcoding the partition entries LBA to 2. > > In which the operating systems do not support GPT partitions (but something > that is close enough to work, as long as the stars are aligned just right) > and there is no reason not to break compatibility against these. Ever heard of reality? Nobody cares why something breaks or whose fault it is - if you break something, *you* have screwed up. U-Boot is no fuzzer. It is a boot loader. If you do some research, you will find plenty of places which claim the partition entries *have to* start at LBA 2 - even this README.gpt stated "always 2". What happens if an implementation rejects the GPT when the entries are not located in LBA? A warning is completely in line here. > > +There is limited support for both variants in U-Boot - reading is fully > > +supported, while the "gpt write" command always creates a GPT with 128 > > +entries. A gap is created when CONFIG_EFI_PARTITION_ENTRIES_OFF is set > > +or when the device tree "/config" node contains a property > > +"u-boot,efi-partition-entries-offset". > > > > "LBA -1" means the last addressable block (in the mmc subsystem: > > "dev_desc->lba - 1") > > @@ -103,7 +125,7 @@ Offset SizeDescription > > > > LBA + 1) > > > > 48 8 B Last usable LBA (secondary partition table first LBA - 1) > > 56 16 BDisk GUID (also referred as UUID on UNIXes) > > -72 8 B Partition entries starting LBA (always 2 in primary copy) > > +72 8 B Partition entries starting LBA (usually 2 in primary > > copy) > > 80
[U-Boot] [PATCH v1] Document padding between GPT header and partition entries
Commit 02e43537b322 ("part_efi: support padding between the GPT header and partition entries") added support for deviating from the typical GPT layout. Explicitly state deviations are allowed/possible, and mention when (SoC SPL) and when not (compatibility) deviations are useful. Also mention support for non-standard layouts in gdisk 1.0.3. Signed-off-by: Stefan Brüns --- doc/README.gpt | 33 + 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/doc/README.gpt b/doc/README.gpt index d3db8bce1c..7134f3b3cf 100644 --- a/doc/README.gpt +++ b/doc/README.gpt @@ -44,8 +44,8 @@ uuid command line tool). GPT brief explanation: == - Layout: - --- + Default layout: + --- -- LBA 0 |Protective MBR | @@ -82,7 +82,29 @@ For a legacy reasons, GPT's LBA 0 sector has a MBR structure. It is called Its first partition entry ID has 0xEE value, and disk software, which is not handling the GPT sees it as a storage device without free space. -It is possible to define 128 linearly placed partition entries. +By default, the first partition entry of the primary GPT is stored in LBA 2, +although this is not explicitly mandated by the UEFI specification. The +start LBAs of the partition entries are given in the corresponding GPT +headers (Primary/Backup) (offset 72 bytes). + +The UEFI specification mandates at least 128 contigously stored partition +entries, the number is specified in the GPT headers (offset 80). + +As several SoCs require the SPL to be located at a fixed position, often +below LBA 34 (17 kByte for 512 byte blocks), it is possible to deviate +from the standard layout: + +1. Lower the number of partition entries. This violates the UEFI/GPT + specification, but usually works. +2. Insert a gap between Primary GPT Header and partition entries. This + is in line with the specification, but may cause problems with tools + or operating systems hardcoding the partition entries LBA to 2. + +There is limited support for both variants in U-Boot - reading is fully +supported, while the "gpt write" command always creates a GPT with 128 +entries. A gap is created when CONFIG_EFI_PARTITION_ENTRIES_OFF is set +or when the device tree "/config" node contains a property +"u-boot,efi-partition-entries-offset". "LBA -1" means the last addressable block (in the mmc subsystem: "dev_desc->lba - 1") @@ -103,7 +125,7 @@ Offset SizeDescription LBA + 1) 48 8 B Last usable LBA (secondary partition table first LBA - 1) 56 16 BDisk GUID (also referred as UUID on UNIXes) -72 8 B Partition entries starting LBA (always 2 in primary copy) +72 8 B Partition entries starting LBA (usually 2 in primary copy) 80 4 B Number of partition entries 84 4 B Size of a partition entry (usually 128) 88 4 B CRC32 of partition array @@ -283,6 +305,9 @@ Two programs, namely: 'gdisk' and 'parted' are recommended to work with GPT recovery. Both are able to handle GUID partitions. Please, pay attention at -l switch for parted. +'gdisk' as of version 1.0.3 is able to create tables with a number of partition +entries different to 128, and insert padding after the GPT header. + "uuid" program is recommended to generate UUID string. Moreover it can decode (-d switch) passed in UUID string. It can be used to generate partitions UUID passed to u-boot environment variables. -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v5] cmd: usb: add blk, emulation devices to ignore list as needed
On Tue, Oct 17, 2017 at 5:43 AM, Marek Vasut wrote: > On 10/17/2017 05:21 AM, Bin Meng wrote: >> +Marek, Tom, > > Well, if the author CCed me in the first place, that'd be useful. > >> On Tue, Oct 17, 2017 at 11:14 AM, Suneel Garapati >> wrote: >>> Hi Bin/Simon, >>> >>> Request to know if this will be applied for v2017.11 >>> >> >> Not sure which of you should pick this up for v2017.11. > > The commit message makes no sense, can you explain to me what this patch > tries to achieve ? usb tree/info commands for DM_USB should ignore blk child under mass storage and usb_emul devices otherwise u-boot crashes. Regards, Suneel > >>> Regards, >>> Suneel >>> >> >> Suneel, please avoid top-posting next time. thanks! >> >>> On Sun, Sep 24, 2017 at 7:13 PM, Simon Glass wrote: On 20 September 2017 at 23:09, Suneel Garapati wrote: > add blk child devices to ignore list while displaying usb tree graph, > also preamble should not be set for blk child devices. > add usb_emul to ignore list in usb_show_info. otherwise usb tree and > info commands may cause crash treating blk as usb device. > > Signed-off-by: Suneel Garapati > Reviewed-by: Bin Meng > Tested-by: Bin Meng > --- > Changes v5: > - add usb_emul to ignore list in usb_show_info > - modify description > Changes v4: > - do not set preamble if child is block device for mass storage > Changes v3: > - remove 'check on parent uclass' in description > Changes v2: > - remove check on parent uclass > Changes v1: > - add separate check on blk uclass > - modify description > - add separate check on parent uclass as usb > > cmd/usb.c | 22 +++--- > 1 file changed, 19 insertions(+), 3 deletions(-) Reviewed-by: Simon Glass >> >> Regards, >> Bin >> > > > -- > Best regards, > Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 3/4] pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile
2017-10-18 3:03 GMT+09:00 Matthew Weber : > Masahiro, > I'm working on updating Buildroot to remove the host dependency on > python as part of the tools build (Plus fix the mix of host system vs > host buildroot python/swig checks). Appreciate the recent changes as > it makes that easier, with the addition of the kconfig option to turn > on the libfdt build. I assume that removes the python/swig dependency > when that's disabled? Right. No more dependency on python/swig when CONFIG_PYLIBFDT is disabled. >Is the default in a un-configured uboot (ie > if I was just building tools) to leave libfdt off? If un-configured, CONFIG_PYLIBFDT is undefined. Kbuild will not build pylibfdt. > I'm irc if it's easier to discuss. > > Matt > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 18/18] efi_loader: set parent handle in efi_load_image
The parent_handle of the loaded image must be set. Set the system table. Signed-off-by: Heinrich Schuchardt --- v3 new patch --- lib/efi_loader/efi_boottime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index fd8d15655b..f70d8658ab 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1282,6 +1282,8 @@ static efi_status_t EFIAPI efi_load_image(bool boot_policy, return EFI_EXIT(EFI_UNSUPPORTED); } + info->system_table = &systab; + info->parent_handle = parent_image; *image_handle = info; return EFI_EXIT(EFI_SUCCESS); -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 05/18] efi_loader: guard against double inclusion of efi_loader.h
Use a define to detect double inclusion of efi_loader.h. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 new patch --- include/efi_loader.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index af64b11cee..e506eeec61 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -6,6 +6,9 @@ * SPDX-License-Identifier: GPL-2.0+ */ +#ifndef _EFI_LOADER_H +#define _EFI_LOADER_H 1 + #include #include #include @@ -345,4 +348,6 @@ static inline void efi_set_bootdev(const char *dev, const char *devnr, const char *path) { } static inline void efi_net_set_dhcp_ack(void *pkt, int len) { } -#endif +#endif /* CONFIG_EFI_LOADER && !CONFIG_SPL_BUILD */ + +#endif /* _EFI_LOADER_H */ -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 09/18] efi_selftest: efi_st_memcmp should return 0
If the compared memory areas match the return value should be 0. We should not use the unrelated constant EFI_ST_SUCCESS. Signed-off-by: Heinrich Schuchardt --- v3 new patch split off --- lib/efi_selftest/efi_selftest_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_selftest/efi_selftest_util.c b/lib/efi_selftest/efi_selftest_util.c index 5cffe383d8..5f81f251c4 100644 --- a/lib/efi_selftest/efi_selftest_util.c +++ b/lib/efi_selftest/efi_selftest_util.c @@ -21,5 +21,5 @@ int efi_st_memcmp(const void *buf1, const void *buf2, size_t length) ++pos1; ++pos2; } - return EFI_ST_SUCCESS; + return 0; } -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 13/18] efi_loader: use bootargs as load options
Use environment variable bootargs used as load options for bootefi payloads. Signed-off-by: Heinrich Schuchardt --- v3 new patch split off --- cmd/bootefi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 40834f3899..ff659fc02f 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -218,6 +218,8 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt, efi_install_configuration_table(&fdt_guid, NULL); } + /* Transfer environment variable bootargs as load options */ + set_load_options(&loaded_image_info, "bootargs"); /* Load the EFI payload */ entry = efi_load_pe(efi, &loaded_image_info); if (!entry) { -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 16/18] test/py: fix typo in test_efi_loader.py
Make a comment line easier to read. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- test/py/tests/test_efi_loader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index 5d7f5dbfb2..4d391e13ef 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -12,7 +12,7 @@ import u_boot_utils """ Note: This test relies on boardenv_* containing configuration values to define -which the network environment available for testing. Without this, the parts +which network environment is available for testing. Without this, the parts that rely on network will be automatically skipped. For example: -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 17/18] efi_selftest: provide test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
The following services are tested: OutputString, TestString, SetAttribute. Signed-off-by: Heinrich Schuchardt --- v3 new patch --- lib/efi_selftest/Makefile | 5 ++- lib/efi_selftest/efi_selftest_textoutput.c | 53 ++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 lib/efi_selftest/efi_selftest_textoutput.c diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 3e5c9a6d16..b1385383ed 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -17,7 +17,9 @@ CFLAGS_efi_selftest_exitbootservices.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_exitbootservices.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_snp.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_snp.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI) +CFLAGS_efi_selftest_text_output.o := $(CFLAGS_EFI) +CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI) +CFLAGS_efi_selftest_text_output.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_util.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_util.o := $(CFLAGS_NON_EFI) @@ -30,6 +32,7 @@ efi_selftest_console.o \ efi_selftest_events.o \ efi_selftest_exitbootservices.o \ efi_selftest_snp.o \ +efi_selftest_textoutput.o \ efi_selftest_tpl.o \ efi_selftest_util.o \ efi_selftest_watchdog.o diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c new file mode 100644 index 00..7bc4d2f446 --- /dev/null +++ b/lib/efi_selftest/efi_selftest_textoutput.c @@ -0,0 +1,53 @@ +/* + * efi_selftest_textoutput + * + * Copyright (c) 2017 Heinrich Schuchardt + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Test the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL. + * + * The following services are tested: + * OutputString, TestString, SetAttribute. + */ + +#include + +/* + * Execute unit test. + * + * @return:EFI_ST_SUCCESS for success + */ +static int execute(void) +{ + size_t foreground; + size_t background; + size_t attrib; + efi_status_t ret; + + /* SetAttribute */ + efi_st_printf("\nColor palette\n"); + for (foreground = 0; foreground < 0x10; ++foreground) { + for (background = 0; background < 0x80; background += 0x10) { + attrib = foreground | background; + con_out->set_attribute(con_out, attrib); + efi_st_printf("%p", (void *)attrib); + } + con_out->set_attribute(con_out, 0); + efi_st_printf("\n"); + } + /* TestString */ + ret = con_out->test_string(con_out, + L" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n"); + if (ret != EFI_ST_SUCCESS) { + efi_st_error("TestString failed for ANSI characters\n"); + return EFI_ST_FAILURE; + } + return EFI_ST_SUCCESS; +} + +EFI_UNIT_TEST(textoutput) = { + .name = "text output", + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + .execute = execute, +}; -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 10/18] efi_selftest: deduplicate code
Move duplicate code to the new function efi_st_do_tests. Suggested-by: Alexander Graf Signed-off-by: Heinrich Schuchardt --- v3 new patch --- lib/efi_selftest/efi_selftest.c | 71 - 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c index c2c339a7be..73f074d9e1 100644 --- a/lib/efi_selftest/efi_selftest.c +++ b/lib/efi_selftest/efi_selftest.c @@ -9,6 +9,13 @@ #include #include +/* + * Constants for test step bitmap + */ +#define EFI_ST_SETUP 1 +#define EFI_ST_EXECUTE 2 +#define EFI_ST_TEARDOWN4 + static const struct efi_system_table *systable; static const struct efi_boot_services *boottime; static const struct efi_runtime_services *runtime; @@ -133,6 +140,31 @@ static int teardown(struct efi_unit_test *test, unsigned int *failures) return ret; } +/* + * Execute test steps of one phase. + * + * @phase test phase + * @steps steps to execute + * failuresreturns EFI_ST_SUCCESS if all test steps succeeded + */ +void efi_st_do_tests(unsigned int phase, unsigned int steps, +unsigned int *failures) +{ + struct efi_unit_test *test; + + for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); +test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { + if (test->phase != phase) + continue; + if (steps & EFI_ST_SETUP) + setup(test, failures); + if (steps & EFI_ST_EXECUTE) + execute(test, failures); + if (steps & EFI_ST_TEARDOWN) + teardown(test, failures); + } +} + /* * Execute selftest of the EFI API * @@ -153,7 +185,6 @@ static int teardown(struct efi_unit_test *test, unsigned int *failures) efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, struct efi_system_table *systab) { - struct efi_unit_test *test; unsigned int failures = 0; systable = systab; @@ -169,41 +200,23 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, ll_entry_count(struct efi_unit_test, efi_unit_test)); /* Execute boottime tests */ - for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); -test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { - if (test->phase == EFI_EXECUTE_BEFORE_BOOTTIME_EXIT) { - setup(test, &failures); - execute(test, &failures); - teardown(test, &failures); - } - } + efi_st_do_tests(EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN, + &failures); /* Execute mixed tests */ - for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); -test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { - if (test->phase == EFI_SETUP_BEFORE_BOOTTIME_EXIT) - setup(test, &failures); - } + efi_st_do_tests(EFI_SETUP_BEFORE_BOOTTIME_EXIT, + EFI_ST_SETUP, &failures); efi_st_exit_boot_services(); - for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); -test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { - if (test->phase == EFI_SETUP_BEFORE_BOOTTIME_EXIT) { - execute(test, &failures); - teardown(test, &failures); - } - } + efi_st_do_tests(EFI_SETUP_BEFORE_BOOTTIME_EXIT, + EFI_ST_EXECUTE | EFI_ST_TEARDOWN, &failures); /* Execute runtime tests */ - for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); -test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { - if (test->phase == EFI_SETUP_AFTER_BOOTTIME_EXIT) { - setup(test, &failures); - execute(test, &failures); - teardown(test, &failures); - } - } + efi_st_do_tests(EFI_SETUP_AFTER_BOOTTIME_EXIT, + EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN, + &failures); /* Give feedback */ efi_st_printf("\nSummary: %u failures\n\n", failures); -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 15/18] test/py: test reboot by EFI watchdog
Clear environment variable efi_selftest before executing the default tests. Provide a test verifying that the EFI watchdog reboots the system upon timeout. The test depends on CONFIG_CMD_EFI_SELFTEST=y. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 choose test via environment variable --- test/py/tests/test_efi_selftest.py | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py index 76e282a6c7..66b799bed6 100644 --- a/test/py/tests/test_efi_selftest.py +++ b/test/py/tests/test_efi_selftest.py @@ -1,4 +1,3 @@ -# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. # Copyright (c) 2017, Heinrich Schuchardt # # SPDX-License-Identifier: GPL-2.0 @@ -14,6 +13,7 @@ def test_efi_selftest(u_boot_console): Run bootefi selftest """ + u_boot_console.run_command(cmd='setenv efi_selftest') u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False) m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key']) if m != 0: @@ -23,3 +23,15 @@ def test_efi_selftest(u_boot_console): if m != 0: raise Exception('Reset failed during the EFI selftest') u_boot_console.restart_uboot(); + +@pytest.mark.buildconfigspec('cmd_bootefi_selftest') +def test_efi_selftest_watchdog_reboot(u_boot_console): + u_boot_console.run_command(cmd='setenv efi_selftest list') + output = u_boot_console.run_command('bootefi selftest') + assert '\'watchdog reboot\'' in output + u_boot_console.run_command(cmd='setenv efi_selftest watchdog reboot') + u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False) + m = u_boot_console.p.expect(['resetting', 'U-Boot']) + if m != 0: + raise Exception('Reset failed in \'watchdog reboot\' test') + u_boot_console.restart_uboot(); -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 11/18] efi_selftest: allow to select a single test for exexution
Environment variable efi_selftest is passed as load options to the selftest application. It is used to select a single test to be executed. The load options are an UTF8 string. Yet I decided to keep the name propertiy of the tests as char[] to reduce code size. Special value 'list' displays a list of all available tests. Tests get an on_request property. If this property is set the tests are only executed if explicitly requested. The invocation of efi_selftest is changed to reflect that bootefi selftest with efi_selftest = 'list' will call the Exit bootservice. Signed-off-by: Heinrich Schuchardt --- v3 split off unrelated changes to separate patches v2 use an environment variable to choose a test --- cmd/bootefi.c | 37 +- include/efi_selftest.h | 18 +++ lib/efi_selftest/efi_selftest.c | 90 ++--- lib/efi_selftest/efi_selftest_console.c | 10 lib/efi_selftest/efi_selftest_util.c| 9 5 files changed, 155 insertions(+), 9 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index d497381ac3..18331536dd 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -6,10 +6,12 @@ * SPDX-License-Identifier: GPL-2.0+ */ +#include #include #include #include #include +#include #include #include #include @@ -50,6 +52,32 @@ static void efi_init_obj_list(void) efi_get_time_init(); } +/* + * Set the load options of an image from an environment variable. + * + * @loaded_image_info: the image + * @env_var: name of the environment variable + */ +static void set_load_options(struct efi_loaded_image *loaded_image_info, +const char *env_var) +{ + size_t size; + const char *env = env_get(env_var); + + loaded_image_info->load_options = NULL; + loaded_image_info->load_options_size = 0; + if (!env) + return; + size = strlen(env) + 1; + loaded_image_info->load_options = calloc(size, sizeof(u16)); + if (!loaded_image_info->load_options) { + printf("ERROR: Out of memory\n"); + return; + } + utf8_to_utf16(loaded_image_info->load_options, (u8 *)env, size); + loaded_image_info->load_options_size = size * 2; +} + static void *copy_fdt(void *fdt) { u64 fdt_size = fdt_totalsize(fdt); @@ -317,7 +345,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Initialize and populate EFI object list */ if (!efi_obj_list_initalized) efi_init_obj_list(); - return efi_selftest(&loaded_image_info, &systab); + /* Transfer environment variable efi_selftest as load options */ + set_load_options(&loaded_image_info, "efi_selftest"); + /* Execute the test */ + r = efi_selftest(&loaded_image_info, &systab); + free(loaded_image_info.load_options); + return r; } else #endif if (!strcmp(argv[1], "bootmgr")) { @@ -363,6 +396,8 @@ static char bootefi_help_text[] = #ifdef CONFIG_CMD_BOOTEFI_SELFTEST "bootefi selftest\n" " - boot an EFI selftest application stored within U-Boot\n" + "Use environment variable efi_selftest to select a single test.\n" + "Use 'setenv efi_selftest list' to enumerate all tests.\n" #endif "bootmgr [fdt addr]\n" " - load and boot EFI payload based on BootOrder/Boot variables.\n" diff --git a/include/efi_selftest.h b/include/efi_selftest.h index 7ec42a0406..978ca2a7ea 100644 --- a/include/efi_selftest.h +++ b/include/efi_selftest.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #define EFI_ST_SUCCESS 0 @@ -71,6 +72,15 @@ void efi_st_printf(const char *fmt, ...) */ int efi_st_memcmp(const void *buf1, const void *buf2, size_t length); +/* + * Compare an u16 string to a char string. + * + * @buf1: u16 string + * @buf2: char string + * @return:0 if both buffers contain the same bytes + */ +int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2); + /* * Reads an Unicode character from the input device. * @@ -88,6 +98,7 @@ u16 efi_st_get_key(void); * @setup: set up the unit test * @teardown: tear down the unit test * @execute: execute the unit test + * @on_request:test is only executed on request */ struct efi_unit_test { const char *name; @@ -96,10 +107,17 @@ struct efi_unit_test { const struct efi_system_table *systable); int (*execute)(void); int (*teardown)(void); + bool on_request; }; /* Declare a new EFI unit test */ #define EFI_UNIT_TEST(__name) \ ll_entry_declare(struct efi_unit_test, __name, efi_unit_test) +#define EFI_SELFTEST_TABLE_GUID \ + EFI_GUID(0xbc3ebe57, 0x09e5,
[U-Boot] [PATCH v3 04/18] efi_loader: new function utf8_to_utf16
Provide a conversion function from utf8 to utf16. Add missing #include in include/charset.h. Remove superfluous #include in lib/charset.c. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 new patch --- include/charset.h | 15 +++ lib/charset.c | 57 ++- 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/include/charset.h b/include/charset.h index 37a3278499..2662c2f7c9 100644 --- a/include/charset.h +++ b/include/charset.h @@ -9,6 +9,8 @@ #ifndef __CHARSET_H_ #define __CHARSET_H_ +#include + #define MAX_UTF8_PER_UTF16 3 /** @@ -62,4 +64,17 @@ uint16_t *utf16_strdup(const uint16_t *s); */ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size); +/** + * utf8_to_utf16() - Convert an utf8 string to utf16 + * + * Converts up to 'size' characters of the utf16 string 'src' to utf8 + * written to the 'dest' buffer. Stops at 0x00. + * + * @dest the destination buffer to write the utf8 characters + * @srcthe source utf16 string + * @size maximum number of utf16 characters to convert + * @return the pointer to the first unwritten byte in 'dest' + */ +uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size); + #endif /* __CHARSET_H_ */ diff --git a/lib/charset.c b/lib/charset.c index ff76e88c77..8cd17ea1cb 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -6,7 +6,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include #include #include @@ -99,3 +98,59 @@ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size) return dest; } + +uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size) +{ + while (size--) { + int extension_bytes; + uint32_t code; + + extension_bytes = 0; + if (*src <= 0x7f) { + code = *src++; + /* Exit on zero byte */ + if (!code) + size = 0; + } else if (*src <= 0xbf) { + /* Illegal code */ + code = '?'; + } else if (*src <= 0xdf) { + code = *src++ & 0x1f; + extension_bytes = 1; + } else if (*src <= 0xef) { + code = *src++ & 0x0f; + extension_bytes = 2; + } else if (*src <= 0xf7) { + code = *src++ & 0x07; + extension_bytes = 3; + } else { + /* Illegal code */ + code = '?'; + } + + for (; extension_bytes && size; --size, --extension_bytes) { + if ((*src & 0xc0) == 0x80) { + code <<= 6; + code |= *src++ & 0x3f; + } else { + /* Illegal code */ + code = '?'; + ++src; + --size; + break; + } + } + + if (code < 0x1) { + *dest++ = code; + } else { + /* +* Simplified expression for +* (((code - 0x1) >> 10) & 0x3ff) | 0xd800 +*/ + *dest++ = (code >> 10) + 0xd7c0; + *dest++ = (code & 0x3ff) | 0xdc00; + } + } + return dest; +} -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 12/18] efi_selftest: correctly cleanup after selftest
After executing bootefi selftest * restore GD * unlink the load image handle * return 0 or 1 and not a truncated efi_status_t. Signed-off-by: Heinrich Schuchardt --- v3 new patch split off --- cmd/bootefi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 18331536dd..40834f3899 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -349,8 +349,10 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) set_load_options(&loaded_image_info, "efi_selftest"); /* Execute the test */ r = efi_selftest(&loaded_image_info, &systab); + efi_restore_gd(); free(loaded_image_info.load_options); - return r; + list_del(&loaded_image_info_obj.link); + return r != EFI_SUCCESS; } else #endif if (!strcmp(argv[1], "bootmgr")) { -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 14/18] efi_selftest: test reboot by watchdog
A test is added that verifies that the watchdog timer actually causes a reboot upon timeout. The test is only executed on request using setenv efi_selftest watchdog reboot bootefi selftest Signed-off-by: Heinrich Schuchardt --- v3 correct comments v2 no change --- lib/efi_selftest/efi_selftest_watchdog.c | 68 ++-- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/lib/efi_selftest/efi_selftest_watchdog.c b/lib/efi_selftest/efi_selftest_watchdog.c index f8c5404000..e4af38407f 100644 --- a/lib/efi_selftest/efi_selftest_watchdog.c +++ b/lib/efi_selftest/efi_selftest_watchdog.c @@ -5,11 +5,16 @@ * * SPDX-License-Identifier: GPL-2.0+ * - * This unit test checks that the watchdog timer will not cause - * a system restart during the timeout period after a timer reset. + * The 'watchdog timer' unit test checks that the watchdog timer + * will not cause a system restart during the timeout period after + * a timer reset. * - * Testing that the watchdog timer actually will reset the system - * after a timeout is not possible within the used framework. + * The 'watchdog reboot' unit test checks that the watchdog timer + * actually reboots the system after a timeout. The test is only + * executed on explicit request. Use the following commands: + * + * setenv efi_selftest watchdog reboot + * bootefi selftest */ #include @@ -28,6 +33,7 @@ static struct efi_event *event_notify; static struct efi_event *event_wait; static struct efi_boot_services *boottime; static struct notify_context notification_context; +static bool watchdog_reset; /* * Notification function, increments the notfication count if parameter @@ -88,6 +94,34 @@ static int setup(const efi_handle_t handle, return EFI_ST_SUCCESS; } +/* + * Execute the test resetting the watchdog in a timely manner. No reboot occurs. + * + * @handle:handle of the loaded image + * @systable: system table + * @return:EFI_ST_SUCCESS for success + */ +static int setup_timer(const efi_handle_t handle, + const struct efi_system_table *systable) +{ + watchdog_reset = true; + return setup(handle, systable); +} + +/* + * Execute the test without resetting the watchdog. A system reboot occurs. + * + * @handle:handle of the loaded image + * @systable: system table + * @return:EFI_ST_SUCCESS for success + */ +static int setup_reboot(const efi_handle_t handle, + const struct efi_system_table *systable) +{ + watchdog_reset = false; + return setup(handle, systable); +} + /* * Tear down unit test. * @@ -146,11 +180,14 @@ static int execute(void) efi_st_error("Setting watchdog timer failed\n"); return EFI_ST_FAILURE; } - /* Set 600 ms timer */ - ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 600); - if (ret != EFI_SUCCESS) { - efi_st_error("Could not set timer\n"); - return EFI_ST_FAILURE; + if (watchdog_reset) { + /* Set 600 ms timer */ + ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, + 600); + if (ret != EFI_SUCCESS) { + efi_st_error("Could not set timer\n"); + return EFI_ST_FAILURE; + } } /* Set 1350 ms timer */ ret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1350); @@ -176,10 +213,19 @@ static int execute(void) return EFI_ST_SUCCESS; } -EFI_UNIT_TEST(watchdog) = { +EFI_UNIT_TEST(watchdog1) = { .name = "watchdog timer", .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, - .setup = setup, + .setup = setup_timer, + .execute = execute, + .teardown = teardown, +}; + +EFI_UNIT_TEST(watchdog2) = { + .name = "watchdog reboot", + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + .setup = setup_reboot, .execute = execute, .teardown = teardown, + .on_request = true, }; -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 07/18] efi_selftest: provide a dummy device path
Currently we pass bootefi_device_path and bootefi_image_path as device and image path without initializing them. They may carry values from previous calls to bootefi. With the patch the variables are initialized valid dummy values. Signed-off-by: Heinrich Schuchardt --- v3 new patch split off --- cmd/bootefi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 59696f4601..d497381ac3 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -299,6 +299,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) struct efi_loaded_image loaded_image_info = {}; struct efi_object loaded_image_info_obj = {}; + /* Construct a dummy device path. */ + bootefi_device_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, + (uintptr_t)&efi_selftest, + (uintptr_t)&efi_selftest); + bootefi_image_path = efi_dp_from_file(NULL, 0, "\\selftest"); + efi_setup_loaded_image(&loaded_image_info, &loaded_image_info_obj, bootefi_device_path, bootefi_image_path); -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 01/18] efi_loader: move efi_search_obj up in code
To avoid a forward declaration move efi_search_obj before all protocol services functions. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_loader/efi_boottime.c | 41 + 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index f627340de4..30577f717e 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -690,6 +690,27 @@ static efi_status_t EFIAPI efi_check_event(struct efi_event *event) return EFI_EXIT(EFI_INVALID_PARAMETER); } +/* + * Find the internal EFI object for a handle. + * + * @handle handle to find + * @return EFI object + */ +static struct efi_object *efi_search_obj(void *handle) +{ + struct list_head *lhandle; + + list_for_each(lhandle, &efi_obj_list) { + struct efi_object *efiobj; + + efiobj = list_entry(lhandle, struct efi_object, link); + if (efiobj->handle == handle) + return efiobj; + } + + return NULL; +} + /* * Install protocol interface. * @@ -1355,26 +1376,6 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle, panic("EFI application exited"); } -/* - * Find the internal EFI object for a handle. - * - * @handle handle to find - * @return EFI object - */ -static struct efi_object *efi_search_obj(void *handle) -{ - struct list_head *lhandle; - - list_for_each(lhandle, &efi_obj_list) { - struct efi_object *efiobj; - efiobj = list_entry(lhandle, struct efi_object, link); - if (efiobj->handle == handle) - return efiobj; - } - - return NULL; -} - /* * Unload an EFI image. * -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 08/18] efi_selftest: reformat code
Remove superfluous spaces. Signed-off-by: Heinrich Schuchardt --- v3 new patch split off --- lib/efi_selftest/efi_selftest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c index 45d8d3d384..c2c339a7be 100644 --- a/lib/efi_selftest/efi_selftest.c +++ b/lib/efi_selftest/efi_selftest.c @@ -25,8 +25,8 @@ static u16 reset_message[] = L"Selftest completed"; */ void efi_st_exit_boot_services(void) { - unsigned long map_size = 0; - unsigned long map_key; + unsigned long map_size = 0; + unsigned long map_key; unsigned long desc_size; u32 desc_version; efi_status_t ret; -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 06/18] efi_loader: consistently use efi_status_t in bootefi
Where ulong or unsigned long are used to hold an EFI status code we should consistenly use efi_status_t. Signed-off-by: Heinrich Schuchardt --- v3 new patch --- cmd/bootefi.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 18176a1266..6bdbb89c29 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -93,10 +93,10 @@ static void *copy_fdt(void *fdt) return new_fdt; } -static ulong efi_do_enter(void *image_handle, - struct efi_system_table *st, - asmlinkage ulong (*entry)(void *image_handle, - struct efi_system_table *st)) +static efi_status_t efi_do_enter( + void *image_handle, struct efi_system_table *st, + asmlinkage ulong (*entry)(void *image_handle, + struct efi_system_table *st)) { efi_status_t ret = EFI_LOAD_ERROR; @@ -107,7 +107,7 @@ static ulong efi_do_enter(void *image_handle, } #ifdef CONFIG_ARM64 -static unsigned long efi_run_in_el2(asmlinkage ulong (*entry)( +static efi_status_t efi_run_in_el2(asmlinkage ulong (*entry)( void *image_handle, struct efi_system_table *st), void *image_handle, struct efi_system_table *st) { @@ -122,9 +122,9 @@ static unsigned long efi_run_in_el2(asmlinkage ulong (*entry)( * Load an EFI payload into a newly allocated piece of memory, register all * EFI objects it would want to access and jump to it. */ -static unsigned long do_bootefi_exec(void *efi, void *fdt, -struct efi_device_path *device_path, -struct efi_device_path *image_path) +static efi_status_t do_bootefi_exec(void *efi, void *fdt, + struct efi_device_path *device_path, + struct efi_device_path *image_path) { struct efi_loaded_image loaded_image_info = {}; struct efi_object loaded_image_info_obj = {}; @@ -278,7 +278,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *saddr, *sfdt; unsigned long addr, fdt_addr = 0; - unsigned long r; + efi_status_t r; if (argc < 2) return CMD_RET_USAGE; -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 03/18] efi_selftest: provide test for watchdog timer
The test verifies that resetting the watchdog timer ensures that it is not called during the timeout period. Testing that the watchdog timer actually executes a reset would require a test outside the efi_selftest framework. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_selftest/Makefile| 5 +- lib/efi_selftest/efi_selftest_watchdog.c | 185 +++ 2 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 lib/efi_selftest/efi_selftest_watchdog.c diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index e446046e02..3e5c9a6d16 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -21,6 +21,8 @@ CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_util.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_util.o := $(CFLAGS_NON_EFI) +CFLAGS_efi_selftest_watchdog.o := $(CFLAGS_EFI) +CFLAGS_REMOVE_efi_selftest_watchdog.o := $(CFLAGS_NON_EFI) obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \ efi_selftest.o \ @@ -29,4 +31,5 @@ efi_selftest_events.o \ efi_selftest_exitbootservices.o \ efi_selftest_snp.o \ efi_selftest_tpl.o \ -efi_selftest_util.o +efi_selftest_util.o \ +efi_selftest_watchdog.o diff --git a/lib/efi_selftest/efi_selftest_watchdog.c b/lib/efi_selftest/efi_selftest_watchdog.c new file mode 100644 index 00..f8c5404000 --- /dev/null +++ b/lib/efi_selftest/efi_selftest_watchdog.c @@ -0,0 +1,185 @@ +/* + * efi_selftest_watchdog + * + * Copyright (c) 2017 Heinrich Schuchardt + * + * SPDX-License-Identifier: GPL-2.0+ + * + * This unit test checks that the watchdog timer will not cause + * a system restart during the timeout period after a timer reset. + * + * Testing that the watchdog timer actually will reset the system + * after a timeout is not possible within the used framework. + */ + +#include + +/* + * This is the communication structure for the notification function. + */ +struct notify_context { + /* Status code returned when resetting watchdog */ + efi_status_t status; + /* Number of invocations of the notification function */ + unsigned int timer_ticks; +}; + +static struct efi_event *event_notify; +static struct efi_event *event_wait; +static struct efi_boot_services *boottime; +static struct notify_context notification_context; + +/* + * Notification function, increments the notfication count if parameter + * context is provided. + * + * @event notified event + * @contextpointer to the timeout + */ +static void EFIAPI notify(struct efi_event *event, void *context) +{ + struct notify_context *notify_context = context; + efi_status_t ret = EFI_SUCCESS; + + if (!notify_context) + return; + + /* Reset watchdog timer to one second */ + ret = boottime->set_watchdog_timer(1, 0, 0, NULL); + if (ret != EFI_SUCCESS) + notify_context->status = ret; + /* Count number of calls */ + notify_context->timer_ticks++; +} + +/* + * Setup unit test. + * + * Create two timer events. + * One with EVT_NOTIFY_SIGNAL, the other with EVT_NOTIFY_WAIT. + * + * @handle:handle of the loaded image + * @systable: system table + * @return:EFI_ST_SUCCESS for success + */ +static int setup(const efi_handle_t handle, +const struct efi_system_table *systable) +{ + efi_status_t ret; + + boottime = systable->boottime; + + notification_context.status = EFI_SUCCESS; + notification_context.timer_ticks = 0; + ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL, +TPL_CALLBACK, notify, +(void *)¬ification_context, +&event_notify); + if (ret != EFI_SUCCESS) { + efi_st_error("could not create event\n"); + return EFI_ST_FAILURE; + } + ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT, +TPL_CALLBACK, notify, NULL, &event_wait); + if (ret != EFI_SUCCESS) { + efi_st_error("could not create event\n"); + return EFI_ST_FAILURE; + } + return EFI_ST_SUCCESS; +} + +/* + * Tear down unit test. + * + * Close the events created in setup. + * + * @return:EFI_ST_SUCCESS for success + */ +static int teardown(void) +{ + efi_status_t ret; + + /* Set the watchdog timer to the five minute default value */ + ret = boottime->set_watchdog_timer(300, 0, 0, NULL); + if (ret != EFI_SUCCESS) { + efi_st_error("Setting watchdog timer failed\n"); + return EFI_ST_FAILURE; + } + if (event_notify) { + ret = boottime->close_event(event_notify); + event_notify = NULL; + if (ret != EFI_SUCCESS) { + efi_st_error("Could not close event
[U-Boot] [PATCH v3 00/18] efi_loader: implement SetWatchdogTimer
The patch series is centered on implementing the SetWatchdogTimer boottime service. Two tests are supplied. One that checks that resetting the watchdog timer saves from a reboot. The other checks that the watchdog timer actually leads to a reset. Both are covered by Python test cases. A test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.setattribute is supplied. Additional fixes include missing comments and fixing typos. v3: Split patches as suggested by Alex. Add test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.setattribute Heinrich Schuchardt (18): efi_loader: move efi_search_obj up in code efi_loader: implement SetWatchdogTimer efi_selftest: provide test for watchdog timer efi_loader: new function utf8_to_utf16 efi_loader: guard against double inclusion of efi_loader.h efi_loader: consistently use efi_status_t in bootefi efi_selftest: provide a dummy device path efi_selftest: reformat code efi_selftest: efi_st_memcmp should return 0 efi_selftest: deduplicate code efi_selftest: allow to select a single test for exexution efi_selftest: correctly cleanup after selftest efi_loader: use bootargs as load options efi_selftest: test reboot by watchdog test/py: test reboot by EFI watchdog test/py: fix typo in test_efi_loader.py efi_selftest: provide test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL efi_loader: set parent handle in efi_load_image cmd/bootefi.c | 56 ++- include/charset.h | 15 ++ include/efi_loader.h | 11 +- include/efi_selftest.h | 18 +++ lib/charset.c | 57 ++- lib/efi_loader/Makefile| 2 +- lib/efi_loader/efi_boottime.c | 60 lib/efi_loader/efi_watchdog.c | 89 +++ lib/efi_selftest/Makefile | 10 +- lib/efi_selftest/efi_selftest.c| 153 ++- lib/efi_selftest/efi_selftest_console.c| 10 ++ lib/efi_selftest/efi_selftest_textoutput.c | 53 +++ lib/efi_selftest/efi_selftest_util.c | 11 +- lib/efi_selftest/efi_selftest_watchdog.c | 230 + test/py/tests/test_efi_loader.py | 2 +- test/py/tests/test_efi_selftest.py | 14 +- 16 files changed, 711 insertions(+), 80 deletions(-) create mode 100644 lib/efi_loader/efi_watchdog.c create mode 100644 lib/efi_selftest/efi_selftest_textoutput.c create mode 100644 lib/efi_selftest/efi_selftest_watchdog.c -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 02/18] efi_loader: implement SetWatchdogTimer
The watchdog is initialized with a 5 minute timeout period. It can be reset by SetWatchdogTimer. It is stopped by ExitBoottimeServices. Signed-off-by: Heinrich Schuchardt --- v3 add a constant for 1s to 100ns conversion v2 code comments updated --- cmd/bootefi.c | 1 + include/efi_loader.h | 4 ++ lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_boottime.c | 17 ++--- lib/efi_loader/efi_watchdog.c | 89 +++ 5 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 lib/efi_loader/efi_watchdog.c diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 478bc116e2..18176a1266 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -43,6 +43,7 @@ static void efi_init_obj_list(void) #ifdef CONFIG_GENERATE_SMBIOS_TABLE efi_smbios_register(); #endif + efi_watchdog_register(); /* Initialize EFI runtime services */ efi_reset_system_init(); diff --git a/include/efi_loader.h b/include/efi_loader.h index 1b92edbd77..af64b11cee 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -163,6 +163,8 @@ int efi_disk_register(void); int efi_gop_register(void); /* Called by bootefi to make the network interface available */ int efi_net_register(void); +/* Called by bootefi to make the watchdog available */ +int efi_watchdog_register(void); /* Called by bootefi to make SMBIOS tables available */ void efi_smbios_register(void); @@ -171,6 +173,8 @@ efi_fs_from_path(struct efi_device_path *fp); /* Called by networking code to memorize the dhcp ack package */ void efi_net_set_dhcp_ack(void *pkt, int len); +/* Called by efi_set_watchdog_timer to reset the timer */ +efi_status_t efi_set_watchdog(unsigned long timeout); /* Called from places to check whether a timer expired */ void efi_timer_check(void); diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index ddb978f650..83d879b686 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -17,7 +17,7 @@ endif obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o -obj-y += efi_file.o efi_variable.o efi_bootmgr.o +obj-y += efi_file.o efi_variable.o efi_bootmgr.o efi_watchdog.o obj-$(CONFIG_LCD) += efi_gop.o obj-$(CONFIG_DM_VIDEO) += efi_gop.o obj-$(CONFIG_PARTITIONS) += efi_disk.o diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 30577f717e..fd8d15655b 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -155,18 +155,6 @@ void efi_signal_event(struct efi_event *event) event->is_queued = false; } -/* - * Write a debug message for an EPI API service that is not implemented yet. - * - * @funcname function that is not yet implemented - * @return EFI_UNSUPPORTED - */ -static efi_status_t efi_unsupported(const char *funcname) -{ - debug("EFI: App called into unimplemented function %s\n", funcname); - return EFI_EXIT(EFI_UNSUPPORTED); -} - /* * Raise the task priority level. * @@ -1454,6 +1442,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(void *image_handle, bootm_disable_interrupts(); /* Give the payload some time to boot */ + efi_set_watchdog(0); WATCHDOG_RESET(); return EFI_EXIT(EFI_SUCCESS); @@ -1497,7 +1486,7 @@ static efi_status_t EFIAPI efi_stall(unsigned long microseconds) /* * Reset the watchdog timer. * - * This function implements the WatchdogTimer service. + * This function implements the SetWatchdogTimer service. * See the Unified Extensible Firmware Interface (UEFI) specification * for details. * @@ -1514,7 +1503,7 @@ static efi_status_t EFIAPI efi_set_watchdog_timer(unsigned long timeout, { EFI_ENTRY("%ld, 0x%"PRIx64", %ld, %p", timeout, watchdog_code, data_size, watchdog_data); - return efi_unsupported(__func__); + return EFI_EXIT(efi_set_watchdog(timeout)); } /* diff --git a/lib/efi_loader/efi_watchdog.c b/lib/efi_loader/efi_watchdog.c new file mode 100644 index 00..35a45dedf8 --- /dev/null +++ b/lib/efi_loader/efi_watchdog.c @@ -0,0 +1,89 @@ +/* + * EFI watchdog + * + * Copyright (c) 2017 Heinrich Schuchardt + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +/* Conversion factor from seconds to multiples of 100ns */ +#define EFI_SECONDS_TO_100NS 1000ULL + +static struct efi_event *watchdog_timer_event; + +/* + * Reset the system when the watchdog event is notified. + * + * @event: the watchdog event + * @context: not used + */ +static void EFIAPI efi_watchdog_timer_notify(struct efi_event *event, +void *context) +{ + EFI_ENTRY("%p, %p", event, context); + + printf("\nEFI: Watchdog timeout\n"); + EFI_CALL_VOID(efi_runtime_services.reset_system(EFI_RESET_
Re: [U-Boot] [PATCH u-boot 3/3] arm: add initial support for Amlogic P212 based on Meson GXL family
On Thu, Oct 12, 2017 at 03:50:32PM +0200, Neil Armstrong wrote: > This adds platform code for the Amlogic P212 reference board based on a > Meson GXL (S905X) SoC with the Meson GXL configuration. > > This initial submission only supports UART and MMC/SDCard, support for the > internal Ethernet PHY in Work In Progress. > > Signed-off-by: Neil Armstrong Reviewed-by: Beniamino Galvani ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 2/3] pinctrl: meson: Add GXL Support
On Thu, Oct 12, 2017 at 03:50:31PM +0200, Neil Armstrong wrote: > Add the Amlogic Meson GXL pinctrl support based on the GXBB driver and > the synchronized DTS from Linux 4.13.5 > > Signed-off-by: Neil Armstrong Reviewed-by: Beniamino Galvani ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 1/3] ARM: dts: Synchronize Amlogic from Linux Mainline 4.13.5
On Thu, Oct 12, 2017 at 03:50:30PM +0200, Neil Armstrong wrote: > Synchronize the Amlogic ARM64 dts from mainline Linux 4.13.5 > > In the preparation of the support of the Amlogic P212 board, > import the corresponding meson-gxl-s905x-p212.dts file. > > Signed-off-by: Neil Armstrong Reviewed-by: Beniamino Galvani ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 6/9] efi_selftest: allow to select a single test for exexution
On 10/17/2017 09:48 AM, Alexander Graf wrote: > > > On 13.10.17 19:33, Heinrich Schuchardt wrote: >> Environment variable efi_selftest is passed as load options >> to the selftest application. It is used to select a single >> test to be executed. >> >> Special value 'list' displays a list of all available tests. >> >> Tests get an on_request property. If this property is set >> the tests are only executed if explicitly requested. >> >> The invocation of efi_selftest is changed to reflect that >> bootefi selftest with efi_selftest = 'list' will call the >> Exit bootservice. >> >> Environment variable bootargs is used as load options >> for all other bootefi payloads. >> >> Signed-off-by: Heinrich Schuchardt >> --- >> v2 >> use an environment variable to choose a test >> --- >> cmd/bootefi.c | 46 - >> include/efi_selftest.h | 18 +++ >> lib/efi_selftest/efi_selftest.c | 90 >> +++-- >> lib/efi_selftest/efi_selftest_console.c | 10 >> lib/efi_selftest/efi_selftest_util.c| 11 +++- >> 5 files changed, 168 insertions(+), 7 deletions(-) >> >> diff --git a/cmd/bootefi.c b/cmd/bootefi.c >> index 18176a1266..2d70137482 100644 >> --- a/cmd/bootefi.c >> +++ b/cmd/bootefi.c >> @@ -6,10 +6,12 @@ >> * SPDX-License-Identifier: GPL-2.0+ >> */ >> >> +#include >> #include >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -50,6 +52,32 @@ static void efi_init_obj_list(void) >> efi_get_time_init(); >> } >> >> +/* >> + * Set the load options of an image from an environment variable. >> + * >> + * @loaded_image_info: the image >> + * @env_var:name of the environment variable >> + */ >> +static void set_load_options(struct efi_loaded_image *loaded_image_info, >> + const char *env_var) >> +{ >> +size_t size; >> +const char *env = env_get(env_var); >> + >> +loaded_image_info->load_options = NULL; >> +loaded_image_info->load_options_size = 0; >> +if (!env) >> +return; >> +size = strlen(env) + 1; >> +loaded_image_info->load_options = calloc(size, sizeof(u16)); >> +if (!loaded_image_info->load_options) { >> +printf("ERROR: Out of memory\n"); >> +return; >> +} >> +utf8_to_utf16(loaded_image_info->load_options, (u8 *)env, size); >> +loaded_image_info->load_options_size = size * 2; >> +} >> + >> static void *copy_fdt(void *fdt) >> { >> u64 fdt_size = fdt_totalsize(fdt); >> @@ -190,6 +218,8 @@ static unsigned long do_bootefi_exec(void *efi, void >> *fdt, >> efi_install_configuration_table(&fdt_guid, NULL); >> } >> >> +/* Transfer environment variable bootargs as load options */ >> +set_load_options(&loaded_image_info, "bootargs"); > > While I really want to see that change, please try not to sneak it in > with the selftest one :). > > Just split that hunk out to a following patch and give it its own patch > description. In case something goes wrong, we'd only need to revert a > small patch then. > >> /* Load the EFI payload */ >> entry = efi_load_pe(efi, &loaded_image_info); >> if (!entry) { >> @@ -237,6 +267,7 @@ static unsigned long do_bootefi_exec(void *efi, void >> *fdt, >> >> exit: >> /* image has returned, loaded-image obj goes *poof*: */ >> +free(loaded_image_info.load_options); > > This too is a change that doesn't fit the patch description? > >> list_del(&loaded_image_info_obj.link); >> >> return ret; >> @@ -301,17 +332,26 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int >> argc, char * const argv[]) >> >> efi_setup_loaded_image(&loaded_image_info, >> &loaded_image_info_obj, >> - bootefi_device_path, bootefi_image_path); >> + NULL, NULL); > > Why? > >> /* >> * gd lives in a fixed register which may get clobbered while we >> * execute the payload. So save it here and restore it on every >> * callback entry >> */ >> efi_save_gd(); >> +loaded_image_info.image_code_type = EFI_LOADER_CODE; >> +loaded_image_info.image_data_type = EFI_LOADER_DATA; > > Also unrelated? Please split it out. > >> /* Initialize and populate EFI object list */ >> if (!efi_obj_list_initalized) >> efi_init_obj_list(); >> -return efi_selftest(&loaded_image_info, &systab); >> +/* Transfer environment variable efi_selftest as load options */ >> +set_load_options(&loaded_image_info, "efi_selftest"); >> +/* Execute the test */ >> +r = efi_selftest(&loaded_image_info, &systab); >> +efi_restore_gd(); >> +free(loa
Re: [U-Boot] [PATCH v1] Document padding between GPT header and partition entries
> On 17 Oct 2017, at 19:55, Stefan Brüns wrote: > > Commit 02e43537b322 ("part_efi: support padding between the GPT > header and partition entries") added support for deviating from > the typical GPT layout. > > Explicitly state deviations are allowed/possible, and mention when > (SoC SPL) and when not (compatibility) deviations are useful. Also > mention support for non-standard layouts in gdisk 1.0.3. There is nothing in the GPT specification that mandates that the partition entries are to follow immediately after the header and it is even assumed that this does not have to be the case (i.e. the address needs to be computed from the info in the header). So I object to the “non-standard”. > > Signed-off-by: Stefan Brüns Reviewed-by: Philipp Tomsich > > --- > > doc/README.gpt | 33 + > 1 file changed, 29 insertions(+), 4 deletions(-) > > diff --git a/doc/README.gpt b/doc/README.gpt > index d3db8bce1c..7134f3b3cf 100644 > --- a/doc/README.gpt > +++ b/doc/README.gpt > @@ -44,8 +44,8 @@ uuid command line tool). > GPT brief explanation: > == > > - Layout: > - --- > + Default layout: > + --- > > -- > LBA 0 |Protective MBR | > @@ -82,7 +82,29 @@ For a legacy reasons, GPT's LBA 0 sector has a MBR > structure. It is called > Its first partition entry ID has 0xEE value, and disk software, which is not > handling the GPT sees it as a storage device without free space. > > -It is possible to define 128 linearly placed partition entries. > +By default, the first partition entry of the primary GPT is stored in LBA 2, The “default" is merely the most compact representation (i.e. tries to waste no space). I would not even call this “default” (it is a common behaviour found “in the wild”, but in no way a “default”). > +although this is not explicitly mandated by the UEFI specification. The > +start LBAs of the partition entries are given in the corresponding GPT > +headers (Primary/Backup) (offset 72 bytes). > + > +The UEFI specification mandates at least 128 contigously stored partition > +entries, the number is specified in the GPT headers (offset 80). > + > +As several SoCs require the SPL to be located at a fixed position, often > +below LBA 34 (17 kByte for 512 byte blocks), it is possible to deviate > +from the standard layout: > + > +1. Lower the number of partition entries. This violates the UEFI/GPT > + specification, but usually works. If you deviate from the UEFI/GPT specification, then you don’t have a GPT partition table. So this is not a permissible change and thus should not be listed here. > +2. Insert a gap between Primary GPT Header and partition entries. This > + is in line with the specification, but may cause problems with tools > + or operating systems hardcoding the partition entries LBA to 2. In which the operating systems do not support GPT partitions (but something that is close enough to work, as long as the stars are aligned just right) and there is no reason not to break compatibility against these. > + > +There is limited support for both variants in U-Boot - reading is fully > +supported, while the "gpt write" command always creates a GPT with 128 > +entries. A gap is created when CONFIG_EFI_PARTITION_ENTRIES_OFF is set > +or when the device tree "/config" node contains a property > +"u-boot,efi-partition-entries-offset". > > "LBA -1" means the last addressable block (in the mmc subsystem: > "dev_desc->lba - 1") > @@ -103,7 +125,7 @@ Offset SizeDescription > LBA + 1) > 48 8 B Last usable LBA (secondary partition table first LBA - 1) > 56 16 BDisk GUID (also referred as UUID on UNIXes) > -72 8 B Partition entries starting LBA (always 2 in primary copy) > +72 8 B Partition entries starting LBA (usually 2 in primary copy) > 80 4 B Number of partition entries > 84 4 B Size of a partition entry (usually 128) > 88 4 B CRC32 of partition array > @@ -283,6 +305,9 @@ Two programs, namely: 'gdisk' and 'parted' are > recommended to work with GPT > recovery. Both are able to handle GUID partitions. > Please, pay attention at -l switch for parted. > > +'gdisk' as of version 1.0.3 is able to create tables with a number of > partition > +entries different to 128, and insert padding after the GPT header. > + > "uuid" program is recommended to generate UUID string. Moreover it can decode > (-d switch) passed in UUID string. It can be used to generate partitions UUID > passed to u-boot environment variables. > -- > 2.14.2 > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 3/4] pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile
Masahiro, On Mon, Oct 16, 2017 at 11:42 PM, Masahiro Yamada wrote: > The pylibfdt is used by dtoc (and, indirectly by binman), but there > is no reason why it must be generated in the tools/ directory. > > Recently, U-Boot switched over to the bundled DTC, and the directory > structure under scripts/dtc/ now mirrors the upstream DTC project. > So, scripts/dtc/pylibfdt is the best location. > > I also rewrote the Makefile in a cleaner Kbuild style. > > The scripts from the upstream have been moved as follows: > > lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py > lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped > > The .i_shipped is coped to .i during building because the .i must be > located in the objtree when we build it out of tree. > > Signed-off-by: Masahiro Yamada > --- > > Makefile | 2 +- > scripts/Makefile.spl | 4 +-- > scripts/dtc/Makefile | 3 +++ > scripts/dtc/pylibfdt/.gitignore| 4 +++ > scripts/dtc/pylibfdt/Makefile | 30 > ++ > .../dtc/pylibfdt/libfdt.i_shipped | 0 > {lib/libfdt => scripts/dtc}/pylibfdt/setup.py | 0 > tools/.gitignore | 4 --- > tools/Makefile | 30 > -- > tools/binman/binman.py | 2 +- > 10 files changed, 41 insertions(+), 38 deletions(-) > create mode 100644 scripts/dtc/pylibfdt/.gitignore > create mode 100644 scripts/dtc/pylibfdt/Makefile > rename lib/libfdt/pylibfdt/libfdt.i => scripts/dtc/pylibfdt/libfdt.i_shipped > (100%) > rename {lib/libfdt => scripts/dtc}/pylibfdt/setup.py (100%) > > diff --git a/Makefile b/Makefile > index d074358..40cd61a 100644 > --- a/Makefile > +++ b/Makefile > @@ -1380,7 +1380,7 @@ $(timestamp_h): $(srctree)/Makefile FORCE > $(call filechk,timestamp.h) > > checkbinman: tools > - @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \ > + @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt > $(PYTHON) )); then \ > echo >&2; \ > echo >&2 '*** binman needs the Python libfdt library.'; \ > echo >&2 '*** Either install it on your system, or try:'; \ > diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl > index 49b27ac..065bb25 100644 > --- a/scripts/Makefile.spl > +++ b/scripts/Makefile.spl > @@ -257,7 +257,7 @@ quiet_cmd_fdtgrep = FDTGREP $@ > $(obj)/$(SPL_BIN).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE > $(call if_changed,fdtgrep) > > -pythonpath = PYTHONPATH=tools > +pythonpath = PYTHONPATH=scripts/dtc/pylibfdt > > quiet_cmd_dtocc = DTOC C $@ > cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d > $(obj)/$(SPL_BIN).dtb -o $@ platdata > @@ -381,7 +381,7 @@ ifneq ($(cmd_files),) > endif > > checkdtoc: tools > - @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \ > + @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt > $(PYTHON) )); then \ > echo '*** dtoc needs the Python libfdt library. Either '; \ > echo '*** install it on your system, or try:'; \ > echo '***'; \ > diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile > index 2a48022..f4a16ed 100644 > --- a/scripts/dtc/Makefile > +++ b/scripts/dtc/Makefile > @@ -29,3 +29,6 @@ $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h > > # generated files need to be cleaned explicitly > clean-files:= dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h > + > +# Added for U-Boot > +subdir-y += pylibfdt > diff --git a/scripts/dtc/pylibfdt/.gitignore b/scripts/dtc/pylibfdt/.gitignore > new file mode 100644 > index 000..033f23d > --- /dev/null > +++ b/scripts/dtc/pylibfdt/.gitignore > @@ -0,0 +1,4 @@ > +/_libfdt.so > +/libfdt.py > +/libfdt.pyc > +/libfdt_wrap.c > diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile > new file mode 100644 > index 000..01d5e0f > --- /dev/null > +++ b/scripts/dtc/pylibfdt/Makefile > @@ -0,0 +1,30 @@ > +# Unfortunately setup.py below cannot handle srctree being ".." which it > often > +# is. It fails with an error like: > +# Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o: > +#No such file or directory > +# To fix this, use an absolute path. > +LIBFDT_srcdir = $(abspath $(srctree)/$(src)/../libfdt) > + > +include $(LIBFDT_srcdir)/Makefile.libfdt > + > +# Unfortunately setup.py (or actually the Python distutil implementation) > puts > +# files into the same directory as the .i file. We cannot touch the source > +# directory, so we "ship" .i file into the objtree. > +PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \ > + $(obj)/libfdt.i > + > +quiet_cmd_pymod = PYMOD $@ > + cmd_pymod = unset CC; unset CROSS_CO
Re: [U-Boot] libfdt: give setup.py optional interpreter
Tom, On Tue, Oct 17, 2017 at 12:46 PM, Matthew Weber wrote: > Tom, > > On Mon, Oct 16, 2017 at 8:46 PM, Tom Rini wrote: >> On Mon, Oct 16, 2017 at 08:48:16PM -0400, Tom Rini wrote: >>> On Thu, Oct 12, 2017 at 09:32:41PM -0500, Matt Weber wrote: >>> >>> > If building in a sandboxed environment where a >>> > alternate python interpreter is desired. Allow >>> > configuring of the PYTHON variable to specify >>> > the interpreter to invoke setup.py. >>> > >>> > Signed-off-by: Matthew Weber >>> >>> Applied to u-boot/master, thanks! >> >> No, no it wasn't, bad me for not cleaning that out of my bundle after >> noticing it wasn't applicable and skipping it. >> >> -- > > Should I send in a patch for the swig check update? > Just noticed the recent patches. Disregard, I'll checkout the updated behavior. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] libfdt: give setup.py optional interpreter
Tom, On Mon, Oct 16, 2017 at 8:46 PM, Tom Rini wrote: > On Mon, Oct 16, 2017 at 08:48:16PM -0400, Tom Rini wrote: >> On Thu, Oct 12, 2017 at 09:32:41PM -0500, Matt Weber wrote: >> >> > If building in a sandboxed environment where a >> > alternate python interpreter is desired. Allow >> > configuring of the PYTHON variable to specify >> > the interpreter to invoke setup.py. >> > >> > Signed-off-by: Matthew Weber >> >> Applied to u-boot/master, thanks! > > No, no it wasn't, bad me for not cleaning that out of my bundle after > noticing it wasn't applicable and skipping it. > > -- Should I send in a patch for the swig check update? Matt ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] efi_loader: use named constant for memory type
On Tue, Oct 17, 2017 at 12:53 PM, Heinrich Schuchardt wrote: > When we call an EFI image from memory a memory device path > is created. The memory type should use a named constant. > > Fixes: bf19273e81e efi_loader: Add mem-mapped for fallback > Signed-off-by: Heinrich Schuchardt > --- > cmd/bootefi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > index b2f6fd486a..140072f044 100644 > --- a/cmd/bootefi.c > +++ b/cmd/bootefi.c > @@ -173,7 +173,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt, > if (!device_path && !image_path) { > printf("WARNING: using memory device/image path, this may > confuse some payloads!\n"); > /* actual addresses filled in after efi_load_pe() */ > - memdp = efi_dp_from_mem(0, 0, 0); > + memdp = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, 0, 0); Note that I actually used '0' because this is a special case where the real memtype is filled in later. And the real mem_type is going to be one of EFI_LOADER_CODE / EFI_BOOT_SERVICES_CODE / EFI_RUNTIME_SERVICES_CODE depending on type of .efi that is loaded. So using EFI_RESERVED_MEMORY_TYPE makes things more confusing. So I think it should stay '0'.. (or maybe '-1' would be more clear, except that it is an unsigned arg) BR, -R > device_path = image_path = memdp; > } else { > assert(device_path && image_path); > -- > 2.14.2 > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/1] efi_loader: use named constant for memory type
When we call an EFI image from memory a memory device path is created. The memory type should use a named constant. Fixes: bf19273e81e efi_loader: Add mem-mapped for fallback Signed-off-by: Heinrich Schuchardt --- cmd/bootefi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index b2f6fd486a..140072f044 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -173,7 +173,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt, if (!device_path && !image_path) { printf("WARNING: using memory device/image path, this may confuse some payloads!\n"); /* actual addresses filled in after efi_load_pe() */ - memdp = efi_dp_from_mem(0, 0, 0); + memdp = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, 0, 0); device_path = image_path = memdp; } else { assert(device_path && image_path); -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] powerpc: mpc85xx: Implement CPU erratum A-007907 for secondary cores
Commit 06ad970b53a3 ("powerpc: mpc85xx: Implemente workaround for CPU erratum A-007907") clears L1CSR2 for the boot core, but other cores don't run through the workaround. Add similar code for secondary cores to clear DCSTASHID field in L1CSR2 register. Signed-off-by: York Sun --- arch/powerpc/cpu/mpc85xx/release.S | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/cpu/mpc85xx/release.S b/arch/powerpc/cpu/mpc85xx/release.S index 0e0daf5..e1f1208 100644 --- a/arch/powerpc/cpu/mpc85xx/release.S +++ b/arch/powerpc/cpu/mpc85xx/release.S @@ -184,12 +184,18 @@ __secondary_start_page: mtspr SPRN_PIR,r4 /* write to PIR register */ +#ifdef CONFIG_SYS_FSL_ERRATUM_A007907 + mfspr r8, L1CSR2 + clrrwi r8, r8, 10 /* clear bit [54-63] DCSTASHID */ + mtspr L1CSR2, r8 +#else #ifdef CONFIG_SYS_CACHE_STASHING /* set stash id to (coreID) * 2 + 32 + L1 CT (0) */ slwir8,r4,1 addir8,r8,32 mtspr L1CSR2,r8 #endif +#endif /* CONFIG_SYS_FSL_ERRATUM_A007907 */ #if defined(CONFIG_SYS_P4080_ERRATUM_CPU22) || \ defined(CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011) -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] rtc: mc146818: Correct alarm message for day alarm
RTC_CONFIG_D register contains the day within the month to generate an alarm, not the month. This corrects the printf to indicate it. Signed-off-by: Bin Meng --- drivers/rtc/mc146818.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/mc146818.c b/drivers/rtc/mc146818.c index 4df9eda..21705c8 100644 --- a/drivers/rtc/mc146818.c +++ b/drivers/rtc/mc146818.c @@ -100,7 +100,7 @@ static int mc146818_get(struct rtc_time *tmp) #ifdef RTC_DEBUG printf("Get RTC year: %02x mon/cent: %02x mday: %02x wday: %02x hr: %02x min: %02x sec: %02x\n", year, mon, mday, wday, hour, min, sec); - printf("Alarms: month: %02x hour: %02x min: %02x sec: %02x\n", + printf("Alarms: mday: %02x hour: %02x min: %02x sec: %02x\n", mc146818_read8(RTC_CONFIG_D) & 0x3f, mc146818_read8(RTC_HOURS_ALARM), mc146818_read8(RTC_MINUTES_ALARM), -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] mtd: replace MTDDEBUG() with pr_debug()
In old days, the MTD subsystem in Linux had debug facility like DEBUG(MTD_DEBUG_LEVEL1, ...). They were all replaced with pr_debug() until Linux 3.2. See Linux commit 289c05222172 ("mtd: replace DEBUG() with pr_debug()"). U-Boot still uses similar macros. Covert all of them for easier sync. Done with the help of Coccinelle. The semantic patch I used is as follows: // @@ expression e1, e2; @@ -MTDDEBUG(e1, e2) +pr_debug(e2) @@ expression e1, e2; @@ -MTDDEBUG(e1, e2, +pr_debug(e2, ...) // Signed-off-by: Masahiro Yamada --- drivers/mtd/nand/atmel_nand.c | 7 +++--- drivers/mtd/nand/davinci_nand.c| 7 +++--- drivers/mtd/nand/mxc_nand.c| 49 -- drivers/mtd/nand/nand_bch.c| 4 ++-- drivers/mtd/onenand/onenand_base.c | 38 +++-- drivers/mtd/onenand/onenand_bbt.c | 5 ++-- 6 files changed, 51 insertions(+), 59 deletions(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 7c10bfe..65dd83e 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -702,7 +702,7 @@ static int pmecc_choose_ecc(struct atmel_nand_host *host, if (chip->onfi_version) { *cap = chip->ecc_strength_ds; *sector_size = chip->ecc_step_ds; - MTDDEBUG(MTD_DEBUG_LEVEL1, "ONFI params, minimum required ECC: %d bits in %d bytes\n", + pr_debug("ONFI params, minimum required ECC: %d bits in %d bytes\n", *cap, *sector_size); } @@ -863,9 +863,8 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand, host->pmecc_index_table_offset = ATMEL_PMECC_INDEX_OFFSET_1024; #endif - MTDDEBUG(MTD_DEBUG_LEVEL1, - "Initialize PMECC params, cap: %d, sector: %d\n", - cap, sector_size); + pr_debug("Initialize PMECC params, cap: %d, sector: %d\n", +cap, sector_size); host->pmecc = (struct pmecc_regs __iomem *) ATMEL_BASE_PMECC; host->pmerrloc = (struct pmecc_errloc_regs __iomem *) diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c index 0624644..2a01fd3 100644 --- a/drivers/mtd/nand/davinci_nand.c +++ b/drivers/mtd/nand/davinci_nand.c @@ -238,7 +238,7 @@ static int nand_davinci_correct_data(struct mtd_info *mtd, u_char *dat, uint32_t find_byte = diff >> (12 + 3); dat[find_byte] ^= find_bit; - MTDDEBUG(MTD_DEBUG_LEVEL0, "Correcting single " + pr_debug("Correcting single " "bit ECC error at offset: %d, bit: " "%d\n", find_byte, find_bit); return 1; @@ -248,12 +248,11 @@ static int nand_davinci_correct_data(struct mtd_info *mtd, u_char *dat, } else if (!(diff & (diff - 1))) { /* Single bit ECC error in the ECC itself, nothing to fix */ - MTDDEBUG(MTD_DEBUG_LEVEL0, "Single bit ECC error in " -"ECC.\n"); + pr_debug("Single bit ECC error in " "ECC.\n"); return 1; } else { /* Uncorrectable error */ - MTDDEBUG(MTD_DEBUG_LEVEL0, "ECC UNCORRECTED_ERROR 1\n"); + pr_debug("ECC UNCORRECTED_ERROR 1\n"); return -EBADMSG; } } diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 7221d0b..764391c 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -132,7 +132,7 @@ static void wait_op_done(struct mxc_nand_host *host, int max_retries, udelay(1); } if (max_retries < 0) { - MTDDEBUG(MTD_DEBUG_LEVEL0, "%s(%d): INT not set\n", + pr_debug("%s(%d): INT not set\n", __func__, param); } } @@ -143,7 +143,7 @@ static void wait_op_done(struct mxc_nand_host *host, int max_retries, */ static void send_cmd(struct mxc_nand_host *host, uint16_t cmd) { - MTDDEBUG(MTD_DEBUG_LEVEL3, "send_cmd(host, 0x%x)\n", cmd); + pr_debug("send_cmd(host, 0x%x)\n", cmd); writenfc(cmd, &host->regs->flash_cmd); writenfc(NFC_CMD, &host->regs->operation); @@ -159,7 +159,7 @@ static void send_cmd(struct mxc_nand_host *host, uint16_t cmd) */ static void send_addr(struct mxc_nand_host *host, uint16_t addr) { - MTDDEBUG(MTD_DEBUG_LEVEL3, "send_addr(host, 0x%x)\n", addr); + pr_debug("send_addr(host, 0x%x)\n", addr); writenfc(addr, &host->regs->flash_addr); writenfc(NFC_ADDR, &host->regs->operation); @@ -176,7 +176,7 @@ static void send_prog_page(struct mxc_nand_host *host, uint8_t buf_id,
[U-Boot] [PATCH 2/2] mtd: remove MTDDEBUG() and CONFIG_MTD_DEBUG
All users of this macro have been converted. Remove MTDDEBUG and related CONFIG options. ubifs_dbg_msg_key() is kept. It is silent unless DEBUG is defined. I am not touching scripts/config_whitelist.txt. The deprecated options will be dropped by the next resync. Signed-off-by: Masahiro Yamada --- fs/ubifs/debug.h | 7 --- include/configs/woodburn_common.h | 4 include/linux/mtd/mtd.h | 24 3 files changed, 35 deletions(-) diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 807ce1b..9814083 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h @@ -187,19 +187,12 @@ struct ubifs_global_debug_info { ##__VA_ARGS__) #define DBG_KEY_BUF_LEN 48 -#if defined CONFIG_MTD_DEBUG #define ubifs_dbg_msg_key(type, key, fmt, ...) do { \ char __tmp_key_buf[DBG_KEY_BUF_LEN]; \ pr_debug("UBIFS DBG " type ": " fmt "%s\n",\ ##__VA_ARGS__,\ dbg_snprintf_key(c, key, __tmp_key_buf, DBG_KEY_BUF_LEN));\ } while (0) -#else -#define ubifs_dbg_msg_key(type, key, fmt, ...) do { \ - pr_debug("UBIFS DBG\n"); \ -} while (0) - -#endif #endif diff --git a/include/configs/woodburn_common.h b/include/configs/woodburn_common.h index 7c08f0f..c07fb57 100644 --- a/include/configs/woodburn_common.h +++ b/include/configs/woodburn_common.h @@ -179,10 +179,6 @@ #define CONFIG_MXC_NAND_HWECC #define CONFIG_SYS_NAND_LARGEPAGE -#if 0 -#define CONFIG_MTD_DEBUG -#define CONFIG_MTD_DEBUG_VERBOSE 7 -#endif #define CONFIG_SYS_NAND_ONFI_DETECTION /* diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 3e1694b..4bde251 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -442,30 +442,6 @@ static inline void mtd_erase_callback(struct erase_info *instr) } #endif -#ifdef __UBOOT__ -/* - * Debugging macro and defines - */ -#define MTD_DEBUG_LEVEL0 (0) /* Quiet */ -#define MTD_DEBUG_LEVEL1 (1) /* Audible */ -#define MTD_DEBUG_LEVEL2 (2) /* Loud*/ -#define MTD_DEBUG_LEVEL3 (3) /* Noisy */ - -#ifdef CONFIG_MTD_DEBUG -#define MTDDEBUG(n, args...) \ - do {\ - if (n <= CONFIG_MTD_DEBUG_VERBOSE) \ - printk(KERN_INFO args); \ - } while(0) -#else /* CONFIG_MTD_DEBUG */ -#define MTDDEBUG(n, args...) \ - do {\ - if (0) \ - printk(KERN_INFO args); \ - } while(0) -#endif /* CONFIG_MTD_DEBUG */ -#endif - static inline int mtd_is_bitflip(int err) { return err == -EUCLEAN; } -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] DW SPI: Get clock value from Device Tree
On Tue, Oct 17, 2017 at 8:27 PM, Alexey Brodkin wrote: > Hi Jagan, > >> -Original Message- >> From: Eugeniy Paltsev [mailto:palt...@synopsys.com] >> Sent: Tuesday, October 17, 2017 4:33 PM >> To: jagannadh.t...@gmail.com >> Cc: u-boot@lists.denx.de; uboot-snps-...@synopsys.com >> Subject: [uboot-snps-arc] Re: [PATCH v2] DW SPI: Get clock value from Device >> Tree >> > >> > How hard it is to make others to use clock manager? do you have any list? >> >> clock_manager.h is an old (and non-generic) way to deal with different >> clocks. >> For example in SOCFPGA_GEN5 and SOCFPGA_ARRIA10 clock_manager.h provides >> cm_get_spi_controller_clk_hz function to deal with spi controller clock. >> >> But today we have another, linux-like alternative: to bind clocks via device >> tree >> and manipulate with clocks via generic functions provided by clk.h >> >> In this patch I added option to get clock via device tree using standard >> bindings >> and restrict clock_manager.h functions usage only to targets which still use >> it, >> so new targets can simply bind clock via device tree and they do not need to >> implement/define something in clock_manager.h >> >> So we don't need to make others to use clock manager :) > > Maybe it worth trying the other way around and think about switching SOCFPGA > platforms to > generic clk framework? Yes, ie what exactly I thought of, thanks! -- Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] DW SPI: Get clock value from Device Tree
On 10/17/2017 04:57 PM, Alexey Brodkin wrote: > Hi Jagan, > >> -Original Message- >> From: Eugeniy Paltsev [mailto:palt...@synopsys.com] >> Sent: Tuesday, October 17, 2017 4:33 PM >> To: jagannadh.t...@gmail.com >> Cc: u-boot@lists.denx.de; uboot-snps-...@synopsys.com >> Subject: [uboot-snps-arc] Re: [PATCH v2] DW SPI: Get clock value from Device >> Tree >>> >>> How hard it is to make others to use clock manager? do you have any list? >> >> clock_manager.h is an old (and non-generic) way to deal with different >> clocks. >> For example in SOCFPGA_GEN5 and SOCFPGA_ARRIA10 clock_manager.h provides >> cm_get_spi_controller_clk_hz function to deal with spi controller clock. >> >> But today we have another, linux-like alternative: to bind clocks via device >> tree >> and manipulate with clocks via generic functions provided by clk.h >> >> In this patch I added option to get clock via device tree using standard >> bindings >> and restrict clock_manager.h functions usage only to targets which still use >> it, >> so new targets can simply bind clock via device tree and they do not need to >> implement/define something in clock_manager.h >> >> So we don't need to make others to use clock manager :) > > Maybe it worth trying the other way around and think about switching SOCFPGA > platforms to > generic clk framework? That'd be real neat. > Marek, any plans for that? Patches welcome, +CC Dinh. > -Alexey > -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] DW SPI: Get clock value from Device Tree
Hi Jagan, > -Original Message- > From: Eugeniy Paltsev [mailto:palt...@synopsys.com] > Sent: Tuesday, October 17, 2017 4:33 PM > To: jagannadh.t...@gmail.com > Cc: u-boot@lists.denx.de; uboot-snps-...@synopsys.com > Subject: [uboot-snps-arc] Re: [PATCH v2] DW SPI: Get clock value from Device > Tree > > > > How hard it is to make others to use clock manager? do you have any list? > > clock_manager.h is an old (and non-generic) way to deal with different clocks. > For example in SOCFPGA_GEN5 and SOCFPGA_ARRIA10 clock_manager.h provides > cm_get_spi_controller_clk_hz function to deal with spi controller clock. > > But today we have another, linux-like alternative: to bind clocks via device > tree > and manipulate with clocks via generic functions provided by clk.h > > In this patch I added option to get clock via device tree using standard > bindings > and restrict clock_manager.h functions usage only to targets which still use > it, > so new targets can simply bind clock via device tree and they do not need to > implement/define something in clock_manager.h > > So we don't need to make others to use clock manager :) Maybe it worth trying the other way around and think about switching SOCFPGA platforms to generic clk framework? Marek, any plans for that? -Alexey ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Please pull from u-boot-i2c
Hello Tom, please pull from u-boot-i2c master The following changes since commit eb0044db392247aa1c43e29f2703418d5668018a: Prepare v2017.11-rc2 (2017-10-16 21:40:56 -0400) are available in the git repository at: git://git.denx.de/u-boot-i2c.git master for you to fetch changes up to d10bd6cfd85c2a9f27c950e22e83d27ff978e7e8: i2c: stm32f7_i2c: fix usage of useless local variable (2017-10-17 11:28:41 +0200) Christophe Kerello (1): i2c: stm32f7_i2c: fix data abort Masahiro Yamada (1): i2c: remove DECLARE_GLOBAL_DATA_PTR from i2c-uclass Patrice Chotard (1): i2c: stm32f7_i2c: fix usage of useless local variable drivers/i2c/i2c-uclass.c | 2 -- drivers/i2c/stm32f7_i2c.c | 17 ++--- 2 files changed, 6 insertions(+), 13 deletions(-) Tree build fine on travis: https://travis-ci.org/hsdenx/u-boot-i2c/builds/288957319 bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: h...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 2/2] i2c: stm32f7_i2c: fix usage of useless local variable
Hello Patrice, Am 17.10.2017 um 11:21 schrieb patrice.chot...@st.com: From: Patrice Chotard Remove useless local variable "s" and use directly function's parameter "output" Signed-off-by: Patrice Chotard --- v2: rebase on top of v2017.11-rc2 Thanks! Applied to u-boot-i2c.git bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: h...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/2] i2c: stm32f7_i2c: fix data abort
Hello Patrice, Am 17.10.2017 um 11:21 schrieb patrice.chot...@st.com: From: Christophe Kerello As "v" is a local variable in stm32_i2c_choose_solution() "v" has to be copied into "s" to avoid data abort in stm32_i2c_compute_timing(). Signed-off-by: Christophe Kerello Reviewed-by: Patrick DELAUNAY Signed-off-by: Patrice Chotard --- v2: rebase on top of v2017.11-rc2 Thanks! Applied to u-boot-i2c.git bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: h...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] i2c: remove DECLARE_GLOBAL_DATA_PTR from i2c-uclass
Hello Masahiro, Am 13.10.2017 um 12:29 schrieb Masahiro Yamada: No global pointer is used in this file. Signed-off-by: Masahiro Yamada --- drivers/i2c/i2c-uclass.c | 2 -- 1 file changed, 2 deletions(-) Thanks! Applied to u-boot-i2c.git bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: h...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2] chiliboard config: use CONFIG_DEFAULT_FDT_FILE as env variable
Remove hardcoded ftd file name from environment variables. Use CONFIG_DEFAULT_FDT_FILE macro instead. Signed-off-by: Michal Oleszczyk --- Set CONFIG_DEFAULT_FDT_FILE in configs/chiliboard_defconfig and also added 'Signed-off-by' section. configs/chiliboard_defconfig | 1 + include/configs/chiliboard.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/chiliboard_defconfig b/configs/chiliboard_defconfig index ee5f80bc60..24c83f3908 100644 --- a/configs/chiliboard_defconfig +++ b/configs/chiliboard_defconfig @@ -12,6 +12,7 @@ CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_SPL_FAT_SUPPORT=y CONFIG_BOOTDELAY=1 CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_DEFAULT_FDT_FILE="am335x-chiliboard.dtb" CONFIG_SPL=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y diff --git a/include/configs/chiliboard.h b/include/configs/chiliboard.h index b7887d90d4..153789e6be 100644 --- a/include/configs/chiliboard.h +++ b/include/configs/chiliboard.h @@ -45,7 +45,7 @@ "boot_fdt=try\0" \ "console=ttyO0,115200n8\0" \ "image=zImage\0" \ - "fdt_file=am335x-chiliboard.dtb\0" \ + "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ "ip_dyn=yes\0" \ "optargs=\0" \ "loadbootscript=" \ -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Pull request: u-boot-spi/master
Hi Tom, Please pull this PR. thanks! Jagan. The following changes since commit 10509987285515b0a969c39ef7374fea3545851b: spi: fsl_qspi: Copy 16 byte aligned data in TX FIFO (2017-09-25 15:45:15 +0530) are available in the git repository at: git://git.denx.de/u-boot-spi.git master for you to fetch changes up to ca1ac16da097bf0ab176b1a201653553160dc042: sf: bar: Clean BA24 Bank Address Register bit after read/write/erase operation (2017-09-27 13:31:59 +0530) Andre Przywara (1): SPL: SPI: sunxi: add SPL FIT image support Lukasz Majewski (1): sf: bar: Clean BA24 Bank Address Register bit after read/write/erase operation drivers/mtd/spi/spi_flash.c | 33 + drivers/mtd/spi/sunxi_spi_spl.c | 39 --- 2 files changed, 65 insertions(+), 7 deletions(-) ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] DW SPI: Get clock value from Device Tree
Hi Jagan, On Mon, 2017-10-16 at 22:37 +0530, Jagan Teki wrote: > On Fri, Oct 13, 2017 at 8:48 PM, Eugeniy Paltsev > wrote: > > Add option to set spi controller clock frequency via device tree > > using standard clock bindings. > > Old way of setting spi controller clock frequency (via implementation > > of 'cm_get_spi_controller_clk_hz' function in platform specific code) > > remains supported for backward compatibility. > > > > Signed-off-by: Eugeniy Paltsev > > --- > > Changes v1->v2: > > * disable clock if we can't get the rate. > > * get rid of cm_get_spi_controller_clk_hz weak declaration. > > > > drivers/spi/designware_spi.c | 65 > > +++- > > 1 file changed, 64 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c > > index 5aa507b..9eb5b1c 100644 > > --- a/drivers/spi/designware_spi.c > > +++ b/drivers/spi/designware_spi.c > > @@ -11,6 +11,7 @@ > > */ > > > > #include > > +#include > > #include > > #include > > #include > > @@ -18,7 +19,10 @@ > > #include > > #include > > #include > > +/* Only SOCFPGA_GEN5 and SOCFPGA_ARRIA10 uses their clock_manager > > functions */ > > +#if defined(CONFIG_TARGET_SOCFPGA_GEN5) || > > defined(CONFIG_TARGET_SOCFPGA_ARRIA10) > > #include > > +#endif > > How hard it is to make others to use clock manager? do you have any list? clock_manager.h is an old (and non-generic) way to deal with different clocks. For example in SOCFPGA_GEN5 and SOCFPGA_ARRIA10 clock_manager.h provides cm_get_spi_controller_clk_hz function to deal with spi controller clock. But today we have another, linux-like alternative: to bind clocks via device tree and manipulate with clocks via generic functions provided by clk.h In this patch I added option to get clock via device tree using standard bindings and restrict clock_manager.h functions usage only to targets which still use it, so new targets can simply bind clock via device tree and they do not need to implement/define something in clock_manager.h So we don't need to make others to use clock manager :) > thanks! -- Eugeniy Paltsev ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/5] tools: use files from scripts/dtc/libfdt where possible
Prior to this commit, tools/Makefile pulls all libfdt files from lib/libfdt. lib/libfdt/ and scripts/dtc/libfdt have the same copies for the followings 6 files: fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c fdt_sw.c This commit changes them to #include ones from scripts/dtc/libfdt. Unfortunately, U-Boot locally modified the following 3 files: fdt_ro.c fdt_wip.c fdt_rw.c I did not touch them in order to avoid unpredictable impact. The fdt_region.c is U-Boot own file. This is also borrowed from lib/libfdt/. Signed-off-by: Masahiro Yamada --- tools/Makefile| 15 ++- tools/libfdt/fdt.c| 2 ++ tools/libfdt/fdt_addresses.c | 2 ++ tools/libfdt/fdt_empty_tree.c | 2 ++ tools/libfdt/fdt_overlay.c| 2 ++ tools/libfdt/fdt_strerror.c | 2 ++ tools/libfdt/fdt_sw.c | 2 ++ 7 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 tools/libfdt/fdt.c create mode 100644 tools/libfdt/fdt_addresses.c create mode 100644 tools/libfdt/fdt_empty_tree.c create mode 100644 tools/libfdt/fdt_overlay.c create mode 100644 tools/libfdt/fdt_strerror.c create mode 100644 tools/libfdt/fdt_sw.c diff --git a/tools/Makefile b/tools/Makefile index 2b87e18..acbcd87 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -58,12 +58,17 @@ hostprogs-y += dumpimage mkimage hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o -# Flattened device tree objects -LIBFDT_CSRCS := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \ - fdt_empty_tree.c fdt_addresses.c fdt_overlay.c \ - fdt_region.c -LIBFDT_OBJS := $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_CSRCS))) +# The following files are synced with upstream DTC. +# Use synced versions from scripts/dtc/libfdt/. +LIBFDT_SRCS_SYNCED := fdt.c fdt_sw.c fdt_strerror.c fdt_empty_tree.c \ + fdt_addresses.c fdt_overlay.c +# The following files are locally modified for U-Boot (unfotunately). +# Use U-Boot own versions from lib/libfdt/. +LIBFDT_SRCS_UNSYNCED := fdt_ro.c fdt_wip.c fdt_rw.c fdt_region.c + +LIBFDT_OBJS := $(addprefix libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_SYNCED))) \ + $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_UNSYNCED))) RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \ rsa-sign.o rsa-verify.o rsa-checksum.o \ diff --git a/tools/libfdt/fdt.c b/tools/libfdt/fdt.c new file mode 100644 index 000..8ba8091 --- /dev/null +++ b/tools/libfdt/fdt.c @@ -0,0 +1,2 @@ +#include "fdt_host.h" +#include "../scripts/dtc/libfdt/fdt.c" diff --git a/tools/libfdt/fdt_addresses.c b/tools/libfdt/fdt_addresses.c new file mode 100644 index 000..242a2c0 --- /dev/null +++ b/tools/libfdt/fdt_addresses.c @@ -0,0 +1,2 @@ +#include "fdt_host.h" +#include "../scripts/dtc/libfdt/fdt_addresses.c" diff --git a/tools/libfdt/fdt_empty_tree.c b/tools/libfdt/fdt_empty_tree.c new file mode 100644 index 000..9ccbb1f --- /dev/null +++ b/tools/libfdt/fdt_empty_tree.c @@ -0,0 +1,2 @@ +#include "fdt_host.h" +#include "../scripts/dtc/libfdt/fdt_empty_tree.c" diff --git a/tools/libfdt/fdt_overlay.c b/tools/libfdt/fdt_overlay.c new file mode 100644 index 000..801ec37 --- /dev/null +++ b/tools/libfdt/fdt_overlay.c @@ -0,0 +1,2 @@ +#include "fdt_host.h" +#include "../scripts/dtc/libfdt/fdt_overlay.c" diff --git a/tools/libfdt/fdt_strerror.c b/tools/libfdt/fdt_strerror.c new file mode 100644 index 000..d7ed70b --- /dev/null +++ b/tools/libfdt/fdt_strerror.c @@ -0,0 +1,2 @@ +#include "fdt_host.h" +#include "../scripts/dtc/libfdt/fdt_strerror.c" diff --git a/tools/libfdt/fdt_sw.c b/tools/libfdt/fdt_sw.c new file mode 100644 index 000..ed6b327 --- /dev/null +++ b/tools/libfdt/fdt_sw.c @@ -0,0 +1,2 @@ +#include "fdt_host.h" +#include "../scripts/dtc/libfdt/fdt_sw.c" -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/5] libfdt: Reduce duplicated copies of libfdt
Recently, U-Boot switched to the bundled DTC approach. This means we have two copies, lib/libfdt and scripts/dtc/libfdt. Ideally, we should change lib/libfdt to #include scripts/dtc/libfdt. One big problem is lib/libfdt is locally modified (fdt_ro.c fdt_wip.c fdt_rw.c) and makes our life difficult. For now I synced only 6 files. This series depends on "pylibfdt: compile pylibfdt in scripts/dtc/pylibfdt only when necessary" http://patchwork.ozlabs.org/project/uboot/list/?series=8554 Masahiro Yamada (5): libfdt: change fdt.h to a wrapper of scripts/dtc/libfdt/* libfdt: change libfdt_internal.h to a wrapper of scripts/dtc/libfdt/* tools: use files from scripts/dtc/libfdt where possible linux/types.h: add typedef of uintptr_t lib: libfdt: wrap scripts/dtc/libfdt/* where possible include/fdt.h | 2 +- include/libfdt_env.h | 6 - include/linux/libfdt.h| 17 + include/linux/libfdt_env.h| 22 ++ include/linux/types.h | 2 + lib/libfdt/Makefile | 17 +- lib/libfdt/fdt.c | 212 +-- lib/libfdt/fdt.h | 67 lib/libfdt/fdt_addresses.c| 57 +-- lib/libfdt/fdt_empty_tree.c | 39 +- lib/libfdt/fdt_overlay.c | 863 +- lib/libfdt/fdt_strerror.c | 63 +-- lib/libfdt/fdt_sw.c | 256 + lib/libfdt/libfdt_internal.h | 51 +-- tools/Makefile| 15 +- tools/libfdt/fdt.c| 2 + tools/libfdt/fdt_addresses.c | 2 + tools/libfdt/fdt_empty_tree.c | 2 + tools/libfdt/fdt_overlay.c| 2 + tools/libfdt/fdt_strerror.c | 2 + tools/libfdt/fdt_sw.c | 2 + 21 files changed, 89 insertions(+), 1612 deletions(-) create mode 100644 include/linux/libfdt.h create mode 100644 include/linux/libfdt_env.h delete mode 100644 lib/libfdt/fdt.h create mode 100644 tools/libfdt/fdt.c create mode 100644 tools/libfdt/fdt_addresses.c create mode 100644 tools/libfdt/fdt_empty_tree.c create mode 100644 tools/libfdt/fdt_overlay.c create mode 100644 tools/libfdt/fdt_strerror.c create mode 100644 tools/libfdt/fdt_sw.c -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 5/5] lib: libfdt: wrap scripts/dtc/libfdt/* where possible
lib/libfdt/ and scripts/dtc/libfdt have the same copies for the followings 6 files: fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c fdt_sw.c Make them a wrapper of scripts/dtc/libfdt/*. This is exactly what Linux does to sync libfdt. In order to make is possible, import and from Linux 4.14-rc5. Unfortunately, U-Boot locally modified the following 3 files: fdt_ro.c fdt_wip.c fdt_rw.c The fdt_region.c is U-Boot own file. I did not touch them in order to avoid unpredictable impact. Signed-off-by: Masahiro Yamada --- include/libfdt_env.h| 6 - include/linux/libfdt.h | 17 + include/linux/libfdt_env.h | 22 ++ lib/libfdt/Makefile | 17 +- lib/libfdt/fdt.c| 212 +-- lib/libfdt/fdt_addresses.c | 57 +-- lib/libfdt/fdt_empty_tree.c | 39 +- lib/libfdt/fdt_overlay.c| 863 +--- lib/libfdt/fdt_strerror.c | 63 +--- lib/libfdt/fdt_sw.c | 256 + 10 files changed, 63 insertions(+), 1489 deletions(-) create mode 100644 include/linux/libfdt.h create mode 100644 include/linux/libfdt_env.h diff --git a/include/libfdt_env.h b/include/libfdt_env.h index 6c6845f..273b5d3 100644 --- a/include/libfdt_env.h +++ b/include/libfdt_env.h @@ -23,12 +23,6 @@ typedef __be64 fdt64_t; #define fdt64_to_cpu(x)be64_to_cpu(x) #define cpu_to_fdt64(x)cpu_to_be64(x) -#ifdef __UBOOT__ -#include - -#define strtoul(cp, endp, base)simple_strtoul(cp, endp, base) -#endif - /* adding a ramdisk needs 0x44 bytes in version 2008.10 */ #define FDT_RAMDISK_OVERHEAD 0x80 diff --git a/include/linux/libfdt.h b/include/linux/libfdt.h new file mode 100644 index 000..2a663c6 --- /dev/null +++ b/include/linux/libfdt.h @@ -0,0 +1,17 @@ +#ifndef _LIBFDT_ENV_H +#define _LIBFDT_ENV_H + +#include + +#include + +typedef __be16 fdt16_t; +typedef __be32 fdt32_t; +typedef __be64 fdt64_t; + +#define fdt32_to_cpu(x) be32_to_cpu(x) +#define cpu_to_fdt32(x) cpu_to_be32(x) +#define fdt64_to_cpu(x) be64_to_cpu(x) +#define cpu_to_fdt64(x) cpu_to_be64(x) + +#endif /* _LIBFDT_ENV_H */ diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h new file mode 100644 index 000..8178f91 --- /dev/null +++ b/include/linux/libfdt_env.h @@ -0,0 +1,22 @@ +#ifndef _LIBFDT_ENV_H +#define _LIBFDT_ENV_H + +#include + +#include + +typedef __be16 fdt16_t; +typedef __be32 fdt32_t; +typedef __be64 fdt64_t; + +#define fdt32_to_cpu(x) be32_to_cpu(x) +#define cpu_to_fdt32(x) cpu_to_be32(x) +#define fdt64_to_cpu(x) be64_to_cpu(x) +#define cpu_to_fdt64(x) cpu_to_be64(x) + +/* U-Boot: for strtoul in fdt_overlay.c */ +#include + +#define strtoul(cp, endp, base)simple_strtoul(cp, endp, base) + +#endif /* _LIBFDT_ENV_H */ diff --git a/lib/libfdt/Makefile b/lib/libfdt/Makefile index 6ef8290..369bbf9 100644 --- a/lib/libfdt/Makefile +++ b/lib/libfdt/Makefile @@ -5,15 +5,22 @@ # SPDX-License-Identifier: GPL-2.0+ # +# Use upstream code. obj-y += \ fdt.o \ - fdt_ro.o \ - fdt_rw.o \ fdt_strerror.o \ fdt_sw.o \ - fdt_wip.o \ fdt_empty_tree.o \ - fdt_addresses.o \ - fdt_region.o + fdt_addresses.o obj-$(CONFIG_OF_LIBFDT_OVERLAY) += fdt_overlay.o + +# Locally modified for U-Boot. +# TODO: split out the local modifiction. +obj-y += \ + fdt_ro.o \ + fdt_rw.o \ + fdt_wip.o \ + +# U-Boot own file +obj-y += fdt_region.o diff --git a/lib/libfdt/fdt.c b/lib/libfdt/fdt.c index 2055734..0958e6ba 100644 --- a/lib/libfdt/fdt.c +++ b/lib/libfdt/fdt.c @@ -1,210 +1,2 @@ -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * SPDX-License-Identifier:GPL-2.0+ BSD-2-Clause - */ -#include - -#ifndef USE_HOSTCC -#include -#include -#else -#include "fdt_host.h" -#endif - -#include "libfdt_internal.h" - -int fdt_check_header(const void *fdt) -{ - if (fdt_magic(fdt) == FDT_MAGIC) { - /* Complete tree */ - if (fdt_version(fdt) < FDT_FIRST_SUPPORTED_VERSION) - return -FDT_ERR_BADVERSION; - if (fdt_last_comp_version(fdt) > FDT_LAST_SUPPORTED_VERSION) - return -FDT_ERR_BADVERSION; - } else if (fdt_magic(fdt) == FDT_SW_MAGIC) { - /* Unfinished sequential-write blob */ - if (fdt_size_dt_struct(fdt) == 0) - return -FDT_ERR_BADSTATE; - } else { - return -FDT_ERR_BADMAGIC; - } - - return 0; -} - -const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len) -{ - unsigned absoffset = offset + fdt_off_dt_struct(fdt); - - if ((absoffset < offset) - || ((absoffset + len) < absoffset) - || (absoffset + len) > fdt_totalsize(fdt)) - return NULL; - - if (fdt_version(fdt) >= 0x11) - if (((offset + len) < offset) -
[U-Boot] [PATCH 1/5] libfdt: change fdt.h to a wrapper of scripts/dtc/libfdt/*
Fortunately, U-Boot did not modify fdt.h locally. Change it to a wrapper of scripts/dtc/libfdt/fdt.h, which will be periodically synced with the upstream DTC (or kernel). Signed-off-by: Masahiro Yamada --- include/fdt.h| 2 +- lib/libfdt/fdt.h | 67 2 files changed, 1 insertion(+), 68 deletions(-) delete mode 100644 lib/libfdt/fdt.h diff --git a/include/fdt.h b/include/fdt.h index 7ead62e..caeadbf 100644 --- a/include/fdt.h +++ b/include/fdt.h @@ -1 +1 @@ -#include <../lib/libfdt/fdt.h> +#include <../scripts/dtc/libfdt/fdt.h> diff --git a/lib/libfdt/fdt.h b/lib/libfdt/fdt.h deleted file mode 100644 index 3134d78..000 --- a/lib/libfdt/fdt.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _FDT_H -#define _FDT_H -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * Copyright 2012 Kim Phillips, Freescale Semiconductor. - * - * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause - */ - -#ifndef __ASSEMBLY__ - -struct fdt_header { - fdt32_t magic; /* magic word FDT_MAGIC */ - fdt32_t totalsize; /* total size of DT block */ - fdt32_t off_dt_struct; /* offset to structure */ - fdt32_t off_dt_strings; /* offset to strings */ - fdt32_t off_mem_rsvmap; /* offset to memory reserve map */ - fdt32_t version; /* format version */ - fdt32_t last_comp_version; /* last compatible version */ - - /* version 2 fields below */ - fdt32_t boot_cpuid_phys; /* Which physical CPU id we're - booting on */ - /* version 3 fields below */ - fdt32_t size_dt_strings; /* size of the strings block */ - - /* version 17 fields below */ - fdt32_t size_dt_struct; /* size of the structure block */ -}; - -struct fdt_reserve_entry { - fdt64_t address; - fdt64_t size; -}; - -struct fdt_node_header { - fdt32_t tag; - char name[0]; -}; - -struct fdt_property { - fdt32_t tag; - fdt32_t len; - fdt32_t nameoff; - char data[0]; -}; - -#endif /* !__ASSEMBLY */ - -#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ -#define FDT_TAGSIZEsizeof(fdt32_t) - -#define FDT_BEGIN_NODE 0x1 /* Start node: full name */ -#define FDT_END_NODE 0x2 /* End node */ -#define FDT_PROP 0x3 /* Property: name off, - size, content */ -#define FDT_NOP0x4 /* nop */ -#define FDT_END0x9 - -#define FDT_V1_SIZE(7*sizeof(fdt32_t)) -#define FDT_V2_SIZE(FDT_V1_SIZE + sizeof(fdt32_t)) -#define FDT_V3_SIZE(FDT_V2_SIZE + sizeof(fdt32_t)) -#define FDT_V16_SIZE FDT_V3_SIZE -#define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) - -#endif /* _FDT_H */ -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/5] libfdt: change libfdt_internal.h to a wrapper of scripts/dtc/libfdt/*
Fortunately, U-Boot did not modify libfdt_internal.h locally. Change it to a wrapper of scripts/dtc/libfdt/fdt.h, which will be periodically synced with the upstream DTC (or kernel). Signed-off-by: Masahiro Yamada --- lib/libfdt/libfdt_internal.h | 51 +--- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/lib/libfdt/libfdt_internal.h b/lib/libfdt/libfdt_internal.h index 9a79fe8..5197c5d 100644 --- a/lib/libfdt/libfdt_internal.h +++ b/lib/libfdt/libfdt_internal.h @@ -1,50 +1 @@ -#ifndef _LIBFDT_INTERNAL_H -#define _LIBFDT_INTERNAL_H -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * SPDX-License-Identifier:GPL-2.0+ BSD-2-Clause - */ -#include - -#define FDT_ALIGN(x, a)(((x) + (a) - 1) & ~((a) - 1)) -#define FDT_TAGALIGN(x)(FDT_ALIGN((x), FDT_TAGSIZE)) - -#define FDT_CHECK_HEADER(fdt) \ - { \ - int __err; \ - if ((__err = fdt_check_header(fdt)) != 0) \ - return __err; \ - } - -int _fdt_check_node_offset(const void *fdt, int offset); -int _fdt_check_prop_offset(const void *fdt, int offset); -const char *_fdt_find_string(const char *strtab, int tabsize, const char *s); -int _fdt_node_end_offset(void *fdt, int nodeoffset); - -static inline const void *_fdt_offset_ptr(const void *fdt, int offset) -{ - return (const char *)fdt + fdt_off_dt_struct(fdt) + offset; -} - -static inline void *_fdt_offset_ptr_w(void *fdt, int offset) -{ - return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset); -} - -static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n) -{ - const struct fdt_reserve_entry *rsv_table = - (const struct fdt_reserve_entry *) - ((const char *)fdt + fdt_off_mem_rsvmap(fdt)); - - return rsv_table + n; -} -static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n) -{ - return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n); -} - -#define FDT_SW_MAGIC (~FDT_MAGIC) - -#endif /* _LIBFDT_INTERNAL_H */ +#include "../../scripts/dtc/libfdt/libfdt_internal.h" -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/5] linux/types.h: add typedef of uintptr_t
Add this typedef in the same place as in Linux. This is necessary to refactor libfdt inclusion. U-Boot also defines it in include/compiler.h. Of course it should not do that, but I do not want to open a can of worms. Signed-off-by: Masahiro Yamada --- include/linux/types.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/types.h b/include/linux/types.h index 416fa66..7c33e7a 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -24,6 +24,8 @@ typedef __kernel_gid32_t gid_t; typedef __kernel_uid16_tuid16_t; typedef __kernel_gid16_tgid16_t; +typedef unsigned long uintptr_t; + #ifdef CONFIG_UID16 /* This is defined by include/asm-{arch}/posix_types.h */ typedef __kernel_old_uid_t old_uid_t; -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] ARM: uniphier: split u-boot, dm-pre-reloc out to uniphier-v7-u-boot.dtsi
On Tue, Oct 17, 2017 at 5:49 PM, Masahiro Yamada wrote: > UniPhier 32-bit SoCs use CONFIG_SPL_OF_CONTROL. So, many nodes must > be marked as dm-pre-reloc to prevent fdtgrep from stripping them off. > > Sprinkling U-Boot specific properties all over the place is painful > because DT files are synced with Linux from time to time. > > Split u-boot,dm-pre-reloc out to uniphier-v7-u-boot.dtsi, which is > appended to UniPhier V7 DTS before the build. > > Signed-off-by: Masahiro Yamada > --- Reviewed-by: Jagan Teki thanks! -- Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] ARM: uniphier: split u-boot, dm-pre-reloc out to uniphier-v7-u-boot.dtsi
On Tue, Oct 17, 2017 at 6:31 PM, Jagan Teki wrote: > On Tue, Oct 17, 2017 at 5:49 PM, Masahiro Yamada > wrote: >> UniPhier 32-bit SoCs use CONFIG_SPL_OF_CONTROL. So, many nodes must >> be marked as dm-pre-reloc to prevent fdtgrep from stripping them off. >> >> Sprinkling U-Boot specific properties all over the place is painful >> because DT files are synced with Linux from time to time. >> >> Split u-boot,dm-pre-reloc out to uniphier-v7-u-boot.dtsi, which is >> appended to UniPhier V7 DTS before the build. >> >> Signed-off-by: Masahiro Yamada >> --- >> >> arch/arm/dts/uniphier-ld4-ref.dts | 9 -- >> arch/arm/dts/uniphier-ld4.dtsi| 3 -- >> arch/arm/dts/uniphier-ld6b-ref.dts| 9 -- >> arch/arm/dts/uniphier-pro4-ace.dts| 9 -- >> arch/arm/dts/uniphier-pro4-ref.dts| 9 -- >> arch/arm/dts/uniphier-pro4-sanji.dts | 21 >> arch/arm/dts/uniphier-pro4.dtsi | 4 --- >> arch/arm/dts/uniphier-pro5-4kbox.dts | 9 -- >> arch/arm/dts/uniphier-pro5.dtsi | 4 --- >> arch/arm/dts/uniphier-pxs2-gentil.dts | 21 >> arch/arm/dts/uniphier-pxs2-vodka.dts | 21 >> arch/arm/dts/uniphier-pxs2.dtsi | 4 --- >> arch/arm/dts/uniphier-sld8-ref.dts| 9 -- >> arch/arm/dts/uniphier-sld8.dtsi | 3 -- >> arch/arm/dts/uniphier-v7-u-boot.dtsi | 61 >> +++ >> arch/arm/mach-uniphier/Kconfig| 2 ++ >> 16 files changed, 63 insertions(+), 135 deletions(-) >> create mode 100644 arch/arm/dts/uniphier-v7-u-boot.dtsi >> >> diff --git a/arch/arm/dts/uniphier-ld4-ref.dts >> b/arch/arm/dts/uniphier-ld4-ref.dts >> index 0f50acb..0fd66e7 100644 >> --- a/arch/arm/dts/uniphier-ld4-ref.dts >> +++ b/arch/arm/dts/uniphier-ld4-ref.dts >> @@ -68,12 +68,3 @@ >> &usb1 { >> status = "okay"; >> }; >> - >> -/* for U-Boot only */ >> -&serial0 { >> - u-boot,dm-pre-reloc; >> -}; >> - >> -&pinctrl_uart0 { >> - u-boot,dm-pre-reloc; >> -}; >> diff --git a/arch/arm/dts/uniphier-ld4.dtsi b/arch/arm/dts/uniphier-ld4.dtsi >> index b816038..158beae 100644 >> --- a/arch/arm/dts/uniphier-ld4.dtsi >> +++ b/arch/arm/dts/uniphier-ld4.dtsi >> @@ -50,7 +50,6 @@ >> #size-cells = <1>; >> ranges; >> interrupt-parent = <&intc>; >> - u-boot,dm-pre-reloc; >> >> l2: l2-cache@500c { >> compatible = "socionext,uniphier-system-cache"; >> @@ -295,11 +294,9 @@ >> compatible = "socionext,uniphier-ld4-soc-glue", >> "simple-mfd", "syscon"; >> reg = <0x5f80 0x2000>; >> - u-boot,dm-pre-reloc; >> >> pinctrl: pinctrl { >> compatible = >> "socionext,uniphier-ld4-pinctrl"; >> - u-boot,dm-pre-reloc; >> }; >> }; >> >> diff --git a/arch/arm/dts/uniphier-ld6b-ref.dts >> b/arch/arm/dts/uniphier-ld6b-ref.dts >> index bdb7f50..926d37e 100644 >> --- a/arch/arm/dts/uniphier-ld6b-ref.dts >> +++ b/arch/arm/dts/uniphier-ld6b-ref.dts >> @@ -70,12 +70,3 @@ >> &usb1 { >> status = "okay"; >> }; >> - >> -/* for U-Boot only */ >> -&serial0 { >> - u-boot,dm-pre-reloc; >> -}; >> - >> -&pinctrl_uart0 { >> - u-boot,dm-pre-reloc; >> -}; >> diff --git a/arch/arm/dts/uniphier-pro4-ace.dts >> b/arch/arm/dts/uniphier-pro4-ace.dts >> index 8161ba8..60a8c33 100644 >> --- a/arch/arm/dts/uniphier-pro4-ace.dts >> +++ b/arch/arm/dts/uniphier-pro4-ace.dts >> @@ -90,12 +90,3 @@ >> &usb3 { >> status = "okay"; >> }; >> - >> -/* for U-Boot only */ >> -&serial0 { >> - u-boot,dm-pre-reloc; >> -}; >> - >> -&pinctrl_uart0 { >> - u-boot,dm-pre-reloc; >> -}; >> diff --git a/arch/arm/dts/uniphier-pro4-ref.dts >> b/arch/arm/dts/uniphier-pro4-ref.dts >> index 360b31d..1b22f80 100644 >> --- a/arch/arm/dts/uniphier-pro4-ref.dts >> +++ b/arch/arm/dts/uniphier-pro4-ref.dts >> @@ -83,12 +83,3 @@ >> &usb1 { >> status = "okay"; >> }; >> - >> -/* for U-Boot only */ >> -&serial0 { >> - u-boot,dm-pre-reloc; >> -}; >> - >> -&pinctrl_uart0 { >> - u-boot,dm-pre-reloc; >> -}; >> diff --git a/arch/arm/dts/uniphier-pro4-sanji.dts >> b/arch/arm/dts/uniphier-pro4-sanji.dts >> index 778e2bb..950f47a 100644 >> --- a/arch/arm/dts/uniphier-pro4-sanji.dts >> +++ b/arch/arm/dts/uniphier-pro4-sanji.dts >> @@ -85,24 +85,3 @@ >> &usb3 { >> status = "okay"; >> }; >> - >> -/* for U-Boot only */ >> -&serial0 { >> - u-boot,dm-pre-reloc; >> -}; >> - >> -&mio_clk { >> - u-boot,dm-pre-reloc; >> -}; >> - >> -&emmc { >> - u-boot,dm-pre-reloc; >> -}; >> - >> -&pinctrl_uart0 { >> - u-boot,dm-pre-reloc; >> -}; >> - >> -&pinctrl_emmc { >> - u-boot,dm-pre-reloc; >> -}; >> diff --git a/arch/arm/dts/uniphier-pro4.dtsi >> b/arch/arm/dts/uniphier-pro4.
Re: [U-Boot] [PATCH 3/4] ARM: uniphier: split u-boot, dm-pre-reloc out to uniphier-v7-u-boot.dtsi
On Tue, Oct 17, 2017 at 5:49 PM, Masahiro Yamada wrote: > UniPhier 32-bit SoCs use CONFIG_SPL_OF_CONTROL. So, many nodes must > be marked as dm-pre-reloc to prevent fdtgrep from stripping them off. > > Sprinkling U-Boot specific properties all over the place is painful > because DT files are synced with Linux from time to time. > > Split u-boot,dm-pre-reloc out to uniphier-v7-u-boot.dtsi, which is > appended to UniPhier V7 DTS before the build. > > Signed-off-by: Masahiro Yamada > --- > > arch/arm/dts/uniphier-ld4-ref.dts | 9 -- > arch/arm/dts/uniphier-ld4.dtsi| 3 -- > arch/arm/dts/uniphier-ld6b-ref.dts| 9 -- > arch/arm/dts/uniphier-pro4-ace.dts| 9 -- > arch/arm/dts/uniphier-pro4-ref.dts| 9 -- > arch/arm/dts/uniphier-pro4-sanji.dts | 21 > arch/arm/dts/uniphier-pro4.dtsi | 4 --- > arch/arm/dts/uniphier-pro5-4kbox.dts | 9 -- > arch/arm/dts/uniphier-pro5.dtsi | 4 --- > arch/arm/dts/uniphier-pxs2-gentil.dts | 21 > arch/arm/dts/uniphier-pxs2-vodka.dts | 21 > arch/arm/dts/uniphier-pxs2.dtsi | 4 --- > arch/arm/dts/uniphier-sld8-ref.dts| 9 -- > arch/arm/dts/uniphier-sld8.dtsi | 3 -- > arch/arm/dts/uniphier-v7-u-boot.dtsi | 61 > +++ > arch/arm/mach-uniphier/Kconfig| 2 ++ > 16 files changed, 63 insertions(+), 135 deletions(-) > create mode 100644 arch/arm/dts/uniphier-v7-u-boot.dtsi > > diff --git a/arch/arm/dts/uniphier-ld4-ref.dts > b/arch/arm/dts/uniphier-ld4-ref.dts > index 0f50acb..0fd66e7 100644 > --- a/arch/arm/dts/uniphier-ld4-ref.dts > +++ b/arch/arm/dts/uniphier-ld4-ref.dts > @@ -68,12 +68,3 @@ > &usb1 { > status = "okay"; > }; > - > -/* for U-Boot only */ > -&serial0 { > - u-boot,dm-pre-reloc; > -}; > - > -&pinctrl_uart0 { > - u-boot,dm-pre-reloc; > -}; > diff --git a/arch/arm/dts/uniphier-ld4.dtsi b/arch/arm/dts/uniphier-ld4.dtsi > index b816038..158beae 100644 > --- a/arch/arm/dts/uniphier-ld4.dtsi > +++ b/arch/arm/dts/uniphier-ld4.dtsi > @@ -50,7 +50,6 @@ > #size-cells = <1>; > ranges; > interrupt-parent = <&intc>; > - u-boot,dm-pre-reloc; > > l2: l2-cache@500c { > compatible = "socionext,uniphier-system-cache"; > @@ -295,11 +294,9 @@ > compatible = "socionext,uniphier-ld4-soc-glue", > "simple-mfd", "syscon"; > reg = <0x5f80 0x2000>; > - u-boot,dm-pre-reloc; > > pinctrl: pinctrl { > compatible = "socionext,uniphier-ld4-pinctrl"; > - u-boot,dm-pre-reloc; > }; > }; > > diff --git a/arch/arm/dts/uniphier-ld6b-ref.dts > b/arch/arm/dts/uniphier-ld6b-ref.dts > index bdb7f50..926d37e 100644 > --- a/arch/arm/dts/uniphier-ld6b-ref.dts > +++ b/arch/arm/dts/uniphier-ld6b-ref.dts > @@ -70,12 +70,3 @@ > &usb1 { > status = "okay"; > }; > - > -/* for U-Boot only */ > -&serial0 { > - u-boot,dm-pre-reloc; > -}; > - > -&pinctrl_uart0 { > - u-boot,dm-pre-reloc; > -}; > diff --git a/arch/arm/dts/uniphier-pro4-ace.dts > b/arch/arm/dts/uniphier-pro4-ace.dts > index 8161ba8..60a8c33 100644 > --- a/arch/arm/dts/uniphier-pro4-ace.dts > +++ b/arch/arm/dts/uniphier-pro4-ace.dts > @@ -90,12 +90,3 @@ > &usb3 { > status = "okay"; > }; > - > -/* for U-Boot only */ > -&serial0 { > - u-boot,dm-pre-reloc; > -}; > - > -&pinctrl_uart0 { > - u-boot,dm-pre-reloc; > -}; > diff --git a/arch/arm/dts/uniphier-pro4-ref.dts > b/arch/arm/dts/uniphier-pro4-ref.dts > index 360b31d..1b22f80 100644 > --- a/arch/arm/dts/uniphier-pro4-ref.dts > +++ b/arch/arm/dts/uniphier-pro4-ref.dts > @@ -83,12 +83,3 @@ > &usb1 { > status = "okay"; > }; > - > -/* for U-Boot only */ > -&serial0 { > - u-boot,dm-pre-reloc; > -}; > - > -&pinctrl_uart0 { > - u-boot,dm-pre-reloc; > -}; > diff --git a/arch/arm/dts/uniphier-pro4-sanji.dts > b/arch/arm/dts/uniphier-pro4-sanji.dts > index 778e2bb..950f47a 100644 > --- a/arch/arm/dts/uniphier-pro4-sanji.dts > +++ b/arch/arm/dts/uniphier-pro4-sanji.dts > @@ -85,24 +85,3 @@ > &usb3 { > status = "okay"; > }; > - > -/* for U-Boot only */ > -&serial0 { > - u-boot,dm-pre-reloc; > -}; > - > -&mio_clk { > - u-boot,dm-pre-reloc; > -}; > - > -&emmc { > - u-boot,dm-pre-reloc; > -}; > - > -&pinctrl_uart0 { > - u-boot,dm-pre-reloc; > -}; > - > -&pinctrl_emmc { > - u-boot,dm-pre-reloc; > -}; > diff --git a/arch/arm/dts/uniphier-pro4.dtsi b/arch/arm/dts/uniphier-pro4.dtsi > index 5f39972..ea97e26 100644 > --- a/arch/arm/dts/uniphier-pro4.dtsi > +++ b/arch/arm/dts/uniphier-pro4.dtsi > @@ -58,7 +58,6 @@ > #size-cells = <1>; > ranges; > inter
Re: [U-Boot] [PATCH v5] cmd: usb: add blk, emulation devices to ignore list as needed
On 10/17/2017 05:21 AM, Bin Meng wrote: > +Marek, Tom, Well, if the author CCed me in the first place, that'd be useful. > On Tue, Oct 17, 2017 at 11:14 AM, Suneel Garapati > wrote: >> Hi Bin/Simon, >> >> Request to know if this will be applied for v2017.11 >> > > Not sure which of you should pick this up for v2017.11. The commit message makes no sense, can you explain to me what this patch tries to achieve ? >> Regards, >> Suneel >> > > Suneel, please avoid top-posting next time. thanks! > >> On Sun, Sep 24, 2017 at 7:13 PM, Simon Glass wrote: >>> On 20 September 2017 at 23:09, Suneel Garapati >>> wrote: add blk child devices to ignore list while displaying usb tree graph, also preamble should not be set for blk child devices. add usb_emul to ignore list in usb_show_info. otherwise usb tree and info commands may cause crash treating blk as usb device. Signed-off-by: Suneel Garapati Reviewed-by: Bin Meng Tested-by: Bin Meng --- Changes v5: - add usb_emul to ignore list in usb_show_info - modify description Changes v4: - do not set preamble if child is block device for mass storage Changes v3: - remove 'check on parent uclass' in description Changes v2: - remove check on parent uclass Changes v1: - add separate check on blk uclass - modify description - add separate check on parent uclass as usb cmd/usb.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) >>> >>> Reviewed-by: Simon Glass > > Regards, > Bin > -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/4] ARM: uniphier: remove CONFIG_UNIPHIER_ETH
The option is never enabled by anyone. Remove the code surrounded by its ifdef. This should be handled by the clock/reset drivers. CONFIG_UNIPHIER_ETH in scripts/config_whitelist.txt will be dropped at the next resync. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/clk/clk-ld4.c | 6 -- arch/arm/mach-uniphier/clk/clk-pro4.c | 6 -- arch/arm/mach-uniphier/clk/clk-pxs2.c | 6 -- 3 files changed, 18 deletions(-) diff --git a/arch/arm/mach-uniphier/clk/clk-ld4.c b/arch/arm/mach-uniphier/clk/clk-ld4.c index def87c1..64fa12e 100644 --- a/arch/arm/mach-uniphier/clk/clk-ld4.c +++ b/arch/arm/mach-uniphier/clk/clk-ld4.c @@ -17,9 +17,6 @@ void uniphier_ld4_clk_init(void) /* deassert reset */ tmp = readl(SC_RSTCTRL); -#ifdef CONFIG_UNIPHIER_ETH - tmp |= SC_RSTCTRL_NRST_ETHER; -#endif #ifdef CONFIG_NAND_DENALI tmp |= SC_RSTCTRL_NRST_NAND; #endif @@ -28,9 +25,6 @@ void uniphier_ld4_clk_init(void) /* provide clocks */ tmp = readl(SC_CLKCTRL); -#ifdef CONFIG_UNIPHIER_ETH - tmp |= SC_CLKCTRL_CEN_ETHER; -#endif #ifdef CONFIG_USB_EHCI_HCD tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC; #endif diff --git a/arch/arm/mach-uniphier/clk/clk-pro4.c b/arch/arm/mach-uniphier/clk/clk-pro4.c index 8a978d2..09c03cd 100644 --- a/arch/arm/mach-uniphier/clk/clk-pro4.c +++ b/arch/arm/mach-uniphier/clk/clk-pro4.c @@ -21,9 +21,6 @@ void uniphier_pro4_clk_init(void) tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 | SC_RSTCTRL_NRST_GIO; #endif -#ifdef CONFIG_UNIPHIER_ETH - tmp |= SC_RSTCTRL_NRST_ETHER; -#endif #ifdef CONFIG_NAND_DENALI tmp |= SC_RSTCTRL_NRST_NAND; #endif @@ -43,9 +40,6 @@ void uniphier_pro4_clk_init(void) tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 | SC_CLKCTRL_CEN_GIO; #endif -#ifdef CONFIG_UNIPHIER_ETH - tmp |= SC_CLKCTRL_CEN_ETHER; -#endif #ifdef CONFIG_USB_EHCI_HCD tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC; #endif diff --git a/arch/arm/mach-uniphier/clk/clk-pxs2.c b/arch/arm/mach-uniphier/clk/clk-pxs2.c index 9775127..27fb2f4 100644 --- a/arch/arm/mach-uniphier/clk/clk-pxs2.c +++ b/arch/arm/mach-uniphier/clk/clk-pxs2.c @@ -19,9 +19,6 @@ void uniphier_pxs2_clk_init(void) #ifdef CONFIG_USB_DWC3_UNIPHIER tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO; #endif -#ifdef CONFIG_UNIPHIER_ETH - tmp |= SC_RSTCTRL_NRST_ETHER; -#endif #ifdef CONFIG_NAND_DENALI tmp |= SC_RSTCTRL_NRST_NAND; #endif @@ -45,9 +42,6 @@ void uniphier_pxs2_clk_init(void) tmp |= BIT(20) | BIT(19) | SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 | SC_CLKCTRL_CEN_GIO; #endif -#ifdef CONFIG_UNIPHIER_ETH - tmp |= SC_CLKCTRL_CEN_ETHER; -#endif #ifdef CONFIG_NAND_DENALI tmp |= SC_CLKCTRL_CEN_NAND; #endif -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/4] ARM: dts: uniphier: sync DT with Linux 4.14-rc5
Signed-off-by: Masahiro Yamada --- arch/arm/dts/uniphier-ld11.dtsi| 13 + arch/arm/dts/uniphier-ld20.dtsi| 30 ++ arch/arm/dts/uniphier-ld4-ref.dts | 4 arch/arm/dts/uniphier-ld6b-ref.dts | 4 arch/arm/dts/uniphier-pinctrl.dtsi | 15 +++ arch/arm/dts/uniphier-pxs3-ref.dts | 4 arch/arm/dts/uniphier-sld8-ref.dts | 4 7 files changed, 74 insertions(+) diff --git a/arch/arm/dts/uniphier-ld11.dtsi b/arch/arm/dts/uniphier-ld11.dtsi index 0cc6fd7..cf079b9 100644 --- a/arch/arm/dts/uniphier-ld11.dtsi +++ b/arch/arm/dts/uniphier-ld11.dtsi @@ -175,6 +175,19 @@ "gpio_range4", "gpio_range5"; ngpios = <200>; + socionext,interrupt-ranges = <0 48 16>, <16 154 5>, +<21 217 3>; + }; + + adamv@5792 { + compatible = "socionext,uniphier-ld11-adamv", +"simple-mfd", "syscon"; + reg = <0x5792 0x1000>; + + adamv_rst: reset { + compatible = "socionext,uniphier-ld11-adamv-reset"; + #reset-cells = <1>; + }; }; i2c0: i2c@5878 { diff --git a/arch/arm/dts/uniphier-ld20.dtsi b/arch/arm/dts/uniphier-ld20.dtsi index a7fdaa7..68f0292 100644 --- a/arch/arm/dts/uniphier-ld20.dtsi +++ b/arch/arm/dts/uniphier-ld20.dtsi @@ -223,6 +223,36 @@ clock-frequency = <5882>; }; + gpio: gpio@5500 { + compatible = "socionext,uniphier-gpio"; + reg = <0x5500 0x200>; + interrupt-parent = <&aidet>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pinctrl 0 0 0>, + <&pinctrl 96 0 0>, + <&pinctrl 160 0 0>; + gpio-ranges-group-names = "gpio_range0", + "gpio_range1", + "gpio_range2"; + ngpios = <205>; + socionext,interrupt-ranges = <0 48 16>, <16 154 5>, +<21 217 3>; + }; + + adamv@5792 { + compatible = "socionext,uniphier-ld20-adamv", +"simple-mfd", "syscon"; + reg = <0x5792 0x1000>; + + adamv_rst: reset { + compatible = "socionext,uniphier-ld20-adamv-reset"; + #reset-cells = <1>; + }; + }; + i2c0: i2c@5878 { compatible = "socionext,uniphier-fi2c"; status = "disabled"; diff --git a/arch/arm/dts/uniphier-ld4-ref.dts b/arch/arm/dts/uniphier-ld4-ref.dts index 0fd66e7..fb94df4 100644 --- a/arch/arm/dts/uniphier-ld4-ref.dts +++ b/arch/arm/dts/uniphier-ld4-ref.dts @@ -68,3 +68,7 @@ &usb1 { status = "okay"; }; + +&nand { + status = "okay"; +}; diff --git a/arch/arm/dts/uniphier-ld6b-ref.dts b/arch/arm/dts/uniphier-ld6b-ref.dts index 926d37e..9b136b8 100644 --- a/arch/arm/dts/uniphier-ld6b-ref.dts +++ b/arch/arm/dts/uniphier-ld6b-ref.dts @@ -70,3 +70,7 @@ &usb1 { status = "okay"; }; + +&nand { + status = "okay"; +}; diff --git a/arch/arm/dts/uniphier-pinctrl.dtsi b/arch/arm/dts/uniphier-pinctrl.dtsi index d5e8aaf..a1b9a6c 100644 --- a/arch/arm/dts/uniphier-pinctrl.dtsi +++ b/arch/arm/dts/uniphier-pinctrl.dtsi @@ -23,6 +23,21 @@ function = "emmc"; }; + pinctrl_ether_mii: ether_mii_grp { + groups = "ether_mii"; + function = "ether_mii"; + }; + + pinctrl_ether_rgmii: ether_rgmii_grp { + groups = "ether_rgmii"; + function = "ether_rgmii"; + }; + + pinctrl_ether_rmii: ether_rmii_grp { + groups = "ether_rmii"; + function = "ether_rmii"; + }; + pinctrl_i2c0: i2c0_grp { groups = "i2c0"; function = "i2c0"; diff --git a/arch/arm/dts/uniphier-pxs3-ref.dts b/arch/arm/dts/uniphier-pxs3-ref.dts index 1118dd7..27de84d 100644 --- a/arch/arm/dts/uniphier-pxs3-ref.dts +++ b/arch/arm/dts/uniphier-pxs3-ref.dts @@ -68,3 +68,7 @@ &usb1 { status = "okay"; }; + +&nand { + status = "okay"; +}; diff --git a/arch/arm/dts/uniphier-sld8-ref.dts b/arch/a
[U-Boot] [PATCH 3/4] ARM: uniphier: split u-boot, dm-pre-reloc out to uniphier-v7-u-boot.dtsi
UniPhier 32-bit SoCs use CONFIG_SPL_OF_CONTROL. So, many nodes must be marked as dm-pre-reloc to prevent fdtgrep from stripping them off. Sprinkling U-Boot specific properties all over the place is painful because DT files are synced with Linux from time to time. Split u-boot,dm-pre-reloc out to uniphier-v7-u-boot.dtsi, which is appended to UniPhier V7 DTS before the build. Signed-off-by: Masahiro Yamada --- arch/arm/dts/uniphier-ld4-ref.dts | 9 -- arch/arm/dts/uniphier-ld4.dtsi| 3 -- arch/arm/dts/uniphier-ld6b-ref.dts| 9 -- arch/arm/dts/uniphier-pro4-ace.dts| 9 -- arch/arm/dts/uniphier-pro4-ref.dts| 9 -- arch/arm/dts/uniphier-pro4-sanji.dts | 21 arch/arm/dts/uniphier-pro4.dtsi | 4 --- arch/arm/dts/uniphier-pro5-4kbox.dts | 9 -- arch/arm/dts/uniphier-pro5.dtsi | 4 --- arch/arm/dts/uniphier-pxs2-gentil.dts | 21 arch/arm/dts/uniphier-pxs2-vodka.dts | 21 arch/arm/dts/uniphier-pxs2.dtsi | 4 --- arch/arm/dts/uniphier-sld8-ref.dts| 9 -- arch/arm/dts/uniphier-sld8.dtsi | 3 -- arch/arm/dts/uniphier-v7-u-boot.dtsi | 61 +++ arch/arm/mach-uniphier/Kconfig| 2 ++ 16 files changed, 63 insertions(+), 135 deletions(-) create mode 100644 arch/arm/dts/uniphier-v7-u-boot.dtsi diff --git a/arch/arm/dts/uniphier-ld4-ref.dts b/arch/arm/dts/uniphier-ld4-ref.dts index 0f50acb..0fd66e7 100644 --- a/arch/arm/dts/uniphier-ld4-ref.dts +++ b/arch/arm/dts/uniphier-ld4-ref.dts @@ -68,12 +68,3 @@ &usb1 { status = "okay"; }; - -/* for U-Boot only */ -&serial0 { - u-boot,dm-pre-reloc; -}; - -&pinctrl_uart0 { - u-boot,dm-pre-reloc; -}; diff --git a/arch/arm/dts/uniphier-ld4.dtsi b/arch/arm/dts/uniphier-ld4.dtsi index b816038..158beae 100644 --- a/arch/arm/dts/uniphier-ld4.dtsi +++ b/arch/arm/dts/uniphier-ld4.dtsi @@ -50,7 +50,6 @@ #size-cells = <1>; ranges; interrupt-parent = <&intc>; - u-boot,dm-pre-reloc; l2: l2-cache@500c { compatible = "socionext,uniphier-system-cache"; @@ -295,11 +294,9 @@ compatible = "socionext,uniphier-ld4-soc-glue", "simple-mfd", "syscon"; reg = <0x5f80 0x2000>; - u-boot,dm-pre-reloc; pinctrl: pinctrl { compatible = "socionext,uniphier-ld4-pinctrl"; - u-boot,dm-pre-reloc; }; }; diff --git a/arch/arm/dts/uniphier-ld6b-ref.dts b/arch/arm/dts/uniphier-ld6b-ref.dts index bdb7f50..926d37e 100644 --- a/arch/arm/dts/uniphier-ld6b-ref.dts +++ b/arch/arm/dts/uniphier-ld6b-ref.dts @@ -70,12 +70,3 @@ &usb1 { status = "okay"; }; - -/* for U-Boot only */ -&serial0 { - u-boot,dm-pre-reloc; -}; - -&pinctrl_uart0 { - u-boot,dm-pre-reloc; -}; diff --git a/arch/arm/dts/uniphier-pro4-ace.dts b/arch/arm/dts/uniphier-pro4-ace.dts index 8161ba8..60a8c33 100644 --- a/arch/arm/dts/uniphier-pro4-ace.dts +++ b/arch/arm/dts/uniphier-pro4-ace.dts @@ -90,12 +90,3 @@ &usb3 { status = "okay"; }; - -/* for U-Boot only */ -&serial0 { - u-boot,dm-pre-reloc; -}; - -&pinctrl_uart0 { - u-boot,dm-pre-reloc; -}; diff --git a/arch/arm/dts/uniphier-pro4-ref.dts b/arch/arm/dts/uniphier-pro4-ref.dts index 360b31d..1b22f80 100644 --- a/arch/arm/dts/uniphier-pro4-ref.dts +++ b/arch/arm/dts/uniphier-pro4-ref.dts @@ -83,12 +83,3 @@ &usb1 { status = "okay"; }; - -/* for U-Boot only */ -&serial0 { - u-boot,dm-pre-reloc; -}; - -&pinctrl_uart0 { - u-boot,dm-pre-reloc; -}; diff --git a/arch/arm/dts/uniphier-pro4-sanji.dts b/arch/arm/dts/uniphier-pro4-sanji.dts index 778e2bb..950f47a 100644 --- a/arch/arm/dts/uniphier-pro4-sanji.dts +++ b/arch/arm/dts/uniphier-pro4-sanji.dts @@ -85,24 +85,3 @@ &usb3 { status = "okay"; }; - -/* for U-Boot only */ -&serial0 { - u-boot,dm-pre-reloc; -}; - -&mio_clk { - u-boot,dm-pre-reloc; -}; - -&emmc { - u-boot,dm-pre-reloc; -}; - -&pinctrl_uart0 { - u-boot,dm-pre-reloc; -}; - -&pinctrl_emmc { - u-boot,dm-pre-reloc; -}; diff --git a/arch/arm/dts/uniphier-pro4.dtsi b/arch/arm/dts/uniphier-pro4.dtsi index 5f39972..ea97e26 100644 --- a/arch/arm/dts/uniphier-pro4.dtsi +++ b/arch/arm/dts/uniphier-pro4.dtsi @@ -58,7 +58,6 @@ #size-cells = <1>; ranges; interrupt-parent = <&intc>; - u-boot,dm-pre-reloc; l2: l2-cache@500c { compatible = "socionext,uniphier-system-cache"; @@ -224,7 +223,6 @@ compatible = "socionext,uniphier-pro4-mioctrl", "simple-mfd", "syscon"; reg = <0x5981 0x800>; -
[U-Boot] [PATCH 1/4] ARM: uniphier: enable DWC3 xHCI driver really
I thought commit d37d31849c6a ("ARM: uniphier: enable DWC3 xHCI driver") enabled CONFIG_USB_DWC3_UNIPHIER, but CONFIG_USB_XHCI_DWC3 was missing in uniphier_v7_defconfig. Re-add. Signed-off-by: Masahiro Yamada --- configs/uniphier_v7_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/uniphier_v7_defconfig b/configs/uniphier_v7_defconfig index 7f2347a..c352d7c 100644 --- a/configs/uniphier_v7_defconfig +++ b/configs/uniphier_v7_defconfig @@ -45,7 +45,9 @@ CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8 CONFIG_SPL_NAND_DENALI=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_UNIPHIER=y CONFIG_USB_STORAGE=y -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] configs: vf610: increase maximum size and enforce correct limit
From: Stefan Agner On Vybrid SoCs U-Boot gets loaded into GFX SRAM which is 512KiB. Currently 32KiB is reserved for the IMX header. However, this is not reflected in the size limit. In v2017.11-rc2 the actual size limit (512KiB-32KiB) has been reached for Colibri VF61, which lead to a successful build of U-Boot but not a working binary. The IMX header is much smaller than 32KiB, typically around 1KiB. Decrease the reserved size to 4KiB and specify the correct U-Boot size limit. Apply this new base address and limit for all Vybrid based boards. Signed-off-by: Stefan Agner --- include/configs/colibri_vf.h | 4 ++-- include/configs/pcm052.h | 4 ++-- include/configs/vf610twr.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h index 8166aa4afb..bf3bbffe24 100644 --- a/include/configs/colibri_vf.h +++ b/include/configs/colibri_vf.h @@ -75,8 +75,8 @@ #define CONFIG_FDTADDR 0x8400 /* We boot from the gfxRAM area of the OCRAM. */ -#define CONFIG_SYS_TEXT_BASE 0x3f408000 -#define CONFIG_BOARD_SIZE_LIMIT524288 +#define CONFIG_SYS_TEXT_BASE 0x3f401000 +#define CONFIG_BOARD_SIZE_LIMIT520192 #define SD_BOOTCMD \ "sdargs=root=/dev/mmcblk0p2 rw rootwait\0" \ diff --git a/include/configs/pcm052.h b/include/configs/pcm052.h index 8144a83db2..060928bd30 100644 --- a/include/configs/pcm052.h +++ b/include/configs/pcm052.h @@ -89,8 +89,8 @@ #define CONFIG_LOADADDR0x8200 /* We boot from the gfxRAM area of the OCRAM. */ -#define CONFIG_SYS_TEXT_BASE 0x3f408000 -#define CONFIG_BOARD_SIZE_LIMIT524288 +#define CONFIG_SYS_TEXT_BASE 0x3f401000 +#define CONFIG_BOARD_SIZE_LIMIT520192 /* if no target-specific extra environment settings were defined by the target, define an empty one */ diff --git a/include/configs/vf610twr.h b/include/configs/vf610twr.h index 3430f27c40..ddfcd6f618 100644 --- a/include/configs/vf610twr.h +++ b/include/configs/vf610twr.h @@ -79,8 +79,8 @@ #define CONFIG_SYS_LOAD_ADDR 0x8200 /* We boot from the gfxRAM area of the OCRAM. */ -#define CONFIG_SYS_TEXT_BASE 0x3f408000 -#define CONFIG_BOARD_SIZE_LIMIT524288 +#define CONFIG_SYS_TEXT_BASE 0x3f401000 +#define CONFIG_BOARD_SIZE_LIMIT520192 /* * We do have 128MB of memory on the Vybrid Tower board. Leave the last -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 4/6] net: gmac_rockchip: Define the gmac grf register struct at gmac_rockchip.c
Hi Philipp, 在 2017/10/6 18:06, Philipp Tomsich 写道: On Thu, 21 Sep 2017, David Wu wrote: If we include both the rk3288_grf.h and rv1108_grf.h, there is a number of compiling error for redefinition. So we define the reg structs of mac_grf at gmac_rockchip.c. Remove the rk**_grf.h files, give them own grf offset for their use. The reg offset should not be open-coded in gmac_rockchip.c. The issue of GRF-header having conflicting definitions was already discussed on the list, when I initially submitted the RK3368 support. The decision back then was as follows: 1/ The GRF files should not contain definitions that are private to the IOMUX (e.g. these should go into the pinctrl-driver), etc. I'll try to move all the iomux definitions at GRF-header into pinctrl-driver, use pinctrl_request* interface to set iomux in some board.c file. 2/ As an intermediate step, we move some of this (i.e. the GMAC_CLK_SEL definitions into gmac_rockchip.c. I still think the 'GMAC_CLK_SEL' bit set should be implemented at clk driver. 3/ The long-term solution will be to either create misc-devices that handle the 'set-to-rgmii' functionality and the 'GMAC_CLK_SEL' bits (although on those, modelling it via the clk-framework might be more appropriate). Could you give me a example code for misc-devices? Please clean up the affected GRF files that cause the conflicts (e.g. the RV1108) and extend the current implementation w/o open-coding a grf-offet. Additional requested changes below. Signed-off-by: David Wu Acked-by: Philipp Tomsich --- drivers/net/gmac_rockchip.c | 144 +++- 1 file changed, 116 insertions(+), 28 deletions(-) diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c index 586ccbf..5f8f0cd 100644 --- a/drivers/net/gmac_rockchip.c +++ b/drivers/net/gmac_rockchip.c @@ -15,9 +15,6 @@ #include #include #include -#include -#include -#include #include #include #include "designware.h" @@ -31,15 +28,37 @@ DECLARE_GLOBAL_DATA_PTR; */ struct gmac_rockchip_platdata { struct dw_eth_pdata dw_eth_pdata; + void *grf; int tx_delay; int rx_delay; }; struct rk_gmac_ops { - int (*fix_mac_speed)(struct dw_eth_dev *priv); + int (*fix_mac_speed)(struct gmac_rockchip_platdata *pdata, + struct dw_eth_dev *priv); void (*set_to_rgmii)(struct gmac_rockchip_platdata *pdata); }; +struct gmac_rockchip_driver_data { + const struct rk_gmac_ops *ops; + unsigned int grf_offset; +}; + +struct rk3288_mac_grf { + u32 soc_con1; + u32 reserved; + u32 soc_con3; +}; + +struct rk3368_mac_grf { + u32 soc_con15; + u32 soc_con16; +}; + +struct rk3399_mac_grf { + u32 soc_con5; + u32 soc_con6; +}; We really can't pollute the GMAC driver with these definitions. The actual values need to come out of the central GRF structure definition. static int gmac_rockchip_ofdata_to_platdata(struct udevice *dev) { @@ -58,10 +77,18 @@ static int gmac_rockchip_ofdata_to_platdata(struct udevice *dev) return designware_eth_ofdata_to_platdata(dev); } -static int rk3288_gmac_fix_mac_speed(struct dw_eth_dev *priv) +static int rk3288_gmac_fix_mac_speed(struct gmac_rockchip_platdata *pdata, + struct dw_eth_dev *priv) { - struct rk3288_grf *grf; + struct rk3288_mac_grf *grf = (struct rk3288_mac_grf *)pdata->grf; int clk; + enum { + RK3288_GMAC_CLK_SEL_SHIFT = 12, + RK3288_GMAC_CLK_SEL_MASK = GENMASK(13, 12), + RK3288_GMAC_CLK_SEL_125M = 0 << 12, + RK3288_GMAC_CLK_SEL_25M = 3 << 12, + RK3288_GMAC_CLK_SEL_2_5M = 2 << 12, + }; switch (priv->phydev->speed) { case 10: @@ -78,15 +105,15 @@ static int rk3288_gmac_fix_mac_speed(struct dw_eth_dev *priv) return -EINVAL; } - grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); rk_clrsetreg(&grf->soc_con1, RK3288_GMAC_CLK_SEL_MASK, clk); return 0; } -static int rk3368_gmac_fix_mac_speed(struct dw_eth_dev *priv) +static int rk3368_gmac_fix_mac_speed(struct gmac_rockchip_platdata *pdata, + struct dw_eth_dev *priv) { - struct rk3368_grf *grf; + struct rk3368_mac_grf *grf = (struct rk3368_mac_grf *)pdata->grf; int clk; enum { RK3368_GMAC_CLK_SEL_2_5M = 2 << 4, @@ -110,16 +137,22 @@ static int rk3368_gmac_fix_mac_speed(struct dw_eth_dev *priv) return -EINVAL; } - grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); rk_clrsetreg(&grf->soc_con15, RK3368_GMAC_CLK_SEL_MASK, clk); return 0; } -static int rk3399_gmac_fix_mac_speed(struct dw_eth_dev *priv) +static int rk3399_gmac_fix_mac_speed(struct gmac_rockchip_platdata *pdata, + struct dw_eth_dev *priv) { - struct rk3399_grf_regs *grf; + struct rk3399_mac_grf *grf = (struct rk3399_mac_grf *)pdata->grf; int clk; + enum { + RK3399_GMAC_CLK_SEL_MASK = GENMASK(6, 4), + RK3399_GMAC_CLK_SEL_
[U-Boot] [PATCH] sf: ensure flash device is in 3-byte address mode
On some boards where the spi flash is not reset during warm reboot, the chip has to be manually set into 3-byte address mode. Signed-off-by: Simon Goldschmidt --- drivers/mtd/spi/sf_internal.h | 2 ++ drivers/mtd/spi/spi_flash.c | 53 +++ 2 files changed, 55 insertions(+) diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h index 839cdbe1b0..06dee0a4ea 100644 --- a/drivers/mtd/spi/sf_internal.h +++ b/drivers/mtd/spi/sf_internal.h @@ -62,6 +62,8 @@ enum spi_nor_option_flags { #define CMD_READ_STATUS1 0x35 #define CMD_READ_CONFIG0x35 #define CMD_FLAG_STATUS0x70 +#define CMD_EN4B 0xB7 +#define CMD_EX4B 0xE9 /* Bank addr access commands */ #ifdef CONFIG_SPI_FLASH_BAR diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 34f68881ed..8db2882075 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -165,6 +165,55 @@ bar_end: } #endif +static int set_4byte(struct spi_flash *flash, const struct spi_flash_info *info, + u8 enable) +{ + int ret; + bool need_wren = false; + u8 cmd; + + if (flash->size <= SPI_FLASH_16MB_BOUN) + return 0; + + switch (JEDEC_MFR(info)) { + case SPI_FLASH_CFI_MFR_STMICRO: + /* Some Micron need WREN command; all will accept it */ + need_wren = true; + case SPI_FLASH_CFI_MFR_MACRONIX: + case SPI_FLASH_CFI_MFR_WINBOND: + ret = spi_claim_bus(flash->spi); + if (ret) { + debug("SF: Unable to claim SPI bus\n"); + return ret; + } + + if (need_wren) { + ret = spi_flash_cmd_write_enable(flash); + if (ret < 0) { + debug("SF: enabling write failed\n"); + spi_release_bus(flash->spi); + return ret; + } + } + + cmd = enable ? CMD_EN4B : CMD_EX4B; + ret = spi_flash_cmd_write(flash->spi, &cmd, 1, NULL, 0); + if (ret) { + debug("SF: fail to %s 4-byte address mode\n", + enable ? "enter" : "exit"); + } + if (need_wren) + if (spi_flash_cmd_write_disable(flash) < 0) + debug("SF: disabling write failed\n"); + spi_release_bus(flash->spi); + return ret; + default: + /* Spansion style handled by bar_write */ + break; + } + return 0; +} + #ifdef CONFIG_SF_DUAL_FLASH static void spi_flash_dual(struct spi_flash *flash, u32 *addr) { @@ -1086,6 +1135,10 @@ int spi_flash_scan(struct spi_flash *flash) flash->flags |= SNOR_F_USE_FSR; #endif + /* disable 4-byte addressing if the device exceeds 16MiB */ + if (flash->size > SPI_FLASH_16MB_BOUN) + set_4byte(flash, info, 0); + /* Configure the BAR - discover bank cmds and read current bank */ #ifdef CONFIG_SPI_FLASH_BAR ret = read_bar(flash, info); -- 2.12.2.windows.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] usb: dwc3: Allocate and flush dwc->ep0_trb in a cache aligned manner
On 10/17/2017 01:10 PM, Faiz Abbas wrote: > Hey, > > On Tuesday 17 October 2017 03:31 PM, Marek Vasut wrote: >> On 10/17/2017 07:25 AM, Faiz Abbas wrote: >>> >>> >>> On Monday 16 October 2017 08:52 PM, Marek Vasut wrote: On 10/16/2017 04:51 PM, Felipe Balbi wrote: > > Hi, > > Faiz Abbas writes: > Marek Vasut writes: >> On 10/16/2017 07:21 AM, Faiz Abbas wrote: >>> A flush of the cache is required before any outbound DMA access can >>> take place. The minimum size that can be flushed from the cache is >>> one cache line size. Therefore, any buffer allocated for DMA should >>> be in multiples of cache line size. >>> >>> Thus, allocate memory for ep0_trb in multiples of cache line size. >>> >>> Also, when local variable trb is assigned to dwc->ep0_trb[1] and >>> used >>> to flush cache, it leads to cache misaligned messages as only the >>> base >>> address dwc->ep0_trb is cache aligned. >>> >>> Therefore, flush cache using ep0_trb_addr which is always cache >>> aligned. >>> >>> Signed-off-by: Faiz Abbas >> >> SGTM, Felipe, can you review this please ? > > is cache maintenance done correctly in u-boot? Isn't the whole idea > of a > coherent memory area that is is non-cacheable, non-bufferable memory? > > Also, why isn't the API itself guaranteeing alignment requirements? > There is no support in u-boot to make a memory area non-cacheable. This is the definition of dma_alloc_coherent() static inline void *dma_alloc_coherent(size_t len, unsigned long *handle) { *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len); return (void *)*handle; } This driver is mostly copied from kernel (where dma_alloc_coherent() is what you describe) and extra flush_cache functions are added because of U-Boot's inability to allocate coherent memory. >>> >>> then that's what should be fixed. No? >>> >> >> You're right but that sounds like a long-term feature which will affect >> a huge part of u-boot. Until it is implemented, I guess this is the best >> way to handle the issue. > > Not my call to make. I'll defer to Marek and Tom > We're deep in RC anyway, so feel free to prepare a fix for next MW . >>> >>> Fix as in rebase same patch for next merge window? >> >> As in, add support for marking memory area noncachable and then use it >> here. It shouldn't be hard, it's only about some MMU table attributes. >> > > dma_alloc_coherent() is used by many architectures (arm, x86, nios2, > nds32). I can implement the feature in arm because I can test it but > someone else needs to do it for the other architectures. Sounds good. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] usb: dwc3: Allocate and flush dwc->ep0_trb in a cache aligned manner
Hey, On Tuesday 17 October 2017 03:31 PM, Marek Vasut wrote: > On 10/17/2017 07:25 AM, Faiz Abbas wrote: >> >> >> On Monday 16 October 2017 08:52 PM, Marek Vasut wrote: >>> On 10/16/2017 04:51 PM, Felipe Balbi wrote: Hi, Faiz Abbas writes: Marek Vasut writes: > On 10/16/2017 07:21 AM, Faiz Abbas wrote: >> A flush of the cache is required before any outbound DMA access can >> take place. The minimum size that can be flushed from the cache is >> one cache line size. Therefore, any buffer allocated for DMA should >> be in multiples of cache line size. >> >> Thus, allocate memory for ep0_trb in multiples of cache line size. >> >> Also, when local variable trb is assigned to dwc->ep0_trb[1] and used >> to flush cache, it leads to cache misaligned messages as only the >> base >> address dwc->ep0_trb is cache aligned. >> >> Therefore, flush cache using ep0_trb_addr which is always cache >> aligned. >> >> Signed-off-by: Faiz Abbas > > SGTM, Felipe, can you review this please ? is cache maintenance done correctly in u-boot? Isn't the whole idea of a coherent memory area that is is non-cacheable, non-bufferable memory? Also, why isn't the API itself guaranteeing alignment requirements? >>> There is no support in u-boot to make a memory area non-cacheable. >>> This is the definition of dma_alloc_coherent() >>> >>> static inline void *dma_alloc_coherent(size_t len, unsigned long >>> *handle) >>> { >>> *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len); >>> return (void *)*handle; >>> } >>> >>> This driver is mostly copied from kernel (where dma_alloc_coherent() is >>> what you describe) and extra flush_cache functions are added because of >>> U-Boot's inability to allocate coherent memory. >> >> then that's what should be fixed. No? >> > > You're right but that sounds like a long-term feature which will affect > a huge part of u-boot. Until it is implemented, I guess this is the best > way to handle the issue. Not my call to make. I'll defer to Marek and Tom >>> We're deep in RC anyway, so feel free to prepare a fix for next MW . >>> >> >> Fix as in rebase same patch for next merge window? > > As in, add support for marking memory area noncachable and then use it > here. It shouldn't be hard, it's only about some MMU table attributes. > dma_alloc_coherent() is used by many architectures (arm, x86, nios2, nds32). I can implement the feature in arm because I can test it but someone else needs to do it for the other architectures. Thanks, Faiz ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] chiliboard config: use CONFIG_DEFAULT_FDT_FILE as env variable
Hi, Please add subsystem/board maintainers to CC list when sending patches. This should give you faster response. You can use scripts/get_maintainer.pl to get list of maintainers / previous submitters. On 17.10.2017 11:45, Michal Oleszczyk wrote: Remove hardcoded ftd file name from environment variables. Use CONFIG_DEFAULT_FDT_FILE macro instead. There is no Signed-off-by line. Please verify your patches with scripts/checkpatch.pl before submitting. --- include/configs/chiliboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/configs/chiliboard.h b/include/configs/chiliboard.h index b7887d90d4..153789e6be 100644 --- a/include/configs/chiliboard.h +++ b/include/configs/chiliboard.h @@ -45,7 +45,7 @@ "boot_fdt=try\0" \ "console=ttyO0,115200n8\0" \ "image=zImage\0" \ - "fdt_file=am335x-chiliboard.dtb\0" \ + "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ "ip_dyn=yes\0" \ "optargs=\0" \ "loadbootscript=" \ After applying patch u-boot does not boot anymore. You need to set CONFIG_DEFAULT_FDT_FILE in configs/chiliboard_defconfig first. Below is boot log: U-Boot SPL 2017.01 (Oct 13 2017 - 17:09:20) Trying to boot from MMC1 reading u-boot.img reading u-boot.img U-Boot 2017.11-rc2-1-g5c398b70cb (Oct 17 2017 - 12:44:59 +0200) CPU : AM335X-GP rev 2.1 I2C: ready DRAM: 256 MiB NAND: 256 MiB MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 *** Warning - bad CRC, using default environment not set. Validating first E-fuse MAC Net: cpsw Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device SD/MMC found on device 0 reading /zImage 5465752 bytes read in 346 ms (15.1 MiB/s) ** Unable to read file / ** Starting kernel ... - -- Regards, Marcin Niestroj ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 6/9] efi_selftest: allow to select a single test for exexution
On 10/17/2017 09:48 AM, Alexander Graf wrote: > > > On 13.10.17 19:33, Heinrich Schuchardt wrote: >> Environment variable efi_selftest is passed as load options >> to the selftest application. It is used to select a single >> test to be executed. >> >> Special value 'list' displays a list of all available tests. >> >> Tests get an on_request property. If this property is set >> the tests are only executed if explicitly requested. >> >> The invocation of efi_selftest is changed to reflect that >> bootefi selftest with efi_selftest = 'list' will call the >> Exit bootservice. >> >> Environment variable bootargs is used as load options >> for all other bootefi payloads. >> >> Signed-off-by: Heinrich Schuchardt >> --- >> v2 >> use an environment variable to choose a test >> --- >> cmd/bootefi.c | 46 - >> include/efi_selftest.h | 18 +++ >> lib/efi_selftest/efi_selftest.c | 90 >> +++-- >> lib/efi_selftest/efi_selftest_console.c | 10 >> lib/efi_selftest/efi_selftest_util.c| 11 +++- >> 5 files changed, 168 insertions(+), 7 deletions(-) >> >> diff --git a/cmd/bootefi.c b/cmd/bootefi.c >> index 18176a1266..2d70137482 100644 >> --- a/cmd/bootefi.c >> +++ b/cmd/bootefi.c >> @@ -6,10 +6,12 @@ >> * SPDX-License-Identifier: GPL-2.0+ >> */ >> >> +#include >> #include >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -50,6 +52,32 @@ static void efi_init_obj_list(void) >> efi_get_time_init(); >> } >> >> +/* >> + * Set the load options of an image from an environment variable. >> + * >> + * @loaded_image_info: the image >> + * @env_var:name of the environment variable >> + */ >> +static void set_load_options(struct efi_loaded_image *loaded_image_info, >> + const char *env_var) >> +{ >> +size_t size; >> +const char *env = env_get(env_var); >> + >> +loaded_image_info->load_options = NULL; >> +loaded_image_info->load_options_size = 0; >> +if (!env) >> +return; >> +size = strlen(env) + 1; >> +loaded_image_info->load_options = calloc(size, sizeof(u16)); >> +if (!loaded_image_info->load_options) { >> +printf("ERROR: Out of memory\n"); >> +return; >> +} >> +utf8_to_utf16(loaded_image_info->load_options, (u8 *)env, size); >> +loaded_image_info->load_options_size = size * 2; >> +} >> + >> static void *copy_fdt(void *fdt) >> { >> u64 fdt_size = fdt_totalsize(fdt); >> @@ -190,6 +218,8 @@ static unsigned long do_bootefi_exec(void *efi, void >> *fdt, >> efi_install_configuration_table(&fdt_guid, NULL); >> } >> >> +/* Transfer environment variable bootargs as load options */ >> +set_load_options(&loaded_image_info, "bootargs"); > > While I really want to see that change, please try not to sneak it in > with the selftest one :). > > Just split that hunk out to a following patch and give it its own patch > description. In case something goes wrong, we'd only need to revert a > small patch then. > >> /* Load the EFI payload */ >> entry = efi_load_pe(efi, &loaded_image_info); >> if (!entry) { >> @@ -237,6 +267,7 @@ static unsigned long do_bootefi_exec(void *efi, void >> *fdt, >> >> exit: >> /* image has returned, loaded-image obj goes *poof*: */ >> +free(loaded_image_info.load_options); > > This too is a change that doesn't fit the patch description? > >> list_del(&loaded_image_info_obj.link); >> >> return ret; >> @@ -301,17 +332,26 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int >> argc, char * const argv[]) >> >> efi_setup_loaded_image(&loaded_image_info, >> &loaded_image_info_obj, >> - bootefi_device_path, bootefi_image_path); >> + NULL, NULL); > > Why? We have neither a device nor an image path here. We do not want to use the values that where set by a prior call. bf19273e81eb efi_loader: Add mem-mapped for fallback provided a logic for helloworld. I will add a preceding patch to move that to efi_setup_loaded_image. Regards Heinrich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] mtd: nand: fsl-ifc: fix support of multiple NAND devices
Currently the chipselect used to identify the corresponding NAND chip is stored at the controller and only set during fsl_ifc_chip_init(). This way, only the last NAND chip is working, as the previous value of cs_nand gets overwritten. In order to solve this issue the chipselect is moved from the controller to the NAND chip structure. Thus, the correct chipselect for each NAND chip operation is used. Tested on hardware with two NAND chips connected to the IFC controller. Signed-off-by: Kurt Kanzenbach --- drivers/mtd/nand/fsl_ifc_nand.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c index bc6bdc9b2c..57737dbe94 100644 --- a/drivers/mtd/nand/fsl_ifc_nand.c +++ b/drivers/mtd/nand/fsl_ifc_nand.c @@ -36,6 +36,7 @@ struct fsl_ifc_mtd { struct device *dev; int bank; /* Chip select bank number*/ + unsigned int cs_nand; /* On which chipsel NAND is connected */ unsigned int bufnum_mask; /* bufnum = page & bufnum_mask */ u8 __iomem *vbase; /* Chip select base virtual address */ }; @@ -48,7 +49,6 @@ struct fsl_ifc_ctrl { /* device info */ struct fsl_ifc regs; void __iomem *addr; /* Address of assigned IFC buffer*/ - unsigned int cs_nand;/* On which chipsel NAND is connected*/ unsigned int page; /* Last page written to / read from */ unsigned int read_bytes; /* Number of bytes read during command */ unsigned int column; /* Saved column from SEQIN */ @@ -296,7 +296,7 @@ static int fsl_ifc_run_command(struct mtd_info *mtd) int i; /* set the chip select for NAND Transaction */ - ifc_out32(&ifc->ifc_nand.nand_csel, ifc_ctrl->cs_nand); + ifc_out32(&ifc->ifc_nand.nand_csel, priv->cs_nand); /* start read/write seq */ ifc_out32(&ifc->ifc_nand.nandseq_strt, @@ -798,8 +798,10 @@ static void fsl_ifc_select_chip(struct mtd_info *mtd, int chip) { } -static int fsl_ifc_sram_init(uint32_t ver) +static int fsl_ifc_sram_init(struct mtd_info *mtd, uint32_t ver) { + struct nand_chip *chip = mtd_to_nand(mtd); + struct fsl_ifc_mtd *priv = nand_get_controller_data(chip); struct fsl_ifc_runtime *ifc = ifc_ctrl->regs.rregs; uint32_t cs = 0, csor = 0, csor_8k = 0, csor_ext = 0; uint32_t ncfgr = 0; @@ -823,7 +825,7 @@ static int fsl_ifc_sram_init(uint32_t ver) return 1; } - cs = ifc_ctrl->cs_nand >> IFC_NAND_CSEL_SHIFT; + cs = priv->cs_nand >> IFC_NAND_CSEL_SHIFT; /* Save CSOR and CSOR_ext */ csor = ifc_in32(&ifc_ctrl->regs.gregs->csor_cs[cs].csor); @@ -850,7 +852,7 @@ static int fsl_ifc_sram_init(uint32_t ver) ifc_out32(&ifc->ifc_nand.col0, 0x0); /* set the chip select for NAND Transaction */ - ifc_out32(&ifc->ifc_nand.nand_csel, ifc_ctrl->cs_nand); + ifc_out32(&ifc->ifc_nand.nand_csel, priv->cs_nand); /* start read seq */ ifc_out32(&ifc->ifc_nand.nandseq_strt, IFC_NAND_SEQ_STRT_FIR_STRT); @@ -912,7 +914,7 @@ static int fsl_ifc_chip_init(int devnum, u8 *addr) if ((cspr & CSPR_V) && (cspr & CSPR_MSEL) == CSPR_MSEL_NAND && (cspr & CSPR_BA) == CSPR_PHYS_ADDR(phys_addr)) { - ifc_ctrl->cs_nand = priv->bank << IFC_NAND_CSEL_SHIFT; + priv->cs_nand = priv->bank << IFC_NAND_CSEL_SHIFT; break; } } @@ -1029,7 +1031,7 @@ static int fsl_ifc_chip_init(int devnum, u8 *addr) ver = ifc_in32(&gregs->ifc_rev); if (ver >= FSL_IFC_V1_1_0) - ret = fsl_ifc_sram_init(ver); + ret = fsl_ifc_sram_init(mtd, ver); if (ret) return ret; -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] chiliboard config: use CONFIG_DEFAULT_FDT_FILE as env variable
Remove hardcoded ftd file name from environment variables. Use CONFIG_DEFAULT_FDT_FILE macro instead. --- include/configs/chiliboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/configs/chiliboard.h b/include/configs/chiliboard.h index b7887d90d4..153789e6be 100644 --- a/include/configs/chiliboard.h +++ b/include/configs/chiliboard.h @@ -45,7 +45,7 @@ "boot_fdt=try\0" \ "console=ttyO0,115200n8\0" \ "image=zImage\0" \ - "fdt_file=am335x-chiliboard.dtb\0" \ + "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ "ip_dyn=yes\0" \ "optargs=\0" \ "loadbootscript=" \ -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v5] Convert CONFIG_NAND_OMAP_GPMC et al to Kconfig
Hello Adam, Am 16.10.2017 um 21:08 schrieb Adam Ford: This converts the following to Kconfig: CONFIG_NAND_OMAP_GPMC CONFIG_NAND_OMAP_GPMC_PREFETCH CONFIG_NAND_OMAP_ELM CONFIG_SPL_NAND_AM33XX_BCH CONFIG_SPL_NAND_SIMPLE (ARCH_OMAP2PLUS only) Signed-off-by: Adam Ford --- V5: Rebase against master V4: Fix missing data from V2-V3 V3: Remove selection from CMD_NAND V2: Rebased on latest Master Fixed a few missing entries where some features lacked dependancies Signed-off-by: Adam Ford Reviewed-by: Heiko Schocher Thanks! bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: h...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] usb: dwc3: Allocate and flush dwc->ep0_trb in a cache aligned manner
On 10/17/2017 07:25 AM, Faiz Abbas wrote: > > > On Monday 16 October 2017 08:52 PM, Marek Vasut wrote: >> On 10/16/2017 04:51 PM, Felipe Balbi wrote: >>> >>> Hi, >>> >>> Faiz Abbas writes: >>> Marek Vasut writes: On 10/16/2017 07:21 AM, Faiz Abbas wrote: > A flush of the cache is required before any outbound DMA access can > take place. The minimum size that can be flushed from the cache is > one cache line size. Therefore, any buffer allocated for DMA should > be in multiples of cache line size. > > Thus, allocate memory for ep0_trb in multiples of cache line size. > > Also, when local variable trb is assigned to dwc->ep0_trb[1] and used > to flush cache, it leads to cache misaligned messages as only the base > address dwc->ep0_trb is cache aligned. > > Therefore, flush cache using ep0_trb_addr which is always cache > aligned. > > Signed-off-by: Faiz Abbas SGTM, Felipe, can you review this please ? >>> >>> is cache maintenance done correctly in u-boot? Isn't the whole idea of a >>> coherent memory area that is is non-cacheable, non-bufferable memory? >>> >>> Also, why isn't the API itself guaranteeing alignment requirements? >>> >> There is no support in u-boot to make a memory area non-cacheable. >> This is the definition of dma_alloc_coherent() >> >> static inline void *dma_alloc_coherent(size_t len, unsigned long *handle) >> { >> *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len); >> return (void *)*handle; >> } >> >> This driver is mostly copied from kernel (where dma_alloc_coherent() is >> what you describe) and extra flush_cache functions are added because of >> U-Boot's inability to allocate coherent memory. > > then that's what should be fixed. No? > You're right but that sounds like a long-term feature which will affect a huge part of u-boot. Until it is implemented, I guess this is the best way to handle the issue. >>> >>> Not my call to make. I'll defer to Marek and Tom >>> >> We're deep in RC anyway, so feel free to prepare a fix for next MW . >> > > Fix as in rebase same patch for next merge window? As in, add support for marking memory area noncachable and then use it here. It shouldn't be hard, it's only about some MMU table attributes. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] i2c: remove DECLARE_GLOBAL_DATA_PTR from i2c-uclass
Hello Masahiro, Am 17.10.2017 um 10:40 schrieb Masahiro Yamada: Hi Heiko. 2017-10-16 15:26 GMT+09:00 Heiko Schocher : Hello Masahiro, Am 13.10.2017 um 12:29 schrieb Masahiro Yamada: No global pointer is used in this file. Signed-off-by: Masahiro Yamada --- drivers/i2c/i2c-uclass.c | 2 -- 1 file changed, 2 deletions(-) Reviewed-by: Heiko Schocher FYI. Looks like this was delegated to you. Yes, travis build is running. bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: h...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] dm: pci: change bus number register setting compliant with Linux
Hi Bin, Thanks a lot for your review! > -Original Message- > From: Bin Meng [mailto:bmeng...@gmail.com] > Sent: 2017年10月17日 17:37 > To: Z.q. Hou > Cc: U-Boot Mailing List ; York Sun > ; Stefan Roese ; Simon Glass > ; Konstantin Porotchkin ; Tuomas > Tynkkynen ; sh...@marvell.com; Mingkai Hu > > Subject: Re: [U-Boot] [PATCH] dm: pci: change bus number register setting > compliant with Linux > > On Tue, Oct 17, 2017 at 3:48 PM, Zhiqiang Hou > wrote: > > From: Minghuan Lian > > > > This patch is to change uboot PCI bus assignement compliant with Linux. > > nits: U-Boot Yes, I'll correct it next version. > > > It means each PCIe controller's bus number is 0, not the current > > maximum PCI bus number, when start to scan this controller. > > > > Signed-off-by: Minghuan Lian > > Signed-off-by: Hou Zhiqiang > > --- > > drivers/pci/pci_auto.c| 6 +++--- > > drivers/pci/pcie_dw_mvebu.c | 1 + > > drivers/pci/pcie_layerscape.c | 2 +- > > drivers/pci/pcie_xilinx.c | 2 ++ > > 4 files changed, 7 insertions(+), 4 deletions(-) > > > > Other than that, > Reviewed-by: Bin Meng Thanks, Zhiqiang ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] simple-bus: remove DECLARE_GLOBAL_DATA_PTR
On Tue, Oct 17, 2017 at 4:37 PM, Masahiro Yamada wrote: > No global pointer is used in this file. > > Signed-off-by: Masahiro Yamada > --- > > drivers/core/simple-bus.c | 2 -- > 1 file changed, 2 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] dm: pci: change bus number register setting compliant with Linux
On Tue, Oct 17, 2017 at 3:48 PM, Zhiqiang Hou wrote: > From: Minghuan Lian > > This patch is to change uboot PCI bus assignement compliant with Linux. nits: U-Boot > It means each PCIe controller's bus number is 0, not the current maximum > PCI bus number, when start to scan this controller. > > Signed-off-by: Minghuan Lian > Signed-off-by: Hou Zhiqiang > --- > drivers/pci/pci_auto.c| 6 +++--- > drivers/pci/pcie_dw_mvebu.c | 1 + > drivers/pci/pcie_layerscape.c | 2 +- > drivers/pci/pcie_xilinx.c | 2 ++ > 4 files changed, 7 insertions(+), 4 deletions(-) > Other than that, Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/2] i2c: stm32f7_i2c: fix usage of useless local variable
From: Patrice Chotard Remove useless local variable "s" and use directly function's parameter "output" Signed-off-by: Patrice Chotard --- v2: rebase on top of v2017.11-rc2 drivers/i2c/stm32f7_i2c.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 346748d..8662487 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -640,7 +640,7 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv, struct stm32_i2c_setup *setup, struct stm32_i2c_timings *output) { - struct stm32_i2c_timings *v, *_v, s; + struct stm32_i2c_timings *v, *_v; struct list_head solutions; int ret; @@ -676,16 +676,10 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv, if (ret) goto exit; - ret = stm32_i2c_choose_solution(setup, &solutions, &s); + ret = stm32_i2c_choose_solution(setup, &solutions, output); if (ret) goto exit; - output->presc = s.presc; - output->scldel = s.scldel; - output->sdadel = s.sdadel; - output->scll = s.scll; - output->sclh = s.sclh; - debug("%s: Presc: %i, scldel: %i, sdadel: %i, scll: %i, sclh: %i\n", __func__, output->presc, output->scldel, output->sdadel, -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/2] stm32f7_i2c fixes
From: Patrice Chotard This series : _ fixes data abort for stm32f7_i2c driver _ removes useless local variable v2: rebase on top of v2017.11-rc2 Christophe Kerello (1): i2c: stm32f7_i2c: fix data abort Patrice Chotard (1): i2c: stm32f7_i2c: fix usage of useless local variable drivers/i2c/stm32f7_i2c.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] i2c: stm32f7_i2c: fix data abort
From: Christophe Kerello As "v" is a local variable in stm32_i2c_choose_solution() "v" has to be copied into "s" to avoid data abort in stm32_i2c_compute_timing(). Signed-off-by: Christophe Kerello Reviewed-by: Patrick DELAUNAY Signed-off-by: Patrice Chotard --- v2: rebase on top of v2017.11-rc2 drivers/i2c/stm32f7_i2c.c | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 196f236..346748d 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -571,6 +571,7 @@ static int stm32_i2c_choose_solution(struct stm32_i2c_setup *setup, u32 dnf_delay; u32 tsync; u16 l, h; + bool sol_found = false; int ret = 0; af_delay_min = setup->analog_filter ? @@ -619,14 +620,15 @@ static int stm32_i2c_choose_solution(struct stm32_i2c_setup *setup, clk_error_prev = clk_error; v->scll = l; v->sclh = h; - s = v; + sol_found = true; + memcpy(s, v, sizeof(*s)); } } } } } - if (!s) { + if (!sol_found) { pr_err("%s: no solution at all\n", __func__); ret = -EPERM; } @@ -638,7 +640,7 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv, struct stm32_i2c_setup *setup, struct stm32_i2c_timings *output) { - struct stm32_i2c_timings *v, *_v, *s; + struct stm32_i2c_timings *v, *_v, s; struct list_head solutions; int ret; @@ -669,21 +671,20 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv, return -EINVAL; } - s = NULL; INIT_LIST_HEAD(&solutions); ret = stm32_i2c_compute_solutions(setup, &solutions); if (ret) goto exit; - ret = stm32_i2c_choose_solution(setup, &solutions, s); + ret = stm32_i2c_choose_solution(setup, &solutions, &s); if (ret) goto exit; - output->presc = s->presc; - output->scldel = s->scldel; - output->sdadel = s->sdadel; - output->scll = s->scll; - output->sclh = s->sclh; + output->presc = s.presc; + output->scldel = s.scldel; + output->sdadel = s.sdadel; + output->scll = s.scll; + output->sclh = s.sclh; debug("%s: Presc: %i, scldel: %i, sdadel: %i, scll: %i, sclh: %i\n", __func__, output->presc, -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] i2c: stm32f7_i2c: fix data abort
Hi Heiko On 10/17/2017 05:45 AM, Heiko Schocher wrote: > Hello patrice, > > Am 11.10.2017 um 15:30 schrieb patrice.chot...@st.com: >> From: Christophe Kerello >> >> As "v" is a local variable in stm32_i2c_choose_solution() >> "v" has to be copied into "s" to avoid data abort in >> stm32_i2c_compute_timing(). >> >> Signed-off-by: Christophe Kerello >> Reviewed-by: Patrick DELAUNAY >> Signed-off-by: Patrice Chotard >> --- >> drivers/i2c/stm32f7_i2c.c | 21 +++-- >> 1 file changed, 11 insertions(+), 10 deletions(-) > > Your patch does not apply to u-boot mainline: > > hs@pollux [ 4:41:31] ttbott> git am -3 mbox > Applying: i2c: stm32f7_i2c: fix data abort > Using index info to reconstruct a base tree... > M drivers/i2c/stm32f7_i2c.c > Falling back to patching base and 3-way merge... > Auto-merging drivers/i2c/stm32f7_i2c.c > CONFLICT (content): Merge conflict in drivers/i2c/stm32f7_i2c.c > error: Failed to merge in the changes. > Patch failed at 0001 i2c: stm32f7_i2c: fix data abort > The copy of the patch that failed is found in: .git/rebase-apply/patch > When you have resolved this problem, run "git am --continue". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". > hs@pollux [ 4:41:31] ttbott> > > For full log see for example on the corvus board: > > http://xeidos.ddns.net/tbot/id_469/html_log.html > > unfold the last three 4 "control" lines ... > > please fix, thanks! I will send a v2 to fix this issue Thanks Patrice > > bye, > Heiko ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] x86: place CONFIG_CMD_BOOTEFI_SELFTEST in natural position
On Tue, Oct 17, 2017 at 2:22 AM, Heinrich Schuchardt wrote: > New options should be placed in defconfig according to the sequence > in .config. > > Fixes: 4a59ada5e60d efi_selftest: enable CONFIG_CMD_BOOTEFI_SELFTEST > Suggested-by: Bin Meng > Signed-off-by: Heinrich Schuchardt > --- > configs/qemu-x86_64_defconfig | 2 +- > configs/qemu-x86_defconfig| 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v4 1/1] x86: provide CONFIG_BUILD_ROM
On Tue, Oct 17, 2017 at 2:08 AM, Heinrich Schuchardt wrote: > Up to now we depended on an exported variable to build u-boot.rom. > We should be able to specify it in the configuration file, too. > > With this patch this becomes possible using the new Kconfig option > CONFIG_BUILD_ROM. > > This option depends on CONFIG_X86 and is selected in > qemu-x86_defconfig and qemu-x86_64_defconfig. > > Cc: Simon Glass > Cc: Bin Meng > Signed-off-by: Heinrich Schuchardt > --- > v4 > Place BUILD_ROM in defconfig according to the sequence of > the generated .config. > Remove default=n > v3 > Rework the documentation. Simon suggested not to deprecate > the export variable. > v2 > Enable CONFIG_BUILD_ROM for qemu-x86_64_defconfig > as suggested by Bin. > Fix typos. > --- > Kconfig | 9 + > Makefile | 2 +- > configs/qemu-x86_64_defconfig | 1 + > configs/qemu-x86_defconfig| 1 + > doc/README.x86| 10 +++--- > 5 files changed, 19 insertions(+), 4 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] x86: conga-qeval20-qa3-e3845-internal-uart_defconfig: Add ACPI resume support
On Tue, Oct 17, 2017 at 2:09 PM, Stefan Roese wrote: > I've missed to add the ACPI resume support to this x86 build target. > This patch adds the ACPI resume support enabling S3 suspend / > resume. > > Signed-off-by: Stefan Roese > Cc: Bin Meng > Cc: Simon Glass > --- > configs/conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 + > 1 file changed, 1 insertion(+) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] i2c: remove DECLARE_GLOBAL_DATA_PTR from i2c-uclass
Hi Heiko. 2017-10-16 15:26 GMT+09:00 Heiko Schocher : > Hello Masahiro, > > Am 13.10.2017 um 12:29 schrieb Masahiro Yamada: >> >> No global pointer is used in this file. >> >> Signed-off-by: Masahiro Yamada >> --- >> >> drivers/i2c/i2c-uclass.c | 2 -- >> 1 file changed, 2 deletions(-) > > > Reviewed-by: Heiko Schocher > FYI. Looks like this was delegated to you. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] simple-bus: remove DECLARE_GLOBAL_DATA_PTR
No global pointer is used in this file. Signed-off-by: Masahiro Yamada --- drivers/core/simple-bus.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c index 14803e3..5acfa5f 100644 --- a/drivers/core/simple-bus.c +++ b/drivers/core/simple-bus.c @@ -7,8 +7,6 @@ #include #include -DECLARE_GLOBAL_DATA_PTR; - struct simple_bus_plat { u32 base; u32 size; -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] dm: pci: change bus number register setting compliant with Linux
From: Minghuan Lian This patch is to change uboot PCI bus assignement compliant with Linux. It means each PCIe controller's bus number is 0, not the current maximum PCI bus number, when start to scan this controller. Signed-off-by: Minghuan Lian Signed-off-by: Hou Zhiqiang --- drivers/pci/pci_auto.c| 6 +++--- drivers/pci/pcie_dw_mvebu.c | 1 + drivers/pci/pcie_layerscape.c | 2 +- drivers/pci/pcie_xilinx.c | 2 ++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index ee9a854bda..87b648cf19 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -181,8 +181,8 @@ void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) /* Configure bus number registers */ dm_pci_write_config8(dev, PCI_PRIMARY_BUS, -PCI_BUS(dm_pci_get_bdf(dev))); - dm_pci_write_config8(dev, PCI_SECONDARY_BUS, sub_bus); +PCI_BUS(dm_pci_get_bdf(dev)) - ctlr->seq); + dm_pci_write_config8(dev, PCI_SECONDARY_BUS, sub_bus - ctlr->seq); dm_pci_write_config8(dev, PCI_SUBORDINATE_BUS, 0xff); if (pci_mem) { @@ -257,7 +257,7 @@ void dm_pciauto_postscan_setup_bridge(struct udevice *dev, int sub_bus) pci_io = ctlr_hose->pci_io; /* Configure bus number registers */ - dm_pci_write_config8(dev, PCI_SUBORDINATE_BUS, sub_bus); + dm_pci_write_config8(dev, PCI_SUBORDINATE_BUS, sub_bus - ctlr->seq); if (pci_mem) { /* Round memory allocator to 1MB boundary */ diff --git a/drivers/pci/pcie_dw_mvebu.c b/drivers/pci/pcie_dw_mvebu.c index 202cfe9d03..a19885501c 100644 --- a/drivers/pci/pcie_dw_mvebu.c +++ b/drivers/pci/pcie_dw_mvebu.c @@ -162,6 +162,7 @@ static uintptr_t set_cfg_address(struct pcie_dw_mvebu *pcie, /* Accessing root port configuration space. */ va_address = (uintptr_t)pcie->ctrl_base; } else { + d = PCI_MASK_BUS(d) | (PCI_BUS(d) - pcie->first_busno); writel(d << 8, pcie->ctrl_base + PCIE_ATU_LOWER_TARGET); va_address = (uintptr_t)pcie->cfg_base; } diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c index 610f85c4e8..48fc4efc75 100644 --- a/drivers/pci/pcie_layerscape.c +++ b/drivers/pci/pcie_layerscape.c @@ -250,7 +250,7 @@ void *ls_pcie_conf_address(struct ls_pcie *pcie, pci_dev_t bdf, if (PCI_BUS(bdf) == bus->seq) return pcie->dbi + offset; - busdev = PCIE_ATU_BUS(PCI_BUS(bdf)) | + busdev = PCIE_ATU_BUS(PCI_BUS(bdf) - bus->seq) | PCIE_ATU_DEV(PCI_DEV(bdf)) | PCIE_ATU_FUNC(PCI_FUNC(bdf)); diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c index 4ba32df516..72fc0f3c43 100644 --- a/drivers/pci/pcie_xilinx.c +++ b/drivers/pci/pcie_xilinx.c @@ -105,6 +105,7 @@ static int pcie_xilinx_read_config(struct udevice *bus, pci_dev_t bdf, void *address; int err; + bdf = PCI_MASK_BUS(bdf) | (PCI_BUS(bdf) - bus->seq); err = pcie_xilinx_config_address(pcie, bdf, offset, &address); if (err < 0) { *valuep = pci_get_ff(size); @@ -148,6 +149,7 @@ static int pcie_xilinx_write_config(struct udevice *bus, pci_dev_t bdf, void *address; int err; + bdf = PCI_MASK_BUS(bdf) | (PCI_BUS(bdf) - bus->seq); err = pcie_xilinx_config_address(pcie, bdf, offset, &address); if (err < 0) return 0; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 7/9] efi_selftest: test reboot by watchdog
On 13.10.17 19:33, Heinrich Schuchardt wrote: > A test is added that verifies that the watchdog timer actually > causes a reboot upon timeout. The test in only executed on > request using > > bootefi selftest 'watchdog reboot' > > Signed-off-by: Heinrich Schuchardt > --- > v2 > no change > --- > lib/efi_selftest/efi_selftest_watchdog.c | 65 > +++- > 1 file changed, 55 insertions(+), 10 deletions(-) > > diff --git a/lib/efi_selftest/efi_selftest_watchdog.c > b/lib/efi_selftest/efi_selftest_watchdog.c > index f8c5404000..a2c11ab1b9 100644 > --- a/lib/efi_selftest/efi_selftest_watchdog.c > +++ b/lib/efi_selftest/efi_selftest_watchdog.c > @@ -5,11 +5,15 @@ > * > * SPDX-License-Identifier: GPL-2.0+ > * > - * This unit test checks that the watchdog timer will not cause > - * a system restart during the timeout period after a timer reset. > + * The 'watchdog timer' unit test checks that the watchdog timer > + * will not cause a system restart during the timeout period after > + * a timer reset. > * > - * Testing that the watchdog timer actually will reset the system > - * after a timeout is not possible within the used framework. > + * The 'watchdog reboot' unit test checks that the watchdog timer > + * actually reboots the system after a timeout. The test is only > + * executed on explicit request. Use the following command: > + * > + * bootefi selftest 'watchdog reboot' > */ > > #include > @@ -28,6 +32,7 @@ static struct efi_event *event_notify; > static struct efi_event *event_wait; > static struct efi_boot_services *boottime; > static struct notify_context notification_context; > +static bool watchdog_reset; > > /* > * Notification function, increments the notfication count if parameter > @@ -88,6 +93,34 @@ static int setup(const efi_handle_t handle, > return EFI_ST_SUCCESS; > } > > +/* > + * Execute the test resetting the watchdog in a timely manner. No reboot > occurs. > + * > + * @handle: handle of the loaded image > + * @systable:system table > + * @return: EFI_ST_SUCCESS for success > + */ > +static int setup_timer(const efi_handle_t handle, > +const struct efi_system_table *systable) > +{ > + watchdog_reset = true; > + return setup(handle, systable); > +} > + > +/* > + * Execute the test without resetting the watchdog. A system reboot occurs. > + * > + * @handle: handle of the loaded image > + * @systable:system table > + * @return: EFI_ST_SUCCESS for success > + */ > +static int setup_reboot(const efi_handle_t handle, > + const struct efi_system_table *systable) > +{ > + watchdog_reset = false; > + return setup(handle, systable); > +} > + > /* > * Tear down unit test. > * > @@ -146,11 +179,14 @@ static int execute(void) > efi_st_error("Setting watchdog timer failed\n"); > return EFI_ST_FAILURE; > } > + if (watchdog_reset) { > /* Set 600 ms timer */ Please indent :) Alex > - ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 600); > - if (ret != EFI_SUCCESS) { > - efi_st_error("Could not set timer\n"); > - return EFI_ST_FAILURE; > + ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, > + 600); > + if (ret != EFI_SUCCESS) { > + efi_st_error("Could not set timer\n"); > + return EFI_ST_FAILURE; > + } > } > /* Set 1350 ms timer */ > ret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1350); > @@ -176,10 +212,19 @@ static int execute(void) > return EFI_ST_SUCCESS; > } > > -EFI_UNIT_TEST(watchdog) = { > +EFI_UNIT_TEST(watchdog1) = { > .name = "watchdog timer", > .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, > - .setup = setup, > + .setup = setup_timer, > + .execute = execute, > + .teardown = teardown, > +}; > + > +EFI_UNIT_TEST(watchdog2) = { > + .name = "watchdog reboot", > + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, > + .setup = setup_reboot, > .execute = execute, > .teardown = teardown, > + .on_request = true, > }; > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 6/9] efi_selftest: allow to select a single test for exexution
On 13.10.17 19:33, Heinrich Schuchardt wrote: > Environment variable efi_selftest is passed as load options > to the selftest application. It is used to select a single > test to be executed. > > Special value 'list' displays a list of all available tests. > > Tests get an on_request property. If this property is set > the tests are only executed if explicitly requested. > > The invocation of efi_selftest is changed to reflect that > bootefi selftest with efi_selftest = 'list' will call the > Exit bootservice. > > Environment variable bootargs is used as load options > for all other bootefi payloads. > > Signed-off-by: Heinrich Schuchardt > --- > v2 > use an environment variable to choose a test > --- > cmd/bootefi.c | 46 - > include/efi_selftest.h | 18 +++ > lib/efi_selftest/efi_selftest.c | 90 > +++-- > lib/efi_selftest/efi_selftest_console.c | 10 > lib/efi_selftest/efi_selftest_util.c| 11 +++- > 5 files changed, 168 insertions(+), 7 deletions(-) > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > index 18176a1266..2d70137482 100644 > --- a/cmd/bootefi.c > +++ b/cmd/bootefi.c > @@ -6,10 +6,12 @@ > * SPDX-License-Identifier: GPL-2.0+ > */ > > +#include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -50,6 +52,32 @@ static void efi_init_obj_list(void) > efi_get_time_init(); > } > > +/* > + * Set the load options of an image from an environment variable. > + * > + * @loaded_image_info: the image > + * @env_var: name of the environment variable > + */ > +static void set_load_options(struct efi_loaded_image *loaded_image_info, > + const char *env_var) > +{ > + size_t size; > + const char *env = env_get(env_var); > + > + loaded_image_info->load_options = NULL; > + loaded_image_info->load_options_size = 0; > + if (!env) > + return; > + size = strlen(env) + 1; > + loaded_image_info->load_options = calloc(size, sizeof(u16)); > + if (!loaded_image_info->load_options) { > + printf("ERROR: Out of memory\n"); > + return; > + } > + utf8_to_utf16(loaded_image_info->load_options, (u8 *)env, size); > + loaded_image_info->load_options_size = size * 2; > +} > + > static void *copy_fdt(void *fdt) > { > u64 fdt_size = fdt_totalsize(fdt); > @@ -190,6 +218,8 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt, > efi_install_configuration_table(&fdt_guid, NULL); > } > > + /* Transfer environment variable bootargs as load options */ > + set_load_options(&loaded_image_info, "bootargs"); While I really want to see that change, please try not to sneak it in with the selftest one :). Just split that hunk out to a following patch and give it its own patch description. In case something goes wrong, we'd only need to revert a small patch then. > /* Load the EFI payload */ > entry = efi_load_pe(efi, &loaded_image_info); > if (!entry) { > @@ -237,6 +267,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt, > > exit: > /* image has returned, loaded-image obj goes *poof*: */ > + free(loaded_image_info.load_options); This too is a change that doesn't fit the patch description? > list_del(&loaded_image_info_obj.link); > > return ret; > @@ -301,17 +332,26 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int > argc, char * const argv[]) > > efi_setup_loaded_image(&loaded_image_info, > &loaded_image_info_obj, > -bootefi_device_path, bootefi_image_path); > +NULL, NULL); Why? > /* >* gd lives in a fixed register which may get clobbered while we >* execute the payload. So save it here and restore it on every >* callback entry >*/ > efi_save_gd(); > + loaded_image_info.image_code_type = EFI_LOADER_CODE; > + loaded_image_info.image_data_type = EFI_LOADER_DATA; Also unrelated? Please split it out. > /* Initialize and populate EFI object list */ > if (!efi_obj_list_initalized) > efi_init_obj_list(); > - return efi_selftest(&loaded_image_info, &systab); > + /* Transfer environment variable efi_selftest as load options */ > + set_load_options(&loaded_image_info, "efi_selftest"); > + /* Execute the test */ > + r = efi_selftest(&loaded_image_info, &systab); > + efi_restore_gd(); > + free(loaded_image_info.load_options); > + list_del(&loaded_image_info_obj.link); That change too is unrelated to the patch description. Please split out. > +
Re: [U-Boot] [PATCH v2 2/9] efi_loader: implement SetWatchdogTimer
On 13.10.17 19:33, Heinrich Schuchardt wrote: > The watchdog is initialized with a 5 minute timeout period. > It can be reset by SetWatchdogTimer. > It is stopped by ExitBoottimeServices. > > Signed-off-by: Heinrich Schuchardt > --- > v2 > code comments updated > --- > cmd/bootefi.c | 1 + > include/efi_loader.h | 4 ++ > lib/efi_loader/Makefile | 2 +- > lib/efi_loader/efi_boottime.c | 17 ++--- > lib/efi_loader/efi_watchdog.c | 86 > +++ > 5 files changed, 95 insertions(+), 15 deletions(-) > create mode 100644 lib/efi_loader/efi_watchdog.c > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > index 478bc116e2..18176a1266 100644 > --- a/cmd/bootefi.c > +++ b/cmd/bootefi.c > @@ -43,6 +43,7 @@ static void efi_init_obj_list(void) > #ifdef CONFIG_GENERATE_SMBIOS_TABLE > efi_smbios_register(); > #endif > + efi_watchdog_register(); > > /* Initialize EFI runtime services */ > efi_reset_system_init(); > diff --git a/include/efi_loader.h b/include/efi_loader.h > index 1b92edbd77..af64b11cee 100644 > --- a/include/efi_loader.h > +++ b/include/efi_loader.h > @@ -163,6 +163,8 @@ int efi_disk_register(void); > int efi_gop_register(void); > /* Called by bootefi to make the network interface available */ > int efi_net_register(void); > +/* Called by bootefi to make the watchdog available */ > +int efi_watchdog_register(void); > /* Called by bootefi to make SMBIOS tables available */ > void efi_smbios_register(void); > > @@ -171,6 +173,8 @@ efi_fs_from_path(struct efi_device_path *fp); > > /* Called by networking code to memorize the dhcp ack package */ > void efi_net_set_dhcp_ack(void *pkt, int len); > +/* Called by efi_set_watchdog_timer to reset the timer */ > +efi_status_t efi_set_watchdog(unsigned long timeout); > > /* Called from places to check whether a timer expired */ > void efi_timer_check(void); > diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile > index ddb978f650..83d879b686 100644 > --- a/lib/efi_loader/Makefile > +++ b/lib/efi_loader/Makefile > @@ -17,7 +17,7 @@ endif > obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o > obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o > obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o > -obj-y += efi_file.o efi_variable.o efi_bootmgr.o > +obj-y += efi_file.o efi_variable.o efi_bootmgr.o efi_watchdog.o > obj-$(CONFIG_LCD) += efi_gop.o > obj-$(CONFIG_DM_VIDEO) += efi_gop.o > obj-$(CONFIG_PARTITIONS) += efi_disk.o > diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c > index 30577f717e..fd8d15655b 100644 > --- a/lib/efi_loader/efi_boottime.c > +++ b/lib/efi_loader/efi_boottime.c > @@ -155,18 +155,6 @@ void efi_signal_event(struct efi_event *event) > event->is_queued = false; > } > > -/* > - * Write a debug message for an EPI API service that is not implemented yet. > - * > - * @funcname function that is not yet implemented > - * @return EFI_UNSUPPORTED > - */ > -static efi_status_t efi_unsupported(const char *funcname) > -{ > - debug("EFI: App called into unimplemented function %s\n", funcname); > - return EFI_EXIT(EFI_UNSUPPORTED); > -} > - > /* > * Raise the task priority level. > * > @@ -1454,6 +1442,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(void > *image_handle, > bootm_disable_interrupts(); > > /* Give the payload some time to boot */ > + efi_set_watchdog(0); > WATCHDOG_RESET(); > > return EFI_EXIT(EFI_SUCCESS); > @@ -1497,7 +1486,7 @@ static efi_status_t EFIAPI efi_stall(unsigned long > microseconds) > /* > * Reset the watchdog timer. > * > - * This function implements the WatchdogTimer service. > + * This function implements the SetWatchdogTimer service. > * See the Unified Extensible Firmware Interface (UEFI) specification > * for details. > * > @@ -1514,7 +1503,7 @@ static efi_status_t EFIAPI > efi_set_watchdog_timer(unsigned long timeout, > { > EFI_ENTRY("%ld, 0x%"PRIx64", %ld, %p", timeout, watchdog_code, > data_size, watchdog_data); > - return efi_unsupported(__func__); > + return EFI_EXIT(efi_set_watchdog(timeout)); > } > > /* > diff --git a/lib/efi_loader/efi_watchdog.c b/lib/efi_loader/efi_watchdog.c > new file mode 100644 > index 00..eb437faf4b > --- /dev/null > +++ b/lib/efi_loader/efi_watchdog.c > @@ -0,0 +1,86 @@ > +/* > + * EFI watchdog > + * > + * Copyright (c) 2017 Heinrich Schuchardt > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > + > +static struct efi_event *watchdog_timer_event; > + > +/* > + * Reset the system when the watchdog event is notified. > + * > + * @event: the watchdog event > + * @context: not used > + */ > +static void EFIAPI efi_watchdog_timer_notify(struct efi_event *event, > + void *context) > +{ > + EFI_ENTRY("%
[U-Boot] [PATCH] mtd/spi: add support for is25lq040b
Signed-off-by: Sean Nyekjaer --- drivers/mtd/spi/spi_flash_ids.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/spi/spi_flash_ids.c b/drivers/mtd/spi/spi_flash_ids.c index 13f64e773f..2cb0196065 100644 --- a/drivers/mtd/spi/spi_flash_ids.c +++ b/drivers/mtd/spi/spi_flash_ids.c @@ -70,6 +70,7 @@ const struct spi_flash_info spi_flash_ids[] = { {"is25lp032", INFO(0x9d6016, 0x0, 64 * 1024,64, 0) }, {"is25lp064", INFO(0x9d6017, 0x0, 64 * 1024, 128, 0) }, {"is25lp128", INFO(0x9d6018, 0x0, 64 * 1024, 256, 0) }, + {"is25lq040b", INFO(0x9d4013, 0x0, 64 * 1024,64, SECT_4K) }, #endif #ifdef CONFIG_SPI_FLASH_MACRONIX /* MACRONIX */ {"mx25l2006e", INFO(0xc22012, 0x0, 64 * 1024, 4, 0) }, -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot