[RFC PATCH v2 7/8] FWU: Add support for FWU Multi Bank Update feature
The FWU Multi Bank Update feature supports updation of firmware images to one of multiple sets(also called banks) of images. The firmware images are clubbed together in banks, with the system booting images from the active bank. Information on the images such as which bank they belong to is stored as part of the metadata structure, which is stored on the same storage media as the firmware images on a dedicated partition. At the time of update, the metadata is read to identify the bank to which the images need to be flashed(update bank). On a successful update, the metadata is modified to set the updated bank as active bank to subsequently boot from. Signed-off-by: Sughosh Ganu --- Changes since V1: * Call function fwu_update_checks_pass to check if the update can be initiated * Do not allow firmware update from efi_init_obj_list as the fwu boot-time checks need to be run include/fwu.h| 18 +++- lib/Kconfig | 32 ++ lib/Makefile | 1 + lib/efi_loader/efi_capsule.c | 198 ++- lib/efi_loader/efi_setup.c | 3 +- lib/fwu_updates/Makefile | 11 ++ lib/fwu_updates/fwu.c| 27 + 7 files changed, 284 insertions(+), 6 deletions(-) create mode 100644 lib/fwu_updates/Makefile diff --git a/include/fwu.h b/include/fwu.h index 2d2e674d6a..bf50fe9277 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -10,14 +10,28 @@ #include -#define FWU_MDATA_VERSION 0x1 +#define FWU_MDATA_GUID \ + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ +0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) + +#define FWU_OS_REQUEST_FW_REVERT_GUID \ + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ +0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) + +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ +0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) #define FWU_MDATA_GUID \ EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) -int fwu_boottime_checks(void); +#define FWU_MDATA_VERSION 0x1 +#define FWU_IMAGE_ACCEPTED 0x1 + u8 fwu_update_checks_pass(void); +int fwu_boottime_checks(void); +int fwu_trial_state_ctr_start(void); int fwu_get_active_index(u32 *active_idx); int fwu_update_active_index(u32 active_idx); diff --git a/lib/Kconfig b/lib/Kconfig index 807a4c6ade..7cb306317c 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -835,3 +835,35 @@ config PHANDLE_CHECK_SEQ When there are multiple device tree nodes with same name, enable this config option to distinguish them using phandles in fdtdec_get_alias_seq() function. + +config FWU_MULTI_BANK_UPDATE + bool "Enable FWU Multi Bank Update Feature" + depends on EFI_HAVE_CAPSULE_SUPPORT + select PARTITION_TYPE_GUID + select EFI_SETUP_EARLY + help + Feature for updating firmware images on platforms having + multiple banks(copies) of the firmware images. One of the + bank is selected for updating all the firmware components + +config FWU_NUM_BANKS + int "Number of Banks defined by the platform" + depends on FWU_MULTI_BANK_UPDATE + help + Define the number of banks of firmware images on a platform + +config FWU_NUM_IMAGES_PER_BANK + int "Number of firmware images per bank" + depends on FWU_MULTI_BANK_UPDATE + help + Define the number of firmware images per bank. This value + should be the same for all the banks. + +config FWU_TRIAL_STATE_CNT + int "Number of times system boots in Trial State" + depends on FWU_MULTI_BANK_UPDATE + default 3 + help + With FWU Multi Bank Update feature enabled, number of times + the platform is allowed to boot in Trial State after an + update. diff --git a/lib/Makefile b/lib/Makefile index 5ddbc77ed6..bc5c1e22fc 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_EFI) += efi/ obj-$(CONFIG_EFI_LOADER) += efi_driver/ obj-$(CONFIG_EFI_LOADER) += efi_loader/ obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest/ +obj-$(CONFIG_FWU_MULTI_BANK_UPDATE) += fwu_updates/ obj-$(CONFIG_LZMA) += lzma/ obj-$(CONFIG_BZIP2) += bzip2/ obj-$(CONFIG_TIZEN) += tizen/ diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 8301eed631..6dfe56bb0f 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -30,6 +31,13 @@ static const efi_guid_t efi_guid_firmware_management_capsule_id = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID; const efi_guid_t efi_guid_firmware_management_protocol = EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID; +const efi_guid_t fwu_guid_os_request_fw_revert = + FWU_OS_REQUEST_FW_REVERT_GUID; +const efi_guid_t fwu_guid_o
[RFC PATCH v2 8/8] FWU: cmd: Add a command to read FWU metadata
Add a command to read the metadata as specified in the FWU specification and print the fields of the metadata. Signed-off-by: Sughosh Ganu --- Changes since V1: * None cmd/Kconfig | 7 ++ cmd/Makefile| 1 + cmd/fwu_mdata.c | 64 + 3 files changed, 72 insertions(+) create mode 100644 cmd/fwu_mdata.c diff --git a/cmd/Kconfig b/cmd/Kconfig index 5b30b13e43..ee8a976b46 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -137,6 +137,13 @@ config CMD_CPU internal name) and clock frequency. Other information may be available depending on the CPU driver. +config CMD_FWU_METADATA + bool "fwu metadata read" + depends on FWU_MULTI_BANK_UPDATE + default y if FWU_MULTI_BANK_UPDATE + help + Command to read the metadata and dump it's contents + config CMD_LICENSE bool "license" select BUILD_BIN2C diff --git a/cmd/Makefile b/cmd/Makefile index 891819ae0f..32958cba43 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -72,6 +72,7 @@ obj-$(CONFIG_CMD_FPGA) += fpga.o obj-$(CONFIG_CMD_FPGAD) += fpgad.o obj-$(CONFIG_CMD_FS_GENERIC) += fs.o obj-$(CONFIG_CMD_FUSE) += fuse.o +obj-$(CONFIG_CMD_FWU_METADATA) += fwu_mdata.o obj-$(CONFIG_CMD_GETTIME) += gettime.o obj-$(CONFIG_CMD_GPIO) += gpio.o obj-$(CONFIG_CMD_HVC) += smccc.o diff --git a/cmd/fwu_mdata.c b/cmd/fwu_mdata.c new file mode 100644 index 00..4049fb186d --- /dev/null +++ b/cmd/fwu_mdata.c @@ -0,0 +1,64 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2021, Linaro Limited + */ + +#include +#include +#include + +#include + +static void print_mdata(struct fwu_mdata *mdata) +{ + int i, j; + struct fwu_image_entry *img_entry; + struct fwu_image_bank_info *img_info; + u32 nimages, nbanks; + + printf("\tFWU Metadata Read\n"); + printf("crc32: %#x\n", mdata->crc32); + printf("version: %#x\n", mdata->version); + printf("active_index: %#x\n", mdata->active_index); + printf("previous_active_index: %#x\n", mdata->previous_active_index); + + nimages = CONFIG_FWU_NUM_IMAGES_PER_BANK; + nbanks = CONFIG_FWU_NUM_BANKS; + printf("\tImage Info\n"); + for (i = 0; i < nimages; i++) { + img_entry = &mdata->img_entry[i]; + printf("\nImage Type Guid: %pUL\n", &img_entry->image_type_uuid); + printf("Location Guid: %pUL\n", &img_entry->location_uuid); + for (j = 0; j < nbanks; j++) { + img_info = &img_entry->img_bank_info[j]; + printf("Image Guid: %pUL\n", &img_info->image_uuid); + printf("Image Acceptance: %#x\n", img_info->accepted); + } + } +} + +int do_fwu_mdata_read(struct cmd_tbl *cmdtp, int flag, +int argc, char * const argv[]) +{ + int ret = CMD_RET_SUCCESS; + struct fwu_mdata *mdata = NULL; + + ret = fwu_get_mdata(&mdata); + if (ret < 0) { + log_err("Unable to get valid FWU metadata\n"); + ret = CMD_RET_FAILURE; + goto out; + } + + print_mdata(mdata); + +out: + free(mdata); + return ret; +} + +U_BOOT_CMD( + fwu_mdata_read, 1, 1, do_fwu_mdata_read, + "Read and print FWU metadata", + "" +); -- 2.17.1
[RFC PATCH v2 6/8] FWU: Add boot time checks as highlighted by the FWU specification
The FWU Multi Bank Update specification requires the Update Agent to carry out certain checks at the time of platform boot. The Update Agent is the component which is responsible for updating the firmware components and maintaining and keeping the metadata in sync. The spec requires that the Update Agent perform the following checks at the time of boot * Sanity check of both the metadata copies maintained by the platform. * Get the boot index passed to U-Boot by the prior stage bootloader and use this value for metadata bookkeeping. * Check if the system is booting in Trial State. If the system boots in the Trial State for more than a specified number of boot counts, change the Active Bank to be booting the platform from. Add these checks in the board initialisation sequence, invoked after relocation. Signed-off-by: Sughosh Ganu --- Changes since V1: * Define a funtion fwu_update_checks_pass to do the checks before initiating the update * Log the status of the boottime checks using boottime_check variable and allow system to boot instead of hanging the platform(fwu_boottime_checks) common/board_r.c | 6 ++ include/fwu.h | 3 + lib/fwu_updates/fwu.c | 163 ++ 3 files changed, 172 insertions(+) create mode 100644 lib/fwu_updates/fwu.c diff --git a/common/board_r.c b/common/board_r.c index 31a59c585a..81678870b9 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -78,6 +78,9 @@ #ifdef CONFIG_EFI_SETUP_EARLY #include #endif +#ifdef CONFIG_FWU_MULTI_BANK_UPDATE +#include +#endif DECLARE_GLOBAL_DATA_PTR; @@ -805,6 +808,9 @@ static init_fnc_t init_sequence_r[] = { #endif #ifdef CONFIG_EFI_SETUP_EARLY (init_fnc_t)efi_init_obj_list, +#endif +#ifdef CONFIG_FWU_MULTI_BANK_UPDATE + fwu_boottime_checks, #endif run_main_loop, }; diff --git a/include/fwu.h b/include/fwu.h index 5ba437798d..2d2e674d6a 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -16,6 +16,9 @@ EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) +int fwu_boottime_checks(void); +u8 fwu_update_checks_pass(void); + int fwu_get_active_index(u32 *active_idx); int fwu_update_active_index(u32 active_idx); int fwu_get_image_alt_num(efi_guid_t image_type_id, u32 update_bank, diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c new file mode 100644 index 00..e964f9b0b1 --- /dev/null +++ b/lib/fwu_updates/fwu.c @@ -0,0 +1,163 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2021, Linaro Limited + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +static u8 trial_state = 0; +static u8 boottime_check = 0; + +static int fwu_trial_state_check(void) +{ + int ret, i; + efi_status_t status; + efi_uintn_t var_size; + u16 trial_state_ctr; + u32 nimages, active_bank, var_attributes, active_idx; + struct fwu_mdata *mdata = NULL; + struct fwu_image_entry *img_entry; + struct fwu_image_bank_info *img_bank_info; + + ret = fwu_get_mdata(&mdata); + if (ret < 0) + return ret; + + ret = 0; + nimages = CONFIG_FWU_NUM_IMAGES_PER_BANK; + active_bank = mdata->active_index; + img_entry = &mdata->img_entry[0]; + for (i = 0; i < nimages; i++) { + img_bank_info = &img_entry[i].img_bank_info[active_bank]; + if (!img_bank_info->accepted) { + trial_state = 1; + break; + } + } + + if (trial_state) { + var_size = (efi_uintn_t)sizeof(trial_state_ctr); + log_info("System booting in Trial State\n"); + var_attributes = EFI_VARIABLE_NON_VOLATILE | + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS; + status = efi_get_variable_int(L"TrialStateCtr", + &efi_global_variable_guid, + &var_attributes, + &var_size, &trial_state_ctr, + NULL); + if (status != EFI_SUCCESS) { + log_err("Unable to read TrialStateCtr variable\n"); + ret = -1; + goto out; + } + + ++trial_state_ctr; + if (trial_state_ctr > CONFIG_FWU_TRIAL_STATE_CNT) { + log_info("Trial State count exceeded. Revert back to previous_active_index\n"); + active_idx = mdata->active_index; + ret = fwu_revert_boot_index(); + if (ret < 0) { + log_err("Unable to revert active_index\n"); + goto out; + } + + tri
[RFC PATCH v2 5/8] EFI: FMP: Add provision to update image's ImageTypeId in image descriptor
The FWU Multi Banks Update feature allows updating different types of updatable firmware images on the platform. These image types are identified using the ImageTypeId GUID value. Add support in the GetImageInfo function of the FMP protocol to get the GUID values for the individual images and populate these in the image descriptor for the corresponding images. Signed-off-by: Sughosh Ganu --- Changes since V1: * Define a new function fwu_plat_get_alt_num for filling up all the dfu partitions with a preset ImageTypeId guid * Remove the distinction made in the earlier version for setting image_type_id as suggested by Heinrich lib/efi_loader/efi_firmware.c | 90 --- 1 file changed, 83 insertions(+), 7 deletions(-) diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index a1b88dbfc2..648342ae72 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -96,6 +97,46 @@ efi_status_t EFIAPI efi_firmware_set_package_info_unsupported( return EFI_EXIT(EFI_UNSUPPORTED); } +static efi_status_t fill_part_guid_array(const efi_guid_t *guid, +efi_guid_t **part_guid_arr) +{ + int i; + int dfu_num = 0; + efi_guid_t *guid_arr; + struct dfu_entity *dfu; + efi_status_t ret = EFI_SUCCESS; + + dfu_init_env_entities(NULL, NULL); + + dfu_num = 0; + list_for_each_entry(dfu, &dfu_list, list) { + dfu_num++; + } + + if (!dfu_num) { + log_warning("Probably dfu_alt_info not defined\n"); + ret = EFI_NOT_READY; + goto out; + } + + *part_guid_arr = malloc(sizeof(efi_guid_t) * dfu_num); + if (!*part_guid_arr) { + ret = EFI_OUT_OF_RESOURCES; + goto out; + } + + guid_arr = *part_guid_arr; + for (i = 0; i < dfu_num; i++) { + guidcpy(guid_arr, guid); + ++guid_arr; + } + +out: + dfu_free_entities(); + + return ret; +} + /** * efi_get_dfu_info - return information about the current firmware image * @this: Protocol instance @@ -104,9 +145,9 @@ efi_status_t EFIAPI efi_firmware_set_package_info_unsupported( * @descriptor_version:Pointer to version number * @descriptor_count: Pointer to number of descriptors * @descriptor_size: Pointer to descriptor size - * package_version:Package version - * package_version_name: Package version's name - * image_type: Image type GUID + * @package_version: Package version + * @package_version_name: Package version's name + * @guid_array:Image type GUID array * * Return information bout the current firmware image in @image_info. * @image_info will consist of a number of descriptors. @@ -122,7 +163,7 @@ static efi_status_t efi_get_dfu_info( efi_uintn_t *descriptor_size, u32 *package_version, u16 **package_version_name, - const efi_guid_t *image_type) + const efi_guid_t *guid_array) { struct dfu_entity *dfu; size_t names_len, total_size; @@ -172,7 +213,7 @@ static efi_status_t efi_get_dfu_info( next = name; list_for_each_entry(dfu, &dfu_list, list) { image_info[i].image_index = dfu->alt + 1; - image_info[i].image_type_id = *image_type; + image_info[i].image_type_id = guid_array[i]; image_info[i].image_id = dfu->alt; /* copy the DFU entity name */ @@ -250,6 +291,7 @@ efi_status_t EFIAPI efi_firmware_fit_get_image_info( u16 **package_version_name) { efi_status_t ret; + efi_guid_t *part_guid_arr = NULL; EFI_ENTRY("%p %p %p %p %p %p %p %p\n", this, image_info_size, image_info, @@ -264,12 +306,19 @@ efi_status_t EFIAPI efi_firmware_fit_get_image_info( !descriptor_size || !package_version || !package_version_name)) return EFI_EXIT(EFI_INVALID_PARAMETER); + ret = fill_part_guid_array(&efi_firmware_image_type_uboot_fit, + &part_guid_arr); + if (ret != EFI_SUCCESS) + goto out; + ret = efi_get_dfu_info(image_info_size, image_info, descriptor_version, descriptor_count, descriptor_size, package_version, package_version_name, - &efi_firmware_image_type_uboot_fit); + part_guid_arr); +out: + free(part_guid_arr); return EFI_EXIT(ret); } @@ -358,7 +407,10 @@ efi_status_t EFIAPI efi_firmware_raw_get_image_info( u32 *package_version, u16 **package_version_name) { + int sta
[RFC PATCH v2 4/8] FWU: STM32MP1: Add support to read boot index from backup register
The FWU Multi Bank Update feature allows the platform to boot the firmware images from one of the partitions(banks). The first stage bootloader(fsbl) passes the value of the boot index, i.e. the bank from which the firmware images were booted from to U-Boot. On the STM32MP157C-DK2 board, this value is passed through one of the SoC's backup register. Add a function to read the boot index value from the backup register. Signed-off-by: Sughosh Ganu --- Changes since V1: * Use the TAMP_BOOTCOUNT register as suggested by Yann Gautier instead of the earlier unused register 10 board/st/stm32mp1/stm32mp1.c | 7 +++ include/fwu.h| 1 + 2 files changed, 8 insertions(+) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 28402fd127..a8543c6410 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -1090,6 +1090,13 @@ int fwu_plat_get_blk_desc(struct blk_desc **desc) return 0; } +void fwu_plat_get_bootidx(void *boot_idx) +{ + u32 *bootidx = boot_idx; + + *bootidx = readl(TAMP_BOOTCOUNT); +} + struct fwu_mdata_ops *get_plat_fwu_mdata_ops(void) { if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) && diff --git a/include/fwu.h b/include/fwu.h index 1e7a1eabff..5ba437798d 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -29,5 +29,6 @@ int fwu_plat_get_update_index(u32 *update_idx); int fwu_plat_get_blk_desc(struct blk_desc **desc); int fwu_plat_get_alt_num(int dev_num, void *identifier); int fwu_plat_fill_partition_guids(efi_guid_t **part_guid_arr); +void fwu_plat_get_bootidx(void *boot_idx); #endif /* _FWU_H_ */ -- 2.17.1
[RFC PATCH v2 3/8] FWU: stm32mp1: Add helper functions for accessing FWU metadata
Add helper functions needed for accessing the FWU metadata which contains information on the updatable images. These functions have been added for the STM32MP157C-DK2 board which has the updatable images on the uSD card, formatted as GPT partitions. Signed-off-by: Sughosh Ganu --- Changes since V1: * Define a new function fwu_plat_get_alt_num using logic suggested by Patrick for returning the alt_num for the partition * Define a new function plat_fill_gpt_partition_guids to fill the guid array with Partition Type guids board/st/stm32mp1/stm32mp1.c| 162 include/fwu.h | 5 + lib/fwu_updates/fwu_mdata_gpt_blk.c | 11 +- 3 files changed, 173 insertions(+), 5 deletions(-) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 84592677e4..28402fd127 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -7,10 +7,13 @@ #include #include +#include #include #include #include +#include #include +#include #include #include #include @@ -23,9 +26,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -938,3 +943,160 @@ static void board_copro_image_process(ulong fw_image, size_t fw_size) } U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process); + +#if defined(CONFIG_FWU_MULTI_BANK_UPDATE) +#include +#include + +int fwu_plat_get_alt_num(int dev_num, void *identifier) +{ + int i; + int ret = -1; + u32 part; + int alt_num = dfu_get_alt_number(); + struct dfu_entity *dfu; + + part = *(u32 *)identifier; + dfu_init_env_entities(NULL, NULL); + + for (i = 0; i < alt_num; i++) { + dfu = dfu_get_entity(i); + + if (!dfu) + continue; + + /* +* Currently, Multi Bank update +* feature is being supported +* only on GPT partitioned +* MMC/SD devices. +*/ + if (dfu->dev_type != DFU_DEV_MMC) + continue; + + if (dfu->layout == DFU_RAW_ADDR && + dfu->data.mmc.dev_num == dev_num && + dfu->data.mmc.part == part) { + ret = dfu->alt; + break; + } + } + + dfu_free_entities(); + + return ret; +} + +static int plat_fill_gpt_partition_guids(struct blk_desc *desc, +efi_guid_t **part_guid_arr) +{ + int i, ret = 0; + u32 part; + struct dfu_entity *dfu; + struct disk_partition info; + efi_guid_t part_type_guid; + int alt_num = dfu_get_alt_number(); + + dfu_init_env_entities(NULL, NULL); + + for (i = 0, part = 1; i < alt_num; i++) { + dfu = dfu_get_entity(i); + + if (!dfu) + continue; + + /* +* Currently, Multi Bank update +* feature is being supported +* only on GPT partitioned +* MMC/SD devices. +*/ + if (dfu->dev_type != DFU_DEV_MMC) + continue; + + if (part_get_info(desc, part, &info)) { + part++; + continue; + } + + uuid_str_to_bin(info.type_guid, part_type_guid.b, + UUID_STR_FORMAT_GUID); + guidcpy((*part_guid_arr + i), &part_type_guid); + part++; + } + + dfu_free_entities(); + + return ret; +} + +int fwu_plat_fill_partition_guids(efi_guid_t **part_guid_arr) +{ + int ret; + struct blk_desc *desc; + + ret = fwu_plat_get_blk_desc(&desc); + if (ret < 0) { + log_err("Block device not found\n"); + return -ENODEV; + } + + return plat_fill_gpt_partition_guids(desc, part_guid_arr); +} + +int fwu_plat_get_update_index(u32 *update_idx) +{ + int ret; + u32 active_idx; + + ret = fwu_get_active_index(&active_idx); + + if (ret < 0) + return -1; + + *update_idx = active_idx ^= 0x1; + + return ret; +} + +int fwu_plat_get_blk_desc(struct blk_desc **desc) +{ + int ret; + struct mmc *mmc; + struct udevice *dev; + + /* +* Initial support is being added for the DK2 +* platform +*/ + if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) && + (of_machine_is_compatible("st,stm32mp157c-dk2"))) { + ret = uclass_get_device(UCLASS_MMC, 0, &dev); + if (ret) + return -1; + + mmc = mmc_get_mmc_dev(dev); + if (!mmc) + return -1; + + if (mmc_init(mmc)) + return -1; + +
[RFC PATCH v2 2/8] FWU: Add FWU metadata access functions for GPT partitioned block devices
In the FWU Multi Bank Update feature, the information about the updatable images is stored as part of the metadata, on a separate partition. Add functions for reading from and writing to the metadata when the updatable images and the metadata are stored on a block device which is formated with GPT based partition scheme. Signed-off-by: Sughosh Ganu --- Changes since V1: * Rename metadata with mdata for all symbols * Use BIT for all macros * Use the logic suggested by Patrick to get the partition type guids and partition guid's instead of defining a new api * Call the platform function fwu_plat_get_alt_num for getting the alt_num for the image partition, instead of the earlier hard-coded approach. * Change the logic in gpt_check_mdata_validity as suggested by Ilias. * Other smaller code style changes suggested by Ilias include/fwu_mdata.h | 2 + lib/fwu_updates/fwu_mdata_gpt_blk.c | 634 2 files changed, 636 insertions(+) create mode 100644 lib/fwu_updates/fwu_mdata_gpt_blk.c diff --git a/include/fwu_mdata.h b/include/fwu_mdata.h index 11eb570012..9e24ab4047 100644 --- a/include/fwu_mdata.h +++ b/include/fwu_mdata.h @@ -99,4 +99,6 @@ struct fwu_mdata_ops { int fwu_get_mdata(struct fwu_mdata **mdata); struct fwu_mdata_ops *get_plat_fwu_mdata_ops(void); +extern struct fwu_mdata_ops fwu_gpt_blk_ops; + #endif /* _FWU_MDATA_H_ */ diff --git a/lib/fwu_updates/fwu_mdata_gpt_blk.c b/lib/fwu_updates/fwu_mdata_gpt_blk.c new file mode 100644 index 00..2dcac0c3d4 --- /dev/null +++ b/lib/fwu_updates/fwu_mdata_gpt_blk.c @@ -0,0 +1,634 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2021, Linaro Limited + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define PRIMARY_PART BIT(0) +#define SECONDARY_PART BIT(1) +#define BOTH_PARTS (PRIMARY_PART | SECONDARY_PART) + +#define MDATA_READ BIT(0) +#define MDATA_WRITEBIT(1) + +#define IMAGE_ACCEPT_SET BIT(0) +#define IMAGE_ACCEPT_CLEAR BIT(1) + +static int gpt_verify_mdata(struct fwu_mdata *mdata, bool pri_part) +{ + u32 calc_crc32; + void *buf; + + buf = &mdata->version; + calc_crc32 = crc32(0, buf, sizeof(*mdata) - sizeof(u32)); + + if (calc_crc32 != mdata->crc32) { + log_err("crc32 check failed for %s FWU metadata partition\n", + pri_part ? "primary" : "secondary"); + return -1; + } + + return 0; +} + +static int gpt_get_mdata_partitions(struct blk_desc *desc, + u16 *primary_mpart, + u16 *secondary_mpart) +{ + int i, ret; + u32 mdata_parts; + efi_guid_t part_type_guid; + struct disk_partition info; + const efi_guid_t fwu_mdata_guid = FWU_MDATA_GUID; + + for (i = 1; i < MAX_SEARCH_PARTITIONS; i++) { + if (part_get_info(desc, i, &info)) + continue; + uuid_str_to_bin(info.type_guid, part_type_guid.b, + UUID_STR_FORMAT_GUID); + + if (!guidcmp(&fwu_mdata_guid, &part_type_guid)) { + ++mdata_parts; + if (!*primary_mpart) + *primary_mpart = i; + else + *secondary_mpart = i; + } + } + + if (mdata_parts != 2) { + log_err("Expect two copies of the FWU metadata instead of %d\n", + mdata_parts); + ret = -EINVAL; + } else { + ret = 0; + } + + return ret; +} + +static int gpt_get_mdata_disk_part(struct blk_desc *desc, + struct disk_partition *info, + u32 part_num) +{ + int ret; + char *mdata_guid_str = "8a7a84a0-8387-40f6-ab41-a8b9a5a60d23"; + + ret = part_get_info(desc, part_num, info); + if (ret < 0) { + log_err("Unable to get the partition info for the FWU metadata part %d", + part_num); + return -1; + } + + /* Check that it is indeed the FWU metadata partition */ + if (!strncmp(info->type_guid, mdata_guid_str, UUID_STR_LEN)) { + /* Found the FWU metadata partition */ + return 0; + } + + return -1; +} + +static int gpt_read_write_mdata(struct blk_desc *desc, + struct fwu_mdata *mdata, + u8 access, u32 part_num) +{ + int ret; + u32 len, blk_start, blkcnt; + struct disk_partition info; + + ALLOC_CACHE_ALIGN_BUFFER_PAD(struct fwu_mdata, mdata_aligned, 1, +desc->blksz); + + ret = gpt_get_mdata_disk_part(desc, &info, part_num)
[RFC PATCH v2 1/8] FWU: Add FWU metadata structure and functions for accessing metadata
In the FWU Multi Bank Update feature, the information about the updatable images is stored as part of the metadata, which is stored on a dedicated partition. Add the metadata structure, and functions to access the metadata. These are generic API's, and implementations can be added based on parameters like how the metadata partition is accessed and what type of storage device houses the metadata. Signed-off-by: Sughosh Ganu --- Changes since V1: * Move all function declarations to a separate header fwu.h * Rename metadata with mdata for all symbols * Drop the parameter in the function fwu_revert_boot_index as suggested by Etienne include/fwu.h | 28 + include/fwu_mdata.h | 102 lib/fwu_updates/fwu_mdata.c | 236 3 files changed, 366 insertions(+) create mode 100644 include/fwu.h create mode 100644 include/fwu_mdata.h create mode 100644 lib/fwu_updates/fwu_mdata.c diff --git a/include/fwu.h b/include/fwu.h new file mode 100644 index 00..e6bc3e6b73 --- /dev/null +++ b/include/fwu.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2021, Linaro Limited + */ + +#if !defined _FWU_H_ +#define _FWU_H_ + +#include + +#include + +#define FWU_MDATA_VERSION 0x1 + +#define FWU_MDATA_GUID \ + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ +0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) + +int fwu_get_active_index(u32 *active_idx); +int fwu_update_active_index(u32 active_idx); +int fwu_get_image_alt_num(efi_guid_t image_type_id, u32 update_bank, + int *alt_num); +int fwu_mdata_check(void); +int fwu_revert_boot_index(void); +int fwu_accept_image(efi_guid_t *img_type_id); +int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank); + +#endif /* _FWU_H_ */ diff --git a/include/fwu_mdata.h b/include/fwu_mdata.h new file mode 100644 index 00..11eb570012 --- /dev/null +++ b/include/fwu_mdata.h @@ -0,0 +1,102 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2021, Linaro Limited + */ + +#if !defined _FWU_MDATA_H_ +#define _FWU_MDATA_H_ + +#include +#include + +#include + +/** + * struct fwu_image_bank_info - firmware image information + * @image_uuid: Guid value of the image in this bank + * @accepted: Acceptance status of the image + * @reserved: Reserved + * + * The structure contains image specific fields which are + * used to identify the image and to specify the image's + * acceptance status + */ +struct fwu_image_bank_info { + efi_guid_t image_uuid; + u32 accepted; + u32 reserved; +}; + +/** + * struct fwu_image_entry - information for a particular type of image + * @image_type_uuid: Guid value for identifying the image type + * @location_uuid: Guid of the storage volume where the image is located + * @img_bank_info: Array containing properties of images + * + * This structure contains information on various types of updatable + * firmware images. Each image type then contains an array of image + * information per bank. + */ +struct fwu_image_entry { + efi_guid_t image_type_uuid; + efi_guid_t location_uuid; + struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS]; +}; + +/** + * struct fwu_mdata - FWU metadata structure for multi-bank updates + * @crc32: crc32 value for the FWU metadata + * @version: FWU metadata version + * @active_index: Index of the bank currently used for booting images + * @previous_active_inde: Index of the bank used before the current bank + *being used for booting + * @img_entry: Array of information on various firmware images that can + * be updated + * + * This structure is used to store all the needed information for performing + * multi bank updates on the platform. This contains info on the bank being + * used to boot along with the information needed for identification of + * individual images + */ +struct fwu_mdata { + u32 crc32; + u32 version; + u32 active_index; + u32 previous_active_index; + + struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK]; +}; + +/** + * @get_active_index: get the current active_index value + * @update_active_index: update the active_index value + * @get_image_alt_num: get the alt number to be used for the image + * @mdata_check: check the validity of the FWU metadata partitions + * @revert_boot_index: set the active_index to previous_active_index + * @set_accept_image: set the accepted bit for the image + * @clear_accept_image: clear the accepted bit for the image + * @get_mdata() - Get a FWU metadata copy + */ +struct fwu_mdata_ops { + int (*get_active_index)(u32 *active_idx); + + int (*update_active_index)(u32 active_idx); + + int (*get_image_alt_num)(efi_guid_t image_type_id, u32 update_bank, +int *alt_num); + + int (*mdata_check)(void); + + int (*revert_boot_index)(void); + +
[RFC PATCH v2 0/8] FWU: Add support for FWU Multi Bank Update feature
The patchset adds support for the FWU Multi Bank Update[1] feature. Certain aspects of the Dependable Boot[2] specification have also been implemented. The FWU multi bank update feature is used for supporting multiple sets(also called banks) of firmware image(s), allowing the platform to boot from a different bank, in case it fails to boot from the active bank. This functionality is supported by keeping the relevant information in a structure called metadata, which provides information on the images. Among other parameters, the metadata structure contains information on the currect active bank that is being used to boot image(s). Functionality is being added to work with the UEFI capsule driver in u-boot. The metadata is read to gather information on the update bank, which is the bank to which the firmware images would be flashed to. On a successful completion of the update of all components, the active bank field in the metadata is updated, to reflect the bank from which the platform will boot on the subsequent boots. Currently, the feature is being enabled on the STM32MP157C-DK2 board which boots a FIP image from a uSD card partitioned with the GPT partioning scheme. This also requires changes in the previous stage of bootloader, which parses the metadata and selects the bank to boot the image(s) from. Support is being added in tf-a(BL2 stage) for the STM32MP157C-DK2 board to boot the active bank images. These changes are under review currently[3]. Changes since V1: * Rename metadata with mdata for all symbols. Applicable for all patches * Move all function declarations to a separate header fwu.h * Drop the patch which added the get_gpt_hdr_parts api, as suggested by Patrick * Use the logic suggested by Patrick to get the partition type guids and partition guid's instead of defining a new api * Drop the parameter in the function fwu_revert_boot_index as suggested by Etienne * Use BIT for all macros * Call the platform function fwu_plat_get_alt_num for getting the alt_num for the image partition, instead of the earlier hard-coded approach. * Change the logic in gpt_check_mdata_validity as suggested by Ilias. * Other smaller code style changes suggested by Ilias * Define a new function fwu_plat_get_alt_num using logic suggested by Patrick for returning the alt_num for the partition * Define a new function plat_fill_gpt_partition_guids to fill the guid array with Partition Type guids * Use the TAMP_BOOTCOUNT register as suggested by Yann Gautier instead of the earlier unused register 10 * Define a new function fwu_plat_get_alt_num for filling up all the dfu partitions with a preset ImageTypeId guid * Remove the distinction made in the earlier version for setting image_type_id as suggested by Heinrich * Define a funtion fwu_update_checks_pass to do the checks before initiating the update * Log the status of the boottime checks using boottime_check variable and allow system to boot instead of hanging the platform(fwu_boottime_checks) * Call function fwu_update_checks_pass to check if the update can be initiated * Do not allow firmware update from efi_init_obj_list as the fwu boot-time checks need to be run Todo's -- 1) Add a test(selftest) for the metadata access. 2) Add a tool for generation of the metadata. Not sure if this needs to be part of the u-boot repository though. 3) Add a tool for generation of the firmware accept/reject dummy capsule. Need to check if this can be added to the mkeficapsule tool in u-boot. [1] - https://developer.arm.com/documentation/den0118/a [2] - https://staging-git.codelinaro.org/linaro/firmware-dual-banked-updates/test [3] - https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/12566 Sughosh Ganu (8): FWU: Add FWU metadata structure and functions for accessing metadata FWU: Add FWU metadata access functions for GPT partitioned block devices FWU: stm32mp1: Add helper functions for accessing FWU metadata FWU: STM32MP1: Add support to read boot index from backup register EFI: FMP: Add provision to update image's ImageTypeId in image descriptor FWU: Add boot time checks as highlighted by the FWU specification FWU: Add support for FWU Multi Bank Update feature FWU: cmd: Add a command to read FWU metadata board/st/stm32mp1/stm32mp1.c| 169 cmd/Kconfig | 7 + cmd/Makefile| 1 + cmd/fwu_mdata.c | 64 +++ common/board_r.c| 6 + include/fwu.h | 51 +++ include/fwu_mdata.h | 104 + lib/Kconfig | 32 ++ lib/Makefile| 1 + lib/efi_loader/efi_capsule.c| 198 - lib/efi_loader/efi_firmware.c | 90 +++- lib/efi_loader/efi_setup.c | 3 +- lib/fwu_updates/Makefile| 11 + lib/fwu_updates/fwu.c | 190 + lib/fwu_updates/fwu_mdata.c
Re: [RFC PATCH v2 0/3] imx8m: move env_get_location for imx8mn and imx8mp at board level
On 2021/12/1 4:17, Tommaso Merciai wrote: This series move env_get_location from soc to board level. As suggested by Michael make no sense to define an unique way for multiple board. One board can boot from emmc and having env on spi flash etc.. Anyways, this function is kept in both imx8mn and imx8mp evk boards instead of being completely dropped. (as suggested by Andrey ) If there are other i.MX8MN/P boards already uses the function, move it to i.mx8mn/p_evk would break other boards. If i.MX8MN/P evk are the other users, it should be ok to move the board code. Regards, Peng. Tommaso Merciai (3): imx8m: drop env_get_location for imx8mn and imx8mp imx: imx8mn_evk: override env_get_location imx: imx8mp_evk: override env_get_location arch/arm/mach-imx/imx8m/soc.c | 39 - board/freescale/imx8mn_evk/imx8mn_evk.c | 35 ++ board/freescale/imx8mp_evk/imx8mp_evk.c | 34 + 3 files changed, 69 insertions(+), 39 deletions(-)
Re: [PATCH] ARM: imx6: dh-imx6: Add update_sf script to install U-Boot into SF
On 2021/11/28 10:52, Marek Vasut wrote: Add script to read U-Boot from SD card and write it to matching locations in the SPI NOR, thus making the SPI NOR bootable. Signed-off-by: Marek Vasut Cc: Christoph Niedermaier Cc: Stefano Babic Acked-by: Peng Fan --- include/configs/dh_imx6.h | 4 1 file changed, 4 insertions(+) diff --git a/include/configs/dh_imx6.h b/include/configs/dh_imx6.h index ee56eb691ad..8183e7debd4 100644 --- a/include/configs/dh_imx6.h +++ b/include/configs/dh_imx6.h @@ -82,6 +82,10 @@ "ramdisk_addr_r=0x1800\0" \ "scriptaddr=0x1400\0" \ "fdtfile=imx6q-dhcom-pdk2.dtb\0"\ + "update_sf=" /* Erase SPI NOR and install U-Boot from SD */ \ + "load mmc 0:1 ${loadaddr} /boot/u-boot-with-spl.imx && "\ + "sf probe && sf erase 0x0 0xa && "\ + "sf write ${loadaddr} 0x400 ${filesize}\0"\ BOOTENV #define CONFIG_BOOTCOMMAND "run distro_bootcmd"
Re: [PATCH 1/1] mmc: unconditionally define mmc_deinit()
On 2021/12/18 17:53, Heinrich Schuchardt wrote: We want to replace '#ifdef' by 'if (IS_ENABLED(CONFIG_...))' in our code. Therefore functions should be defined unconditionally even if they are not implemented. Signed-off-by: Heinrich Schuchardt Acked-by: Peng Fan --- include/mmc.h | 5 - 1 file changed, 5 deletions(-) diff --git a/include/mmc.h b/include/mmc.h index b92e255340..244d2dc592 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -786,12 +786,7 @@ int mmc_init_device(int num); int mmc_init(struct mmc *mmc); int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error); int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data); - -#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \ -CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \ -CONFIG_IS_ENABLED(MMC_HS400_SUPPORT) int mmc_deinit(struct mmc *mmc); -#endif /** * mmc_of_parse() - Parse the device tree to get the capabilities of the host
Re: [PATCH v2] ARM: dts: imx6ull: Use the correct name for ESAI_TX0
On 2021/12/17 19:09, Fabio Estevam wrote: According to the i.MX6ULL Reference Manual, pad CSI_DATA07 may have the ESAI_TX0 functionality, not ESAI_T0. Also, NXP's i.MX Config Tools 10.0 generates dtsi with the MX6ULL_PAD_CSI_DATA07__ESAI_TX0 naming, so fix it accordingly. There are no devicetree users in mainline that use the old name, so just remove the old entry. Fixes: f8ca22b8de32 ("arm: dts: imx6ull: add pinctrl defines") Reported-by: George Makarov Signed-off-by: Fabio Estevam Acked-by: Peng Fan --- Changes since v2: - Use the linux-version fix: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/arch/arm/boot/dts/imx6ull-pinfunc.h?h=next-20211216&id=737e65c7956795b3553781fb7bc82fce1c39503f arch/arm/dts/imx6ull-pinfunc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/imx6ull-pinfunc.h b/arch/arm/dts/imx6ull-pinfunc.h index eb025a9d4759..7328d4ef8559 100644 --- a/arch/arm/dts/imx6ull-pinfunc.h +++ b/arch/arm/dts/imx6ull-pinfunc.h @@ -82,6 +82,6 @@ #define MX6ULL_PAD_CSI_DATA04__ESAI_TX_FS 0x01F4 0x0480 0x 0x9 0x0 #define MX6ULL_PAD_CSI_DATA05__ESAI_TX_CLK0x01F8 0x0484 0x 0x9 0x0 #define MX6ULL_PAD_CSI_DATA06__ESAI_TX5_RX0 0x01FC 0x0488 0x 0x9 0x0 -#define MX6ULL_PAD_CSI_DATA07__ESAI_T00x0200 0x048C 0x 0x9 0x0 +#define MX6ULL_PAD_CSI_DATA07__ESAI_TX0 0x0200 0x048C 0x 0x9 0x0 #endif /* __DTS_IMX6ULL_PINFUNC_H */
Re: [PATCH v3 2/2] board: mntre: imx8mq: Add MNT Reform 2 board support
On 2021-12-14, Patrick Wildt wrote: > The MNT Reform 2 is a modular DIY laptop. In its initial version it > is based on the BoundaryDevices i.MX8MQ SoM. Some parts have been > lifted from BoundaryDevices official U-Boot downstream project. Successfully loaded u-boot, loaded a kernel and .dtb, thanks! Tested-By: Vagrant Cascadian This may not be specific to this patch series, but one problem I had during build is that it doesn't appear to respect the BL31 environment variable that many other platforms support to specify the path to the ATF firmware; is there a way to add that with binman? Similarly, it would be ideal to have environment variables for the other various firmware (lpddr*.bin, signed-hdmi*.bin) needed to build. The Debian u-boot packages build all boards from a single source, and copying *.bin into the top-level directory for each one at the right time seems trickier than telling each build target where the firmware is via environment variables. A couple relatively small things in the patch itself: > diff --git a/include/configs/imx8mq_reform2.h > b/include/configs/imx8mq_reform2.h > new file mode 100644 > index 00..8aed1acfcf > --- /dev/null > +++ b/include/configs/imx8mq_reform2.h ... > +#define CONFIG_EXTRA_ENV_SETTINGS\ > + BOOTENV \ > + "scriptaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ > + "kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ > + "image=Image\0" \ > + "console=ttymxc0,115200\0" \ > + "fdt_addr_r=0x4300\0" \ This should have ramdisk_addr_r, maybe: "ramdisk_addr_r=0x4400\0" Maybe 0x440 is a bit overkill, but anything that that starts sufficiently after fdt_addr_r to leave room for the .dtb file. This is needed to support distro_bootcmd functionality (boot scripts, extlinux.conf support, etc.) where an initrd/initramfs should be an available option. > + "boot_fdt=try\0" \ > + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ This should be something like: "fdtfile=freescale/" CONFIG_DEFAULT_FDT_FILE "\0" \ Or maybe CONFIG_DEFAULT_FDT_FILE should have the vendor directory prepended in configs/imx8mq_reform2_defconfig? Not sure which is more correct, but the boot environment should have the vendor directory included in fdtfile one way or another. Thanks again, it is very nice to be able to build my own bootloader. :) live well, vagrant signature.asc Description: PGP signature
Re: [PATCH 1/8] arm: kirkwood: Pogoplug-V4 : Add DTS files
Hi Andre, On Sat, Dec 18, 2021 at 4:03 PM Andre Przywara wrote: > > On Sat, 18 Dec 2021 14:05:39 -0800 > Tony Dinh wrote: > > Hi Tony, > > > On Sat, Dec 18, 2021 at 8:38 AM Andre Przywara > > wrote: > > > > > > On Fri, 17 Dec 2021 20:23:27 -0800 > > > Tony Dinh wrote: > > > > > > Hi, > > > > > > > Add DTS files for Pogoplug V4 board > > > > > > is there any reason you didn't take the kirkwood-pogoplug-series-4.dts > > > file from the Linux tree? That is the same device, isn't it? > > > > > > Tom will ask you about the upstream status anyway... > > > > There were some differences that I dislike about the Linux tree > > version. Such as the NAND mtd0 is read-only, but we store the envs in > > mtd0 (a few blocks after the u-boot image). It seems we both created > > this DTS about the same time back then in early 2010's using the same > > source as a base. Both versions are identical in substance, but the > > node placements are different. > > > > I'm not familiar with the thinking here. If we take the Linux upstream > > version, are we allowed to modify it? please advise. > > In general the rule is to only take verbatim copies from the Linux > tree. The DT describes the hardware, so there should be no change > needed between U-Boot and Linux. The kernel has more reviewers for DT > changes, so their DTs are of better quality. Definitely, I've also noticed now that the author's name is Linus Walleij. > So if you think the DT in the kernel tree is wrong or missing out, you > should try to send a patch to Linux to get this fixed, then sync the > change into the U-Boot tree. > There is a way to make small changes to the DT that U-Boot sees: You > create a file with the same stub name, but add "-u-boot.dtsi", and put > your changes in there. Look into arch/arm/dts, there are plenty of > examples. However you should have a good reason for doing that, and > ideally would not need that at all. Cool! But I hope we are keeping this approach? I recalled there are some discussions about the FDT and "-u-boot.dtsi" might go away. > Your case is somewhat interesting: the partition isn't technically > write-protected, I guess, it's probably just some Linux safe guarding > measure to prevent accidental overwrites of the firmware. > So read-only in there is strictly speaking not correct, so you should > try to get this fixed in Linux. Ideally U-Boot would add the read-only > property, after it consumed the node, so that the kernel does not stomp > over it (unless you want U-Boot environment access from Linux). > > So in your case you should copy the existing kernel DT, and then > put: "/delete-property/ read-only;" in *-u-boot.dtsi. Sounds like the best way to do it. > What DT do you typically give to the kernel? Something loaded along > with the kernel? Or just the U-Boot DT, using $fdtcontroladdr? (A little bit of history: I've been maintaining the Kirkwood u-boots and Linux kernel for a hobbyist community for many years). The approach we take is to load the kernel uImage, uInitrd, and DTB separately from the rootfs. And also let users access the u-boot envs with fw_setenv and fw_printenv in Debian. Basically, we want users to have maximum flexibility about how u-boot starts the kernel. For example, for whatever reason, the users can also choose to load uImage with appended DTB, then the mtd0 in NAND must be writable, i.e. to allow flashing new u-boot and/or envs image in Linux shell. Thanks, Tony > Cheers, > Andre > > > > > > > > > Signed-off-by: Tony Dinh > > > > --- > > > > > > > > arch/arm/dts/Makefile | 1 + > > > > arch/arm/dts/kirkwood-pogoplug_v4.dts | 145 ++ > > > > 2 files changed, 146 insertions(+) > > > > create mode 100644 arch/arm/dts/kirkwood-pogoplug_v4.dts > > > > > > > > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile > > > > index 7f622fedbd..716c6c0ed2 100644 > > > > --- a/arch/arm/dts/Makefile > > > > +++ b/arch/arm/dts/Makefile > > > > @@ -68,6 +68,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += \ > > > > kirkwood-openrd-client.dtb \ > > > > kirkwood-openrd-ultimate.dtb \ > > > > kirkwood-pogo_e02.dtb \ > > > > + kirkwood-pogoplug_v4.dtb \ > > > > kirkwood-sheevaplug.dtb > > > > > > > > dtb-$(CONFIG_MACH_S900) += \ > > > > diff --git a/arch/arm/dts/kirkwood-pogoplug_v4.dts > > > > b/arch/arm/dts/kirkwood-pogoplug_v4.dts > > > > new file mode 100644 > > > > index 00..b4754f600e > > > > --- /dev/null > > > > +++ b/arch/arm/dts/kirkwood-pogoplug_v4.dts > > > > @@ -0,0 +1,145 @@ > > > > +// SPDX-License-Identifier: GPL-2.0+ > > > > +/* > > > > + * Copyright (C) 2014-2021 Tony Dinh > > > > + * > > > > + * Device tree file for the Pogoplug V4/Mobile > > > > + * > > > > + */ > > > > + > > > > +/dts-v1/; > > > > + > > > > +#include "kirkwood.dtsi" > > > > +#include "kirkwood-6192.dtsi" > > > > + > > > > +/ { > > > > + model = "Pogoplug v4"; > > > > + compatible = "cloudengines,pogoplug-v4", > > > > "cloude
Re: [PATCH 1/8] arm: kirkwood: Pogoplug-V4 : Add DTS files
On Sat, 18 Dec 2021 14:05:39 -0800 Tony Dinh wrote: Hi Tony, > On Sat, Dec 18, 2021 at 8:38 AM Andre Przywara wrote: > > > > On Fri, 17 Dec 2021 20:23:27 -0800 > > Tony Dinh wrote: > > > > Hi, > > > > > Add DTS files for Pogoplug V4 board > > > > is there any reason you didn't take the kirkwood-pogoplug-series-4.dts > > file from the Linux tree? That is the same device, isn't it? > > > > Tom will ask you about the upstream status anyway... > > There were some differences that I dislike about the Linux tree > version. Such as the NAND mtd0 is read-only, but we store the envs in > mtd0 (a few blocks after the u-boot image). It seems we both created > this DTS about the same time back then in early 2010's using the same > source as a base. Both versions are identical in substance, but the > node placements are different. > > I'm not familiar with the thinking here. If we take the Linux upstream > version, are we allowed to modify it? please advise. In general the rule is to only take verbatim copies from the Linux tree. The DT describes the hardware, so there should be no change needed between U-Boot and Linux. The kernel has more reviewers for DT changes, so their DTs are of better quality. So if you think the DT in the kernel tree is wrong or missing out, you should try to send a patch to Linux to get this fixed, then sync the change into the U-Boot tree. There is a way to make small changes to the DT that U-Boot sees: You create a file with the same stub name, but add "-u-boot.dtsi", and put your changes in there. Look into arch/arm/dts, there are plenty of examples. However you should have a good reason for doing that, and ideally would not need that at all. Your case is somewhat interesting: the partition isn't technically write-protected, I guess, it's probably just some Linux safe guarding measure to prevent accidental overwrites of the firmware. So read-only in there is strictly speaking not correct, so you should try to get this fixed in Linux. Ideally U-Boot would add the read-only property, after it consumed the node, so that the kernel does not stomp over it (unless you want U-Boot environment access from Linux). So in your case you should copy the existing kernel DT, and then put: "/delete-property/ read-only;" in *-u-boot.dtsi. What DT do you typically give to the kernel? Something loaded along with the kernel? Or just the U-Boot DT, using $fdtcontroladdr? Cheers, Andre > > > > > > Signed-off-by: Tony Dinh > > > --- > > > > > > arch/arm/dts/Makefile | 1 + > > > arch/arm/dts/kirkwood-pogoplug_v4.dts | 145 ++ > > > 2 files changed, 146 insertions(+) > > > create mode 100644 arch/arm/dts/kirkwood-pogoplug_v4.dts > > > > > > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile > > > index 7f622fedbd..716c6c0ed2 100644 > > > --- a/arch/arm/dts/Makefile > > > +++ b/arch/arm/dts/Makefile > > > @@ -68,6 +68,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += \ > > > kirkwood-openrd-client.dtb \ > > > kirkwood-openrd-ultimate.dtb \ > > > kirkwood-pogo_e02.dtb \ > > > + kirkwood-pogoplug_v4.dtb \ > > > kirkwood-sheevaplug.dtb > > > > > > dtb-$(CONFIG_MACH_S900) += \ > > > diff --git a/arch/arm/dts/kirkwood-pogoplug_v4.dts > > > b/arch/arm/dts/kirkwood-pogoplug_v4.dts > > > new file mode 100644 > > > index 00..b4754f600e > > > --- /dev/null > > > +++ b/arch/arm/dts/kirkwood-pogoplug_v4.dts > > > @@ -0,0 +1,145 @@ > > > +// SPDX-License-Identifier: GPL-2.0+ > > > +/* > > > + * Copyright (C) 2014-2021 Tony Dinh > > > + * > > > + * Device tree file for the Pogoplug V4/Mobile > > > + * > > > + */ > > > + > > > +/dts-v1/; > > > + > > > +#include "kirkwood.dtsi" > > > +#include "kirkwood-6192.dtsi" > > > + > > > +/ { > > > + model = "Pogoplug v4"; > > > + compatible = "cloudengines,pogoplug-v4", > > > "cloudengines,pogoplug-mobile", > > > + "marvell,kirkwood-88f6192", "marvell,kirkwood"; > > > + > > > + memory { > > > + device_type = "memory"; > > > + reg = <0x 0x800>; > > > + }; > > > + > > > + chosen { > > > + bootargs = "console=ttyS0,115200"; > > > + stdout-path = &uart0; > > > + }; > > > + > > > + ocp@f100 { > > > + pinctrl: pin-controller@1 { > > > + pmx_led_green: pmx-led-green { > > > + marvell,pins = "mpp22"; > > > + marvell,function = "gpio"; > > > + }; > > > + pmx_led_red: pmx-led-red { > > > + marvell,pins = "mpp24"; > > > + marvell,function = "gpio"; > > > + }; > > > + pmx_button_eject: pmx-button-eject { > > > + marvell,pins = "mpp29"; > > > + marvell,function = "gpio"; > > > + }; > > > + };
Re: [PATCH 7/8] arm: kirkwood: Pogoplug-V4 : Add board implementation
On Sat, 18 Dec 2021 15:28:49 -0800 Tony Dinh wrote: > Hi Marek, > > On Sat, Dec 18, 2021 at 2:59 PM Marek Behún wrote: > > > > > +#if defined(CONFIG_RESET_PHY_R) > > > +/* Configure and initialize PHY */ > > > +void reset_phy(void) > > > +{ > > > + u16 reg; > > > + int phyaddr; > > > + char *name = "ethernet-controller@72000"; > > > + char *eth0_path = "/ocp@f100/ethernet-controller@72000"; > > > + > > > + if (miiphy_set_current_dev(name)) > > > + return; > > > + > > > + phyaddr = fdt_get_phy_addr(eth0_path); > > > + if (phyaddr < 0) > > > + return; > > > + > > > + /* > > > + * Enable RGMII delay on Tx and Rx for CPU port > > > + * Ref: sec 4.7.2 of chip datasheet > > > + */ > > > + miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 2); > > > + miiphy_read(name, phyaddr, MV88E1116_MAC_CTRL_REG, ®); > > > + reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); > > > + miiphy_write(name, phyaddr, MV88E1116_MAC_CTRL_REG, reg); > > > + miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 0); > > > + > > > + /* reset the phy */ > > > + miiphy_reset(name, phyaddr); > > > + > > > + printf("88E1116 Initialized on %s\n", name); > > > +} > > > > This PHY has a driver in U-Boot, drivers/net/phy/marvell.c, > > structure M88E1118_driver. > > > > There the m88e1118_config() method already does one thing of what you > > are doing here: enabling rgmii delays. It also sets LED config, but > > does not reset the PHY. You can add call to phy_reset() there... > > Thanks for the advice! That would be best. > > Will look into this for another separate patch, to see if it is > possible to factor out similar code in other Kirkwood boards too. Also implement the .readext and .writeext methods as M88E151x_driver and you won't need to alwyas change page by hand. Marek
Re: [PATCH 2/6] moveconfig: Convert to ArgumentParser
Hi Heinrich, On Sat, 18 Dec 2021 at 15:32, Heinrich Schuchardt wrote: > > On 12/18/21 22:54, Simon Glass wrote: > > This is a newer library and is now preferred for Python scripts. Update > > the code to use it instead of optparse > > > > Use 'args' instead of 'options' throughout, since this is the term used > > in that module. Also it helps to avoid confusion with CONFIG options, a > > term that is used in this file. > > > > Signed-off-by: Simon Glass > > The patch is not applicable to origin/master: > > $ git am 02.patch > Applying: moveconfig: Convert to ArgumentParser > error: patch failed: tools/moveconfig.py:1648 > error: tools/moveconfig.py: patch does not apply > Patch failed at 0001 moveconfig: Convert to ArgumentParser > Sorry, this patch is on top of the previous series which is based on -next. Please see u-boot-dm/move-working for the full tree. Regards, Simon
Re: [PATCH 7/8] arm: kirkwood: Pogoplug-V4 : Add board implementation
Hi Marek, On Sat, Dec 18, 2021 at 2:59 PM Marek Behún wrote: > > > +#if defined(CONFIG_RESET_PHY_R) > > +/* Configure and initialize PHY */ > > +void reset_phy(void) > > +{ > > + u16 reg; > > + int phyaddr; > > + char *name = "ethernet-controller@72000"; > > + char *eth0_path = "/ocp@f100/ethernet-controller@72000"; > > + > > + if (miiphy_set_current_dev(name)) > > + return; > > + > > + phyaddr = fdt_get_phy_addr(eth0_path); > > + if (phyaddr < 0) > > + return; > > + > > + /* > > + * Enable RGMII delay on Tx and Rx for CPU port > > + * Ref: sec 4.7.2 of chip datasheet > > + */ > > + miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 2); > > + miiphy_read(name, phyaddr, MV88E1116_MAC_CTRL_REG, ®); > > + reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); > > + miiphy_write(name, phyaddr, MV88E1116_MAC_CTRL_REG, reg); > > + miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 0); > > + > > + /* reset the phy */ > > + miiphy_reset(name, phyaddr); > > + > > + printf("88E1116 Initialized on %s\n", name); > > +} > > This PHY has a driver in U-Boot, drivers/net/phy/marvell.c, > structure M88E1118_driver. > > There the m88e1118_config() method already does one thing of what you > are doing here: enabling rgmii delays. It also sets LED config, but > does not reset the PHY. You can add call to phy_reset() there... Thanks for the advice! That would be best. Will look into this for another separate patch, to see if it is possible to factor out similar code in other Kirkwood boards too. Thanks, Tony > > Marek
Re: [PATCH 7/8] arm: kirkwood: Pogoplug-V4 : Add board implementation
> +#if defined(CONFIG_RESET_PHY_R) > +/* Configure and initialize PHY */ > +void reset_phy(void) > +{ > + u16 reg; > + int phyaddr; > + char *name = "ethernet-controller@72000"; > + char *eth0_path = "/ocp@f100/ethernet-controller@72000"; > + > + if (miiphy_set_current_dev(name)) > + return; > + > + phyaddr = fdt_get_phy_addr(eth0_path); > + if (phyaddr < 0) > + return; > + > + /* > + * Enable RGMII delay on Tx and Rx for CPU port > + * Ref: sec 4.7.2 of chip datasheet > + */ > + miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 2); > + miiphy_read(name, phyaddr, MV88E1116_MAC_CTRL_REG, ®); > + reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); > + miiphy_write(name, phyaddr, MV88E1116_MAC_CTRL_REG, reg); > + miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 0); > + > + /* reset the phy */ > + miiphy_reset(name, phyaddr); > + > + printf("88E1116 Initialized on %s\n", name); > +} This PHY has a driver in U-Boot, drivers/net/phy/marvell.c, structure M88E1118_driver. There the m88e1118_config() method already does one thing of what you are doing here: enabling rgmii delays. It also sets LED config, but does not reset the PHY. You can add call to phy_reset() there... Marek
Re: [PATCH] i2c: mvtwsi: Swab the register address if its size is > 1
On Sat, 18 Dec 2021 14:42:51 +0100 Stefan Roese wrote: > Hi Heiko, > > On 11/18/21 09:18, Stefan Roese wrote: > > Testing on Armada XP with an EEPROM using register address with size > > of 2 has shown, that the register address bytes are sent to the I2C > > EEPROM in the incorrect order. This patch swabs the address bytes so > > that the correct address is transferred to the I2C device. > > > > BTW: This worked without any issues before migrating Armada XP to > > DM I2C. > > > > Signed-off-by: Stefan Roese > > Cc: Heiko Schocher > > Cc: Samuel Holland > > Cc: Baruch Siach > > Cc: Pali Rohár > > Cc: Marek Behún > > --- > > It would be good if other users of this I2C driver could test this change > > with e.g. I2C EEPROM devices using 2 bytes (or more) for addressing. > > Could you and other please take a look at this? Would be great, if this > could be pulled in the next merge window. Tested-by: Marek Behún
Re: [PATCH 2/6] moveconfig: Convert to ArgumentParser
On 12/18/21 22:54, Simon Glass wrote: This is a newer library and is now preferred for Python scripts. Update the code to use it instead of optparse Use 'args' instead of 'options' throughout, since this is the term used in that module. Also it helps to avoid confusion with CONFIG options, a term that is used in this file. Signed-off-by: Simon Glass The patch is not applicable to origin/master: $ git am 02.patch Applying: moveconfig: Convert to ArgumentParser error: patch failed: tools/moveconfig.py:1648 error: tools/moveconfig.py: patch does not apply Patch failed at 0001 moveconfig: Convert to ArgumentParser Best regards Heinrich
Re: [PATCH 3/6] moveconfig: Drop check for old Python
On 12/18/21 22:54, Simon Glass wrote: Python 2 is not supported anymore and Python 3 has had subprocess.DEVNULL since version 3.3 which was released in 2012. Drop the unnecessary check. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- tools/moveconfig.py | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 521297f7d58..0b33f3190e3 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -91,14 +91,6 @@ SIZES = { } ### helper functions ### -def get_devnull(): -"""Get the file object of '/dev/null' device.""" -try: -devnull = subprocess.DEVNULL # py3k -except AttributeError: -devnull = open(os.devnull, 'wb') -return devnull - def check_top_directory(): """Exit if we are not at the top of source directory.""" for f in ('README', 'Licenses'): @@ -1083,7 +1075,7 @@ class Slots: """ self.args = args self.slots = [] -devnull = get_devnull() +devnull = subprocess.DEVNULL make_cmd = get_make_cmd() for i in range(args.jobs): self.slots.append(Slot(toolchains, configs, args, progress,
Re: [PATCH 1/6] moveconfig: Use single quotes
On 12/18/21 22:54, Simon Glass wrote: Quite a few places use double quotes. Fix this to be consistent with other Python code in U-Boot. Signed-off-by: Simon Glass --- tools/moveconfig.py | 72 ++--- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index a86c07caa6e..ab2d4905db5 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -71,23 +71,23 @@ CONFIG_DATABASE = 'moveconfig.db' CONFIG_LEN = len('CONFIG_') SIZES = { -"SZ_1":0x0001, "SZ_2":0x0002, -"SZ_4":0x0004, "SZ_8":0x0008, -"SZ_16": 0x0010, "SZ_32": 0x0020, -"SZ_64": 0x0040, "SZ_128": 0x0080, -"SZ_256": 0x0100, "SZ_512": 0x0200, -"SZ_1K": 0x0400, "SZ_2K": 0x0800, -"SZ_4K": 0x1000, "SZ_8K": 0x2000, -"SZ_16K": 0x4000, "SZ_32K": 0x8000, -"SZ_64K": 0x0001, "SZ_128K": 0x0002, -"SZ_256K": 0x0004, "SZ_512K": 0x0008, -"SZ_1M": 0x0010, "SZ_2M": 0x0020, -"SZ_4M": 0x0040, "SZ_8M": 0x0080, -"SZ_16M": 0x0100, "SZ_32M": 0x0200, -"SZ_64M": 0x0400, "SZ_128M": 0x0800, -"SZ_256M": 0x1000, "SZ_512M": 0x2000, -"SZ_1G": 0x4000, "SZ_2G": 0x8000, -"SZ_4G": 0x1 +'SZ_1':0x0001, 'SZ_2':0x0002, +'SZ_4':0x0004, 'SZ_8':0x0008, +'SZ_16': 0x0010, 'SZ_32': 0x0020, +'SZ_64': 0x0040, 'SZ_128': 0x0080, +'SZ_256': 0x0100, 'SZ_512': 0x0200, +'SZ_1K': 0x0400, 'SZ_2K': 0x0800, +'SZ_4K': 0x1000, 'SZ_8K': 0x2000, +'SZ_16K': 0x4000, 'SZ_32K': 0x8000, +'SZ_64K': 0x0001, 'SZ_128K': 0x0002, +'SZ_256K': 0x0004, 'SZ_512K': 0x0008, +'SZ_1M': 0x0010, 'SZ_2M': 0x0020, +'SZ_4M': 0x0040, 'SZ_8M': 0x0080, +'SZ_16M': 0x0100, 'SZ_32M': 0x0200, +'SZ_64M': 0x0400, 'SZ_128M': 0x0800, +'SZ_256M': 0x1000, 'SZ_512M': 0x2000, +'SZ_1G': 0x4000, 'SZ_2G': 0x8000, +'SZ_4G': 0x1 } ### helper functions ### @@ -536,12 +536,12 @@ def try_expand(line): aeval = asteval.Interpreter( usersyms=SIZES, minimal=True ) cfg, val = re.split("=", line) val= val.strip('\"') -if re.search("[*+-/]|<<|SZ_+|\(([^\)]+)\)", val): +if re.search(r'[*+-/]|<<|SZ_+|\(([^\)]+)\)', val): In the commit message you could have mentioned that you mark a string as regular expression to fix a pylint warning. newval = hex(aeval(val)) -print("\tExpanded expression %s to %s" % (val, newval)) +print('\tExpanded expression %s to %s' % (val, newval)) return cfg+'='+newval except: -print("\tFailed to expand expression in %s" % line) +print('\tFailed to expand expression in %s' % line) return line @@ -735,10 +735,10 @@ class KconfigParser: actlog = "Move '%s'" % value log_color = COLOR_LIGHT_GREEN elif action == ACTION_NO_ENTRY: -actlog = "%s is not defined in Kconfig. Do nothing." % value +actlog = '%s is not defined in Kconfig. Do nothing.' % value log_color = COLOR_LIGHT_BLUE elif action == ACTION_NO_ENTRY_WARN: -actlog = "%s is not defined in Kconfig (suspicious). Do nothing." % value +actlog = '%s is not defined in Kconfig (suspicious). Do nothing.' % value log_color = COLOR_YELLOW suspicious = True elif action == ACTION_NO_CHANGE: @@ -746,10 +746,10 @@ class KconfigParser: % value log_color = COLOR_LIGHT_PURPLE elif action == ACTION_SPL_NOT_EXIST: -actlog = "SPL is not enabled for this defconfig. Skip." +actlog = 'SPL is not enabled for this defconfig. Skip.' log_color = COLOR_PURPLE else: -sys.exit("Internal Error. This should not happen.") +sys.exit('Internal Error. This should not happen.') log += color_text(self.options.color, log_color, actlog) + '\n' @@ -930,7 +930,7 @@ class Slot: elif self.state == STATE_SAVEDEFCONFIG: self.update_defconfig() else: -sys.exit("Internal Error. This should not happen.") +sys.exit('Internal Error. This should not happen.') return True if self.state == STATE_IDLE else False @@ -938,7 +938,7 @@ class Slot: """Handle error cases.""" self.log += color_text(self.options.color, COLOR_LIGHT_RED, - "Failed to process.\n") + 'Failed to process.\n')
Re: [PATCH 1/8] arm: kirkwood: Pogoplug-V4 : Add DTS files
HI Andre, On Sat, Dec 18, 2021 at 8:38 AM Andre Przywara wrote: > > On Fri, 17 Dec 2021 20:23:27 -0800 > Tony Dinh wrote: > > Hi, > > > Add DTS files for Pogoplug V4 board > > is there any reason you didn't take the kirkwood-pogoplug-series-4.dts > file from the Linux tree? That is the same device, isn't it? > > Tom will ask you about the upstream status anyway... There were some differences that I dislike about the Linux tree version. Such as the NAND mtd0 is read-only, but we store the envs in mtd0 (a few blocks after the u-boot image). It seems we both created this DTS about the same time back then in early 2010's using the same source as a base. Both versions are identical in substance, but the node placements are different. I'm not familiar with the thinking here. If we take the Linux upstream version, are we allowed to modify it? please advise. Thanks, Tony > Cheers, > Andre > > > > > Signed-off-by: Tony Dinh > > --- > > > > arch/arm/dts/Makefile | 1 + > > arch/arm/dts/kirkwood-pogoplug_v4.dts | 145 ++ > > 2 files changed, 146 insertions(+) > > create mode 100644 arch/arm/dts/kirkwood-pogoplug_v4.dts > > > > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile > > index 7f622fedbd..716c6c0ed2 100644 > > --- a/arch/arm/dts/Makefile > > +++ b/arch/arm/dts/Makefile > > @@ -68,6 +68,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += \ > > kirkwood-openrd-client.dtb \ > > kirkwood-openrd-ultimate.dtb \ > > kirkwood-pogo_e02.dtb \ > > + kirkwood-pogoplug_v4.dtb \ > > kirkwood-sheevaplug.dtb > > > > dtb-$(CONFIG_MACH_S900) += \ > > diff --git a/arch/arm/dts/kirkwood-pogoplug_v4.dts > > b/arch/arm/dts/kirkwood-pogoplug_v4.dts > > new file mode 100644 > > index 00..b4754f600e > > --- /dev/null > > +++ b/arch/arm/dts/kirkwood-pogoplug_v4.dts > > @@ -0,0 +1,145 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Copyright (C) 2014-2021 Tony Dinh > > + * > > + * Device tree file for the Pogoplug V4/Mobile > > + * > > + */ > > + > > +/dts-v1/; > > + > > +#include "kirkwood.dtsi" > > +#include "kirkwood-6192.dtsi" > > + > > +/ { > > + model = "Pogoplug v4"; > > + compatible = "cloudengines,pogoplug-v4", > > "cloudengines,pogoplug-mobile", > > + "marvell,kirkwood-88f6192", "marvell,kirkwood"; > > + > > + memory { > > + device_type = "memory"; > > + reg = <0x 0x800>; > > + }; > > + > > + chosen { > > + bootargs = "console=ttyS0,115200"; > > + stdout-path = &uart0; > > + }; > > + > > + ocp@f100 { > > + pinctrl: pin-controller@1 { > > + pmx_led_green: pmx-led-green { > > + marvell,pins = "mpp22"; > > + marvell,function = "gpio"; > > + }; > > + pmx_led_red: pmx-led-red { > > + marvell,pins = "mpp24"; > > + marvell,function = "gpio"; > > + }; > > + pmx_button_eject: pmx-button-eject { > > + marvell,pins = "mpp29"; > > + marvell,function = "gpio"; > > + }; > > + }; > > + > > + serial@12000 { > > + status = "ok"; > > + }; > > + > > + sata@8 { > > + status = "okay"; > > + nr-ports = <2>; > > + }; > > + > > + mvsdio@9 { > > + pinctrl-0 = <&pmx_sdio>; > > + pinctrl-names = "default"; > > + status = "okay"; > > + cd-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>; > > + /* No WP GPIO */ > > + }; > > + }; > > + > > + gpio-leds { > > + compatible = "gpio-leds"; > > + pinctrl-0 = <&pmx_led_red &pmx_led_green>; > > + pinctrl-names = "default"; > > + > > + health { > > + label = "status:green:health"; > > + gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; > > + default-state = "keep"; > > + }; > > + fault { > > + label = "status:red:fault"; > > + gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; > > + }; > > + }; > > + > > + gpio_keys { > > + compatible = "gpio-keys"; > > + #address-cells = <1>; > > + #size-cells = <0>; > > + pinctrl-0 = <&pmx_button_eject>; > > + pinctrl-names = "default"; > > + > > + button@1 { > > + label = "Eject Button"; > > + linux,code = ; > > + gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; > > + }; > > + }; > > + > > +}; > > + > > +&nand { > > + status = "okay"; > >
[PATCH 6/6] moveconfig: Fix some pylint errors
There are over 200 errors in this file. Fix some of them, starting at the beginning of the file. Future work can continue this effort. Signed-off-by: Simon Glass --- tools/moveconfig.py | 206 +++- 1 file changed, 110 insertions(+), 96 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index c41aa4ee283..35fe6710d70 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -13,6 +13,7 @@ See doc/develop/moveconfig.rst for documentation. from argparse import ArgumentParser import asteval import collections +from contextlib import ExitStack import copy import difflib import doctest @@ -93,14 +94,14 @@ SIZES = { ### helper functions ### def check_top_directory(): """Exit if we are not at the top of source directory.""" -for f in ('README', 'Licenses'): -if not os.path.exists(f): +for fname in 'README', 'Licenses': +if not os.path.exists(fname): sys.exit('Please run at the top of source directory.') def check_clean_directory(): """Exit if the source tree is not clean.""" -for f in ('.config', 'include/config'): -if os.path.exists(f): +for fname in '.config', 'include/config': +if os.path.exists(fname): sys.exit("source tree is not clean, please run 'make mrproper'") def get_make_cmd(): @@ -110,22 +111,22 @@ def get_make_cmd(): necessarily "make". (for example, "gmake" on FreeBSD). Returns the most appropriate command name on your system. """ -process = subprocess.Popen([SHOW_GNU_MAKE], stdout=subprocess.PIPE) -ret = process.communicate() -if process.returncode: -sys.exit('GNU Make not found') +with subprocess.Popen([SHOW_GNU_MAKE], stdout=subprocess.PIPE) as proc: +ret = proc.communicate() +if proc.returncode: +sys.exit('GNU Make not found') return ret[0].rstrip() def get_matched_defconfig(line): """Get the defconfig files that match a pattern Args: -line: Path or filename to match, e.g. 'configs/snow_defconfig' or +line (str): Path or filename to match, e.g. 'configs/snow_defconfig' or 'k2*_defconfig'. If no directory is provided, 'configs/' is prepended Returns: -a list of matching defconfig files +list of str: a list of matching defconfig files """ dirname = os.path.dirname(line) if dirname: @@ -138,38 +139,43 @@ def get_matched_defconfigs(defconfigs_file): """Get all the defconfig files that match the patterns in a file. Args: -defconfigs_file: File containing a list of defconfigs to process, or -'-' to read the list from stdin +defconfigs_file (str): File containing a list of defconfigs to process, +or '-' to read the list from stdin Returns: -A list of paths to defconfig files, with no duplicates +list of str: A list of paths to defconfig files, with no duplicates """ defconfigs = [] -if defconfigs_file == '-': -fd = sys.stdin -defconfigs_file = 'stdin' -else: -fd = open(defconfigs_file) -for i, line in enumerate(fd): -line = line.strip() -if not line: -continue # skip blank lines silently -if ' ' in line: -line = line.split(' ')[0] # handle 'git log' input -matched = get_matched_defconfig(line) -if not matched: -print("warning: %s:%d: no defconfig matched '%s'" % \ - (defconfigs_file, i + 1, line), file=sys.stderr) - -defconfigs += matched +with ExitStack() as stack: +if defconfigs_file == '-': +inf = sys.stdin +defconfigs_file = 'stdin' +else: +inf = stack.enter_context(open(defconfigs_file, encoding='utf-8')) +for i, line in enumerate(inf): +line = line.strip() +if not line: +continue # skip blank lines silently +if ' ' in line: +line = line.split(' ')[0] # handle 'git log' input +matched = get_matched_defconfig(line) +if not matched: +print(f"warning: {defconfigs_file}:{i + 1}: no defconfig matched '{line}'", + file=sys.stderr) + +defconfigs += matched # use set() to drop multiple matching -return [ defconfig[len('configs') + 1:] for defconfig in set(defconfigs) ] +return [defconfig[len('configs') + 1:] for defconfig in set(defconfigs)] def get_all_defconfigs(): -"""Get all the defconfig files under the configs/ directory.""" +"""Get all the defconfig files under the configs/ directory. + +Returns: +list of str: List of paths to defconfig files +""" defconfigs = [] -for (dirpath, dirnames, filenames) in os.walk('configs'): +for (dirpath, _, filenames) in os.walk('con
[PATCH 1/6] moveconfig: Use single quotes
Quite a few places use double quotes. Fix this to be consistent with other Python code in U-Boot. Signed-off-by: Simon Glass --- tools/moveconfig.py | 72 ++--- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index a86c07caa6e..ab2d4905db5 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -71,23 +71,23 @@ CONFIG_DATABASE = 'moveconfig.db' CONFIG_LEN = len('CONFIG_') SIZES = { -"SZ_1":0x0001, "SZ_2":0x0002, -"SZ_4":0x0004, "SZ_8":0x0008, -"SZ_16": 0x0010, "SZ_32": 0x0020, -"SZ_64": 0x0040, "SZ_128": 0x0080, -"SZ_256": 0x0100, "SZ_512": 0x0200, -"SZ_1K": 0x0400, "SZ_2K": 0x0800, -"SZ_4K": 0x1000, "SZ_8K": 0x2000, -"SZ_16K": 0x4000, "SZ_32K": 0x8000, -"SZ_64K": 0x0001, "SZ_128K": 0x0002, -"SZ_256K": 0x0004, "SZ_512K": 0x0008, -"SZ_1M": 0x0010, "SZ_2M": 0x0020, -"SZ_4M": 0x0040, "SZ_8M": 0x0080, -"SZ_16M": 0x0100, "SZ_32M": 0x0200, -"SZ_64M": 0x0400, "SZ_128M": 0x0800, -"SZ_256M": 0x1000, "SZ_512M": 0x2000, -"SZ_1G": 0x4000, "SZ_2G": 0x8000, -"SZ_4G": 0x1 +'SZ_1':0x0001, 'SZ_2':0x0002, +'SZ_4':0x0004, 'SZ_8':0x0008, +'SZ_16': 0x0010, 'SZ_32': 0x0020, +'SZ_64': 0x0040, 'SZ_128': 0x0080, +'SZ_256': 0x0100, 'SZ_512': 0x0200, +'SZ_1K': 0x0400, 'SZ_2K': 0x0800, +'SZ_4K': 0x1000, 'SZ_8K': 0x2000, +'SZ_16K': 0x4000, 'SZ_32K': 0x8000, +'SZ_64K': 0x0001, 'SZ_128K': 0x0002, +'SZ_256K': 0x0004, 'SZ_512K': 0x0008, +'SZ_1M': 0x0010, 'SZ_2M': 0x0020, +'SZ_4M': 0x0040, 'SZ_8M': 0x0080, +'SZ_16M': 0x0100, 'SZ_32M': 0x0200, +'SZ_64M': 0x0400, 'SZ_128M': 0x0800, +'SZ_256M': 0x1000, 'SZ_512M': 0x2000, +'SZ_1G': 0x4000, 'SZ_2G': 0x8000, +'SZ_4G': 0x1 } ### helper functions ### @@ -536,12 +536,12 @@ def try_expand(line): aeval = asteval.Interpreter( usersyms=SIZES, minimal=True ) cfg, val = re.split("=", line) val= val.strip('\"') -if re.search("[*+-/]|<<|SZ_+|\(([^\)]+)\)", val): +if re.search(r'[*+-/]|<<|SZ_+|\(([^\)]+)\)', val): newval = hex(aeval(val)) -print("\tExpanded expression %s to %s" % (val, newval)) +print('\tExpanded expression %s to %s' % (val, newval)) return cfg+'='+newval except: -print("\tFailed to expand expression in %s" % line) +print('\tFailed to expand expression in %s' % line) return line @@ -735,10 +735,10 @@ class KconfigParser: actlog = "Move '%s'" % value log_color = COLOR_LIGHT_GREEN elif action == ACTION_NO_ENTRY: -actlog = "%s is not defined in Kconfig. Do nothing." % value +actlog = '%s is not defined in Kconfig. Do nothing.' % value log_color = COLOR_LIGHT_BLUE elif action == ACTION_NO_ENTRY_WARN: -actlog = "%s is not defined in Kconfig (suspicious). Do nothing." % value +actlog = '%s is not defined in Kconfig (suspicious). Do nothing.' % value log_color = COLOR_YELLOW suspicious = True elif action == ACTION_NO_CHANGE: @@ -746,10 +746,10 @@ class KconfigParser: % value log_color = COLOR_LIGHT_PURPLE elif action == ACTION_SPL_NOT_EXIST: -actlog = "SPL is not enabled for this defconfig. Skip." +actlog = 'SPL is not enabled for this defconfig. Skip.' log_color = COLOR_PURPLE else: -sys.exit("Internal Error. This should not happen.") +sys.exit('Internal Error. This should not happen.') log += color_text(self.options.color, log_color, actlog) + '\n' @@ -930,7 +930,7 @@ class Slot: elif self.state == STATE_SAVEDEFCONFIG: self.update_defconfig() else: -sys.exit("Internal Error. This should not happen.") +sys.exit('Internal Error. This should not happen.') return True if self.state == STATE_IDLE else False @@ -938,7 +938,7 @@ class Slot: """Handle error cases.""" self.log += color_text(self.options.color, COLOR_LIGHT_RED, - "Failed to process.\n") + 'Failed to process.\n') if self.options.verbose: self.log += color_text(self.options.color, COLOR_LIGHT_CYAN, self.ps.stderr.read().decode()) @@ -999,9 +999,9
[PATCH 5/6] moveconfig: Use a function to read files
At present there is quite a bit of ad-hoc code reading from files. The most common case is to read the file as lines. Put it in a function and set the unicode encoding correctly. Avoid writing back to a file when there are obviously no changes as this speeds things up slightly. Signed-off-by: Simon Glass --- tools/moveconfig.py | 113 1 file changed, 63 insertions(+), 50 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 4932bd9b86f..c41aa4ee283 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -288,6 +288,34 @@ def write_file(fname, data): else: out.write(data) +def read_file(fname, as_lines=True, skip_unicode=False): +"""Read a file and return the contents + +Args: +fname (str): Filename to read from +as_lines: Return file contents as a list of lines +skip_unicode (bool): True to report unicode errors and continue + +Returns: +iter of str: List of ;ines from the file with newline removed; str if +as_lines is False with newlines intact; or None if a unicode error +occurred + +Raises: +UnicodeDecodeError: Unicode error occurred when reading +""" +with open(fname, encoding='utf-8') as inf: +try: +if as_lines: +return [line.rstrip('\n') for line in inf.readlines()] +else: +return inf.read() +except UnicodeDecodeError as e: +if not skip_unicode: +raises +print("Failed on file %s': %s" % (fname, e)) +return None + def cleanup_empty_blocks(header_path, args): """Clean up empty conditional blocks @@ -296,12 +324,9 @@ def cleanup_empty_blocks(header_path, args): args: program arguments """ pattern = re.compile(r'^\s*#\s*if.*$\n^\s*#\s*endif.*$\n*', flags=re.M) -with open(header_path) as f: -try: -data = f.read() -except UnicodeDecodeError as e: -print("Failed on file %s': %s" % (header_path, e)) -return +data = read_file(header_path, as_lines=False, skip_unicode=True) +if data is None: +return new_data = pattern.sub('\n', data) @@ -311,7 +336,8 @@ def cleanup_empty_blocks(header_path, args): if args.dry_run: return -write_file(header_path, new_data) +if new_data != data: +write_file(header_path, new_data) def cleanup_one_header(header_path, patterns, args): """Clean regex-matched lines away from a file. @@ -322,12 +348,9 @@ def cleanup_one_header(header_path, patterns, args): patterns are deleted. args: program arguments """ -with open(header_path) as f: -try: -lines = f.readlines() -except UnicodeDecodeError as e: -print("Failed on file %s': %s" % (header_path, e)) -return +lines = read_file(header_path, skip_unicode=True) +if lines is None: +return matched = [] for i, line in enumerate(lines): @@ -416,8 +439,7 @@ def cleanup_one_extra_option(defconfig_path, configs, args): start = 'CONFIG_SYS_EXTRA_OPTIONS="' end = '"\n' -with open(defconfig_path) as f: -lines = f.readlines() +lines = read_file(defconfig_path) for i, line in enumerate(lines): if line.startswith(start) and line.endswith(end): @@ -479,8 +501,7 @@ def cleanup_whitelist(configs, args): if not confirm(args, 'Clean up whitelist entries?'): return -with open(os.path.join('scripts', 'config_whitelist.txt')) as f: -lines = f.readlines() +lines = read_file(os.path.join('scripts', 'config_whitelist.txt')) lines = [x for x in lines if x.strip() not in configs] @@ -506,8 +527,7 @@ def cleanup_readme(configs, args): for config in configs: patterns.append(re.compile(r'^\s+%s' % config)) -with open('README') as f: -lines = f.readlines() +lines = read_file('README') found = False newlines = [] @@ -615,7 +635,7 @@ class KconfigParser: """ arch = '' cpu = '' -for line in open(self.dotconfig): +for line in read_file(self.dotconfig): m = self.re_arch.match(line) if m: arch = m.group(1) @@ -717,11 +737,9 @@ class KconfigParser: else: autoconf_path = self.autoconf -with open(self.dotconfig) as f: -dotconfig_lines = f.readlines() +dotconfig_lines = read_file(self.dotconfig) -with open(autoconf_path) as f: -autoconf_lines = f.readlines() +autoconf_lines = read_file(autoconf_path) for config in self.configs: result = self.parse_one_config(config, dotconfig_lines, @@ -775,8 +793,7 @@ class KconfigParser: log = '' -with open(self.defconfig) as f: -defconf
[PATCH 3/6] moveconfig: Drop check for old Python
Python 2 is not supported anymore and Python 3 has had subprocess.DEVNULL since version 3.3 which was released in 2012. Drop the unnecessary check. Signed-off-by: Simon Glass --- tools/moveconfig.py | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 521297f7d58..0b33f3190e3 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -91,14 +91,6 @@ SIZES = { } ### helper functions ### -def get_devnull(): -"""Get the file object of '/dev/null' device.""" -try: -devnull = subprocess.DEVNULL # py3k -except AttributeError: -devnull = open(os.devnull, 'wb') -return devnull - def check_top_directory(): """Exit if we are not at the top of source directory.""" for f in ('README', 'Licenses'): @@ -1083,7 +1075,7 @@ class Slots: """ self.args = args self.slots = [] -devnull = get_devnull() +devnull = subprocess.DEVNULL make_cmd = get_make_cmd() for i in range(args.jobs): self.slots.append(Slot(toolchains, configs, args, progress, -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH 2/6] moveconfig: Convert to ArgumentParser
This is a newer library and is now preferred for Python scripts. Update the code to use it instead of optparse Use 'args' instead of 'options' throughout, since this is the term used in that module. Also it helps to avoid confusion with CONFIG options, a term that is used in this file. Signed-off-by: Simon Glass --- tools/moveconfig.py | 221 ++-- 1 file changed, 112 insertions(+), 109 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index ab2d4905db5..521297f7d58 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -10,6 +10,7 @@ Move config options from headers to defconfig files. See doc/develop/moveconfig.rst for documentation. """ +from argparse import ArgumentParser import asteval import collections import copy @@ -19,7 +20,6 @@ import filecmp import fnmatch import glob import multiprocessing -import optparse import os import queue import re @@ -267,8 +267,8 @@ def extend_matched_lines(lines, matched, pre_patterns, post_patterns, extend_pre matched += extended_matched matched.sort() -def confirm(options, prompt): -if not options.yes: +def confirm(args, prompt): +if not args.yes: while True: choice = input('{} [y/n]: '.format(prompt)) choice = choice.lower() @@ -281,12 +281,12 @@ def confirm(options, prompt): return True -def cleanup_empty_blocks(header_path, options): +def cleanup_empty_blocks(header_path, args): """Clean up empty conditional blocks Arguments: header_path: path to the cleaned file. - options: option flags. + args: program arguments """ pattern = re.compile(r'^\s*#\s*if.*$\n^\s*#\s*endif.*$\n*', flags=re.M) with open(header_path) as f: @@ -299,22 +299,22 @@ def cleanup_empty_blocks(header_path, options): new_data = pattern.sub('\n', data) show_diff(data.splitlines(True), new_data.splitlines(True), header_path, - options.color) + args.color) -if options.dry_run: +if args.dry_run: return with open(header_path, 'w') as f: f.write(new_data) -def cleanup_one_header(header_path, patterns, options): +def cleanup_one_header(header_path, patterns, args): """Clean regex-matched lines away from a file. Arguments: header_path: path to the cleaned file. patterns: list of regex patterns. Any lines matching to these patterns are deleted. - options: option flags. + args: program arguments """ with open(header_path) as f: try: @@ -362,23 +362,23 @@ def cleanup_one_header(header_path, patterns, options): for i in reversed(matched): tolines.pop(i) -show_diff(lines, tolines, header_path, options.color) +show_diff(lines, tolines, header_path, args.color) -if options.dry_run: +if args.dry_run: return with open(header_path, 'w') as f: for line in tolines: f.write(line) -def cleanup_headers(configs, options): +def cleanup_headers(configs, args): """Delete config defines from board headers. Arguments: configs: A list of CONFIGs to remove. - options: option flags. + args: program arguments """ -if not confirm(options, 'Clean up headers?'): +if not confirm(args, 'Clean up headers?'): return patterns = [] @@ -397,16 +397,16 @@ def cleanup_headers(configs, options): # This file contains UTF-16 data and no CONFIG symbols if header_path == 'include/video_font_data.h': continue -cleanup_one_header(header_path, patterns, options) -cleanup_empty_blocks(header_path, options) +cleanup_one_header(header_path, patterns, args) +cleanup_empty_blocks(header_path, args) -def cleanup_one_extra_option(defconfig_path, configs, options): +def cleanup_one_extra_option(defconfig_path, configs, args): """Delete config defines in CONFIG_SYS_EXTRA_OPTIONS in one defconfig file. Arguments: defconfig_path: path to the cleaned defconfig file. configs: A list of CONFIGs to remove. - options: option flags. + args: program arguments """ start = 'CONFIG_SYS_EXTRA_OPTIONS="' @@ -440,23 +440,23 @@ def cleanup_one_extra_option(defconfig_path, configs, options): else: tolines.pop(i) -show_diff(lines, tolines, defconfig_path, options.color) +show_diff(lines, tolines, defconfig_path, args.color) -if options.dry_run: +if args.dry_run: return with open(defconfig_path, 'w') as f: for line in tolines: f.write(line) -def cleanup_extra_options(configs, options): +def cleanup_extra_options(configs, args): """Delete config defines in CONFIG_SYS_EXTRA_OPTIONS in defconfig files. Arguments: configs: A lis
[PATCH 4/6] moveconfig: Use a function to write files
At present there is quite a bit of ad-hoc code writing to files. The treatment of newlines is different in some of them. Put it in a function and set the unicode encoding correctly. Signed-off-by: Simon Glass --- tools/moveconfig.py | 41 +++-- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 0b33f3190e3..4932bd9b86f 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -273,6 +273,21 @@ def confirm(args, prompt): return True +def write_file(fname, data): +"""Write data to a file + +Args: +fname (str): Filename to write to +data (list of str): Lines to write (with or without trailing newline); +or str to write +""" +with open(fname, 'w', encoding='utf-8') as out: +if isinstance(data, list): +for line in data: +print(line.rstrip('\n'), file=out) +else: +out.write(data) + def cleanup_empty_blocks(header_path, args): """Clean up empty conditional blocks @@ -296,8 +311,7 @@ def cleanup_empty_blocks(header_path, args): if args.dry_run: return -with open(header_path, 'w') as f: -f.write(new_data) +write_file(header_path, new_data) def cleanup_one_header(header_path, patterns, args): """Clean regex-matched lines away from a file. @@ -359,9 +373,7 @@ def cleanup_one_header(header_path, patterns, args): if args.dry_run: return -with open(header_path, 'w') as f: -for line in tolines: -f.write(line) +write_file(header_path, tolines) def cleanup_headers(configs, args): """Delete config defines from board headers. @@ -437,9 +449,7 @@ def cleanup_one_extra_option(defconfig_path, configs, args): if args.dry_run: return -with open(defconfig_path, 'w') as f: -for line in tolines: -f.write(line) +write_file(defconfig_path, tolines) def cleanup_extra_options(configs, args): """Delete config defines in CONFIG_SYS_EXTRA_OPTIONS in defconfig files. @@ -474,8 +484,7 @@ def cleanup_whitelist(configs, args): lines = [x for x in lines if x.strip() not in configs] -with open(os.path.join('scripts', 'config_whitelist.txt'), 'w') as f: -f.write(''.join(lines)) +write_file(os.path.join('scripts', 'config_whitelist.txt'), lines) def find_matching(patterns, line): for pat in patterns: @@ -514,8 +523,7 @@ def cleanup_readme(configs, args): if not found: newlines.append(line) -with open('README', 'w') as f: -f.write(''.join(newlines)) +write_file('README', newlines) def try_expand(line): """If value looks like an expression, try expanding it @@ -1135,8 +1143,7 @@ class Slots: print(color_text(self.args.color, COLOR_LIGHT_RED, msg), file=sys.stderr) -with open(output_file, 'w') as f: -f.write(boards) +write_file(output_file, boards) def show_suspicious_boards(self): """Display all boards (defconfigs) with possible misconversion.""" @@ -1155,8 +1162,7 @@ class Slots: print(color_text(self.args.color, COLOR_YELLOW, msg), file=sys.stderr) -with open(output_file, 'w') as f: -f.write(boards) +write_file(output_file, boards) class ReferenceSource: @@ -1315,8 +1321,7 @@ def add_imply_rule(config, fname, linenum): for offset, line in enumerate(data[linenum:]): if line.strip().startswith('help') or not line: data.insert(linenum + offset, '\timply %s' % config) -with open(fname, 'w') as fd: -fd.write('\n'.join(data) + '\n') +write_file(fname, data) return 'added%s' % file_line return 'could not insert%s' -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH 0/6] moveconfig: Improve the pylist score a little
There are about 240 warnings in this file. This series refactors file reading and writing, which fixes about 40. It also includes a patch to make a start on the rest, reducing the count to about 160. It also tidies up quoting. There are still about 160 warnings left. Simon Glass (6): moveconfig: Use single quotes moveconfig: Convert to ArgumentParser moveconfig: Drop check for old Python moveconfig: Use a function to write files moveconfig: Use a function to read files moveconfig: Fix some pylint errors tools/moveconfig.py | 645 +++- 1 file changed, 336 insertions(+), 309 deletions(-) -- 2.34.1.173.g76aa8bc2d0-goog
Re: [PATCH 0/2] Add more support for NXP's mfgtool
18.12.21 16:34, Angus Ainslie пише: Hi Oleh On 2021-12-18 00:44, Oleh Kravchenko wrote: Hello Angus! What is the use-case for these patches? Would you mind defining why the current implementation is not enough? Used like that: FB: flash -raw2sparse mmc0 emmc.wic Thanks, it looks like the way I'm using fastboot is causing the issue. FB: ucmd setenv fastboot_dev mmc FB: ucmd setenv mmcdev 0 FB: flash -raw2sparse all using your syntax I likely won't need these patches. Just make sure you have these configs enabled: CONFIG_FASTBOOT_MMC_USER_SUPPORT=y CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y # enable this if you planning flash boot area too FB: flash -raw2sparse mmc0 Cheers Angus -- Best regards, Oleh Kravchenko
Re: [PATCH] efi_loader: Bump the number of shared pages with StandAloneMM
Hi Heinrich, On Sat, Dec 18, 2021 at 12:03:34PM +0100, Heinrich Schuchardt wrote: > > > On 12/15/21 08:50, Ilias Apalodimas wrote: > > Currently we allow (and explicitly check) a single shared page with > > StandAloneMM. This is dictated by OP-TEE which runs the application. > > However there's no way for us dynamically discover the number of pages we > > are allowed to use. Since writing big EFI signature list variables > > requires more than a page, OP-TEE has bumped the number of shared pages to > > four. Bump our page checks to four as well. > > > > Note here that checking some kind of version and reason with the > > compatibility doesn't make too much sense. We sanitize the number of pages > > internally in our U-Boot code but eventually OP-TEE will fail if we try to > > write more than it's allowing. The error will just happen later on when we > > access StandAloneMM. So in order to avoid compatibility checks change the > > number to four unconditionally. > > > > Signed-off-by: Ilias Apalodimas > > Tested-by: Ying-Chun Liu (PaulLiu) > > --- > > lib/efi_loader/efi_variable_tee.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/lib/efi_loader/efi_variable_tee.c > > b/lib/efi_loader/efi_variable_tee.c > > index 281f886124af..95eaeaa5fd9d 100644 > > --- a/lib/efi_loader/efi_variable_tee.c > > +++ b/lib/efi_loader/efi_variable_tee.c > > @@ -261,8 +261,8 @@ efi_status_t EFIAPI get_max_payload(efi_uintn_t *size) > > * with StMM. Since OP-TEE will reject to map anything bigger than that, > > * make sure we are in bounds. > > */ > > - if (*size > OPTEE_PAGE_SIZE) > > - *size = OPTEE_PAGE_SIZE - MM_COMMUNICATE_HEADER_SIZE - > > + if (*size > 4 * OPTEE_PAGE_SIZE) > > + *size = 4 * OPTEE_PAGE_SIZE - MM_COMMUNICATE_HEADER_SIZE - > > MM_VARIABLE_COMMUNICATE_SIZE; > > Why do we need this check at all if OPTEE checks again? > OP-TEE will have to try and register the memory in tee_shm_register() to fail. So since we know if only allows 4 pages we have an internal sanity checking to bail out earlier. Regards /Ilias > Best regards > > Heinrich > > > /* > > * There seems to be a bug in EDK2 miscalculating the boundaries and
Re: [PATCH 6/8] arm: kirkwood: Pogoplug-V4 : Add board implementation header
Hi Pali, On Sat, Dec 18, 2021 at 5:09 AM Pali Rohár wrote: > > On Friday 17 December 2021 20:23:32 Tony Dinh wrote: > > Add board implementation header and Makefile for Pogoplug V4 > > > > Signed-off-by: Tony Dinh > > --- > > > > board/cloudengines/pogo_v4/Makefile | 10 > > board/cloudengines/pogo_v4/pogo_v4.h | 36 > > 2 files changed, 46 insertions(+) > > create mode 100644 board/cloudengines/pogo_v4/Makefile > > create mode 100644 board/cloudengines/pogo_v4/pogo_v4.h > > > > diff --git a/board/cloudengines/pogo_v4/Makefile > > b/board/cloudengines/pogo_v4/Makefile > > new file mode 100644 > > index 00..511bf5ff7e > > --- /dev/null > > +++ b/board/cloudengines/pogo_v4/Makefile > > @@ -0,0 +1,10 @@ > > +# SPDX-License-Identifier: GPL-2.0+ > > +# > > +# (C) Copyright 2014-2021 Tony Dinh > > +# > > +# Based on > > +# Marvell Semiconductor > > +# Written-by: Prafulla Wadaskar > > +# > > + > > +obj-y:= pogo_v4.o > > diff --git a/board/cloudengines/pogo_v4/pogo_v4.h > > b/board/cloudengines/pogo_v4/pogo_v4.h > > new file mode 100644 > > index 00..bf3060de60 > > --- /dev/null > > +++ b/board/cloudengines/pogo_v4/pogo_v4.h > > @@ -0,0 +1,36 @@ > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > +/* > > + * Copyright (C) 2014-2021 Tony Dinh > > + * > > + * Based on > > + * Copyright (C) 2012 David Purdy > > + * > > + * Based on Kirkwood support: > > + * (C) Copyright 2009 > > + * Marvell Semiconductor > > + * Written-by: Prafulla Wadaskar > > + */ > > + > > +#ifndef __POGO_V4_H > > +#define __POGO_V4_H > > + > > +#include > > + > > +/* GPIO configuration */ > > +#define POGO_V4_OE_LOW (~(0)) > > +#define POGO_V4_OE_HIGH (~(0)) > > +#define POGO_V4_OE_VAL_LOW BIT(29) > > +#define POGO_V4_OE_VAL_HIGH 0 > > + > > +/* PHY related */ > > +#define MV88E1116_LED_FCTRL_REG 10 > > +#define MV88E1116_CPRSP_CR3_REG 21 > > +#define MV88E1116_MAC_CTRL_REG 21 > > +#define MV88E1116_PGADR_REG 22 > > +#define MV88E1116_RGMII_TXTM_CTRLBIT(4) > > +#define MV88E1116_RGMII_RXTM_CTRLBIT(5) > > + > > +/* button */ > > +#define BTN_EJECT29 > > + > > +#endif /* __POGO_V4_H */ > > Hello! As this pogo_v4.h include file is used only in pogo_v4.c source > file and contains only few defines, you can move all these defines > directly into pogo_v4.c source file. There is no need to export these > constants if they are not used by other files or modules. Sure, but that'll make the .c file harder to read? We've been using the .h file since the old days, I think mostly for readability. This is a small header file, but for some other boards, the header file is quite large. Thanks, Tony > > -- > > 2.20.1 > >
Re: [PATCH 2/8] arm: kirkwood: Pogoplug V4 : Add board defconfig file
Hi Pali, On Sat, Dec 18, 2021 at 5:17 AM Pali Rohár wrote: > > On Friday 17 December 2021 20:23:28 Tony Dinh wrote: > > Add board defconfig file for Pogoplug V4 board > > > > Signed-off-by: Tony Dinh > > --- > > > > configs/pogo_v4_defconfig | 97 +++ > > 1 file changed, 97 insertions(+) > > create mode 100644 configs/pogo_v4_defconfig > > > > diff --git a/configs/pogo_v4_defconfig b/configs/pogo_v4_defconfig > > new file mode 100644 > > index 00..b183c9c46f > > --- /dev/null > > +++ b/configs/pogo_v4_defconfig > > @@ -0,0 +1,97 @@ > > +# SPDX-License-Identifier: GPL-2.0+ > > +# > > +# (C) Copyright 2017-2021 Tony Dinh > > +# > > +CONFIG_ARM=y > > +CONFIG_SKIP_LOWLEVEL_INIT=y > > +CONFIG_SYS_DCACHE_OFF=y > > +CONFIG_ARCH_CPU_INIT=y > > +CONFIG_SYS_THUMB_BUILD=y > > +CONFIG_ARCH_KIRKWOOD=y > > +CONFIG_SYS_TEXT_BASE=0x60 > > +CONFIG_TARGET_POGO_V4=y > > +CONFIG_ENV_SIZE=0x2 > > +CONFIG_ENV_OFFSET=0xC > > +CONFIG_DEFAULT_DEVICE_TREE="kirkwood-pogoplug_v4" > > +CONFIG_BOOTDELAY=10 > > +CONFIG_BOOTSTAGE=y > > +CONFIG_SHOW_BOOT_PROGRESS=y > > +CONFIG_USE_PREBOOT=y > > +CONFIG_HUSH_PARSER=y > > +CONFIG_SYS_PROMPT="Pogo_V4> " > > +CONFIG_IDENT_STRING="\nPogoplug V4" > > +CONFIG_SYS_LOAD_ADDR=0x80 > > +CONFIG_VERSION_VARIABLE=y > > +# CONFIG_CMD_FLASH is not set > > +CONFIG_CMD_SETEXPR=y > > +CONFIG_CMD_NAND=y > > +CONFIG_CMD_MMC=y > > +CONFIG_CMD_USB=y > > +CONFIG_CMD_DHCP=y > > +CONFIG_CMD_MII=y > > +CONFIG_CMD_PING=y > > +CONFIG_CMD_EXT2=y > > +CONFIG_CMD_EXT4=y > > +CONFIG_CMD_FAT=y > > +CONFIG_CMD_JFFS2=y > > +CONFIG_CMD_FS_GENERIC=y > > +CONFIG_CMD_MTDPARTS=y > > +CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)" > > +CONFIG_MTDIDS_DEFAULT="nand0=orion_nand" > > +CONFIG_CMD_UBI=y > > +CONFIG_ISO_PARTITION=y > > +CONFIG_EFI_PARTITION=y > > +CONFIG_PARTITION_UUIDS=y > > +CONFIG_PARTITION_TYPE_GUID=y > > +CONFIG_ENV_OVERWRITE=y > > +CONFIG_ENV_IS_IN_NAND=y > > +CONFIG_SYS_NS16550=y > > +CONFIG_USB=y > > +CONFIG_USB_STORAGE=y > > +CONFIG_USB_EHCI_HCD=y > > +CONFIG_OF_LIBFDT=y > > +CONFIG_CMD_FDT=y > > +CONFIG_CMD_BOOTZ=y > > +CONFIG_NETCONSOLE=y > > +CONFIG_MTD=y > > +CONFIG_MTD_RAW_NAND=y > > +CONFIG_CMD_MTD=y > > +CONFIG_MTD_PARTITIONS=y > > +CONFIG_MTD_DEVICE=y > > +CONFIG_NET=y > > +CONFIG_NETDEVICES=y > > +CONFIG_MVGBE=y > > +CONFIG_MII=y > > +CONFIG_DM=y > > +CONFIG_DM_USB=y > > +CONFIG_OF_CONTROL=y > > +CONFIG_DM_ETH=y > > +CONFIG_NET_RANDOM_ETHADDR=y > > +CONFIG_BLK=y > > +CONFIG_CMD_SATA=y > > +CONFIG_SATA_MV=y > > +CONFIG_DM_MMC=y > > +CONFIG_MVEBU_MMC=y > > +CONFIG_CMD_PCI=y > > +CONFIG_PCI=y > > +CONFIG_PCI_MVEBU=y > > +CONFIG_PCI_PNP=y > > +CONFIG_USB_XHCI_HCD=y > > +CONFIG_USB_XHCI_PCI=y > > +CONFIG_BOARD_LATE_INIT=y > > +# > > +# RTC emulation > > +# > > +CONFIG_CMD_DATE=y > > +CONFIG_PROT_UDP=y > > +CONFIG_CMD_SNTP=y > > +CONFIG_CMD_DNS=y > > +CONFIG_DM_RTC=y > > +CONFIG_RTC_EMULATION=y > > +# > > +# Turn off unused capabilities to save space > > +# > > +# CONFIG_BOOTM_PLAN9 is not set > > +# CONFIG_BOOTM_RTEMS is not set > > +# CONFIG_BOOTM_VXWORKS is not set > > +# CONFIG_MMC_HW_PARTITIONING is not set > > -- > > 2.20.1 > > > > Hello! Please regenerate this defconfig file to its canonical form. You > can do it by commands: > > make pogo_v4_defconfig > make savedefconfig > mv defconfig configs/pogo_v4_defconfig Yes, it's a bit harder to read, but it should be done. Thanks, Tony
Re: [PATCH 4/8] arm: kirkwood: Pogoplug-V4 : Add board include configs file
Hi Pali, On Sat, Dec 18, 2021 at 5:12 AM Pali Rohár wrote: > > On Friday 17 December 2021 20:23:30 Tony Dinh wrote: > > Add include configs file for Pogoplug V4 board > > > > Signed-off-by: Tony Dinh > > --- > > > > include/configs/pogo_v4.h | 94 +++ > > 1 file changed, 94 insertions(+) > > create mode 100644 include/configs/pogo_v4.h > > > > diff --git a/include/configs/pogo_v4.h b/include/configs/pogo_v4.h > > new file mode 100644 > > index 00..b449986e8c > > --- /dev/null > > +++ b/include/configs/pogo_v4.h > > @@ -0,0 +1,94 @@ > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > +/* > > + * Copyright (C) 2014-2021 Tony Dinh > > + * > > + * Based on > > + * Copyright (C) 2012 > > + * David Purdy > > + * > > + * Based on Kirkwood support: > > + * (C) Copyright 2009 > > + * Marvell Semiconductor > > + * Written-by: Prafulla Wadaskar > > + */ > > + > > +#ifndef _CONFIG_POGO_V4_H > > +#define _CONFIG_POGO_V4_H > > + > > +/* > > + * Machine type definition and ID > > + */ > > +#define MACH_TYPE_POGO_V43960 > > +#define CONFIG_MACH_TYPE MACH_TYPE_POGO_V4 > > + > > +/* > > + * High Level Configuration Options (easy to change) > > + */ > > +#define CONFIG_FEROCEON_88FR131 /* #define CPU Core > > subversion */ > > +#define CONFIG_KW88F6192 /* SOC Name */ > > + > > +/* > > + * Commands configuration > > + */ > > +#define CONFIG_SYS_NO_FLASH /* Declare no flash (NOR/SPI) */ > > +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " > > + > > +/* > > + * mv-common.h should be defined after CMD configs since it used them > > + * to enable certain macros > > + */ > > +#include "mv-common.h" > > + > > +/* > > + * Default environment variables > > + */ > > +#define CONFIG_BOOTCOMMAND \ > > + "setenv bootargs $(bootargs_console); " \ > > + "run bootcmd_usb; " \ > > + "bootm 0x0080 0x0110 0x2c0" > > + > > +#define CONFIG_EXTRA_ENV_SETTINGS \ > > + "dtb_file=/boot/dts/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ > > + "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0"\ > > + "mtdids=nand0=orion_nand\0"\ > > + "bootargs_console=console=ttyS0,115200\0" \ > > + "bootcmd_usb=usb start; load usb 0:1 0x0080 /boot/uImage; " \ > > + "load usb 0:1 0x0110 /boot/uInitrd; " \ > > + "load usb 0:1 0x2c0 $dtb_file\0" > > Have you tried to use new standard distroboot? It generates standard > boot commands, so there is no need to specify them manually with > hardcoded addresses. This was the old style that we've been using for many years. Since Simon has introduced the approach of using board envs text file, I'd prefer to keep the default envs the same for now, because it will be moved out to text file and revised anyway. Thanks, Tony > > > + > > +/* > > + * Ethernet Driver configuration > > + */ > > +#ifdef CONFIG_CMD_NET > > +#define CONFIG_FEATURE_COMMAND_EDITING /* for netconsole */ > > +#define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ > > +#define CONFIG_PHY_BASE_ADR 0 > > +#endif /* CONFIG_CMD_NET */ > > + > > +/* > > + * File system > > + */ > > +#ifdef CONFIG_CMD_JFFS2 > > +#define CONFIG_JFFS2_NAND > > +#define CONFIG_JFFS2_LZO > > +#endif /* CONFIG_CMD_JFFS2 */ > > + > > +/* > > + * SATA Driver configuration > > + */ > > +#ifdef CONFIG_SATA > > +#define CONFIG_SYS_SATA_MAX_DEVICE 1 > > +#endif /* CONFIG_SATA */ > > + > > +/* > > + * Support large disk for SATA and USB > > + */ > > +#define CONFIG_SYS_64BIT_LBA > > +#define CONFIG_LBA48 > > + > > +/* > > + * Kirkwood GPIO > > + */ > > +#define CONFIG_KIRKWOOD_GPIO > > + > > +#endif /* _CONFIG_POGO_V4_H */ > > -- > > 2.20.1 > >
[PATCH 6/6] udoo: Select CMD_DM
CMD_DM is useful for showing the whole DM tree. Enable it via "imply CMD_DM". Signed-off-by: Fabio Estevam --- arch/arm/mach-imx/mx6/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig index 62de942a32aa..98df4d4e4281 100644 --- a/arch/arm/mach-imx/mx6/Kconfig +++ b/arch/arm/mach-imx/mx6/Kconfig @@ -588,6 +588,7 @@ config TARGET_UDOO depends on MX6QDL select BOARD_LATE_INIT select SUPPORT_SPL + imply CMD_DM config TARGET_UDOO_NEO bool "UDOO Neo" -- 2.25.1
[PATCH 5/6] udoo: Increase CONFIG_ENV_OFFSET
Increase CONFIG_ENV_OFFSET to avoid the environment region to overlap with U-Boot proper. Signed-off-by: Fabio Estevam --- configs/udoo_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/udoo_defconfig b/configs/udoo_defconfig index 284ea0588465..ab2b2ee67550 100644 --- a/configs/udoo_defconfig +++ b/configs/udoo_defconfig @@ -7,7 +7,7 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x2000 -CONFIG_ENV_OFFSET=0x6 +CONFIG_ENV_OFFSET=0xC CONFIG_MX6QDL=y CONFIG_TARGET_UDOO=y CONFIG_DM_GPIO=y -- 2.25.1
[PATCH 4/6] udoo: Adjust the SD card device numbering
After the conversion to DM the SD card shows up as 'mmc 2' device. Adjust the 'mmcdev' and the distro command 'func' accordingly. Signed-off-by: Fabio Estevam --- configs/udoo_defconfig | 1 + include/configs/udoo.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configs/udoo_defconfig b/configs/udoo_defconfig index 8e1bba112041..284ea0588465 100644 --- a/configs/udoo_defconfig +++ b/configs/udoo_defconfig @@ -35,6 +35,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SYS_MMC_ENV_DEV=2 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_DM=y CONFIG_BOUNCE_BUFFER=y diff --git a/include/configs/udoo.h b/include/configs/udoo.h index fe6ea68dd461..4bddc0eca30e 100644 --- a/include/configs/udoo.h +++ b/include/configs/udoo.h @@ -28,7 +28,7 @@ "fdt_addr=0x1800\0" \ "fdt_addr_r=0x1800\0" \ "ip_dyn=yes\0" \ - "mmcdev=0\0" \ + "mmcdev=2\0" \ "mmcrootfstype=ext4\0" \ "findfdt="\ "if test ${board_rev} = MX6Q; then " \ @@ -44,7 +44,7 @@ BOOTENV #define BOOT_TARGET_DEVICES(func) \ - func(MMC, mmc, 0) \ + func(MMC, mmc, 2) \ func(SATA, sata, 0) \ func(DHCP, dhcp, na) -- 2.25.1
[PATCH 3/6] udoo: Call gpio_request()
Calling gpio_request() prior to its usage is now mandatory. This fixes the following GPIO errors: U-Boot SPL 2022.01-rc3-00067-g7a5be871c0ec (Dec 18 2021 - 17:45:07 -0300) Trying to boot from MMC1 U-Boot 2022.01-rc3-00067-g7a5be871c0ec (Dec 18 2021 - 17:45:07 -0300) CPU: Freescale i.MX6Q rev1.2 at 792 MHz Reset cause: WDOG Model: Udoo i.MX6 Quad Board Board: Udoo Quad DRAM: 1 GiB MMC: FSL_SDHC: 2 Loading Environment from MMC... OK In:serial Out: serial Err: serial gpio@20a: set_dir_flags: error: gpio GPIO2_31 not reserved gpio@20a4000: set_dir_flags: error: gpio GPIO3_23 not reserved gpio@20b: set_dir_flags: error: gpio GPIO6_24 not reserved gpio@20b: set_dir_flags: error: gpio GPIO6_25 not reserved gpio@20b: set_dir_flags: error: gpio GPIO6_27 not reserved gpio@20b: set_dir_flags: error: gpio GPIO6_28 not reserved gpio@20b: set_dir_flags: error: gpio GPIO6_29 not reserved gpio@20a4000: set_value: error: gpio GPIO3_23 not reserved Net: Could not get PHY for FEC0: addr -2 No ethernet found. Signed-off-by: Fabio Estevam --- board/udoo/udoo.c | 8 1 file changed, 8 insertions(+) diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c index 5c49388cbfbe..9e0365615d6d 100644 --- a/board/udoo/udoo.c +++ b/board/udoo/udoo.c @@ -90,6 +90,14 @@ int mx6_rgmii_rework(struct phy_device *phydev) static void setup_iomux_enet(void) { + gpio_request(IMX_GPIO_NR(2, 31), "eth_power"); + gpio_request(IMX_GPIO_NR(3, 23), "eth_phy_reset"); + gpio_request(IMX_GPIO_NR(6, 24), "strap1"); + gpio_request(IMX_GPIO_NR(6, 25), "strap2"); + gpio_request(IMX_GPIO_NR(6, 27), "strap3"); + gpio_request(IMX_GPIO_NR(6, 28), "strap4"); + gpio_request(IMX_GPIO_NR(6, 29), "strap5"); + gpio_direction_output(IMX_GPIO_NR(2, 31), 1); /* Power supply on */ gpio_direction_output(IMX_GPIO_NR(3, 23), 0); /* assert PHY rst */ -- 2.25.1
[PATCH 2/6] ARM: dts: imx6qdl-udoo: Properly describe the SD card detect
GPIO7_IO00 is used as SD card detect. Properly describe this in the devicetree. Signed-off-by: Fabio Estevam --- arch/arm/dts/imx6qdl-udoo.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/imx6qdl-udoo.dtsi b/arch/arm/dts/imx6qdl-udoo.dtsi index d07d8f83456d..2d0d102661bd 100644 --- a/arch/arm/dts/imx6qdl-udoo.dtsi +++ b/arch/arm/dts/imx6qdl-udoo.dtsi @@ -4,7 +4,7 @@ * * Author: Fabio Estevam */ - +#include / { aliases { backlight = &backlight; @@ -226,6 +226,7 @@ MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 + MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x1b0b0 >; }; @@ -304,7 +305,7 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - non-removable; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; status = "okay"; }; -- 2.25.1
[PATCH 1/6] udoo_spl: Initialize the eSDHC controller in SPL
Currently, imx6q udoo board fails to boot like this: U-Boot SPL 2022.01-rc3-00061-g95ca715adad3 (Dec 18 2021 - 18:04:40 -0300) Trying to boot from MMC1 The reason is that the eSDHC controller is not initialized in SPL. Initialize the eSDHC controller in SPL via C code as DM is not used in SPL. Signed-off-by: Fabio Estevam --- board/udoo/udoo_spl.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/board/udoo/udoo_spl.c b/board/udoo/udoo_spl.c index d9afbbb74198..754bd9dfe21e 100644 --- a/board/udoo/udoo_spl.c +++ b/board/udoo/udoo_spl.c @@ -254,4 +254,39 @@ void board_init_f(ulong dummy) /* DDR initialization */ spl_dram_init(); } + +#define USDHC3_CD_GPIO IMX_GPIO_NR(7, 0) + +#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | \ + PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \ + PAD_CTL_SRE_FAST | PAD_CTL_HYS) + +static struct fsl_esdhc_cfg usdhc_cfg[2] = { + {USDHC3_BASE_ADDR}, +}; + +static const iomux_v3_cfg_t usdhc3_pads[] = { + IOMUX_PADS(PAD_SD3_CLK__SD3_CLK| MUX_PAD_CTRL(USDHC_PAD_CTRL)), + IOMUX_PADS(PAD_SD3_CMD__SD3_CMD| MUX_PAD_CTRL(USDHC_PAD_CTRL)), + IOMUX_PADS(PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), + IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), + IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), + IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), + IOMUX_PADS(PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL)), +}; + +int board_mmc_getcd(struct mmc *mmc) +{ + return !gpio_get_value(USDHC3_CD_GPIO); +} + +int board_mmc_init(struct bd_info *bis) +{ + SETUP_IOMUX_PADS(usdhc3_pads); + usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); + usdhc_cfg[0].max_bus_width = 4; + gpio_direction_input(USDHC3_CD_GPIO); + + return fsl_esdhc_initialize(bis, &usdhc_cfg[0]); +} #endif -- 2.25.1
Pull request for efi-2022-01-rc4-3
Dear Tom, The following changes since commit c03942ddc9e88d86d919504299905e4e8b0003cd: Merge commit '4720b83d2c711062cfb55f03591b8f12c897d7cb' of https://github.com/tienfong/uboot_mainline (2021-12-17 07:24:56 -0500) are available in the Git repository at: https://source.denx.de/u-boot/custodians/u-boot-efi.git tags/efi-2022-01-rc4-3 for you to fetch changes up to 3cfc042d43f5c5cec4bcf0133202bdd8516df66c: dm: fix an 'undefined' error in some macros (2021-12-18 12:05:19 +0100) Gitlab CI showed no issues: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/10309 Pull request for efi-2022-01-rc4-3 Documentation: * add Calxeda Highbank/Midway board documentation Bug fixes: * call part_init() in blk_get_device_by_str() only for MMC * fix an 'undefined' error in some driver model macros AKASHI Takahiro (3): part: call part_init() in blk_get_device_by_str() only for MMC blk: add a helper function, blk_probe_or_unbind() dm: fix an 'undefined' error in some macros Andre Przywara (1): doc: board: Add Calxeda Highbank/Midway documentation disk/part.c | 3 +- doc/board/highbank/highbank.rst | 78 + doc/board/highbank/index.rst| 9 + doc/board/index.rst | 1 + drivers/block/blk-uclass.c | 13 +++ include/blk.h | 12 +++ include/dm/device.h | 8 ++--- 7 files changed, 119 insertions(+), 5 deletions(-) create mode 100644 doc/board/highbank/highbank.rst create mode 100644 doc/board/highbank/index.rst
[PATCH v2 3/5] Convert CONFIG_TIMESTAMP to Kconfig
This converts the following to Kconfig: CONFIG_TIMESTAMP Signed-off-by: Simon Glass --- (no changes since v1) arch/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 1 + arch/powerpc/cpu/mpc85xx/Kconfig | 2 ++ boot/Kconfig | 11 +++ configs/am335x_boneblack_vboot_defconfig | 1 + configs/am335x_evm_defconfig | 1 + configs/am335x_evm_spiboot_defconfig | 1 + configs/am335x_guardian_defconfig | 1 + configs/am335x_hs_evm_defconfig | 1 + configs/am335x_hs_evm_uart_defconfig | 1 + configs/am335x_shc_defconfig | 1 + configs/am335x_shc_ict_defconfig | 1 + configs/am335x_shc_netboot_defconfig | 1 + configs/am335x_shc_sdboot_defconfig | 1 + configs/am335x_sl50_defconfig | 1 + configs/chiliboard_defconfig | 1 + configs/cm_t335_defconfig | 1 + configs/colibri_pxa270_defconfig | 1 + configs/imgtec_xilfpga_defconfig | 1 + configs/imx28_xea_defconfig | 1 + configs/k2e_evm_defconfig | 1 + configs/k2e_hs_evm_defconfig | 1 + configs/k2g_evm_defconfig | 1 + configs/k2g_hs_evm_defconfig | 1 + configs/k2hk_evm_defconfig| 1 + configs/k2hk_hs_evm_defconfig | 1 + configs/k2l_evm_defconfig | 1 + configs/k2l_hs_evm_defconfig | 1 + configs/pic32mzdask_defconfig | 1 + configs/socfpga_arria10_defconfig | 1 + configs/socfpga_arria5_defconfig | 1 + configs/socfpga_cyclone5_defconfig| 1 + configs/socfpga_dbm_soc1_defconfig| 1 + configs/socfpga_de0_nano_soc_defconfig| 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_mcvevk_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + configs/stmark2_defconfig | 1 + configs/tools-only_defconfig | 1 + configs/uniphier_ld4_sld8_defconfig | 1 + configs/uniphier_v7_defconfig | 1 + configs/uniphier_v8_defconfig | 1 + include/configs/am335x_evm.h | 4 include/configs/am335x_guardian.h | 4 include/configs/am335x_shc.h | 4 include/configs/am335x_sl50.h | 4 include/configs/chiliboard.h | 4 include/configs/cm_t335.h | 1 - include/configs/colibri_pxa270.h | 1 - include/configs/ids8313.h | 1 - include/configs/imgtec_xilfpga.h | 1 - include/configs/m53menlo.h| 2 -- include/configs/pic32mzdask.h | 1 - include/configs/sandbox.h | 1 - include/configs/socfpga_common.h | 2 -- include/configs/socrates.h| 2 -- include/configs/stmark2.h | 2 -- include/configs/ti_armv7_keystone2.h | 1 - include/configs/uniphier.h| 2 -- include/configs/xea.h | 2 -- net/Kconfig | 1 + scripts/config_whitelist.txt | 1 - 67 files changed, 59 insertions(+), 40 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 39156067b2c..3e8b745ea11 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -252,6 +252,7 @@ config X86 imply ACPIGEN if !QEMU imply SYSINFO if GENERATE_SMBIOS_TABLE imply SYSINFO_SMBIOS if GENERATE_SMBIOS_TABLE + imply TIMESTAMP # Thing to enable for when SPL/TPL are enabled: SPL imply SPL_DM diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index eed27af74e8..fee2b1614c8 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1856,6 +1856,7 @@ config ARCH_STM32MP imply OF_LIBFDT_OVERLAY imply ENV_VARS_UBOOT_RUNTIME_CONFIG imply USE_PREBOOT + imply TIMESTAMP help Support for STM32MP SoC family developed by STMicroelectronics, MPUs based on ARM cortex A core diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index a6ac897ab30..e4c071da173 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -21,6 +21,7 @@ config ARCH_LS1012A select SYS_I2C_MXC_I2C1 if !DM_I2C select SYS_I2C_MXC_I2C2 if !DM_I2C imply PANIC_HANG + imply TIMESTAMP config ARCH_LS1028A bool diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig index 836aeddbe29..f189b988fb0 100644 --- a/arch/powerpc/cpu/mpc85xx/Kconfig +++ b/arch/powerpc/cpu/mpc85
Re: [PATCH 3/4] Convert CONFIG_TIMESTAMP to Kconfig
On 12/18/21 10:08 AM, Simon Glass wrote: This converts the following to Kconfig: CONFIG_TIMESTAMP Signed-off-by: Simon Glass --- [...] diff --git a/net/Kconfig b/net/Kconfig index 3d3329912da..1983506bb8e 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -109,6 +109,7 @@ config KEEP_SERVERADDR config UDP_CHECKSUM bool "Check the UDP checksum" + default y if SANDBOX help Enable this to verify the checksum on UDP packets. If the checksum is wrong then the packet is discussed and an error is shown, like Should this hunk be part of the previous patch? --Sean
[PATCH 3/4] Convert CONFIG_TIMESTAMP to Kconfig
This converts the following to Kconfig: CONFIG_TIMESTAMP Signed-off-by: Simon Glass --- arch/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 1 + arch/powerpc/cpu/mpc85xx/Kconfig | 2 ++ boot/Kconfig | 11 +++ configs/am335x_boneblack_vboot_defconfig | 1 + configs/am335x_evm_defconfig | 1 + configs/am335x_evm_spiboot_defconfig | 1 + configs/am335x_guardian_defconfig | 1 + configs/am335x_hs_evm_defconfig| 1 + configs/am335x_hs_evm_uart_defconfig | 1 + configs/am335x_shc_defconfig | 1 + configs/am335x_shc_ict_defconfig | 1 + configs/am335x_shc_netboot_defconfig | 1 + configs/am335x_shc_sdboot_defconfig| 1 + configs/am335x_sl50_defconfig | 1 + configs/am64x_evm_a53_defconfig| 9 +++-- configs/am64x_evm_r5_defconfig | 8 ++-- configs/chiliboard_defconfig | 1 + configs/cm_t335_defconfig | 1 + configs/colibri_pxa270_defconfig | 1 + configs/elgin-rv1108_defconfig | 2 +- configs/evb-ast2600_defconfig | 4 +--- configs/imgtec_xilfpga_defconfig | 1 + configs/imx28_xea_defconfig| 1 + configs/k2e_evm_defconfig | 1 + configs/k2e_hs_evm_defconfig | 1 + configs/k2g_evm_defconfig | 1 + configs/k2g_hs_evm_defconfig | 1 + configs/k2hk_evm_defconfig | 1 + configs/k2hk_hs_evm_defconfig | 1 + configs/k2l_evm_defconfig | 1 + configs/k2l_hs_evm_defconfig | 1 + configs/ls1021atsn_qspi_defconfig | 4 ++-- configs/ls1021atsn_sdcard_defconfig| 4 ++-- configs/pic32mzdask_defconfig | 1 + configs/sam9x60ek_nandflash_defconfig | 2 +- configs/sam9x60ek_qspiflash_defconfig | 2 +- configs/sama5d27_som1_ek_mmc1_defconfig| 2 +- configs/sama5d27_som1_ek_mmc_defconfig | 2 +- configs/sama5d27_som1_ek_qspiflash_defconfig | 2 +- configs/sama5d27_wlsom1_ek_mmc_defconfig | 2 +- configs/sama5d27_wlsom1_ek_qspiflash_defconfig | 2 +- configs/sama5d2_icp_mmc_defconfig | 2 +- configs/sama5d2_ptc_ek_mmc_defconfig | 2 +- configs/sama5d2_ptc_ek_nandflash_defconfig | 2 +- configs/sama5d2_xplained_emmc_defconfig| 2 +- configs/sama5d2_xplained_mmc_defconfig | 2 +- configs/sama5d2_xplained_qspiflash_defconfig | 2 +- configs/sama5d2_xplained_spiflash_defconfig| 2 +- configs/snow_defconfig | 1 - configs/socfpga_arria10_defconfig | 1 + configs/socfpga_arria5_defconfig | 1 + configs/socfpga_cyclone5_defconfig | 1 + configs/socfpga_dbm_soc1_defconfig | 1 + configs/socfpga_de0_nano_soc_defconfig | 1 + configs/socfpga_de10_nano_defconfig| 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_mcvevk_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + configs/stm32mp15_defconfig| 1 - configs/stm32mp15_trusted_defconfig| 1 - configs/stmark2_defconfig | 1 + configs/tools-only_defconfig | 1 + configs/uniphier_ld4_sld8_defconfig| 1 + configs/uniphier_v7_defconfig | 1 + configs/uniphier_v8_defconfig | 1 + include/configs/am335x_evm.h | 4 include/configs/am335x_guardian.h | 4 include/configs/am335x_shc.h | 4 include/configs/am335x_sl50.h | 4 include/configs/chiliboard.h | 4 include/configs/cm_t335.h | 1 - include/configs/colibri_pxa270.h | 1 - include/configs/ids8313.h | 1 - include/configs/imgtec_xilfpga.h | 1 - include/configs/m53menlo.h | 2 -- include/configs/pic32mzdask.h | 1 - include/configs/sandbox.h | 1 - include/configs/socfpga_common.h | 2 -- include/configs/socrates.h | 2 -- include/configs/stmark2.h | 2 -- include/configs/ti_armv7_keystone2.h | 1 - include/configs/uniphier.h | 2 -- include/configs/xea.h |
[PATCH v7 08/24] efi: Fix ll_boot_init() operation with the app
This should return false when the EFI app is running, since UEFI has done the required low-level init. Fix it. Signed-off-by: Simon Glass --- (no changes since v1) include/init.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/init.h b/include/init.h index f2cd46dead0..3ce7b8b95bd 100644 --- a/include/init.h +++ b/include/init.h @@ -15,7 +15,7 @@ #include /* Avoid using CONFIG_EFI_STUB directly as we may boot from other loaders */ -#ifdef CONFIG_EFI_STUB +#ifdef CONFIG_EFI #define ll_boot_init() false #else #include -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 09/24] efi: Add a few comments to the stub
Comment some functions that need more information. Signed-off-by: Simon Glass --- (no changes since v6) Changes in v6: - Fix comment style in setup_info_table() lib/efi/efi_stub.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index b3393e47fae..e8a594cb2aa 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -225,6 +225,22 @@ static int get_codeseg32(void) return cs32; } +/** + * setup_info_table() - sets up a table containing information from EFI + * + * We must call exit_boot_services() before jumping out of the stub into U-Boot + * proper, so that U-Boot has full control of peripherals, memory, etc. + * + * Once we do this, we cannot call any boot-services functions so we must find + * out everything we need to before doing that. + * + * Set up a struct efi_info_hdr table which can hold various records (e.g. + * struct efi_entry_memmap) with information obtained from EFI. + * + * @priv: Pointer to our private information which contains the list + * @size: Size of the table to allocate + * Return: 0 if OK, non-zero on error + */ static int setup_info_table(struct efi_priv *priv, int size) { struct efi_info_hdr *info; @@ -248,6 +264,12 @@ static int setup_info_table(struct efi_priv *priv, int size) return 0; } +/** + * add_entry_addr() - Add a new entry to the efi_info list + * + * @priv: Pointer to our private information which contains the list + * + */ static void add_entry_addr(struct efi_priv *priv, enum efi_entry_t type, void *ptr1, int size1, void *ptr2, int size2) { -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 11/24] efi: Move exit_boot_services into a function
At present this code is inline in the app and stub. But they do the same thing. The difference is that the stub does it immediately and the app doesn't want to do it until the end (when it boots a kernel) or not at all, if returning to UEFI. Move it into a function so it can be called as needed. Also store the memory map so that it can be accessed within the app if needed. Signed-off-by: Simon Glass --- (no changes since v6) Changes in v6: - Fix typo in function comment Changes in v2: - Add a sentence about what the patch does include/efi.h | 32 ++ lib/efi/efi.c | 68 ++ lib/efi/efi_app.c | 3 ++ lib/efi/efi_stub.c | 66 4 files changed, 114 insertions(+), 55 deletions(-) diff --git a/include/efi.h b/include/efi.h index ca301db7cb5..ca4afaf524b 100644 --- a/include/efi.h +++ b/include/efi.h @@ -407,6 +407,12 @@ static inline struct efi_mem_desc *efi_get_next_mem_desc( * @sys_table: Pointer to system table * @boot: Pointer to boot-services table * @run: Pointer to runtime-services table + * @memmap_key: Key returned from get_memory_map() + * @memmap_desc: List of memory-map records + * @memmap_alloc: Amount of memory allocated for memory map list + * @memmap_size Size of memory-map list in bytes + * @memmap_desc_size: Size of an individual memory-map record, in bytes + * @memmap_version: Memory-map version * * @use_pool_for_malloc: true if all allocation should go through the EFI 'pool' * methods allocate_pool() and free_pool(); false to use 'pages' methods @@ -424,6 +430,12 @@ struct efi_priv { struct efi_system_table *sys_table; struct efi_boot_services *boot; struct efi_runtime_services *run; + efi_uintn_t memmap_key; + struct efi_mem_desc *memmap_desc; + efi_uintn_t memmap_alloc; + efi_uintn_t memmap_size; + efi_uintn_t memmap_desc_size; + u32 memmap_version; /* app: */ bool use_pool_for_malloc; @@ -574,4 +586,24 @@ void efi_putc(struct efi_priv *priv, const char ch); */ int efi_info_get(enum efi_entry_t type, void **datap, int *sizep); +/** + * efi_store_memory_map() - Collect the memory-map info from EFI + * + * Collect the memory info and store it for later use, e.g. in calling + * exit_boot_services() + * + * @priv: Pointer to private EFI structure + * @return 0 if OK, non-zero on error + */ +int efi_store_memory_map(struct efi_priv *priv); + +/** + * efi_call_exit_boot_services() - Handle the exit-boot-service procedure + * + * Tell EFI we don't want their boot services anymore + * + * Return: 0 if OK, non-zero on error + */ +int efi_call_exit_boot_services(void); + #endif /* _LINUX_EFI_H */ diff --git a/lib/efi/efi.c b/lib/efi/efi.c index cd6bf47b180..20da88c9151 100644 --- a/lib/efi/efi.c +++ b/lib/efi/efi.c @@ -135,3 +135,71 @@ void efi_free(struct efi_priv *priv, void *ptr) boot->free_pool(ptr); } + +int efi_store_memory_map(struct efi_priv *priv) +{ + struct efi_boot_services *boot = priv->sys_table->boottime; + efi_uintn_t size, desc_size; + efi_status_t ret; + + /* Get the memory map so we can switch off EFI */ + size = 0; + ret = boot->get_memory_map(&size, NULL, &priv->memmap_key, + &priv->memmap_desc_size, + &priv->memmap_version); + if (ret != EFI_BUFFER_TOO_SMALL) { + printhex2(EFI_BITS_PER_LONG); + putc(' '); + printhex2(ret); + puts(" No memory map\n"); + return ret; + } + /* +* Since doing a malloc() may change the memory map and also we want to +* be able to read the memory map in efi_call_exit_boot_services() +* below, after more changes have happened +*/ + priv->memmap_alloc = size + 1024; + priv->memmap_size = priv->memmap_alloc; + priv->memmap_desc = efi_malloc(priv, size, &ret); + if (!priv->memmap_desc) { + printhex2(ret); + puts(" No memory for memory descriptor\n"); + return ret; + } + + ret = boot->get_memory_map(&priv->memmap_size, priv->memmap_desc, + &priv->memmap_key, &desc_size, + &priv->memmap_version); + if (ret) { + printhex2(ret); + puts(" Can't get memory map\n"); + return ret; + } + + return 0; +} + +int efi_call_exit_boot_services(void) +{ + struct efi_priv *priv = efi_get_priv(); + const struct efi_boot_services *boot = priv->boot; + efi_uintn_t size; + u32 version; + efi_status_t ret; + + size = priv->memmap_alloc; + ret = boot->get_memory_map(&size, priv->memmap_desc, + &priv->memmap_key, +
[PATCH v7 23/24] x86: efi: Set the correct link flags for the 64-bit EFI app
At present some 32-bit settings are used with the 64-bit app. Fix this by separating out the two cases. Be careful not to break the 64-bit payload, which needs to build a 64-bit EFI stub with a 32-bit U-Boot. Signed-off-by: Simon Glass --- (no changes since v5) Changes in v5: - Add new patch to set the correct link flags for the 64-bit EFI app arch/x86/config.mk | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/x86/config.mk b/arch/x86/config.mk index 589f2aed2bc..889497b6bd7 100644 --- a/arch/x86/config.mk +++ b/arch/x86/config.mk @@ -20,6 +20,11 @@ IS_32BIT := y endif endif +EFI_IS_32BIT := $(IS_32BIT) +ifdef CONFIG_EFI_STUB_64BIT +EFI_IS_32BIT := +endif + ifeq ($(IS_32BIT),y) PLATFORM_CPPFLAGS += -march=i386 -m32 else @@ -44,8 +49,14 @@ CFLAGS_EFI := -fpic -fshort-wchar # Compiler flags to be removed when building UEFI applications CFLAGS_NON_EFI := -mregparm=3 -fstack-protector-strong -ifeq ($(CONFIG_EFI_STUB_64BIT),) +ifeq ($(IS_32BIT),y) +EFIPAYLOAD_BFDARCH = i386 +else CFLAGS_EFI += $(call cc-option, -mno-red-zone) +EFIPAYLOAD_BFDARCH = x86_64 +endif + +ifeq ($(EFI_IS_32BIT),y) EFIARCH = ia32 EFIPAYLOAD_BFDTARGET = elf32-i386 else @@ -53,8 +64,6 @@ EFIARCH = x86_64 EFIPAYLOAD_BFDTARGET = elf64-x86-64 endif -EFIPAYLOAD_BFDARCH = i386 - LDSCRIPT_EFI := $(srctree)/arch/x86/lib/elf_$(EFIARCH)_efi.lds EFISTUB := crt0_$(EFIARCH)_efi.o reloc_$(EFIARCH)_efi.o OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH) -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 10/24] efi: Share struct efi_priv between the app and stub code
At present each of these has its own static variable and helper functions. Move them into a shared file. Signed-off-by: Simon Glass --- (no changes since v1) include/efi.h | 21 + lib/efi/efi.c | 29 + lib/efi/efi_app.c | 21 ++--- lib/efi/efi_stub.c | 7 --- 4 files changed, 56 insertions(+), 22 deletions(-) diff --git a/include/efi.h b/include/efi.h index 6622a733e6e..ca301db7cb5 100644 --- a/include/efi.h +++ b/include/efi.h @@ -474,6 +474,27 @@ extern char _binary_u_boot_bin_start[], _binary_u_boot_bin_end[]; EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ EFI_VARIABLE_APPEND_WRITE) +/** + * efi_get_priv() - Get access to the EFI-private information + * + * This struct it used by both the stub and the app to record things about the + * EFI environment. It is not available in U-Boot proper after the stub has + * jumped there. Use efi_info_get() to obtain info in that case. + * + * @return pointer to private info + */ +struct efi_priv *efi_get_priv(void); + +/** + * efi_set_priv() - Set up a pointer to the EFI-private information + * + * This is called in the stub and app to record the location of this + * information. + * + * @priv: New location of private data + */ +void efi_set_priv(struct efi_priv *priv); + /** * efi_get_sys_table() - Get access to the main EFI system table * diff --git a/lib/efi/efi.c b/lib/efi/efi.c index 69e52e45748..cd6bf47b180 100644 --- a/lib/efi/efi.c +++ b/lib/efi/efi.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* + * Functions shared by the app and stub + * * Copyright (c) 2015 Google, Inc * * EFI information obtained here: @@ -17,6 +19,33 @@ #include #include +static struct efi_priv *global_priv; + +struct efi_priv *efi_get_priv(void) +{ + return global_priv; +} + +void efi_set_priv(struct efi_priv *priv) +{ + global_priv = priv; +} + +struct efi_system_table *efi_get_sys_table(void) +{ + return global_priv->sys_table; +} + +struct efi_boot_services *efi_get_boot(void) +{ + return global_priv->boot; +} + +unsigned long efi_get_ram_base(void) +{ + return global_priv->ram_base; +} + /* * Global declaration of gd. * diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index 6a71cef7acb..122945e1ddd 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -27,23 +27,6 @@ DECLARE_GLOBAL_DATA_PTR; -static struct efi_priv *global_priv; - -struct efi_system_table *efi_get_sys_table(void) -{ - return global_priv->sys_table; -} - -struct efi_boot_services *efi_get_boot(void) -{ - return global_priv->boot; -} - -unsigned long efi_get_ram_base(void) -{ - return global_priv->ram_base; -} - int efi_info_get(enum efi_entry_t type, void **datap, int *sizep) { return -ENOSYS; @@ -337,7 +320,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image, /* Set up access to EFI data structures */ efi_init(priv, "App", image, sys_table); - global_priv = priv; + efi_set_priv(priv); /* * Set up the EFI debug UART so that printf() works. This is @@ -363,7 +346,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image, static void efi_exit(void) { - struct efi_priv *priv = global_priv; + struct efi_priv *priv = efi_get_priv(); free_memory(priv); printf("U-Boot EFI exiting\n"); diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index e8a594cb2aa..b4e9f49a6df 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -31,7 +31,6 @@ #error "This file needs to be ported for use on architectures" #endif -static struct efi_priv *global_priv; static bool use_uart; struct __packed desctab_info { @@ -63,6 +62,8 @@ void _debug_uart_init(void) void putc(const char ch) { + struct efi_priv *priv = efi_get_priv(); + if (ch == '\n') putc('\r'); @@ -73,7 +74,7 @@ void putc(const char ch) ; outb(ch, (ulong)&com_port->thr); } else { - efi_putc(global_priv, ch); + efi_putc(priv, ch); } } @@ -313,7 +314,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image, puts(" efi_init() failed\n"); return ret; } - global_priv = priv; + efi_set_priv(priv); cs32 = get_codeseg32(); if (cs32 < 0) -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 24/24] efi: Build the 64-bit app properly
Now that the linker crash is resolved, build the 64-bit EFI app, including all the required code. Signed-off-by: Simon Glass --- Changes in v7: - Rebase on -master instead of -next Changes in v5: - Add new patch to build the 64-bit app properly - Add various patches to fix up the 64-bit app so that it boots Changes in v2: - Add new patch to support the efi command in the app Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 179d31483ee..b53540c271a 100644 --- a/Makefile +++ b/Makefile @@ -1764,9 +1764,9 @@ else quiet_cmd_u-boot__ ?= LD $@ cmd_u-boot__ ?= $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ -T u-boot.lds $(u-boot-init) \ - $(if $(CONFIG_EFI_APP_64BIT),,--whole-archive) \ + --whole-archive \ $(u-boot-main) \ - $(if $(CONFIG_EFI_APP_64BIT),,--no-whole-archive) \ + --no-whole-archive \ $(PLATFORM_LIBS) -Map u-boot.map; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) endif -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 22/24] x86: efi: Don't use the 64-bit link script for the EFI app
That script is not intended for use with EFI, so update the logic to avoid using it. Signed-off-by: Simon Glass --- (no changes since v5) Changes in v5: - Add new patch to avoid using the 64-bit link script for the EFI app arch/x86/cpu/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/cpu/config.mk b/arch/x86/cpu/config.mk index d3033b41603..87e242a2065 100644 --- a/arch/x86/cpu/config.mk +++ b/arch/x86/cpu/config.mk @@ -9,7 +9,7 @@ LDPPFLAGS += -DRESET_VEC_LOC=$(CONFIG_RESET_VEC_LOC) LDPPFLAGS += -DSTART_16=$(CONFIG_SYS_X86_START16) ifdef CONFIG_X86_64 -ifndef CONFIG_SPL_BUILD +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_EFI_APP),) LDSCRIPT = $(srctree)/arch/x86/cpu/u-boot-64.lds endif endif -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 21/24] x86: efi: Round out the link script for 64-bit EFI
Make sure the linker lists are in the right place and drop the eh_frame section, which is not needed. Signed-off-by: Simon Glass --- (no changes since v5) Changes in v5: - Add new patch to round out the link script for 64-bit EFI arch/x86/lib/elf_x86_64_efi.lds | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/lib/elf_x86_64_efi.lds b/arch/x86/lib/elf_x86_64_efi.lds index b436429b33e..75727400aa4 100644 --- a/arch/x86/lib/elf_x86_64_efi.lds +++ b/arch/x86/lib/elf_x86_64_efi.lds @@ -63,6 +63,7 @@ SECTIONS *(.rela.data*) *(.rela.got) *(.rela.stab) +*(.rela.u_boot_list*) } . = ALIGN(4096); @@ -70,9 +71,11 @@ SECTIONS . = ALIGN(4096); .dynstr : { *(.dynstr) } . = ALIGN(4096); + +/DISCARD/ : { *(.eh_frame) } + .ignored.reloc : { *(.rela.reloc) - *(.eh_frame) *(.note.GNU-stack) } -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 17/24] efi: Support the efi command in the app
At present the 'efi' command only works in the EFI payload. Update it to work in the app too, so the memory map can be examined. Signed-off-by: Simon Glass --- (no changes since v1) cmd/Makefile | 2 +- cmd/efi.c | 48 --- include/efi.h | 15 +++ lib/efi/efi_app.c | 33 4 files changed, 82 insertions(+), 16 deletions(-) diff --git a/cmd/Makefile b/cmd/Makefile index 891819ae0f6..df50625bde7 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -58,7 +58,7 @@ obj-$(CONFIG_CMD_EXTENSION) += extension_board.o obj-$(CONFIG_CMD_ECHO) += echo.o obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o obj-$(CONFIG_CMD_EEPROM) += eeprom.o -obj-$(CONFIG_EFI_STUB) += efi.o +obj-$(CONFIG_EFI) += efi.o obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o obj-$(CONFIG_CMD_ELF) += elf.o obj-$(CONFIG_HUSH_PARSER) += exit.o diff --git a/cmd/efi.c b/cmd/efi.c index d2400acbbba..c0384e0db28 100644 --- a/cmd/efi.c +++ b/cmd/efi.c @@ -13,6 +13,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + static const char *const type_name[] = { "reserved", "loader_code", @@ -217,37 +219,53 @@ static void efi_print_mem_table(struct efi_mem_desc *desc, int desc_size, static int do_efi_mem(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - struct efi_mem_desc *desc; - struct efi_entry_memmap *map; + struct efi_mem_desc *orig, *desc; + uint version, key; + int desc_size; int size, ret; bool skip_bs; skip_bs = !argc || *argv[0] != 'a'; - ret = efi_info_get(EFIET_MEMORY_MAP, (void **)&map, &size); - switch (ret) { - case -ENOENT: - printf("No EFI table available\n"); - goto done; - case -EPROTONOSUPPORT: - printf("Incorrect EFI table version\n"); - goto done; + if (IS_ENABLED(CONFIG_EFI_APP)) { + ret = efi_get_mmap(&orig, &size, &key, &desc_size, &version); + if (ret) { + printf("Cannot read memory map (err=%d)\n", ret); + return CMD_RET_FAILURE; + } + } else { + struct efi_entry_memmap *map; + + ret = efi_info_get(EFIET_MEMORY_MAP, (void **)&map, &size); + switch (ret) { + case -ENOENT: + printf("No EFI table available\n"); + goto done; + case -EPROTONOSUPPORT: + printf("Incorrect EFI table version\n"); + goto done; + } + orig = map->desc; + desc_size = map->desc_size; + version = map->version; } - printf("EFI table at %lx, memory map %p, size %x, version %x, descr. size %#x\n", - gd->arch.table, map, size, map->version, map->desc_size); - if (map->version != EFI_MEM_DESC_VERSION) { + printf("EFI table at %lx, memory map %p, size %x, key %x, version %x, descr. size %#x\n", + gd->arch.table, orig, size, key, version, desc_size); + if (version != EFI_MEM_DESC_VERSION) { printf("Incorrect memory map version\n"); ret = -EPROTONOSUPPORT; goto done; } - desc = efi_build_mem_table(map->desc, size, map->desc_size, skip_bs); + desc = efi_build_mem_table(orig, size, desc_size, skip_bs); if (!desc) { ret = -ENOMEM; goto done; } - efi_print_mem_table(desc, map->desc_size, skip_bs); + efi_print_mem_table(desc, desc_size, skip_bs); free(desc); + if (IS_ENABLED(CONFIG_EFI_APP)) + free(orig); done: if (ret) printf("Error: %d\n", ret); diff --git a/include/efi.h b/include/efi.h index d6d73c5fab4..bd23a867136 100644 --- a/include/efi.h +++ b/include/efi.h @@ -610,4 +610,19 @@ int efi_store_memory_map(struct efi_priv *priv); */ int efi_call_exit_boot_services(void); +/** + * efi_get_mmap() - Get the memory map from EFI + * + * This is used in the app. The caller must free *@descp when done + * + * @descp: Returns allocated pointer to EFI memory map table + * @sizep: Returns size of table in bytes + * @keyp: Returns memory-map key + * @desc_sizep:Returns size of each @desc_base record + * @versionp: Returns version number of memory map + * @return 0 on success, -ve on error + */ +int efi_get_mmap(struct efi_mem_desc **descp, int *sizep, uint *keyp, +int *desc_sizep, uint *versionp); + #endif /* _LINUX_EFI_H */ diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index b2d2de1dc3a..d798bf98ca6 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -32,6 +32,39 @@ int efi_info_get(enum efi_entry_t type, void **datap, int *sizep) return -ENOSYS; } +int efi_get_mmap(struct efi_mem_
[PATCH v7 18/24] x86: efi: Show the system-table revision
Show the revision of this table as it can be important. Also update the 'efi table' entry to show the actual address of the EFI table rather than our table that points to it. This saves a step and the intermediate table has nothing else in it. Signed-off-by: Simon Glass --- (no changes since v6) Changes in v6: - Fix Alo typo in commit message Changes in v5: - Fix grammar in commit message Changes in v3: - Add new patch to show the system-table revision arch/x86/cpu/efi/payload.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index d2aa889a2b9..b7778565b19 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -296,8 +297,14 @@ void setup_efi_info(struct efi_info *efi_info) void efi_show_bdinfo(void) { struct efi_entry_systable *table = NULL; + struct efi_system_table *sys_table; int size, ret; ret = efi_info_get(EFIET_SYS_TABLE, (void **)&table, &size); - bdinfo_print_num_l("efi_table", (ulong)table); + if (!ret) { + bdinfo_print_num_l("efi_table", table->sys_table); + sys_table = (struct efi_system_table *)(uintptr_t) + table->sys_table; + bdinfo_print_num_l(" revision", sys_table->fw_revision); + } } -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 19/24] x86: efi: Don't set up global_data again with EFI
Since EFI does not relocate and uses the same global_data pointer throughout the board-init process, drop this unnecessary setup, to avoid a hang. Signed-off-by: Simon Glass --- (no changes since v5) Changes in v5: - Add new patch to avoid setting up global_data again with EFI common/board_r.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 31a59c585a8..8b5948100b1 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -817,9 +817,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) * TODO(s...@chromium.org): Consider doing this for all archs, or * dropping the new_gd parameter. */ -#if CONFIG_IS_ENABLED(X86_64) - arch_setup_gd(new_gd); -#endif + if (CONFIG_IS_ENABLED(X86_64) && !IS_ENABLED(CONFIG_EFI_APP)) + arch_setup_gd(new_gd); #ifdef CONFIG_NEEDS_MANUAL_RELOC int i; -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 16/24] x86: efi: Update efi_get_next_mem_desc() to avoid needing a map
At present this function requires a pointer to struct efi_entry_memmap but the only field used in there is the desc_size. We want to be able to use it from the app, so update it to use desc_size directly. Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/cpu/efi/payload.c | 8 cmd/efi.c | 34 ++ include/efi.h | 4 ++-- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index 3a9f7d72868..d2aa889a2b9 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -50,7 +50,7 @@ ulong board_get_usable_ram_top(ulong total_size) end = (struct efi_mem_desc *)((ulong)map + size); desc = map->desc; - for (; desc < end; desc = efi_get_next_mem_desc(map, desc)) { + for (; desc < end; desc = efi_get_next_mem_desc(desc, map->desc_size)) { if (desc->type != EFI_CONVENTIONAL_MEMORY || desc->physical_start >= 1ULL << 32) continue; @@ -88,7 +88,7 @@ int dram_init(void) end = (struct efi_mem_desc *)((ulong)map + size); gd->ram_size = 0; desc = map->desc; - for (; desc < end; desc = efi_get_next_mem_desc(map, desc)) { + for (; desc < end; desc = efi_get_next_mem_desc(desc, map->desc_size)) { if (desc->type < EFI_MMAP_IO) gd->ram_size += desc->num_pages << EFI_PAGE_SHIFT; } @@ -113,7 +113,7 @@ int dram_init_banksize(void) desc = map->desc; for (num_banks = 0; desc < end && num_banks < CONFIG_NR_DRAM_BANKS; -desc = efi_get_next_mem_desc(map, desc)) { +desc = efi_get_next_mem_desc(desc, map->desc_size)) { /* * We only use conventional memory and ignore * anything less than 1MB. @@ -196,7 +196,7 @@ unsigned int install_e820_map(unsigned int max_entries, end = (struct efi_mem_desc *)((ulong)map + size); for (desc = map->desc; desc < end; -desc = efi_get_next_mem_desc(map, desc)) { +desc = efi_get_next_mem_desc(desc, map->desc_size)) { if (desc->num_pages == 0) continue; diff --git a/cmd/efi.c b/cmd/efi.c index f2ed26bd4b2..d2400acbbba 100644 --- a/cmd/efi.c +++ b/cmd/efi.c @@ -75,16 +75,17 @@ static int h_cmp_entry(const void *v1, const void *v2) /** * efi_build_mem_table() - make a sorted copy of the memory table * - * @map: Pointer to EFI memory map table + * @desc_base: Pointer to EFI memory map table * @size: Size of table in bytes + * @desc_size: Size of each @desc_base record * @skip_bs: True to skip boot-time memory and merge it with conventional * memory. This will significantly reduce the number of table * entries. * Return: pointer to the new table. It should be freed with free() by the * caller. */ -static void *efi_build_mem_table(struct efi_entry_memmap *map, int size, -bool skip_bs) +static void *efi_build_mem_table(struct efi_mem_desc *desc_base, int size, +int desc_size, bool skip_bs) { struct efi_mem_desc *desc, *end, *base, *dest, *prev; int count; @@ -95,15 +96,16 @@ static void *efi_build_mem_table(struct efi_entry_memmap *map, int size, debug("%s: Cannot allocate %#x bytes\n", __func__, size); return NULL; } - end = (struct efi_mem_desc *)((ulong)map + size); - count = ((ulong)end - (ulong)map->desc) / map->desc_size; - memcpy(base, map->desc, (ulong)end - (ulong)map->desc); - qsort(base, count, map->desc_size, h_cmp_entry); + end = (void *)desc_base + size; + count = ((ulong)end - (ulong)desc_base) / desc_size; + memcpy(base, desc_base, (ulong)end - (ulong)desc_base); + qsort(base, count, desc_size, h_cmp_entry); prev = NULL; addr = 0; dest = base; - end = (struct efi_mem_desc *)((ulong)base + count * map->desc_size); - for (desc = base; desc < end; desc = efi_get_next_mem_desc(map, desc)) { + end = (struct efi_mem_desc *)((ulong)base + count * desc_size); + for (desc = base; desc < end; +desc = efi_get_next_mem_desc(desc, desc_size)) { bool merge = true; u32 type = desc->type; @@ -116,7 +118,7 @@ static void *efi_build_mem_table(struct efi_entry_memmap *map, int size, if (skip_bs && is_boot_services(desc->type)) type = EFI_CONVENTIONAL_MEMORY; - memcpy(dest, desc, map->desc_size); + memcpy(dest, desc, desc_size); dest->type = type; if (!skip_bs || !prev) merge = false; @@ -131,7 +133,7 @@ static void *efi_build_mem_table(struct
[PATCH v7 15/24] efi: Allow easy selection of serial-only operation
Add info about how to select vidconsole or serial. Also set up a demo boot command. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Add a better boot command too include/configs/efi-x86_app.h | 25 + 1 file changed, 25 insertions(+) diff --git a/include/configs/efi-x86_app.h b/include/configs/efi-x86_app.h index 6061a6db0a4..33afb7ca0f9 100644 --- a/include/configs/efi-x86_app.h +++ b/include/configs/efi-x86_app.h @@ -10,8 +10,33 @@ #undef CONFIG_TPM_TIS_BASE_ADDRESS +/* + * Select the output device: Put an 'x' prefix before one of these to disable it + */ + +/* + * Video output - can normally continue after exit_boot_services has been + * called, since output to the display does not require EFI services at that + * point. U-Boot sets up the console memory and does its own drawing. + */ #define CONFIG_STD_DEVICES_SETTINGS"stdin=serial\0" \ "stdout=vidconsole\0" \ "stderr=vidconsole\0" +/* + * Serial output with no console. Run qemu with: + * + *-display none -serial mon:stdio + * + * This will hang or fail to output on the console after exit_boot_services is + * called. + */ +#define xCONFIG_STD_DEVICES_SETTINGS "stdin=serial\0" \ + "stdout=serial\0" \ + "stderr=serial\0" + +#undef CONFIG_BOOTCOMMAND + +#define CONFIG_BOOTCOMMAND "part list efi 0; fatls efi 0:1" + #endif -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 14/24] efi: Show when allocated pages are used
Add a message here so that both paths of memory allocation are reported. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Use log_info() instead of printf() lib/efi/efi_app.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index 2a6740b836a..b2d2de1dc3a 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -121,13 +121,14 @@ static efi_status_t setup_memory(struct efi_priv *priv) ret = boot->allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, priv->image_data_type, pages, &addr); if (ret) { - printf("(using pool %lx) ", ret); + log_info("(using pool %lx) ", ret); priv->ram_base = (ulong)efi_malloc(priv, CONFIG_EFI_RAM_SIZE, &ret); if (!priv->ram_base) return ret; priv->use_pool_for_malloc = true; } else { + log_info("(using allocated RAM address %lx) ", (ulong)addr); priv->ram_base = addr; } gd->ram_size = pages << 12; -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 12/24] efi: Check for failure when initing the app
The stub checks for failure with efi_init(). Add this for the app as well. It is unlikely that anything can be done, but we may as well stop. Signed-off-by: Simon Glass --- (no changes since v6) Changes in v6: - Use 'U-Boot' instead of 'ARP' typo lib/efi/efi_app.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index 2024ecc37b6..2a6740b836a 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -318,8 +318,11 @@ efi_status_t EFIAPI efi_main(efi_handle_t image, efi_status_t ret; /* Set up access to EFI data structures */ - efi_init(priv, "App", image, sys_table); - + ret = efi_init(priv, "App", image, sys_table); + if (ret) { + printf("Failed to set up U-Boot: err=%lx\n", ret); + return ret; + } efi_set_priv(priv); /* -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 13/24] efi: Mention that efi_info_get() is only used in the stub
This provides access to EFI tables after U-Boot has exited boot services. It is not needed in the app since boot services remain alive and we can just call them whenever needed. Add a comment to explain this. Signed-off-by: Simon Glass --- (no changes since v6) Changes in v6: - Fix 'stuff' typo in comment - Update to 'This function' in comment Changes in v2: - Fix 'as' typo include/efi.h | 4 1 file changed, 4 insertions(+) diff --git a/include/efi.h b/include/efi.h index ca4afaf524b..0aa07193640 100644 --- a/include/efi.h +++ b/include/efi.h @@ -578,6 +578,10 @@ void efi_putc(struct efi_priv *priv, const char ch); /** * efi_info_get() - get an entry from an EFI table * + * This function is called from U-Boot proper to read information set up by the + * EFI stub. It can only be used when running from the EFI stub, not when U-Boot + * is running as an app. + * * @type: Entry type to search for * @datap: Returns pointer to entry data * @sizep: Returns pointer to entry size -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 07/24] efi: Add comments to struct efi_priv
This structure is uncommented. Fix it. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Drop comments that confuse sphinx - Move device_path path change to its own patch include/efi.h | 23 +++ 1 file changed, 23 insertions(+) diff --git a/include/efi.h b/include/efi.h index 77e599c256e..6622a733e6e 100644 --- a/include/efi.h +++ b/include/efi.h @@ -400,14 +400,37 @@ static inline struct efi_mem_desc *efi_get_next_mem_desc( return (struct efi_mem_desc *)((ulong)desc + map->desc_size); } +/** + * struct efi_priv - Information about the environment provided by EFI + * + * @parent_image: image passed into the EFI app or stub + * @sys_table: Pointer to system table + * @boot: Pointer to boot-services table + * @run: Pointer to runtime-services table + * + * @use_pool_for_malloc: true if all allocation should go through the EFI 'pool' + * methods allocate_pool() and free_pool(); false to use 'pages' methods + * allocate_pages() and free_pages() + * @ram_base: Base address of RAM (size CONFIG_EFI_RAM_SIZE) + * @image_data_type: Type of the loaded image (e.g. EFI_LOADER_CODE) + * + * @info: Header of the info list, holding info collected by the stub and passed + * to U-Boot + * @info_size: Size of the info list, in bytes from @info + * @next_hdr: Pointer to where to put the next header when adding to the list + */ struct efi_priv { efi_handle_t parent_image; struct efi_system_table *sys_table; struct efi_boot_services *boot; struct efi_runtime_services *run; + + /* app: */ bool use_pool_for_malloc; unsigned long ram_base; unsigned int image_data_type; + + /* stub: */ struct efi_info_hdr *info; unsigned int info_size; void *next_hdr; -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 03/24] x86: Allow booting a kernel from the EFI app
At present this is disabled, but it should work so long as the kernel does not need EFI services. Enable it and add a note about remaining work. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Update documentation arch/x86/lib/bootm.c | 11 +++ doc/develop/uefi/u-boot_on_efi.rst | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 667e5e689e3..57cba5c65d3 100644 --- a/arch/x86/lib/bootm.c +++ b/arch/x86/lib/bootm.c @@ -179,10 +179,14 @@ int boot_linux_kernel(ulong setup_base, ulong load_address, bool image_64bit) * U-Boot is setting them up that way for itself in * arch/i386/cpu/cpu.c. * - * Note that we cannot currently boot a kernel while running as - * an EFI application. Please use the payload option for that. + * Note: this is incomplete for EFI kernels! + * + * This can boot a kernel while running as an EFI application, + * but if the kernel requires EFI support then that support needs + * to be enabled first (see EFI_LOADER). Also the EFI information + * must enabled with setup_efi_info(). See setup_zimage() for + * how this is done with the stub. */ -#ifndef CONFIG_EFI_APP __asm__ __volatile__ ( "movl $0, %%ebp\n" "cli\n" @@ -191,7 +195,6 @@ int boot_linux_kernel(ulong setup_base, ulong load_address, bool image_64bit) [boot_params] "S"(setup_base), "b"(0), "D"(0) ); -#endif } /* We can't get to here */ diff --git a/doc/develop/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boot_on_efi.rst index 8f81b799072..acad6397e81 100644 --- a/doc/develop/uefi/u-boot_on_efi.rst +++ b/doc/develop/uefi/u-boot_on_efi.rst @@ -269,7 +269,7 @@ This work could be extended in a number of ways: - Avoid turning off boot services in the stub. Instead allow U-Boot to make use of boot services in case it wants to. It is unclear what it might want - though. + though. It is better to use the app. Where is the code? -- -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 04/24] x86: Don't process the kernel command line unless enabled
If the 'bootm' command is not enabled then this code is not available and this causes a link error. Fix it. Note that for the EFI app, there is no indication of missing code. It just hangs! Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/lib/zimage.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 7ce02226ef9..9cc04490307 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -365,11 +365,14 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, strcpy(cmd_line, (char *)cmdline_force); else build_command_line(cmd_line, auto_boot); - ret = bootm_process_cmdline(cmd_line, max_size, BOOTM_CL_ALL); - if (ret) { - printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n", - max_size, bootproto, ret); - return ret; + if (IS_ENABLED(CONFIG_CMD_BOOTM)) { + ret = bootm_process_cmdline(cmd_line, max_size, + BOOTM_CL_ALL); + if (ret) { + printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n", + max_size, bootproto, ret); + return ret; + } } printf("Kernel command line: \""); puts(cmd_line); -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 06/24] efi: Drop device_path from struct efi_priv
This is not used anywhere drop it. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Move device_path path change to its own patch include/efi.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/efi.h b/include/efi.h index 908c5dc6ebd..77e599c256e 100644 --- a/include/efi.h +++ b/include/efi.h @@ -402,7 +402,6 @@ static inline struct efi_mem_desc *efi_get_next_mem_desc( struct efi_priv { efi_handle_t parent_image; - struct efi_device_path *device_path; struct efi_system_table *sys_table; struct efi_boot_services *boot; struct efi_runtime_services *run; -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 05/24] x86: efi: Add room for the binman definition in the dtb
At present only 4KB of spare space is left in the DTB when building the EFI app. Increase this to 32KB so there is plenty of space to insert the binman definition. This cannot be expanded later (as with OF_SEPARATE) because the ELF image has already been built. Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/dts/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/dts/Makefile b/arch/x86/dts/Makefile index be209aaaf8f..5c8c05ec499 100644 --- a/arch/x86/dts/Makefile +++ b/arch/x86/dts/Makefile @@ -24,7 +24,7 @@ dtb-y += bayleybay.dtb \ targets += $(dtb-y) -DTC_FLAGS += -R 4 -p 0x1000 +DTC_FLAGS += -R 4 -p $(if $(CONFIG_EFI_APP),0x8000,0x1000) PHONY += dtbs dtbs: $(addprefix $(obj)/, $(dtb-y)) -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 01/24] efi: Locate all block devices in the app
When starting the app, locate all block devices and make them available to U-Boot. This allows listing partitions and accessing files in filesystems. EFI also has the concept of 'disks', meaning boot media. For now, this is not obviously useful in U-Boot, but add code to at least locate these. This can be expanded later as needed. Signed-off-by: Simon Glass --- (no changes since v6) Changes in v6: - Add comment for dm_scan_other() - Add comment for free_memory() - Drop setup_disks() as U-Boot does not support it - Fix 'have have' typo - Update comment format for devpath_is_partition() Changes in v2: - Don't export efi_bind_block() - Only bind devices for media devices, not for partitions - Show devices that are processed - Store device path in struct efi_media_plat - Update documentation doc/develop/uefi/u-boot_on_efi.rst | 4 +- include/efi.h | 6 +- include/efi_api.h | 15 ++ lib/efi/efi_app.c | 216 + 4 files changed, 236 insertions(+), 5 deletions(-) diff --git a/doc/develop/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boot_on_efi.rst index 5f2f850f071..8f81b799072 100644 --- a/doc/develop/uefi/u-boot_on_efi.rst +++ b/doc/develop/uefi/u-boot_on_efi.rst @@ -265,9 +265,7 @@ This work could be extended in a number of ways: - Figure out how to solve the interrupt problem -- Add more drivers to the application side (e.g. block devices, USB, - environment access). This would mostly be an academic exercise as a strong - use case is not readily apparent, but it might be fun. +- Add more drivers to the application side (e.g.USB, environment access). - Avoid turning off boot services in the stub. Instead allow U-Boot to make use of boot services in case it wants to. It is unclear what it might want diff --git a/include/efi.h b/include/efi.h index 0ec5913ddd1..908c5dc6ebd 100644 --- a/include/efi.h +++ b/include/efi.h @@ -419,10 +419,12 @@ struct efi_priv { * * @handle: handle of the controller on which this driver is installed * @blkio: block io protocol proxied by this driver + * @device_path: EFI path to the device */ struct efi_media_plat { - efi_handle_thandle; - struct efi_block_io *blkio; + efi_handle_t handle; + struct efi_block_io *blkio; + struct efi_device_path *device_path; }; /* Base address of the EFI image */ diff --git a/include/efi_api.h b/include/efi_api.h index 80109f012bc..ec9fa89a935 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -2035,4 +2035,19 @@ struct efi_firmware_management_protocol { const u16 *package_version_name); }; +#define EFI_DISK_IO_PROTOCOL_GUID \ + EFI_GUID(0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, \ +0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) + +struct efi_disk { + u64 revision; + efi_status_t (EFIAPI *read_disk)(struct efi_disk *this, u32 media_id, +u64 offset, efi_uintn_t buffer_size, +void *buffer); + + efi_status_t (EFIAPI *write_disk)(struct efi_disk *this, u32 media_id, + u64 offset, efi_uintn_t buffer_size, + void *buffer); +}; + #endif diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index f61665686c5..6a71cef7acb 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -21,6 +21,9 @@ #include #include #include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -46,6 +49,64 @@ int efi_info_get(enum efi_entry_t type, void **datap, int *sizep) return -ENOSYS; } +/** + * efi_print_str() - Print a UFT-16 string to the U-Boot console + * + * @str: String to print + */ +static void efi_print_str(const u16 *str) +{ + while (*str) { + int ch = *str++; + + if (ch > ' ' && ch < 127) + putc(ch); + } +} + +/** + * efi_bind_block() - bind a new block device to an EFI device + * + * Binds a new top-level EFI_MEDIA device as well as a child block device so + * that the block device can be accessed in U-Boot. + * + * The device can then be accessed using 'part list efi 0', 'fat ls efi 0:1', + * for example, just like any other interface type. + * + * @handle: handle of the controller on which this driver is installed + * @blkio: block io protocol proxied by this driver + * @device_path: EFI device path structure for this + * @len: Length of @device_path in bytes + * @devp: Returns the bound device + * @return 0 if OK, -ve on error + */ +int efi_bind_block(efi_handle_t handle, struct efi_block_io *blkio, + struct efi_device_path *device_path, int len, + struct udevice **devp) +{ + struct efi_media_plat plat; + struct udevice *dev; + char name[18]; + int ret; + + plat.handle = handle; + plat.blkio = blkio; + plat.devi
[PATCH v7 02/24] efi: serial: Support arrow keys
At present only the backspace key is supported in U-Boot, when running as an EFI app. Add support for arrows, home and end as well, to make the CLI more friendly. Signed-off-by: Simon Glass --- (no changes since v1) drivers/serial/serial_efi.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c index 33ddbd6080c..0067576389d 100644 --- a/drivers/serial/serial_efi.c +++ b/drivers/serial/serial_efi.c @@ -24,6 +24,9 @@ struct serial_efi_priv { bool have_key; }; +/* Convert a lower-case character to its ctrl-char equivalent */ +#define CTL_CH(c) ((c) - 'a' + 1) + int serial_efi_setbrg(struct udevice *dev, int baudrate) { return 0; @@ -49,6 +52,7 @@ static int serial_efi_get_key(struct serial_efi_priv *priv) static int serial_efi_getc(struct udevice *dev) { struct serial_efi_priv *priv = dev_get_priv(dev); + char conv_scan[10] = {0, 'p', 'n', 'f', 'b', 'a', 'e', 0, 8}; int ret, ch; ret = serial_efi_get_key(priv); @@ -63,8 +67,11 @@ static int serial_efi_getc(struct udevice *dev) * key scan code of 8. Handle this so that backspace works correctly * in the U-Boot command line. */ - if (!ch && priv->key.scan_code == 8) - ch = 8; + if (!ch && priv->key.scan_code < sizeof(conv_scan)) { + ch = conv_scan[priv->key.scan_code]; + if (ch >= 'a') + ch -= 'a' - 1; + } debug(" [%x %x %x] ", ch, priv->key.unicode_char, priv->key.scan_code); return ch; -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v7 00/24] efi: Improvements to U-Boot running on top of UEFI
At present U-Boot can be built as an EFI app, but it is really just for testing, with very few features. Instead, the payload build is used for booting on top of UEFI, where U-Boot takes over the machine immediately and supplies its own drivers. But the app could be made more useful. This series provides access to EFI block devices and the video console within U-Boot. It also restructures the app to make it possible to boot a kernel, although further work is needed to implement this. This can be thought of as making U-Boot perform a little like 'grub', in that it runs purely based on UEFI-provided services. Of course a lot more work is required, but this is a start. Note: It would be very useful to include qemu tests of the app and stub in CI. This is available at u-boot-dm/efi-working Changes in v7: - Rebase on -master instead of -next Changes in v6: - Add comment for dm_scan_other() - Add comment for free_memory() - Drop setup_disks() as U-Boot does not support it - Fix 'have have' typo - Fix 'stuff' typo in comment - Fix Alo typo in commit message - Fix comment style in setup_info_table() - Fix typo in function comment - Update comment format for devpath_is_partition() - Update to 'This function' in comment - Use 'U-Boot' instead of 'ARP' typo Changes in v5: - Add new patch to avoid setting up global_data again with EFI - Add new patch to avoid using the 64-bit link script for the EFI app - Add new patch to build the 64-bit app properly - Add new patch to round out the link script for 64-bit EFI - Add new patch to set the correct link flags for the 64-bit EFI app - Add new patch to tweak the code used for the 64-bit EFI app - Add various patches to fix up the 64-bit app so that it boots - Fix grammar in commit message Changes in v3: - Add new patch to show the system-table revision - Drop comments that confuse sphinx - Move device_path path change to its own patch Changes in v2: - Add a better boot command too - Add a sentence about what the patch does - Add new patch to support the efi command in the app - Don't export efi_bind_block() - Fix 'as' typo - Only bind devices for media devices, not for partitions - Show devices that are processed - Store device path in struct efi_media_plat - Update documentation - Use log_info() instead of printf() Simon Glass (24): efi: Locate all block devices in the app efi: serial: Support arrow keys x86: Allow booting a kernel from the EFI app x86: Don't process the kernel command line unless enabled x86: efi: Add room for the binman definition in the dtb efi: Drop device_path from struct efi_priv efi: Add comments to struct efi_priv efi: Fix ll_boot_init() operation with the app efi: Add a few comments to the stub efi: Share struct efi_priv between the app and stub code efi: Move exit_boot_services into a function efi: Check for failure when initing the app efi: Mention that efi_info_get() is only used in the stub efi: Show when allocated pages are used efi: Allow easy selection of serial-only operation x86: efi: Update efi_get_next_mem_desc() to avoid needing a map efi: Support the efi command in the app x86: efi: Show the system-table revision x86: efi: Don't set up global_data again with EFI x86: efi: Tweak the code used for the 64-bit EFI app x86: efi: Round out the link script for 64-bit EFI x86: efi: Don't use the 64-bit link script for the EFI app x86: efi: Set the correct link flags for the 64-bit EFI app efi: Build the 64-bit app properly Makefile | 4 +- arch/x86/config.mk | 15 +- arch/x86/cpu/config.mk | 2 +- arch/x86/cpu/efi/payload.c | 17 +- arch/x86/cpu/x86_64/cpu.c | 5 + arch/x86/dts/Makefile | 2 +- arch/x86/lib/Makefile | 5 +- arch/x86/lib/bootm.c | 11 +- arch/x86/lib/elf_x86_64_efi.lds| 5 +- arch/x86/lib/relocate.c| 2 + arch/x86/lib/zimage.c | 13 +- cmd/Makefile | 2 +- cmd/efi.c | 78 + common/board_r.c | 5 +- doc/develop/uefi/u-boot_on_efi.rst | 6 +- drivers/serial/serial_efi.c| 11 +- include/configs/efi-x86_app.h | 25 +++ include/efi.h | 106 +++- include/efi_api.h | 15 ++ include/init.h | 2 +- lib/efi/efi.c | 97 +++ lib/efi/efi_app.c | 269 +++-- lib/efi/efi_stub.c | 95 -- 23 files changed, 649 insertions(+), 143 deletions(-) -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v2 5/5] net: Drop #ifdefs with CONFIG_BOOTP_SERVERIP
Use IS_ENABLED() instead, to reduce the number of build paths. Signed-off-by: Simon Glass --- (no changes since v1) cmd/net.c | 4 +--- net/bootp.c | 5 +++-- net/net.c | 24 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/cmd/net.c b/cmd/net.c index 651c1411f4d..3619c843d83 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -152,16 +152,14 @@ static void netboot_update_env(void) ip_to_string(net_ip, tmp); env_set("ipaddr", tmp); } -#if !defined(CONFIG_BOOTP_SERVERIP) /* * Only attempt to change serverip if net/bootp.c:store_net_params() * could have set it */ - if (net_server_ip.s_addr) { + if (!IS_ENABLED(CONFIG_BOOTP_SERVERIP) && net_server_ip.s_addr) { ip_to_string(net_server_ip, tmp); env_set("serverip", tmp); } -#endif if (net_dns_server.s_addr) { ip_to_string(net_dns_server, tmp); env_set("dnsip", tmp); diff --git a/net/bootp.c b/net/bootp.c index 58e30cd6b0c..d83e4eb0ba9 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -148,10 +148,12 @@ static int check_reply_packet(uchar *pkt, unsigned dest, unsigned src, static void store_bootp_params(struct bootp_hdr *bp) { -#if !defined(CONFIG_BOOTP_SERVERIP) struct in_addr tmp_ip; bool overwrite_serverip = true; + if (IS_ENABLED(CONFIG_BOOTP_SERVERIP)) + return; + #if defined(CONFIG_BOOTP_PREFER_SERVERIP) overwrite_serverip = false; #endif @@ -179,7 +181,6 @@ static void store_bootp_params(struct bootp_hdr *bp) */ if (*net_boot_file_name) env_set("bootfile", net_boot_file_name); -#endif } /* diff --git a/net/net.c b/net/net.c index 43e230aeb92..072a82d8f9c 100644 --- a/net/net.c +++ b/net/net.c @@ -302,12 +302,12 @@ void net_auto_load(void) if (s != NULL && strcmp(s, "NFS") == 0) { if (net_check_prereq(NFS)) { /* We aren't expecting to get a serverip, so just accept the assigned IP */ -#ifdef CONFIG_BOOTP_SERVERIP - net_set_state(NETLOOP_SUCCESS); -#else - printf("Cannot autoload with NFS\n"); - net_set_state(NETLOOP_FAIL); -#endif + if (IS_ENABLED(CONFIG_BOOTP_SERVERIP)) { + net_set_state(NETLOOP_SUCCESS); + } else { + printf("Cannot autoload with NFS\n"); + net_set_state(NETLOOP_FAIL); + } return; } /* @@ -327,12 +327,12 @@ void net_auto_load(void) } if (net_check_prereq(TFTPGET)) { /* We aren't expecting to get a serverip, so just accept the assigned IP */ -#ifdef CONFIG_BOOTP_SERVERIP - net_set_state(NETLOOP_SUCCESS); -#else - printf("Cannot autoload with TFTPGET\n"); - net_set_state(NETLOOP_FAIL); -#endif + if (IS_ENABLED(CONFIG_BOOTP_SERVERIP)) { + net_set_state(NETLOOP_SUCCESS); + } else { + printf("Cannot autoload with TFTPGET\n"); + net_set_state(NETLOOP_FAIL); + } return; } tftp_start(TFTPGET); -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v2 4/5] Convert CONFIG_BOOTP_SERVERIP to Kconfig
This converts the following to Kconfig: CONFIG_BOOTP_SERVERIP Signed-off-by: Simon Glass --- Changes in v2: - Send the correct series README| 3 --- arch/arm/mach-stm32mp/Kconfig | 1 + configs/adp-ae3xx_defconfig | 1 + configs/adp-ag101p_defconfig | 1 + configs/bitmain_antminer_s9_defconfig | 1 + configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig| 1 + configs/sandbox_noinst_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + include/configs/adp-ae3xx.h | 2 -- include/configs/adp-ag101p.h | 2 -- include/configs/bitmain_antminer_s9.h | 2 -- include/configs/sandbox.h | 2 -- include/configs/stm32mp15_common.h| 1 - net/Kconfig | 7 +++ scripts/config_whitelist.txt | 1 - 17 files changed, 16 insertions(+), 13 deletions(-) diff --git a/README b/README index 79843787eeb..f1b541a796d 100644 --- a/README +++ b/README @@ -1258,9 +1258,6 @@ The following options need to be configured: CONFIG_BOOTP_VENDOREX CONFIG_BOOTP_MAY_FAIL - CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip - environment variable, not the BOOTP server. - CONFIG_BOOTP_MAY_FAIL - If the DHCP server is not found after the configured retry count, the call will fail instead of starting over. This can be used to fail over diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index a6c7fc5bfde..06ac349e2e7 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -173,6 +173,7 @@ config STM32_ETZPC bool "STM32 Extended TrustZone Protection" depends on STM32MP15x default y + imply BOOTP_SERVERIP help Say y to enable STM32 Extended TrustZone Protection diff --git a/configs/adp-ae3xx_defconfig b/configs/adp-ae3xx_defconfig index 3fa00fb4cc4..89f2a153b1d 100644 --- a/configs/adp-ae3xx_defconfig +++ b/configs/adp-ae3xx_defconfig @@ -30,6 +30,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM=y CONFIG_CLK=y CONFIG_MMC=y diff --git a/configs/adp-ag101p_defconfig b/configs/adp-ag101p_defconfig index cc6541b1e3b..b9d1117ff7d 100644 --- a/configs/adp-ag101p_defconfig +++ b/configs/adp-ag101p_defconfig @@ -28,6 +28,7 @@ CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x8014 CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM=y CONFIG_MMC=y CONFIG_FTSDC010=y diff --git a/configs/bitmain_antminer_s9_defconfig b/configs/bitmain_antminer_s9_defconfig index 4cd6a7c102d..f656360 100644 --- a/configs/bitmain_antminer_s9_defconfig +++ b/configs/bitmain_antminer_s9_defconfig @@ -56,6 +56,7 @@ CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_BOOTP_SERVERIP=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_FPGA_XILINX=y diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index d849989cf61..bdf805ad197 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -96,6 +96,7 @@ CONFIG_ENV_IMPORT_FDT=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM_DMA=y CONFIG_REGMAP=y CONFIG_SYSCON=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index c390afe9de5..36461b21b39 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -121,6 +121,7 @@ CONFIG_ENV_IMPORT_FDT=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM_DMA=y CONFIG_DEVRES=y CONFIG_DEBUG_DEVRES=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index f184723a899..7d2130dd89c 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -76,6 +76,7 @@ CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM_DMA=y CONFIG_REGMAP=y CONFIG_SYSCON=y diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index 490368e768f..6679c4335b2 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -96,6 +96,7 @@ CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y +CONFIG_BOOTP_SERVERIP=y CONFIG_SPL_DM=y CONFIG_DM_DMA=y CONFIG_REGMAP=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index f1a54ace9bc..fddf132dfed 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -98,6 +98,7 @@ CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_BOOTP_SEND_HO
[PATCH v2 2/5] Convert CONFIG_UDP_CHECKSUM to Kconfig
This converts the following to Kconfig: CONFIG_UDP_CHECKSUM Signed-off-by: Simon Glass --- (no changes since v1) configs/M5208EVBE_defconfig | 1 + configs/M53017EVB_defconfig | 1 + configs/M5329AFEE_defconfig | 1 + configs/M5329BFEE_defconfig | 1 + configs/M5373EVB_defconfig | 1 + include/configs/M5208EVBE.h | 2 -- include/configs/M53017EVB.h | 2 -- include/configs/M5329EVB.h | 2 -- include/configs/M5373EVB.h | 2 -- include/configs/sandbox.h| 1 - net/Kconfig | 7 +++ net/net.c| 4 +--- scripts/config_whitelist.txt | 1 - 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig index cc307ce43b2..e79791cdfd0 100644 --- a/configs/M5208EVBE_defconfig +++ b/configs/M5208EVBE_defconfig @@ -19,6 +19,7 @@ CONFIG_CMD_CACHE=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x2000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M53017EVB_defconfig b/configs/M53017EVB_defconfig index 1cd48d6c4ae..b8292fdccff 100644 --- a/configs/M53017EVB_defconfig +++ b/configs/M53017EVB_defconfig @@ -21,6 +21,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x4 +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M5329AFEE_defconfig b/configs/M5329AFEE_defconfig index 8a7a2d64f54..a6896650b19 100644 --- a/configs/M5329AFEE_defconfig +++ b/configs/M5329AFEE_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_ADDR=0x4000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M5329BFEE_defconfig b/configs/M5329BFEE_defconfig index f40e86ff222..c640a3c38e8 100644 --- a/configs/M5329BFEE_defconfig +++ b/configs/M5329BFEE_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_ADDR=0x4000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M5373EVB_defconfig b/configs/M5373EVB_defconfig index 8e61b72887d..c5aa3fd5e46 100644 --- a/configs/M5373EVB_defconfig +++ b/configs/M5373EVB_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_ADDR=0x4000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/include/configs/M5208EVBE.h b/include/configs/M5208EVBE.h index 6a69ac45aee..a9febe47a4c 100644 --- a/include/configs/M5208EVBE.h +++ b/include/configs/M5208EVBE.h @@ -41,8 +41,6 @@ /* I2C */ #define CONFIG_SYS_IMMRCONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/M53017EVB.h b/include/configs/M53017EVB.h index 7b33677c551..cda6cbf14e9 100644 --- a/include/configs/M53017EVB.h +++ b/include/configs/M53017EVB.h @@ -56,8 +56,6 @@ /* I2C */ #define CONFIG_SYS_IMMRCONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/M5329EVB.h b/include/configs/M5329EVB.h index 19d8cfe3217..f12edcc32f2 100644 --- a/include/configs/M5329EVB.h +++ b/include/configs/M5329EVB.h @@ -50,8 +50,6 @@ /* I2C */ #define CONFIG_SYS_IMMRCONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/M5373EVB.h b/include/configs/M5373EVB.h index e2ddc4893e7..c6a3f71ec63 100644 --- a/include/configs/M5373EVB.h +++ b/include/configs/M5373EVB.h @@ -52,8 +52,6 @@ /* I2C */ #define CONFIG_SYS_IMMRCONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 1dd21d5e925..2cb8a90f5ea 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -25,7 +25,6 @@ #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ 115200} -#define CONFIG_UDP_CHECKSUM #define CONFIG_TIMESTAMP #define CONFIG_BOOTP_SERVERIP diff --git a/net/Kconfig b/net/Kconfig index fb6420f9bbe..3d3329912da 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -107,4 +107,11 @@ config KEEP_SERVERADDR enabled, when an ARP reply is received, the server's IP address is written there. +config UDP_CHECKSUM + bool "Check the UDP checksum" + help +
[PATCH v2 1/5] Convert CONFIG_KEEP_SERVERADDR to Kconfig
This converts the following to Kconfig: CONFIG_KEEP_SERVERADDR Drop the preprocessor usage also. Signed-off-by: Simon Glass --- (no changes since v1) README | 5 - include/configs/sandbox.h| 1 - net/Kconfig | 9 + net/arp.c| 5 ++--- scripts/config_whitelist.txt | 1 - 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README b/README index 056b717557b..79843787eeb 100644 --- a/README +++ b/README @@ -1193,11 +1193,6 @@ The following options need to be configured: server to contact when using the "tftboot" command. (Environment variable "serverip") - CONFIG_KEEP_SERVERADDR - - Keeps the server's MAC address, in the env 'serveraddr' - for passing to bootargs (like Linux's netconsole option) - - Gateway IP address: CONFIG_GATEWAYIP diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index cd7d99ec69c..1dd21d5e925 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -25,7 +25,6 @@ #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ 115200} -#define CONFIG_KEEP_SERVERADDR #define CONFIG_UDP_CHECKSUM #define CONFIG_TIMESTAMP #define CONFIG_BOOTP_SERVERIP diff --git a/net/Kconfig b/net/Kconfig index 7a2d1450188..fb6420f9bbe 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -98,4 +98,13 @@ config SERVERIP_FROM_PROXYDHCP_DELAY_MS receiving response from main DHCP server. Has no effect if SERVERIP_FROM_PROXYDHCP is false. +config KEEP_SERVERADDR + bool "Write the server's MAC address to 'serveraddr'" + default y if SANDBOX + help + Keeps the server's MAC address, in the env 'serveraddr' + for passing to bootargs (like Linux's netconsole option). If this is + enabled, when an ARP reply is received, the server's IP address is + written there. + endif # if NET diff --git a/net/arp.c b/net/arp.c index 1d06ed25722..0b086dc8d21 100644 --- a/net/arp.c +++ b/net/arp.c @@ -196,13 +196,12 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) if (!arp_is_waiting()) break; -#ifdef CONFIG_KEEP_SERVERADDR - if (net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) { + if (IS_ENABLED(CONFIG_KEEP_SERVERADDR) && + net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) { char buf[20]; sprintf(buf, "%pM", &arp->ar_sha); env_set("serveraddr", buf); } -#endif reply_ip_addr = net_read_ip(&arp->ar_spa); diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 6d961ccb3e6..3285d3cd30e 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -639,7 +639,6 @@ CONFIG_JFFS2_PART_SIZE CONFIG_JFFS2_SUMMARY CONFIG_JRSTARTR_JR0 CONFIG_JTAG_CONSOLE -CONFIG_KEEP_SERVERADDR CONFIG_KEY_REVOCATION CONFIG_KIRKWOOD_EGIGA_INIT CONFIG_KIRKWOOD_GPIO -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH v4] timer: Add a migration message
Some boards still use the old timer mechanism. Set a deadline for them to update to driver model. Point to some examples as well. This needs a bit of a strange rule to avoid an error on some boards. Signed-off-by: Simon Glass --- Changes in v4: - Fix alsol typo Changes in v3: - Push out the deadline Makefile | 4 doc/develop/driver-model/migration.rst | 12 2 files changed, 16 insertions(+) diff --git a/Makefile b/Makefile index ab32efb4d11..7b24250103e 100644 --- a/Makefile +++ b/Makefile @@ -1124,6 +1124,10 @@ endif $(call deprecated,CONFIG_DM_ETH,Ethernet drivers,v2020.07,$(CONFIG_NET)) $(call deprecated,CONFIG_DM_I2C,I2C drivers,v2022.04,$(CONFIG_SYS_I2C_LEGACY)) $(call deprecated,CONFIG_DM_KEYBOARD,Keyboard drivers,v2022.10,$(CONFIG_KEYBOARD)) + @# CONFIG_SYS_TIMER_RATE has brackets in it for some boards which + @# confuses this rule. Use if() to send just a single character which + @# is enable to tell 'deprecated' that one of these symbols exists + $(call deprecated,CONFIG_TIMER,Timer drivers,v2023.01,$(if $(strip $(CONFIG_SYS_TIMER_RATE)$(CONFIG_SYS_TIMER_COUNTER)),x)) @# Check that this build does not use CONFIG options that we do not @# know about unless they are in Kconfig. All the existing CONFIG @# options are whitelisted, so new ones should not be added. diff --git a/doc/develop/driver-model/migration.rst b/doc/develop/driver-model/migration.rst index 3dbeea6537c..10f474e9cdf 100644 --- a/doc/develop/driver-model/migration.rst +++ b/doc/develop/driver-model/migration.rst @@ -106,3 +106,15 @@ Deadline: 2022.10 This is a legacy option which has been replaced by driver model. Maintainers should submit patches switching over to using CONFIG_DM_KEYBOARD and other base driver model options in time for inclusion in the 2022.10 release. + +CONFIG_SYS_TIMER_RATE and CONFIG_SYS_TIMER_COUNTER +-- +Deadline: 2023.01 + +These are legacy options which have been replaced by driver model. +Maintainers should submit patches switching over to using CONFIG_TIMER and +other base driver model options in time for inclusion in the 2022.10 release. + +There is only one method to implement, unless you want to support bootstage, +in which case you need an early timer also. For example drivers, see +sandbox_timer.c and rockchip_timer.c -- 2.34.1.173.g76aa8bc2d0-goog
Re: [PATCH] fw_setenv: Unbreak fw_setenv caused by buggy MEMISLOCKED use
Ping? Maybe just revert commit 8a726b852502 ("fw_setenv: lock the flash only if it was locked before") ? From: Joakim Tjernlund Sent: 13 December 2021 18:22 To: u-boot@lists.denx.de; joe.hershber...@ni.com; fr0st6...@gmail.com Subject: Re: [PATCH] fw_setenv: Unbreak fw_setenv caused by buggy MEMISLOCKED use +Joe Hershberger Jocke On Wed, 2021-12-08 at 15:33 +0100, Joakim Tjernlund wrote: > Commit "fw_setenv: lock the flash only if it was locked before" > checks for Locked status with uninitialized erase data. > Address by moving the test for MEMISLOCKED. > > Fixes: 8a726b852502 ("fw_setenv: lock the flash only if it was locked before") > Signed-off-by: Joakim Tjernlund > --- > tools/env/fw_env.c | 15 --- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c > index e39c39e23a..3da75be783 100644 > --- a/tools/env/fw_env.c > +++ b/tools/env/fw_env.c > @@ -1083,12 +1083,6 @@ static int flash_write_buf(int dev, int fd, void *buf, > size_t count) > } > > erase.length = erasesize; > - if (DEVTYPE(dev) != MTD_ABSENT) { > - was_locked = ioctl(fd, MEMISLOCKED, &erase); > - /* treat any errors as unlocked flash */ > - if (was_locked < 0) > - was_locked = 0; > - } > > /* This only runs once on NOR flash and SPI-dataflash */ > while (processed < write_total) { > @@ -1108,6 +1102,10 @@ static int flash_write_buf(int dev, int fd, void *buf, > size_t count) > > if (DEVTYPE(dev) != MTD_ABSENT) { > erase.start = blockstart; > + was_locked = ioctl(fd, MEMISLOCKED, &erase); > + /* treat any errors as unlocked flash */ > + if (was_locked < 0) > + was_locked = 0; > if (was_locked) > ioctl(fd, MEMUNLOCK, &erase); > /* These do not need an explicit erase cycle */ > @@ -1163,7 +1161,6 @@ static int flash_flag_obsolete(int dev, int fd, off_t > offset) > char tmp = ENV_REDUND_OBSOLETE; > int was_locked; /* flash lock flag */ > > - was_locked = ioctl(fd, MEMISLOCKED, &erase); > erase.start = DEVOFFSET(dev); > erase.length = DEVESIZE(dev); > /* This relies on the fact, that ENV_REDUND_OBSOLETE == 0 */ > @@ -1173,6 +1170,10 @@ static int flash_flag_obsolete(int dev, int fd, off_t > offset) > DEVNAME(dev)); > return rc; > } > + was_locked = ioctl(fd, MEMISLOCKED, &erase); > + /* treat any errors as unlocked flash */ > + if (was_locked < 0) > + was_locked = 0; > if (was_locked) > ioctl(fd, MEMUNLOCK, &erase); > rc = write(fd, &tmp, sizeof(tmp));
Re: [PATCH 1/4] Convert CONFIG_KEEP_SERVERADDR to Kconfig
Hi Sean, Tom, On Sat, 18 Dec 2021 at 09:50, Tom Rini wrote: > > On Sat, Dec 18, 2021 at 10:15:08AM -0500, Sean Anderson wrote: > > On 12/18/21 10:08 AM, Simon Glass wrote: > > > This converts the following to Kconfig: > > > CONFIG_KEEP_SERVERADDR > > > > > > Drop the preprocessor usage also. > > > > > > Signed-off-by: Simon Glass > > > --- > > > > > > README | 6 -- > > > include/configs/sandbox.h| 1 - > > > net/Kconfig | 9 + > > > net/arp.c| 5 ++--- > > > scripts/config_whitelist.txt | 1 - > > > 5 files changed, 11 insertions(+), 11 deletions(-) > > > > > > diff --git a/README b/README > > > index 056b717557b..eaf9170e952 100644 > > > --- a/README > > > +++ b/README > > > @@ -1193,12 +1193,6 @@ The following options need to be configured: > > > server to contact when using the "tftboot" command. > > > (Environment variable "serverip") > > > - CONFIG_KEEP_SERVERADDR > > > - > > > - Keeps the server's MAC address, in the env 'serveraddr' > > > - for passing to bootargs (like Linux's netconsole option) > > > - > > > -- Gateway IP address: > > > CONFIG_GATEWAYIP > > > Defines a default value for the IP address of the > > > diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h > > > index cd7d99ec69c..1dd21d5e925 100644 > > > --- a/include/configs/sandbox.h > > > +++ b/include/configs/sandbox.h > > > @@ -25,7 +25,6 @@ > > > #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ > > > 115200} > > > -#define CONFIG_KEEP_SERVERADDR > > > #define CONFIG_UDP_CHECKSUM > > > #define CONFIG_TIMESTAMP > > > #define CONFIG_BOOTP_SERVERIP > > > diff --git a/net/Kconfig b/net/Kconfig > > > index 7a2d1450188..fb6420f9bbe 100644 > > > --- a/net/Kconfig > > > +++ b/net/Kconfig > > > @@ -98,4 +98,13 @@ config SERVERIP_FROM_PROXYDHCP_DELAY_MS > > > receiving response from main DHCP server. Has no effect if > > > SERVERIP_FROM_PROXYDHCP is false. > > > +config KEEP_SERVERADDR > > > + bool "Write the server's MAC address to 'serveraddr'" > > > + default y if SANDBOX > > > + help > > > + Keeps the server's MAC address, in the env 'serveraddr' > > > + for passing to bootargs (like Linux's netconsole option). If this is > > > + enabled, when an ARP reply is received, the server's IP address is > > > + written there. > > > + > > > > This loses a bit of context originally present in the README. Can you note > > that > > this is the TFTP server's address we are keeping? > > It also removes a wrong line in the README. In general, you need to be > extra careful with moveconfig.py and README contents. Actually the problem is that I sent the wrong series, the one before before I fixed it up and pushed to gitlab: https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/10306 It is also missing a patch at the end. I suppose I forgot to select the correct branch when sending (I send on a different machine). I'll try again. Regards, Simon
Re: [PATCH 1/4] Convert CONFIG_KEEP_SERVERADDR to Kconfig
On Sat, Dec 18, 2021 at 10:15:08AM -0500, Sean Anderson wrote: > On 12/18/21 10:08 AM, Simon Glass wrote: > > This converts the following to Kconfig: > > CONFIG_KEEP_SERVERADDR > > > > Drop the preprocessor usage also. > > > > Signed-off-by: Simon Glass > > --- > > > > README | 6 -- > > include/configs/sandbox.h| 1 - > > net/Kconfig | 9 + > > net/arp.c| 5 ++--- > > scripts/config_whitelist.txt | 1 - > > 5 files changed, 11 insertions(+), 11 deletions(-) > > > > diff --git a/README b/README > > index 056b717557b..eaf9170e952 100644 > > --- a/README > > +++ b/README > > @@ -1193,12 +1193,6 @@ The following options need to be configured: > > server to contact when using the "tftboot" command. > > (Environment variable "serverip") > > - CONFIG_KEEP_SERVERADDR > > - > > - Keeps the server's MAC address, in the env 'serveraddr' > > - for passing to bootargs (like Linux's netconsole option) > > - > > -- Gateway IP address: > > CONFIG_GATEWAYIP > > Defines a default value for the IP address of the > > diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h > > index cd7d99ec69c..1dd21d5e925 100644 > > --- a/include/configs/sandbox.h > > +++ b/include/configs/sandbox.h > > @@ -25,7 +25,6 @@ > > #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ > > 115200} > > -#define CONFIG_KEEP_SERVERADDR > > #define CONFIG_UDP_CHECKSUM > > #define CONFIG_TIMESTAMP > > #define CONFIG_BOOTP_SERVERIP > > diff --git a/net/Kconfig b/net/Kconfig > > index 7a2d1450188..fb6420f9bbe 100644 > > --- a/net/Kconfig > > +++ b/net/Kconfig > > @@ -98,4 +98,13 @@ config SERVERIP_FROM_PROXYDHCP_DELAY_MS > > receiving response from main DHCP server. Has no effect if > > SERVERIP_FROM_PROXYDHCP is false. > > +config KEEP_SERVERADDR > > + bool "Write the server's MAC address to 'serveraddr'" > > + default y if SANDBOX > > + help > > + Keeps the server's MAC address, in the env 'serveraddr' > > + for passing to bootargs (like Linux's netconsole option). If this is > > + enabled, when an ARP reply is received, the server's IP address is > > + written there. > > + > > This loses a bit of context originally present in the README. Can you note > that > this is the TFTP server's address we are keeping? It also removes a wrong line in the README. In general, you need to be extra careful with moveconfig.py and README contents. -- Tom signature.asc Description: PGP signature
Re: [PATCH 1/8] arm: kirkwood: Pogoplug-V4 : Add DTS files
On Fri, 17 Dec 2021 20:23:27 -0800 Tony Dinh wrote: Hi, > Add DTS files for Pogoplug V4 board is there any reason you didn't take the kirkwood-pogoplug-series-4.dts file from the Linux tree? That is the same device, isn't it? Tom will ask you about the upstream status anyway... Cheers, Andre > > Signed-off-by: Tony Dinh > --- > > arch/arm/dts/Makefile | 1 + > arch/arm/dts/kirkwood-pogoplug_v4.dts | 145 ++ > 2 files changed, 146 insertions(+) > create mode 100644 arch/arm/dts/kirkwood-pogoplug_v4.dts > > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile > index 7f622fedbd..716c6c0ed2 100644 > --- a/arch/arm/dts/Makefile > +++ b/arch/arm/dts/Makefile > @@ -68,6 +68,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += \ > kirkwood-openrd-client.dtb \ > kirkwood-openrd-ultimate.dtb \ > kirkwood-pogo_e02.dtb \ > + kirkwood-pogoplug_v4.dtb \ > kirkwood-sheevaplug.dtb > > dtb-$(CONFIG_MACH_S900) += \ > diff --git a/arch/arm/dts/kirkwood-pogoplug_v4.dts > b/arch/arm/dts/kirkwood-pogoplug_v4.dts > new file mode 100644 > index 00..b4754f600e > --- /dev/null > +++ b/arch/arm/dts/kirkwood-pogoplug_v4.dts > @@ -0,0 +1,145 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Copyright (C) 2014-2021 Tony Dinh > + * > + * Device tree file for the Pogoplug V4/Mobile > + * > + */ > + > +/dts-v1/; > + > +#include "kirkwood.dtsi" > +#include "kirkwood-6192.dtsi" > + > +/ { > + model = "Pogoplug v4"; > + compatible = "cloudengines,pogoplug-v4", "cloudengines,pogoplug-mobile", > + "marvell,kirkwood-88f6192", "marvell,kirkwood"; > + > + memory { > + device_type = "memory"; > + reg = <0x 0x800>; > + }; > + > + chosen { > + bootargs = "console=ttyS0,115200"; > + stdout-path = &uart0; > + }; > + > + ocp@f100 { > + pinctrl: pin-controller@1 { > + pmx_led_green: pmx-led-green { > + marvell,pins = "mpp22"; > + marvell,function = "gpio"; > + }; > + pmx_led_red: pmx-led-red { > + marvell,pins = "mpp24"; > + marvell,function = "gpio"; > + }; > + pmx_button_eject: pmx-button-eject { > + marvell,pins = "mpp29"; > + marvell,function = "gpio"; > + }; > + }; > + > + serial@12000 { > + status = "ok"; > + }; > + > + sata@8 { > + status = "okay"; > + nr-ports = <2>; > + }; > + > + mvsdio@9 { > + pinctrl-0 = <&pmx_sdio>; > + pinctrl-names = "default"; > + status = "okay"; > + cd-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>; > + /* No WP GPIO */ > + }; > + }; > + > + gpio-leds { > + compatible = "gpio-leds"; > + pinctrl-0 = <&pmx_led_red &pmx_led_green>; > + pinctrl-names = "default"; > + > + health { > + label = "status:green:health"; > + gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; > + default-state = "keep"; > + }; > + fault { > + label = "status:red:fault"; > + gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; > + }; > + }; > + > + gpio_keys { > + compatible = "gpio-keys"; > + #address-cells = <1>; > + #size-cells = <0>; > + pinctrl-0 = <&pmx_button_eject>; > + pinctrl-names = "default"; > + > + button@1 { > + label = "Eject Button"; > + linux,code = ; > + gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; > + }; > + }; > + > +}; > + > +&nand { > + status = "okay"; > + > + partition@0 { > + label = "u-boot"; > + reg = <0x000 0x20>; > + }; > + > + partition@20 { > + label = "uImage"; > + reg = <0x20 0x30>; > + }; > + > + partition@50 { > + label = "uImage2"; > + reg = <0x50 0x30>; > + }; > + > + partition@80 { > + label = "failsafe"; > + reg = <0x80 0x80>; > + }; > + > + partition@100 { > + label = "root"; > + reg = <0x100 0x700>; > + }; > +}; > + > +&mdio { > + status = "okay"; > + > + ethphy0: ethernet-phy@0 { > + reg = <0>; > + }; > +}; > + > +ð0 { > + status = "okay"; > + ethernet0-port@0 { > + phy-handle = <ðphy0>; > + }; > +}; > + > +&pcie
Re: [PATCH v6 02/27] efi: Add EFI uclass for media
Hi Heinrich, On Sat, 18 Dec 2021 at 01:12, Heinrich Schuchardt wrote: > > On 12/17/21 20:40, Simon Glass wrote: > > At present UCLASS_EFI_LOADER is used to represent an EFI filesystem among > > other things. The only driver that uses this uclass is in fact not a real > > U-Boot driver, since its operations do not include a struct udevice. > > > > Rather than mess with this, create a new UCLASS_EFI_MEDIA uclass to handle > > EFI media such as disks. Make this the uclass to use for devices provided > > by a UEFI implementation loading U-Boot as an EFI application, so that it > > can be used with 'part list', for example. > > > > The existing implementation using UCLASS_EFI remains as is, for > > discussion. > > > > Signed-off-by: Simon Glass > > Reviewed-by: Heinrich Schuchardt > > Why are you sending this patch? origin/master has: > > 42b7f4212a1cb9aa6a5ca959d1f40b6f8465fd8c > efi: Add uclass for devices provided by UEFI firmware > > Please, rebase your series on origin/master. I wasn't aware of that as the previous patch did not get an 'applied' email. I will rebase on master and resend. In any case, please take a look at the other patches. Regards, Simon
Re: [PATCH 1/4] Convert CONFIG_KEEP_SERVERADDR to Kconfig
On 12/18/21 10:08 AM, Simon Glass wrote: This converts the following to Kconfig: CONFIG_KEEP_SERVERADDR Drop the preprocessor usage also. Signed-off-by: Simon Glass --- README | 6 -- include/configs/sandbox.h| 1 - net/Kconfig | 9 + net/arp.c| 5 ++--- scripts/config_whitelist.txt | 1 - 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README b/README index 056b717557b..eaf9170e952 100644 --- a/README +++ b/README @@ -1193,12 +1193,6 @@ The following options need to be configured: server to contact when using the "tftboot" command. (Environment variable "serverip") - CONFIG_KEEP_SERVERADDR - - Keeps the server's MAC address, in the env 'serveraddr' - for passing to bootargs (like Linux's netconsole option) - -- Gateway IP address: CONFIG_GATEWAYIP Defines a default value for the IP address of the diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index cd7d99ec69c..1dd21d5e925 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -25,7 +25,6 @@ #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ 115200} -#define CONFIG_KEEP_SERVERADDR #define CONFIG_UDP_CHECKSUM #define CONFIG_TIMESTAMP #define CONFIG_BOOTP_SERVERIP diff --git a/net/Kconfig b/net/Kconfig index 7a2d1450188..fb6420f9bbe 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -98,4 +98,13 @@ config SERVERIP_FROM_PROXYDHCP_DELAY_MS receiving response from main DHCP server. Has no effect if SERVERIP_FROM_PROXYDHCP is false. +config KEEP_SERVERADDR + bool "Write the server's MAC address to 'serveraddr'" + default y if SANDBOX + help + Keeps the server's MAC address, in the env 'serveraddr' + for passing to bootargs (like Linux's netconsole option). If this is + enabled, when an ARP reply is received, the server's IP address is + written there. + This loses a bit of context originally present in the README. Can you note that this is the TFTP server's address we are keeping? --Sean endif # if NET diff --git a/net/arp.c b/net/arp.c index 1d06ed25722..0b086dc8d21 100644 --- a/net/arp.c +++ b/net/arp.c @@ -196,13 +196,12 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) if (!arp_is_waiting()) break; -#ifdef CONFIG_KEEP_SERVERADDR - if (net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) { + if (IS_ENABLED(CONFIG_KEEP_SERVERADDR) && + net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) { char buf[20]; sprintf(buf, "%pM", &arp->ar_sha); env_set("serveraddr", buf); } -#endif reply_ip_addr = net_read_ip(&arp->ar_spa); diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 6d961ccb3e6..3285d3cd30e 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -639,7 +639,6 @@ CONFIG_JFFS2_PART_SIZE CONFIG_JFFS2_SUMMARY CONFIG_JRSTARTR_JR0 CONFIG_JTAG_CONSOLE -CONFIG_KEEP_SERVERADDR CONFIG_KEY_REVOCATION CONFIG_KIRKWOOD_EGIGA_INIT CONFIG_KIRKWOOD_GPIO
[PATCH 4/5] moveconfig: Allow adding unit tests
Add a -t option to run unit tests in this program. So far, there is none. Signed-off-by: Simon Glass --- tools/moveconfig.py | 9 + 1 file changed, 9 insertions(+) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 369589727cc..71a7736ca63 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -14,6 +14,7 @@ import asteval import collections import copy import difflib +import doctest import filecmp import fnmatch import glob @@ -28,6 +29,7 @@ import sys import tempfile import threading import time +import unittest from buildman import bsettings from buildman import kconfiglib @@ -1621,6 +1623,13 @@ def main(): (options, configs) = parser.parse_args() +if options.test: +sys.argv = [sys.argv[0]] +fail, count = doctest.testmod() +if fail: +return 1 +unittest.main() + if len(configs) == 0 and not any((options.force_sync, options.build_db, options.imply)): parser.print_usage() -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH 5/5] moveconfig: Allow querying board configuration
It is useful to be able to find out which boards define a particular option, or combination of options. This is not as easy as grepping the defconfig files since many options are implied by others. Add a -f option to the moveconfig tool to permit this. Update the documentation to cover this, including a better title for the doc page. Signed-off-by: Simon Glass --- doc/develop/moveconfig.rst | 25 ++- tools/moveconfig.py| 86 -- 2 files changed, 105 insertions(+), 6 deletions(-) diff --git a/doc/develop/moveconfig.rst b/doc/develop/moveconfig.rst index dcd4d927e40..2f53ea52b71 100644 --- a/doc/develop/moveconfig.rst +++ b/doc/develop/moveconfig.rst @@ -1,7 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0+ -moveconfig -== +moveconfig - Migrating and querying CONFIG options +== Since Kconfig was introduced to U-Boot, we have worked on moving config options from headers to Kconfig (defconfig). @@ -129,6 +129,24 @@ To process CONFIG_CMD_FPGAD only for a subset of configs based on path match:: ./tools/moveconfig.py -Cy CONFIG_CMD_FPGAD -d - +Finding boards with particular CONFIG combinations +-- + +You can use `moveconfig.py` to figure out which boards have a CONFIG enabled, or +which do not. To use it, first build a database:: + +./tools/moveconfig.py -b + +Then you can run queries using the `-f` flag followed by a list of CONFIG terms. +Each term is CONFIG name, with or without a tilde (~) prefix. The tool searches +for boards which match the CONFIG name, or do not match if tilde is used. For +example, to find boards which enabled CONFIG_SCSI but not CONFIG_BLK:: + +tools/moveconfig.py -f SCSI ~BLK +3 matches +pg_wcom_seli8_defconfig highbank_defconfig pg_wcom_expu1_defconfig + + Finding implied CONFIGs --- @@ -235,6 +253,9 @@ Available options Specify a file containing a list of defconfigs to move. The defconfig files can be given with shell-style wildcards. Use '-' to read from stdin. + -f, --find + Find boards with a given config combination + -n, --dry-run Perform a trial run that does not make any changes. It is useful to see what is going to happen before one actually runs it. diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 71a7736ca63..a86c07caa6e 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -1569,6 +1569,79 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added, add_imply_rule(config[CONFIG_LEN:], fname, linenum) +def do_find_config(config_list): +"""Find boards with a given combination of CONFIGs + +Params: +config_list: List of CONFIG options to check (each a string consisting +of a config option, with or without a CONFIG_ prefix. If an option +is preceded by a tilde (~) then it must be false, otherwise it must +be true) +""" +all_configs, all_defconfigs, config_db, defconfig_db = read_database() + +# Get the whitelist +with open('scripts/config_whitelist.txt') as inf: +adhoc_configs = set(inf.read().splitlines()) + +# Start with all defconfigs +out = all_defconfigs + +# Work through each config in turn +adhoc = [] +for item in config_list: +# Get the real config name and whether we want this config or not +cfg = item +want = True +if cfg[0] == '~': +want = False +cfg = cfg[1:] + +if cfg in adhoc_configs: +adhoc.append(cfg) +continue + +# Search everything that is still in the running. If it has a config +# that we want, or doesn't have one that we don't, add it into the +# running for the next stage +in_list = out +out = set() +for defc in in_list: +has_cfg = cfg in config_db[defc] +if has_cfg == want: +out.add(defc) +if adhoc: +print(f"Error: Not in Kconfig: %s" % ' '.join(adhoc)) +else: +print(f'{len(out)} matches') +print(' '.join(out)) + + +def prefix_config(cfg): +"""Prefix a config with CONFIG_ if needed + +This handles ~ operator, which indicates that the CONFIG should be disabled + +>>> prefix_config('FRED') +'CONFIG_FRED' +>>> prefix_config('CONFIG_FRED') +'CONFIG_FRED' +>>> prefix_config('~FRED') +'~CONFIG_FRED' +>>> prefix_config('~CONFIG_FRED') +'~CONFIG_FRED' +>>> prefix_config('A123') +'CONFIG_A123' +""" +op = '' +if cfg[0] == '~': +op = cfg[0] +cfg = cfg[1:] +if not cfg.startswith('CONFIG_'): +cfg = 'CONFIG_' + cfg +return op + cfg + + def main(): try: cpu_count = multiprocessing.cpu_count() @@ -1596,6 +1669,8 @@ def main(): parser.add_option('-e', '--exit-on-error', action
[PATCH 3/5] moveconfig: Sort the options
Put the options in sorted order by their short name so it is easier to find an option. Signed-off-by: Simon Glass --- tools/moveconfig.py | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 4ad892e2c0c..369589727cc 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -1591,26 +1591,28 @@ def main(): help='a file containing a list of defconfigs to move, ' "one per line (for example 'snow_defconfig') " "or '-' to read from stdin") -parser.add_option('-i', '--imply', action='store_true', default=False, - help='find options which imply others') -parser.add_option('-I', '--imply-flags', type='string', default='', - help="control the -i option ('help' for help") -parser.add_option('-n', '--dry-run', action='store_true', default=False, - help='perform a trial run (show log with no changes)') parser.add_option('-e', '--exit-on-error', action='store_true', default=False, help='exit immediately on any error') -parser.add_option('-s', '--force-sync', action='store_true', default=False, - help='force sync by savedefconfig') -parser.add_option('-S', '--spl', action='store_true', default=False, - help='parse config options defined for SPL build') parser.add_option('-H', '--headers-only', dest='cleanup_headers_only', action='store_true', default=False, help='only cleanup the headers') +parser.add_option('-i', '--imply', action='store_true', default=False, + help='find options which imply others') +parser.add_option('-I', '--imply-flags', type='string', default='', + help="control the -i option ('help' for help") parser.add_option('-j', '--jobs', type='int', default=cpu_count, help='the number of jobs to run simultaneously') +parser.add_option('-n', '--dry-run', action='store_true', default=False, + help='perform a trial run (show log with no changes)') parser.add_option('-r', '--git-ref', type='string', help='the git ref to clone for building the autoconf.mk') +parser.add_option('-s', '--force-sync', action='store_true', default=False, + help='force sync by savedefconfig') +parser.add_option('-S', '--spl', action='store_true', default=False, + help='parse config options defined for SPL build') +parser.add_option('-t', '--test', action='store_true', default=False, + help='run unit tests') parser.add_option('-y', '--yes', action='store_true', default=False, help="respond 'yes' to any prompts") parser.add_option('-v', '--verbose', action='store_true', default=False, -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH 2/5] moveconfig: Read the database in a separate function
Move this code out into a function so it can be used elsewhere. Signed-off-by: Simon Glass --- tools/moveconfig.py | 78 - 1 file changed, 49 insertions(+), 29 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 8d059be039d..4ad892e2c0c 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -1339,6 +1339,54 @@ IMPLY_FLAGS = { 'Allow Kconfig options outside arch/ and /board/ to imply'], }; + +def read_database(): +"""Read in the config database + +Returns: +tuple: +set of all config options seen (each a str) +set of all defconfigs seen (each a str) +dict of configs for each defconfig: +key: defconfig name, e.g. "MPC8548CDS_legacy_defconfig" +value: dict: +key: CONFIG option +value: Value of option +dict of defconfigs for each config: +key: CONFIG option +value: set of boards using that option + +""" +configs = {} + +# key is defconfig name, value is dict of (CONFIG_xxx, value) +config_db = {} + +# Set of all config options we have seen +all_configs = set() + +# Set of all defconfigs we have seen +all_defconfigs = set() + +defconfig_db = collections.defaultdict(set) +with open(CONFIG_DATABASE) as fd: +for line in fd.readlines(): +line = line.rstrip() +if not line: # Separator between defconfigs +config_db[defconfig] = configs +all_defconfigs.add(defconfig) +configs = {} +elif line[0] == ' ': # CONFIG line +config, value = line.strip().split('=', 1) +configs[config] = value +defconfig_db[config].add(defconfig) +all_configs.add(config) +else: # New defconfig +defconfig = line + +return all_configs, all_defconfigs, config_db, defconfig_db + + def do_imply_config(config_list, add_imply, imply_flags, skip_added, check_kconfig=True, find_superset=False): """Find CONFIG options which imply those in the list @@ -1385,35 +1433,7 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added, if add_imply and add_imply != 'all': add_imply = add_imply.split(',') -# key is defconfig name, value is dict of (CONFIG_xxx, value) -config_db = {} - -# Holds a dict containing the set of defconfigs that contain each config -# key is config, value is set of defconfigs using that config -defconfig_db = collections.defaultdict(set) - -# Set of all config options we have seen -all_configs = set() - -# Set of all defconfigs we have seen -all_defconfigs = set() - -# Read in the database -configs = {} -with open(CONFIG_DATABASE) as fd: -for line in fd.readlines(): -line = line.rstrip() -if not line: # Separator between defconfigs -config_db[defconfig] = configs -all_defconfigs.add(defconfig) -configs = {} -elif line[0] == ' ': # CONFIG line -config, value = line.strip().split('=', 1) -configs[config] = value -defconfig_db[config].add(defconfig) -all_configs.add(config) -else: # New defconfig -defconfig = line +all_configs, all_defconfigs, config_db, defconfig_db = read_database() # Work through each target config option in turn, independently for config in config_list: -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH 1/5] moveconfig: Correct operation of the 'imply' feature
This doesn't work anymore, since the Kconfig update. The script has no tests so we did not notice. Fix it. Signed-off-by: Simon Glass --- tools/moveconfig.py | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 373b395fda4..8d059be039d 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -1263,7 +1263,7 @@ def find_kconfig_rules(kconf, config, imply_config): sym = kconf.syms.get(imply_config) if sym: for sel, cond in (sym.selects + sym.implies): -if sel == config: +if sel.name == config: return sym return None @@ -1291,7 +1291,8 @@ def check_imply_rule(kconf, config, imply_config): nodes = sym.nodes if len(nodes) != 1: return '%d locations' % len(nodes) -fname, linenum = nodes[0].filename, nodes[0].linern +node = nodes[0] +fname, linenum = node.filename, node.linenr cwd = os.getcwd() if cwd and fname.startswith(cwd): fname = fname[len(cwd) + 1:] @@ -1382,7 +1383,7 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added, """ kconf = KconfigScanner().conf if check_kconfig else None if add_imply and add_imply != 'all': -add_imply = add_imply.split() +add_imply = add_imply.split(',') # key is defconfig name, value is dict of (CONFIG_xxx, value) config_db = {} @@ -1414,7 +1415,7 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added, else: # New defconfig defconfig = line -# Work through each target config option in tern, independently +# Work through each target config option in turn, independently for config in config_list: defconfigs = defconfig_db.get(config) if not defconfigs: -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH 2/4] Convert CONFIG_UDP_CHECKSUM to Kconfig
This converts the following to Kconfig: CONFIG_UDP_CHECKSUM Signed-off-by: Simon Glass --- configs/M5208EVBE_defconfig | 1 + configs/M53017EVB_defconfig | 1 + configs/M5329AFEE_defconfig | 1 + configs/M5329BFEE_defconfig | 1 + configs/M5373EVB_defconfig | 1 + include/configs/M5208EVBE.h | 2 -- include/configs/M53017EVB.h | 2 -- include/configs/M5329EVB.h | 2 -- include/configs/M5373EVB.h | 2 -- include/configs/sandbox.h| 1 - net/Kconfig | 7 +++ net/net.c| 4 +--- scripts/config_whitelist.txt | 1 - 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig index cc307ce43b2..e79791cdfd0 100644 --- a/configs/M5208EVBE_defconfig +++ b/configs/M5208EVBE_defconfig @@ -19,6 +19,7 @@ CONFIG_CMD_CACHE=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x2000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M53017EVB_defconfig b/configs/M53017EVB_defconfig index 1cd48d6c4ae..b8292fdccff 100644 --- a/configs/M53017EVB_defconfig +++ b/configs/M53017EVB_defconfig @@ -21,6 +21,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x4 +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M5329AFEE_defconfig b/configs/M5329AFEE_defconfig index 8a7a2d64f54..a6896650b19 100644 --- a/configs/M5329AFEE_defconfig +++ b/configs/M5329AFEE_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_ADDR=0x4000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M5329BFEE_defconfig b/configs/M5329BFEE_defconfig index f40e86ff222..c640a3c38e8 100644 --- a/configs/M5329BFEE_defconfig +++ b/configs/M5329BFEE_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_ADDR=0x4000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M5373EVB_defconfig b/configs/M5373EVB_defconfig index 8e61b72887d..c5aa3fd5e46 100644 --- a/configs/M5373EVB_defconfig +++ b/configs/M5373EVB_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_ADDR=0x4000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/include/configs/M5208EVBE.h b/include/configs/M5208EVBE.h index 6a69ac45aee..a9febe47a4c 100644 --- a/include/configs/M5208EVBE.h +++ b/include/configs/M5208EVBE.h @@ -41,8 +41,6 @@ /* I2C */ #define CONFIG_SYS_IMMRCONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/M53017EVB.h b/include/configs/M53017EVB.h index 7b33677c551..cda6cbf14e9 100644 --- a/include/configs/M53017EVB.h +++ b/include/configs/M53017EVB.h @@ -56,8 +56,6 @@ /* I2C */ #define CONFIG_SYS_IMMRCONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/M5329EVB.h b/include/configs/M5329EVB.h index 19d8cfe3217..f12edcc32f2 100644 --- a/include/configs/M5329EVB.h +++ b/include/configs/M5329EVB.h @@ -50,8 +50,6 @@ /* I2C */ #define CONFIG_SYS_IMMRCONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/M5373EVB.h b/include/configs/M5373EVB.h index e2ddc4893e7..c6a3f71ec63 100644 --- a/include/configs/M5373EVB.h +++ b/include/configs/M5373EVB.h @@ -52,8 +52,6 @@ /* I2C */ #define CONFIG_SYS_IMMRCONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 1dd21d5e925..2cb8a90f5ea 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -25,7 +25,6 @@ #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ 115200} -#define CONFIG_UDP_CHECKSUM #define CONFIG_TIMESTAMP #define CONFIG_BOOTP_SERVERIP diff --git a/net/Kconfig b/net/Kconfig index fb6420f9bbe..3d3329912da 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -107,4 +107,11 @@ config KEEP_SERVERADDR enabled, when an ARP reply is received, the server's IP address is written there. +config UDP_CHECKSUM + bool "Check the UDP checksum" + help + Enable this to verif
[PATCH 1/4] Convert CONFIG_KEEP_SERVERADDR to Kconfig
This converts the following to Kconfig: CONFIG_KEEP_SERVERADDR Drop the preprocessor usage also. Signed-off-by: Simon Glass --- README | 6 -- include/configs/sandbox.h| 1 - net/Kconfig | 9 + net/arp.c| 5 ++--- scripts/config_whitelist.txt | 1 - 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README b/README index 056b717557b..eaf9170e952 100644 --- a/README +++ b/README @@ -1193,12 +1193,6 @@ The following options need to be configured: server to contact when using the "tftboot" command. (Environment variable "serverip") - CONFIG_KEEP_SERVERADDR - - Keeps the server's MAC address, in the env 'serveraddr' - for passing to bootargs (like Linux's netconsole option) - -- Gateway IP address: CONFIG_GATEWAYIP Defines a default value for the IP address of the diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index cd7d99ec69c..1dd21d5e925 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -25,7 +25,6 @@ #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ 115200} -#define CONFIG_KEEP_SERVERADDR #define CONFIG_UDP_CHECKSUM #define CONFIG_TIMESTAMP #define CONFIG_BOOTP_SERVERIP diff --git a/net/Kconfig b/net/Kconfig index 7a2d1450188..fb6420f9bbe 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -98,4 +98,13 @@ config SERVERIP_FROM_PROXYDHCP_DELAY_MS receiving response from main DHCP server. Has no effect if SERVERIP_FROM_PROXYDHCP is false. +config KEEP_SERVERADDR + bool "Write the server's MAC address to 'serveraddr'" + default y if SANDBOX + help + Keeps the server's MAC address, in the env 'serveraddr' + for passing to bootargs (like Linux's netconsole option). If this is + enabled, when an ARP reply is received, the server's IP address is + written there. + endif # if NET diff --git a/net/arp.c b/net/arp.c index 1d06ed25722..0b086dc8d21 100644 --- a/net/arp.c +++ b/net/arp.c @@ -196,13 +196,12 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) if (!arp_is_waiting()) break; -#ifdef CONFIG_KEEP_SERVERADDR - if (net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) { + if (IS_ENABLED(CONFIG_KEEP_SERVERADDR) && + net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) { char buf[20]; sprintf(buf, "%pM", &arp->ar_sha); env_set("serveraddr", buf); } -#endif reply_ip_addr = net_read_ip(&arp->ar_spa); diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 6d961ccb3e6..3285d3cd30e 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -639,7 +639,6 @@ CONFIG_JFFS2_PART_SIZE CONFIG_JFFS2_SUMMARY CONFIG_JRSTARTR_JR0 CONFIG_JTAG_CONSOLE -CONFIG_KEEP_SERVERADDR CONFIG_KEY_REVOCATION CONFIG_KIRKWOOD_EGIGA_INIT CONFIG_KIRKWOOD_GPIO -- 2.34.1.173.g76aa8bc2d0-goog
[PATCH 4/4] Convert CONFIG_BOOTP_SERVERIP to Kconfig
This converts the following to Kconfig: CONFIG_BOOTP_SERVERIP Signed-off-by: Simon Glass --- README| 3 --- arch/arm/mach-stm32mp/Kconfig | 1 + configs/adp-ae3xx_defconfig | 1 + configs/adp-ag101p_defconfig | 1 + configs/bitmain_antminer_s9_defconfig | 1 + configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig| 1 + configs/sandbox_noinst_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + include/configs/adp-ae3xx.h | 2 -- include/configs/adp-ag101p.h | 2 -- include/configs/bitmain_antminer_s9.h | 2 -- include/configs/sandbox.h | 2 -- include/configs/stm32mp15_common.h| 1 - net/Kconfig | 7 +++ scripts/config_whitelist.txt | 1 - 17 files changed, 16 insertions(+), 13 deletions(-) diff --git a/README b/README index eaf9170e952..fcbb550b1e4 100644 --- a/README +++ b/README @@ -1257,9 +1257,6 @@ The following options need to be configured: CONFIG_BOOTP_VENDOREX CONFIG_BOOTP_MAY_FAIL - CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip - environment variable, not the BOOTP server. - CONFIG_BOOTP_MAY_FAIL - If the DHCP server is not found after the configured retry count, the call will fail instead of starting over. This can be used to fail over diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index a6c7fc5bfde..06ac349e2e7 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -173,6 +173,7 @@ config STM32_ETZPC bool "STM32 Extended TrustZone Protection" depends on STM32MP15x default y + imply BOOTP_SERVERIP help Say y to enable STM32 Extended TrustZone Protection diff --git a/configs/adp-ae3xx_defconfig b/configs/adp-ae3xx_defconfig index 3fa00fb4cc4..89f2a153b1d 100644 --- a/configs/adp-ae3xx_defconfig +++ b/configs/adp-ae3xx_defconfig @@ -30,6 +30,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM=y CONFIG_CLK=y CONFIG_MMC=y diff --git a/configs/adp-ag101p_defconfig b/configs/adp-ag101p_defconfig index cc6541b1e3b..b9d1117ff7d 100644 --- a/configs/adp-ag101p_defconfig +++ b/configs/adp-ag101p_defconfig @@ -28,6 +28,7 @@ CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x8014 CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM=y CONFIG_MMC=y CONFIG_FTSDC010=y diff --git a/configs/bitmain_antminer_s9_defconfig b/configs/bitmain_antminer_s9_defconfig index 4cd6a7c102d..f656360 100644 --- a/configs/bitmain_antminer_s9_defconfig +++ b/configs/bitmain_antminer_s9_defconfig @@ -56,6 +56,7 @@ CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_BOOTP_SERVERIP=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_FPGA_XILINX=y diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index d849989cf61..bdf805ad197 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -96,6 +96,7 @@ CONFIG_ENV_IMPORT_FDT=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM_DMA=y CONFIG_REGMAP=y CONFIG_SYSCON=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index c390afe9de5..36461b21b39 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -121,6 +121,7 @@ CONFIG_ENV_IMPORT_FDT=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM_DMA=y CONFIG_DEVRES=y CONFIG_DEBUG_DEVRES=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index f184723a899..7d2130dd89c 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -76,6 +76,7 @@ CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y +CONFIG_BOOTP_SERVERIP=y CONFIG_DM_DMA=y CONFIG_REGMAP=y CONFIG_SYSCON=y diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index 490368e768f..6679c4335b2 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -96,6 +96,7 @@ CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y +CONFIG_BOOTP_SERVERIP=y CONFIG_SPL_DM=y CONFIG_DM_DMA=y CONFIG_REGMAP=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index f1a54ace9bc..fddf132dfed 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -98,6 +98,7 @@ CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_D
Re: [PATCH 2/3] arch: imx8m: imx-regs.h add the USB regs
On 2021-12-17 09:45, Fabio Estevam wrote: On Fri, Dec 17, 2021 at 2:03 PM Adam Ford wrote: I didn't think Driver model was a requirement for SPL. That's my understanding as well. > I had problems getting the dwc3 to initialize properly when using the > device model in the SPL. I'm currently just using this in the SPL and > the device model in u-boot. > > I'll take another shot at initializing the dwc3 in the SPL with the DM. Could we compromise by putting the #define statements in an ifdef to only enable them when SPL is being built? This looks like a a good idea. Thanks Fabian and Adam, I'll rework with the CONFIG_SPL_BUILD guards in place. Angus
Re: [PATCH 0/2] Add more support for NXP's mfgtool
Hi Oleh On 2021-12-18 00:44, Oleh Kravchenko wrote: Hello Angus! What is the use-case for these patches? Would you mind defining why the current implementation is not enough? Used like that: FB: flash -raw2sparse mmc0 emmc.wic Thanks, it looks like the way I'm using fastboot is causing the issue. FB: ucmd setenv fastboot_dev mmc FB: ucmd setenv mmcdev 0 FB: flash -raw2sparse all using your syntax I likely won't need these patches. FB: flash -raw2sparse mmc0 Cheers Angus
Re: Please pull u-boot-marvell/next
On Sat, Dec 18, 2021 at 02:51:49PM +0100, Stefan Roese wrote: > Hi Tom, > > please pull the following Marvell MVEBU related patches into next: > > > - Armada XP etc: Move to DM_I2C (Stefan) > - Some mvebu comphy + mox + fdt_support changes (Marek & Pali) > - mvebu: a38x: improve USB3 serdes configuration (Stefan Eichenberger) > - mvebu: Some maintainer updates (Pali) > - mvebu: Misc minor cleanup (Pali) > > > Here the Azure build, without any issues: > > https://dev.azure.com/sr0718/u-boot/_build/results?buildId=140&view=results > > Thanks, > Stefan > > The following changes since commit c03942ddc9e88d86d919504299905e4e8b0003cd: > > Merge commit '4720b83d2c711062cfb55f03591b8f12c897d7cb' of > https://github.com/tienfong/uboot_mainline (2021-12-17 07:24:56 -0500) This is against master and not next. Please rebase to just on top of next. -- Tom signature.asc Description: PGP signature
Re: [PATCH u-boot-marvell 00/10] PCI mvebu and aardvark changes
Hi Pali, On 12/16/21 11:28, Pali Rohár wrote: On Wednesday 15 December 2021 09:10:50 Stefan Roese wrote: Hi Pali, On 12/13/21 11:27, Pali Rohár wrote: On Monday 13 December 2021 08:41:30 Stefan Roese wrote: Hi Pali, On 12/12/21 12:23, Pali Rohár wrote: On Thursday 11 November 2021 16:35:39 Marek Behún wrote: From: Marek Behún Hello Stefan, we have some more fixes for PCI (mvebu and aardvark), and one patch for Turris MOX board code. Marek Hello Stefan, patches 1, 2 and 7 still needs some modifications. But other remaining patches should be OK. Would you merge remaining patches? And then we can focus on issues with link initialization. Sure, I can pull the "remaining patches" into next (for master it's too late in the release cycle) if this helps. Just let me know and I'll go through the patch queue in the next days to push more Marvell related patches into next. Ok. But please consider applying patches 5, 6 and 9 to master as they have Fixes tag for commits which are already in master branch. Okay, thanks for the reminder. The Azure world build is running. So I'll send the pull request for these 3 patches most likely later today. Hello and thank you! Could you include patches prepared for next into some branch, so I can prepare new patches on top of that branch to so patches would be correctly rebased? Done. As you will have noticed, I've pulled a bunch of patches into next and did send a pull request just a few minutes ago. Please let me know if I forgot something. Once all this lands in Tom's next branch, this should be a good base for your rebase. Thanks, Stefan Thanks, Stefan Thanks, Stefan Marek Behún (2): pci: pci_mvebu, pci_aardvark: Fix size of configuration cache arm: mvebu: turris_mox: Remove extra newline after module topology Pali Rohár (8): pci: pci_mvebu: Wait 100ms for Link Up in mvebu_pcie_probe() arm: mvebu: a38x: serdes: Move non-serdes PCIe code to pci_mvebu.c pci: pci_mvebu: Move setup for BAR[0] where other BARs are setup pci: pci_mvebu: Replace MBUS_PCI_*_SIZE by resource_size() pci: pci_mvebu: Do not allow setting ROM BAR on PCI Bridge pci: pci_mvebu: Fix PCIe MEM and IO resources assignment and mbus mapping pci: pci_mvebu: Remove unused DECLARE_GLOBAL_DATA_PTR arm: a37xx: pci: Do not allow setting ROM BAR on PCI Bridge arch/arm/mach-mvebu/include/mach/cpu.h| 4 +- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h| 4 - .../serdes/a38x/high_speed_env_spec.c | 15 -- board/CZ.NIC/turris_mox/turris_mox.c | 3 - drivers/pci/pci-aardvark.c| 54 +++-- drivers/pci/pci_mvebu.c | 205 -- 6 files changed, 175 insertions(+), 110 deletions(-) -- 2.32.0 Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
Please pull u-boot-marvell/next
Hi Tom, please pull the following Marvell MVEBU related patches into next: - Armada XP etc: Move to DM_I2C (Stefan) - Some mvebu comphy + mox + fdt_support changes (Marek & Pali) - mvebu: a38x: improve USB3 serdes configuration (Stefan Eichenberger) - mvebu: Some maintainer updates (Pali) - mvebu: Misc minor cleanup (Pali) Here the Azure build, without any issues: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=140&view=results Thanks, Stefan The following changes since commit c03942ddc9e88d86d919504299905e4e8b0003cd: Merge commit '4720b83d2c711062cfb55f03591b8f12c897d7cb' of https://github.com/tienfong/uboot_mainline (2021-12-17 07:24:56 -0500) are available in the Git repository at: g...@source.denx.de:u-boot/custodians/u-boot-marvell.git next for you to fetch changes up to 2548e6b8fcaf923bdf43c24e89acc12c0e897053: arm: mvebu: Use printf for printing fatal errors (2021-12-18 10:17:54 +0100) Marek Behún (8): treewide: Use fdt_create_phandle() where appropriate fdt_support: Remove fdt_alloc_phandle() in favor of fdt_generate_phandle() fdt_support: Remove FDT_STATUS_FAIL_ERROR_CODE fdt_support: Fix comment for fdt_create_phandle() fdt_support: Add some useful functions arm: mvebu: turris_mox: Find DT nodes by compatible or alias instead of path arm: mvebu: turris_mox: Fix unstable board topology reading fdt_support: Add fdt_delete_disabled_nodes() and use in Turris MOX Pali Rohár (7): include/linux/byteorder: Fix compilation of __constant_cpu_to_be32() arm: mvebu: turris_mox: Enable eth1 in U-Boot if a network module is present phy: marvell: a3700: Convert to official DT bindings in COMPHY driver arm: mvebu: pci: Add me as co-maintainer and author of Marvell PCIe drivers arm: mvebu: serial: Add me as co-maintainer and author of Marvell serial drivers arm: mvebu: Remove commented example code arm: mvebu: Use printf for printing fatal errors Stefan Eichenberger (2): arm: mvebu: a38x: serdes: fix serdes config for USB3 arm: mvebu: a38x: serdes: improve USB3 electrical configuration Stefan Roese (9): arm: mvebu: theadorable_debug_defconfig: Enable DM_I2C arm: mvebu: db-mv784mp-gp_defconfig: Enable DM_I2C arm: mvebu: ds414_defconfig: Enable DM_I2C arm: mvebu: maxbcm_defconfig: Enable DM_I2C arm: mvebu: theadorable: Switch to using DM I2C API arm: mvebu: axp/high_speed_env_lib: Switch to DM_I2C API arm: mvebu: axp: Remove unreferenced ddr3_get_eprom_fabric() function arm: mvebu: axp: ddr: Switch to using DM I2C API arm: mvebu: armada-xp-theadorable.dts: Add I2C DT nodes MAINTAINERS| 16 +- arch/arm/cpu/armv7/ls102xa/fdt.c | 6 +- arch/arm/dts/armada-3720-espressobin.dts | 21 +- arch/arm/dts/armada-3720-turris-mox.dts| 25 +-- arch/arm/dts/armada-3720-uDPU.dts | 23 +-- arch/arm/dts/armada-37xx.dtsi | 20 +- arch/arm/dts/armada-xp-theadorable.dts | 12 ++ .../mach-mvebu/serdes/a38x/high_speed_env_spec.c | 41 +++- arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h | 2 + .../arm/mach-mvebu/serdes/axp/high_speed_env_lib.c | 17 +- arch/arm/mach-mvebu/spl.c | 17 +- board/CZ.NIC/turris_mox/turris_mox.c | 223 - board/Marvell/octeon_ebb7304/board.c | 5 +- board/freescale/lx2160a/eth_lx2160aqds.c | 8 +- board/freescale/lx2160a/eth_lx2162aqds.c | 8 +- board/gateworks/gw_ventana/common.c| 3 +- board/kontron/sl28/sl28.c | 2 +- board/theadorable/theadorable.c| 15 +- common/fdt_support.c | 174 +--- configs/db-mv784mp-gp_defconfig| 4 +- configs/ds414_defconfig| 4 +- configs/maxbcm_defconfig | 4 +- configs/theadorable_debug_defconfig| 4 +- drivers/ddr/marvell/axp/ddr3_hw_training.h | 1 - drivers/ddr/marvell/axp/ddr3_init.c| 40 +--- drivers/ddr/marvell/axp/ddr3_init.h| 3 +- drivers/ddr/marvell/axp/ddr3_spd.c | 16 +- drivers/misc/fsl_portals.c | 10 +- drivers/pci/pci-aardvark.c | 1 + drivers/pci/pci_mvebu.c| 1 + drivers/pci/pcie_layerscape_fixup.c| 8 +- drivers/pci/pcie_layerscape_gen4_fixup.c | 8 +- drivers/phy/marvell/comphy_a3700.c | 133 drivers/phy/marvell/comphy_core.
Re: [PATCH] arm: mvebu: Use printf for printing fatal errors
On 12/17/21 18:31, Pali Rohár wrote: There is no point to hide/disable fatal errors via debug() macro. Print fatal errors loudly. Signed-off-by: Pali Rohár Applied to u-boot-marvell/next Thanks, Stefan --- arch/arm/mach-mvebu/spl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 29a8adc9d79c..609495097585 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -313,7 +313,7 @@ void board_init_f(ulong dummy) ret = spl_init(); if (ret) { - debug("spl_init() failed: %d\n", ret); + printf("spl_init() failed: %d\n", ret); hang(); } @@ -329,7 +329,7 @@ void board_init_f(ulong dummy) /* Setup DDR */ ret = ddr3_init(); if (ret) { - debug("ddr3_init() failed: %d\n", ret); + printf("ddr3_init() failed: %d\n", ret); hang(); } #endif Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
Re: [PATCH] arm: mvebu: Remove commented example code
On 12/17/21 18:28, Pali Rohár wrote: Include file debug_uart.h already contains documentation how to use it. Signed-off-by: Pali Rohár Applied to u-boot-marvell/next Thanks, Stefan --- arch/arm/mach-mvebu/spl.c | 13 - 1 file changed, 13 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 6a9e1d860cf7..29a8adc9d79c 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -5,7 +5,6 @@ #include #include -#include #include #include #include @@ -303,18 +302,6 @@ void board_init_f(ulong dummy) */ board_early_init_f(); - /* Example code showing how to enable the debug UART on MVEBU */ -#ifdef EARLY_UART - /* -* Debug UART can be used from here if required: -* -* debug_uart_init(); -* printch('a'); -* printhex8(0x1234); -* printascii("string"); -*/ -#endif - /* * Use special translation offset for SPL. This needs to be * configured *before* spl_init() is called as this function Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
Re: [PATCH u-boot-marvell 0/2] arm: mvebu: Add maintainer entries for Marvell PCIe and serial drivers
On 12/16/21 12:04, Pali Rohár wrote: Hello Stefan! I did big cleanup of Marvell PCIe and serial drivers and I'm sending these two patches which adds me as author and co-maintainer of these two drivers. Pali Rohár (2): arm: mvebu: pci: Add me as co-maintainer and author of Marvell PCIe drivers arm: mvebu: serial: Add me as co-maintainer and author of Marvell serial drivers MAINTAINERS | 16 +++- drivers/pci/pci-aardvark.c | 1 + drivers/pci/pci_mvebu.c | 1 + drivers/serial/serial_mvebu_a3700.c | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) Applied to u-boot-marvell/next Thanks, Stefan
Re: [PATCH 0/2] arm: mvebu: a38x: improve USB3 serdes configuration
On 12/9/21 11:19, Stefan Eichenberger wrote: This patchset improves the USB3 serdes configuration for the Armada 38x SoC from Marvell. The changes are based on the version from Marvell found here: https://github.com/MarvellEmbeddedProcessors/u-boot-marvell Stefan Eichenberger (2): arm: mvebu: a38x: serdes: fix serdes config for USB3 arm: mvebu: a38x: serdes: Improve USB3 electrical configuration .../serdes/a38x/high_speed_env_spec.c | 38 ++- arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h | 2 + 2 files changed, 31 insertions(+), 9 deletions(-) Applied to u-boot-marvell/next Thanks, Stefan
Re: [PATCH u-boot-marvell RESEND 00/11] Some mvebu comphy + mox + fdt_support changes
On 11/26/21 14:57, Marek Behún wrote: From: Marek Behún Hello Stefan, as requested I am resending this series with board maintainers added in Ccs. Original message: Pali prepared patches that convert A3720 comphy driver to use Linux' DT bindings. (Yes, I have patches that convert the whole driver into using SMC calls into ATF, but haven't found time yet to rebase them since last year, and Pali has done this in the meantime :-D Maybe I'll look into my old patches sometimes, but this is now usable.) These patches needed some changes in Turris MOX board code, and I added some more changes to handling device-tree fixups, and this lead to adding some code into fdt_support, which can hopefully be used by other people as well. No reply yet. Let's move forward if nobody objects. Applied to u-boot-marvell/next Thanks, Stefan Marek Marek Behún (8): treewide: Use fdt_create_phandle() where appropriate fdt_support: Remove fdt_alloc_phandle() in favor of fdt_generate_phandle() fdt_support: Remove FDT_STATUS_FAIL_ERROR_CODE fdt_support: Fix comment for fdt_create_phandle() fdt_support: Add some useful functions arm: mvebu: turris_mox: Find DT nodes by compatible or alias instead of path arm: mvebu: turris_mox: Fix unstable board topology reading fdt_support: Add fdt_delete_disabled_nodes() and use in Turris MOX Pali Rohár (3): include/linux/byteorder: Fix compilation of __constant_cpu_to_be32() arm: mvebu: turris_mox: Enable eth1 in U-Boot if a network module is present phy: marvell: a3700: Convert to official DT bindings in COMPHY driver arch/arm/cpu/armv7/ls102xa/fdt.c | 6 +- arch/arm/dts/armada-3720-espressobin.dts | 21 +-- arch/arm/dts/armada-3720-turris-mox.dts | 25 +-- arch/arm/dts/armada-3720-uDPU.dts| 23 +-- arch/arm/dts/armada-37xx.dtsi| 20 +- board/CZ.NIC/turris_mox/turris_mox.c | 223 --- board/Marvell/octeon_ebb7304/board.c | 5 +- board/freescale/lx2160a/eth_lx2160aqds.c | 8 +- board/freescale/lx2160a/eth_lx2162aqds.c | 8 +- board/gateworks/gw_ventana/common.c | 3 +- board/kontron/sl28/sl28.c| 2 +- common/fdt_support.c | 174 +++--- drivers/misc/fsl_portals.c | 10 +- drivers/pci/pcie_layerscape_fixup.c | 8 +- drivers/pci/pcie_layerscape_gen4_fixup.c | 8 +- drivers/phy/marvell/comphy_a3700.c | 133 ++ drivers/phy/marvell/comphy_core.c| 59 +- drivers/phy/marvell/comphy_core.h| 23 +++ drivers/phy/marvell/comphy_cp110.c | 58 ++ include/fdt_support.h| 51 -- include/linux/byteorder/swab.h | 4 + 21 files changed, 551 insertions(+), 321 deletions(-) Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de