diff options
29 files changed, 690 insertions, 566 deletions
diff --git a/arch/x86/cpu/tangier/Kconfig b/arch/x86/cpu/tangier/Kconfig index 571470c74b2..19aaf165d6a 100644 --- a/arch/x86/cpu/tangier/Kconfig +++ b/arch/x86/cpu/tangier/Kconfig @@ -10,9 +10,11 @@ config INTEL_TANGIER imply MMC_SDHCI imply MMC_SDHCI_SDMA imply MMC_SDHCI_TANGIER + imply MISC imply USB + imply USB_XHCI_HCD imply USB_DWC3 - imply BINMAN + imply USB_DWC3_GENERIC if INTEL_TANGIER @@ -27,8 +29,4 @@ config SYS_CAR_SIZE Space in bytes in eSRAM used as Cache-As-RAM (CAR). Note this size must not exceed eSRAM's total size. -config SYS_USB_OTG_BASE - hex - default 0xf9100000 - endif diff --git a/arch/x86/cpu/tangier/sdram.c b/arch/x86/cpu/tangier/sdram.c index df3b9e4ec97..afb08476ed3 100644 --- a/arch/x86/cpu/tangier/sdram.c +++ b/arch/x86/cpu/tangier/sdram.c @@ -196,6 +196,49 @@ unsigned int install_e820_map(unsigned int max_entries, return sfi_setup_e820(max_entries, entries); } +/* + * This function looks for the highest region of memory lower than 2GB which + * has enough space for U-Boot where U-Boot is aligned on a page boundary. It + * overrides the default implementation found elsewhere which simply picks the + * end of RAM, wherever that may be. The location of the stack, the relocation + * address, and how far U-Boot is moved by relocation are set in the global + * data structure. + */ +ulong board_get_usable_ram_top(ulong total_size) +{ + struct sfi_table_simple *sb; + struct sfi_mem_entry *mentry; + ulong dest_addr = 0; + u32 i; + + sb = sfi_search_mmap(); + if (!sb) + panic("No available memory found for relocation"); + + sfi_for_each_mentry(i, sb, mentry) { + unsigned long long start, end; + + if (mentry->type != SFI_MEM_CONV) + continue; + + start = mentry->phys_start; + end = start + (mentry->pages << 12); + + /* Filter memory over 2GB. */ + if (end > 0x7fffffffULL) + end = 0x80000000ULL; + /* Skip this region if it's too small. */ + if (end - start < total_size) + continue; + + /* Use this address if it's the largest so far. */ + if (end > dest_addr) + dest_addr = end; + } + + return dest_addr; +} + int dram_init_banksize(void) { sfi_get_bank_size(); diff --git a/arch/x86/dts/edison.dts b/arch/x86/dts/edison.dts index bc84bc892e7..8d245bffc2f 100644 --- a/arch/x86/dts/edison.dts +++ b/arch/x86/dts/edison.dts @@ -16,7 +16,7 @@ / { model = "Intel Edison"; - compatible = "intel,edison"; + compatible = "intel,edison", "intel,tangier"; aliases { serial0 = &serial0; @@ -105,6 +105,18 @@ reg = <0xff009000 0x1000>; }; + usb: usb@f9100000 { + compatible = "intel,tangier-dwc3"; + #address-cells = <1>; + #size-cells = <1>; + + dwc3: dwc3 { + reg = <0xf9100000 0x100000>; + maximum-speed = "high-speed"; + dr_mode = "peripheral"; + }; + }; + watchdog: wdt@0 { compatible = "intel,tangier-wdt"; }; diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 50fb16d2dac..24a503d011e 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -60,8 +60,8 @@ * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR * @base_ptr: Pointer to the boot parameters, typically at address * DEFAULT_SETUP_BASE - * @cmdline: Address of 'override' command line, or 0 to use the one in the - * setup block + * @cmdline: Environment variable containing the 'override' command line, or + * NULL to use the one in the setup block */ struct zboot_state { ulong bzimage_addr; @@ -70,7 +70,7 @@ struct zboot_state { ulong initrd_size; ulong load_address; struct boot_params *base_ptr; - ulong cmdline; + char *cmdline; } state; enum { @@ -406,7 +406,7 @@ static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc, state.bzimage_addr = 0; } if (argc >= 7) - state.cmdline = simple_strtoul(argv[6], NULL, 16); + state.cmdline = env_get(argv[6]); return 0; } @@ -452,7 +452,7 @@ static int do_zboot_setup(struct cmd_tbl *cmdtp, int flag, int argc, } ret = setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET, 0, state.initrd_addr, state.initrd_size, - state.cmdline); + (ulong)state.cmdline); if (ret) { puts("Setting up boot parameters failed ...\n"); return CMD_RET_FAILURE; @@ -743,8 +743,9 @@ U_BOOT_CMDREP_COMPLETE( " initrd size - The size of the initrd image to use, if any.\n" " setup - The address of the kernel setup region, if this\n" " is not at addr\n" - " cmdline - The address of the kernel command line, to\n" - " override U-Boot's normal cmdline generation\n" + " cmdline - Environment variable containing the kernel\n" + " command line, to override U-Boot's normal\n" + " cmdline generation\n" "\n" "Sub-commands to do part of the zboot sequence:\n" "\tstart [addr [arg ...]] - specify arguments\n" diff --git a/board/intel/edison/Kconfig b/board/intel/edison/Kconfig index 05d65445e40..23b2af4821d 100644 --- a/board/intel/edison/Kconfig +++ b/board/intel/edison/Kconfig @@ -31,5 +31,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy select INTEL_TANGIER select BOARD_LATE_INIT select MD5 + imply BINMAN endif diff --git a/board/intel/edison/edison.c b/board/intel/edison/edison.c index 652f9755155..11e7f74e47c 100644 --- a/board/intel/edison/edison.c +++ b/board/intel/edison/edison.c @@ -3,15 +3,10 @@ * Copyright (c) 2017 Intel Corporation */ #include <common.h> -#include <dwc3-uboot.h> #include <env.h> #include <init.h> #include <mmc.h> #include <u-boot/md5.h> -#include <usb.h> -#include <watchdog.h> - -#include <linux/usb/gadget.h> #include <asm/cache.h> #include <asm/pmu.h> @@ -27,36 +22,6 @@ int board_early_init_r(void) return 0; } -static struct dwc3_device dwc3_device_data = { - .maximum_speed = USB_SPEED_HIGH, - .base = CONFIG_SYS_USB_OTG_BASE, - .dr_mode = USB_DR_MODE_PERIPHERAL, - .index = 0, -}; - -int usb_gadget_handle_interrupts(int controller_index) -{ - dwc3_uboot_handle_interrupt(controller_index); - WATCHDOG_RESET(); - return 0; -} - -int board_usb_init(int index, enum usb_init_type init) -{ - if (index == 0 && init == USB_INIT_DEVICE) - return dwc3_uboot_init(&dwc3_device_data); - return -EINVAL; -} - -int board_usb_cleanup(int index, enum usb_init_type init) -{ - if (index == 0 && init == USB_INIT_DEVICE) { - dwc3_uboot_exit(index); - return 0; - } - return -EINVAL; -} - static void assign_serial(void) { struct mmc *mmc = find_mmc_device(0); diff --git a/configs/apalis-imx8x_defconfig b/configs/apalis-imx8x_defconfig index e6aa5753805..777d3a93542 100644 --- a/configs/apalis-imx8x_defconfig +++ b/configs/apalis-imx8x_defconfig @@ -3,6 +3,8 @@ CONFIG_ARCH_IMX8=y CONFIG_SYS_TEXT_BASE=0x80020000 CONFIG_SYS_MALLOC_F_LEN=0x4000 CONFIG_NR_DRAM_BANKS=3 +CONFIG_SYS_MEMTEST_START=0x88000000 +CONFIG_SYS_MEMTEST_END=0x89000000 CONFIG_ENV_SIZE=0x2000 CONFIG_ENV_OFFSET=0xFFFFDE00 CONFIG_DM_GPIO=y @@ -21,8 +23,6 @@ CONFIG_CMD_CPU=y # CONFIG_BOOTM_NETBSD is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_MEMTEST=y -CONFIG_SYS_MEMTEST_START=0x88000000 -CONFIG_SYS_MEMTEST_END=0x89000000 CONFIG_CMD_CLK=y CONFIG_CMD_DM=y CONFIG_CMD_GPIO=y diff --git a/configs/edison_defconfig b/configs/edison_defconfig index c69c3f883c1..304a172a1b9 100644 --- a/configs/edison_defconfig +++ b/configs/edison_defconfig @@ -37,7 +37,7 @@ CONFIG_DFU_TIMEOUT=y CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y CONFIG_SUPPORT_EMMC_BOOT=y -CONFIG_DM_PCI_COMPAT=y +CONFIG_DM_USB_GADGET=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Intel" CONFIG_USB_GADGET_VENDOR_NUM=0x8087 diff --git a/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig b/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig index 610e09d7266..2ecd6b404a1 100644 --- a/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig +++ b/configs/lx2162aqds_tfa_SECURE_BOOT_defconfig @@ -1,17 +1,19 @@ CONFIG_ARM=y +CONFIG_GIC_V3_ITS=y CONFIG_TARGET_LX2162AQDS=y CONFIG_TFABOOT=y CONFIG_SYS_TEXT_BASE=0x82000000 CONFIG_SYS_MALLOC_F_LEN=0x6000 -CONFIG_NXP_ESBC=y +CONFIG_NR_DRAM_BANKS=3 CONFIG_ENV_SIZE=0x2000 -CONFIG_ENV_SECT_SIZE=0x20000 -CONFIG_ENV_OFFSET=0x500000 +CONFIG_NXP_ESBC=y +CONFIG_DM_GPIO=y CONFIG_FSPI_AHB_EN_4BYTE=y CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y +CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2162a-qds" CONFIG_AHCI=y -CONFIG_NR_DRAM_BANKS=3 +CONFIG_OF_BOARD_FIXUP=y CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -20,41 +22,39 @@ CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x2 # CONFIG_USE_BOOTCOMMAND is not set CONFIG_BOARD_EARLY_INIT_R=y CONFIG_MISC_INIT_R=y -CONFIG_BOARD_EARLY_INIT_R=y CONFIG_CMD_GREPENV=y CONFIG_CMD_EEPROM=y CONFIG_CMD_DM=y -CONFIG_CMD_GPT=y CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y -CONFIG_CMD_SF=y CONFIG_CMD_USB=y CONFIG_CMD_WDT=y CONFIG_CMD_CACHE=y CONFIG_MP=y CONFIG_OF_CONTROL=y -CONFIG_OF_BOARD_FIXUP=y -CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2162a-qds" CONFIG_OF_LIST="fsl-lx2162a-qds-17-x fsl-lx2162a-qds-18-x fsl-lx2162a-qds-20-x" CONFIG_MULTI_DTB_FIT=y CONFIG_ENV_OVERWRITE=y -CONFIG_ENV_IS_IN_MMC=y -CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_ENV_ADDR=0x20500000 CONFIG_NET_RANDOM_ETHADDR=y CONFIG_DM=y CONFIG_SATA_CEVA=y +CONFIG_MPC8XXX_GPIO=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y CONFIG_DM_MMC=y CONFIG_MMC_HS400_SUPPORT=y CONFIG_FSL_ESDHC=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_EON=y -CONFIG_SPI_FLASH_SST=y -CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set CONFIG_PHYLIB=y CONFIG_PHY_AQUANTIA=y @@ -72,6 +72,8 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_LAYERSCAPE_RC=y +CONFIG_DM_RTC=y +CONFIG_RTC_PCF2127=y CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y @@ -88,14 +90,3 @@ CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y -CONFIG_GIC_V3_ITS=y -CONFIG_DM_I2C=y -CONFIG_I2C_SET_DEFAULT_BUS_NUM=y -CONFIG_I2C_DEFAULT_BUS_NUMBER=0 -CONFIG_DM_RTC=y -CONFIG_DM_GPIO=y -CONFIG_CMD_DATE=y -CONFIG_RTC_PCF2127=y -CONFIG_I2C_MUX=y -CONFIG_I2C_MUX_PCA954x=y -CONFIG_MPC8XXX_GPIO=y diff --git a/configs/lx2162aqds_tfa_defconfig b/configs/lx2162aqds_tfa_defconfig index af7a63f6af6..d0d33840478 100644 --- a/configs/lx2162aqds_tfa_defconfig +++ b/configs/lx2162aqds_tfa_defconfig @@ -1,16 +1,20 @@ CONFIG_ARM=y +CONFIG_GIC_V3_ITS=y CONFIG_TARGET_LX2162AQDS=y +CONFIG_TFABOOT=y CONFIG_SYS_TEXT_BASE=0x82000000 CONFIG_SYS_MALLOC_F_LEN=0x6000 +CONFIG_NR_DRAM_BANKS=3 CONFIG_ENV_SIZE=0x2000 -CONFIG_ENV_SECT_SIZE=0x20000 CONFIG_ENV_OFFSET=0x500000 +CONFIG_ENV_SECT_SIZE=0x20000 +CONFIG_DM_GPIO=y CONFIG_FSPI_AHB_EN_4BYTE=y -CONFIG_TFABOOT=y CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y +CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2162a-qds" CONFIG_AHCI=y -CONFIG_NR_DRAM_BANKS=3 +CONFIG_OF_BOARD_FIXUP=y CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -20,23 +24,20 @@ CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x2 # CONFIG_USE_BOOTCOMMAND is not set CONFIG_BOARD_EARLY_INIT_R=y CONFIG_MISC_INIT_R=y -CONFIG_BOARD_EARLY_INIT_R=y CONFIG_CMD_GREPENV=y CONFIG_CMD_EEPROM=y CONFIG_CMD_DM=y -CONFIG_CMD_GPT=y CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_OPTEE_RPMB=y CONFIG_CMD_PCI=y -CONFIG_CMD_SF=y CONFIG_CMD_USB=y CONFIG_CMD_WDT=y CONFIG_CMD_CACHE=y CONFIG_MP=y CONFIG_OF_CONTROL=y -CONFIG_OF_BOARD_FIXUP=y -CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2162a-qds" CONFIG_OF_LIST="fsl-lx2162a-qds-17-x fsl-lx2162a-qds-18-x fsl-lx2162a-qds-20-x" CONFIG_MULTI_DTB_FIT=y CONFIG_ENV_OVERWRITE=y @@ -47,15 +48,21 @@ CONFIG_NET_RANDOM_ETHADDR=y CONFIG_DM=y CONFIG_SATA_CEVA=y CONFIG_FSL_CAAM=y +CONFIG_MPC8XXX_GPIO=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y CONFIG_DM_MMC=y +CONFIG_SUPPORT_EMMC_RPMB=y CONFIG_MMC_HS400_SUPPORT=y CONFIG_FSL_ESDHC=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_EON=y -CONFIG_SPI_FLASH_SST=y -CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set CONFIG_PHYLIB=y CONFIG_PHY_AQUANTIA=y @@ -73,12 +80,16 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_LAYERSCAPE_RC=y +CONFIG_DM_RTC=y +CONFIG_RTC_PCF2127=y CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_NXP_FSPI=y +CONFIG_TEE=y +CONFIG_OPTEE=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y @@ -86,19 +97,3 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_WDT=y CONFIG_WDT_SBSA=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y -CONFIG_GIC_V3_ITS=y -CONFIG_DM_I2C=y -CONFIG_I2C_SET_DEFAULT_BUS_NUM=y -CONFIG_I2C_DEFAULT_BUS_NUMBER=0 -CONFIG_DM_RTC=y -CONFIG_DM_GPIO=y -CONFIG_CMD_DATE=y -CONFIG_RTC_PCF2127=y -CONFIG_I2C_MUX=y -CONFIG_I2C_MUX_PCA954x=y -CONFIG_MPC8XXX_GPIO=y -CONFIG_TEE=y -CONFIG_OPTEE=y -CONFIG_OPTEE_TA_AVB=y -CONFIG_SUPPORT_EMMC_RPMB=y -CONFIG_CMD_OPTEE_RPMB=y diff --git a/configs/lx2162aqds_tfa_verified_boot_defconfig b/configs/lx2162aqds_tfa_verified_boot_defconfig index 32c583cf82e..b9261251c15 100644 --- a/configs/lx2162aqds_tfa_verified_boot_defconfig +++ b/configs/lx2162aqds_tfa_verified_boot_defconfig @@ -1,19 +1,22 @@ CONFIG_ARM=y +CONFIG_GIC_V3_ITS=y CONFIG_TARGET_LX2162AQDS=y +CONFIG_TFABOOT=y CONFIG_SYS_TEXT_BASE=0x82000000 CONFIG_SYS_MALLOC_F_LEN=0x6000 +CONFIG_NR_DRAM_BANKS=3 CONFIG_ENV_SIZE=0x2000 -CONFIG_ENV_SECT_SIZE=0x20000 CONFIG_ENV_OFFSET=0x500000 +CONFIG_ENV_SECT_SIZE=0x20000 +CONFIG_DM_GPIO=y CONFIG_FSPI_AHB_EN_4BYTE=y -CONFIG_TFABOOT=y CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y +CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2162a-qds" CONFIG_AHCI=y -CONFIG_NR_DRAM_BANKS=3 -CONFIG_FIT_VERBOSE=y +CONFIG_OF_BOARD_FIXUP=y CONFIG_FIT_SIGNATURE=y -CONFIG_RSA=y +CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_BOOTDELAY=10 @@ -22,23 +25,20 @@ CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x2 # CONFIG_USE_BOOTCOMMAND is not set CONFIG_BOARD_EARLY_INIT_R=y CONFIG_MISC_INIT_R=y -CONFIG_BOARD_EARLY_INIT_R=y CONFIG_CMD_GREPENV=y CONFIG_CMD_EEPROM=y CONFIG_CMD_DM=y -CONFIG_CMD_GPT=y CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_OPTEE_RPMB=y CONFIG_CMD_PCI=y -CONFIG_CMD_SF=y CONFIG_CMD_USB=y CONFIG_CMD_WDT=y CONFIG_CMD_CACHE=y CONFIG_MP=y CONFIG_OF_CONTROL=y -CONFIG_OF_BOARD_FIXUP=y -CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2162a-qds" CONFIG_OF_LIST="fsl-lx2162a-qds-17-x fsl-lx2162a-qds-18-x fsl-lx2162a-qds-20-x" CONFIG_MULTI_DTB_FIT=y CONFIG_ENV_OVERWRITE=y @@ -49,15 +49,21 @@ CONFIG_NET_RANDOM_ETHADDR=y CONFIG_DM=y CONFIG_SATA_CEVA=y CONFIG_FSL_CAAM=y +CONFIG_MPC8XXX_GPIO=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y CONFIG_DM_MMC=y +CONFIG_SUPPORT_EMMC_RPMB=y CONFIG_MMC_HS400_SUPPORT=y CONFIG_FSL_ESDHC=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_EON=y -CONFIG_SPI_FLASH_SST=y -CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set CONFIG_PHYLIB=y CONFIG_PHY_AQUANTIA=y @@ -75,12 +81,16 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_LAYERSCAPE_RC=y +CONFIG_DM_RTC=y +CONFIG_RTC_PCF2127=y CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_NXP_FSPI=y +CONFIG_TEE=y +CONFIG_OPTEE=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y @@ -88,19 +98,3 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_WDT=y CONFIG_WDT_SBSA=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y -CONFIG_GIC_V3_ITS=y -CONFIG_DM_I2C=y -CONFIG_I2C_SET_DEFAULT_BUS_NUM=y -CONFIG_I2C_DEFAULT_BUS_NUMBER=0 -CONFIG_DM_RTC=y -CONFIG_DM_GPIO=y -CONFIG_CMD_DATE=y -CONFIG_RTC_PCF2127=y -CONFIG_I2C_MUX=y -CONFIG_I2C_MUX_PCA954x=y -CONFIG_TEE=y -CONFIG_OPTEE=y -CONFIG_CMD_OPTEE_RPMB=y -CONFIG_OPTEE_TA_AVB=y -CONFIG_SUPPORT_EMMC_RPMB=y -CONFIG_MPC8XXX_GPIO=y diff --git a/doc/README.bootmenu b/doc/README.bootmenu deleted file mode 100644 index 9ff89f2e55c..00000000000 --- a/doc/README.bootmenu +++ /dev/null @@ -1,98 +0,0 @@ -SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2011-2012 Pali Rohár <pali@kernel.org> - */ - -ANSI terminal bootmenu command - -The "bootmenu" command uses U-Boot menu interfaces and provides -a simple mechanism for creating menus with different boot items. -The cursor keys "Up" and "Down" are used for navigation through -the items. Current active menu item is highlighted and can be -selected using the "Enter" key. The selection of the highlighted -menu entry invokes an U-Boot command (or a list of commands) -associated with this menu entry. - -The "bootmenu" command interprets ANSI escape sequencies, so -an ANSI terminal is required for proper menu rendering and item -selection. - -The assembling of the menu is done via a set of environment variables -"bootmenu_<num>" and "bootmenu_delay", i.e.: - - bootmenu_delay=<delay> - bootmenu_<num>="<title>=<commands>" - - <delay> is the autoboot delay in seconds, after which the first - menu entry will be selected automatically - - <num> is the boot menu entry number, starting from zero - - <title> is the text of the menu entry shown on the console - or on the boot screen - - <commands> are commands which will be executed when a menu - entry is selected - - (title and commands are separated by first appearance of '=' - character in the environment variable) - -First (optional) argument of the "bootmenu" command is a delay specifier -and it overrides the delay value defined by "bootmenu_delay" environment -variable. If the environment variable "bootmenu_delay" is not set or if -the argument of the "bootmenu" command is not specified, the default delay -will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on -the console (or on the screen) and the command of the first menu entry will -be called immediately. If delay is less then 0, bootmenu will be shown and -autoboot will be disabled. - -Bootmenu always adds menu entry "U-Boot console" at the end of all menu -entries specified by environment variables. When selecting this entry -the bootmenu terminates and the usual U-Boot command prompt is presented -to the user. - -Example environment: - - setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000 # Set first menu entry - setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000 # Set second menu entry - setenv bootmenu_2 Reset board=reset # Set third menu entry - setenv bootmenu_3 U-Boot boot order=boot # Set fourth menu entry - bootmenu 20 # Run bootmenu with autoboot delay 20s - - -The above example will be rendered as below -(without decorating rectangle): - -┌──────────────────────────────────────────┐ -│ │ -│ *** U-Boot Boot Menu *** │ -│ │ -│ Boot 1. kernel │ -│ Boot 2. kernel │ -│ Reset board │ -│ U-Boot boot order │ -│ U-Boot console │ -│ │ -│ Hit any key to stop autoboot: 20 │ -│ Press UP/DOWN to move, ENTER to select │ -│ │ -└──────────────────────────────────────────┘ - -Selected menu entry will be highlighted - it will have inverted -background and text colors. - -To enable the "bootmenu" command add following definitions to the -board config file: - - #define CONFIG_CMD_BOOTMENU - #define CONFIG_MENU - -To run the bootmenu at startup add these additional definitions: - - #define CONFIG_AUTOBOOT_KEYED - #define CONFIG_BOOTDELAY 30 - #define CONFIG_AUTOBOOT_MENU_SHOW - -When you intend to use the bootmenu on color frame buffer console, -make sure to additionally define CONFIG_CFB_CONSOLE_ANSI in the -board config file. diff --git a/doc/README.commands b/doc/README.commands deleted file mode 100644 index 22ab063fdc0..00000000000 --- a/doc/README.commands +++ /dev/null @@ -1,186 +0,0 @@ -Command definition ------------------- - -Commands are added to U-Boot by creating a new command structure. -This is done by first including command.h, then using the U_BOOT_CMD() or the -U_BOOT_CMD_COMPLETE macro to fill in a struct cmd_tbl struct. - -U_BOOT_CMD(name, maxargs, repeatable, command, "usage", "help") -U_BOOT_CMD_COMPLETE(name, maxargs, repeatable, command, "usage, "help", comp) - -name: The name of the command. THIS IS NOT a string. - -maxargs: The maximum number of arguments this function takes including - the command itself. - -repeatable: Either 0 or 1 to indicate if autorepeat is allowed. - -command: Pointer to the command function. This is the function that is - called when the command is issued. - -usage: Short description. This is a string. - -help: Long description. This is a string. The long description is - only available if CONFIG_SYS_LONGHELP is defined. - -comp: Pointer to the completion function. May be NULL. - This function is called if the user hits the TAB key while - entering the command arguments to complete the entry. Command - completion is only available if CONFIG_AUTO_COMPLETE is defined. - -Sub-command definition ----------------------- - -Likewise an array of struct cmd_tbl holding sub-commands can be created using either -of the following macros: - -* U_BOOT_CMD_MKENT(name, maxargs, repeatable, command, "usage", "help") -* U_BOOT_CMD_MKENTCOMPLETE(name, maxargs, repeatable, command, "usage, "help", - comp) - -This table has to be evaluated in the command function of the main command, e.g. - - static struct cmd_tbl cmd_sub[] = { - U_BOOT_CMD_MKENT(foo, CONFIG_SYS_MAXARGS, 1, do_foo, "", ""), - U_BOOT_CMD_MKENT(bar, CONFIG_SYS_MAXARGS, 1, do_bar, "", ""), - }; - - static int do_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) - { - struct cmd_tbl *cp; - - if (argc < 2) - return CMD_RET_USAGE; - - /* drop sub-command argument */ - argc--; - argv++; - - cp = find_cmd_tbl(argv[0], cmd_ut_sub, ARRAY_SIZE(cmd_sub)); - - if (cp) - return cp->cmd(cmdtp, flag, argc, argv); - - return CMD_RET_USAGE; - } - -Command function ----------------- - -The command function pointer has to be of type -int (*cmd)(struct cmd_tbl *cmdtp, int flag, int argc, const char *argv[]); - -cmdtp: Table entry describing the command (see above). - -flag: A bitmap which may contain the following bit: - CMD_FLAG_REPEAT - The last command is repeated. - CMD_FLAG_BOOTD - The command is called by the bootd command. - CMD_FLAG_ENV - The command is called by the run command. - -argc: Number of arguments including the command. - -argv: Arguments. - -Allowable return value are: - -CMD_RET_SUCCESS The command was successfully executed. - -CMD_RET_FAILURE The command failed. - -CMD_RET_USAGE The command was called with invalid parameters. This value - leads to the display of the usage string. - -Completion function -------------------- - -The completion function pointer has to be of type -int (*complete)(int argc, char *const argv[], char last_char, - int maxv, char *cmdv[]); - -argc: Number of arguments including the command. - -argv: Arguments. - -last_char: The last character in the command line buffer. - -maxv: Maximum number of possible completions that may be returned by - the function. - -cmdv: Used to return possible values for the last argument. The last - possible completion must be followed by NULL. - -The function returns the number of possible completions (without the terminating -NULL value). - -Behind the scene ----------------- - -The structure created is named with a special prefix and placed by -the linker in a special section using the linker lists mechanism -(see include/linker_lists.h) - -This makes it possible for the final link to extract all commands -compiled into any object code and construct a static array so the -command array can be iterated over using the linker lists macros. - -The linker lists feature ensures that the linker does not discard -these symbols when linking full U-Boot even though they are not -referenced in the source code as such. - -If a new board is defined do not forget to define the command section -by writing in u-boot.lds ($(srctree)/board/boardname/u-boot.lds) these -3 lines: - - .u_boot_list : { - KEEP(*(SORT(.u_boot_list*))); - } - -Writing tests -------------- - -All new commands should have tests. Tests for existing commands are very -welcome. - -It is fairly easy to write a test for a command. Enable it in sandbox, and -then add code that runs the command and checks the output. - -Here is an example: - -/* Test 'acpi items' command */ -static int dm_test_acpi_cmd_items(struct unit_test_state *uts) -{ - struct acpi_ctx ctx; - void *buf; - - buf = malloc(BUF_SIZE); - ut_assertnonnull(buf); - - ctx.current = buf; - ut_assertok(acpi_fill_ssdt(&ctx)); - console_record_reset(); - run_command("acpi items", 0); - ut_assert_nextline("dev 'acpi-test', type 1, size 2"); - ut_assert_nextline("dev 'acpi-test2', type 1, size 2"); - ut_assert_console_end(); - - ctx.current = buf; - ut_assertok(acpi_inject_dsdt(&ctx)); - console_record_reset(); - run_command("acpi items", 0); - ut_assert_nextline("dev 'acpi-test', type 2, size 2"); - ut_assert_nextline("dev 'acpi-test2', type 2, size 2"); - ut_assert_console_end(); - - console_record_reset(); - run_command("acpi items -d", 0); - ut_assert_nextline("dev 'acpi-test', type 2, size 2"); - ut_assert_nextlines_are_dump(2); - ut_assert_nextline("%s", ""); - ut_assert_nextline("dev 'acpi-test2', type 2, size 2"); - ut_assert_nextlines_are_dump(2); - ut_assert_nextline("%s", ""); - ut_assert_console_end(); - - return 0; -} -DM_TEST(dm_test_acpi_cmd_items, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst index 1ceba0b6998..c51b3e73b83 100644 --- a/doc/build/gcc.rst +++ b/doc/build/gcc.rst @@ -29,6 +29,26 @@ Depending on the build targets further packages maybe needed lzma-alone openssl python3 python3-coverage python3-pyelftools \ python3-pytest python3-sphinxcontrib.apidoc python3-sphinx-rtd-theme swig +SUSE based +~~~~~~~~~~ + +On suse based systems the cross compiler packages are named +cross-<architecture>-gcc<version>. + +You could install GCC and the GCC 10 cross compiler for the ARMv8 architecture +with + +.. code-block:: bash + + sudo zypper install gcc cross-aarch64-gcc10 + +Depending on the build targets further packages maybe needed. + +.. code-block:: bash + + zypper install bc bison flex gcc libopenssl-devel libSDL2-devel make \ + ncurses-devel python3-devel python3-pytest swig + Prerequisites ------------- diff --git a/doc/conf.py b/doc/conf.py index 93250a6aeed..ee7f2017242 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -36,7 +36,34 @@ latex_engine = 'xelatex' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure'] +extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'kfigure'] + +# +# cdomain is badly broken in Sphinx 3+. Leaving it out generates *most* +# of the docs correctly, but not all. +# +if major >= 3: + if (major > 3) or (minor > 0 or patch >= 2): + sys.stderr.write('''The build process with Sphinx 3+ is broken. +You will have to remove -W in doc/Makefile. +''') + # Sphinx c function parser is more pedantic with regards to type + # checking. Due to that, having macros at c:function cause problems. + # Those needed to be escaped by using c_id_attributes[] array + c_id_attributes = [ + + # include/linux/compiler.h + "__maybe_unused", + + # include/efi.h + "EFIAPI", + + # include/efi_loader.h + "__efi_runtime", + ] + +else: + extensions.append('cdomain') # The name of the math extension changed on Sphinx 1.4 if (major == 1 and minor > 3) or (major > 1): diff --git a/doc/develop/commands.rst b/doc/develop/commands.rst new file mode 100644 index 00000000000..c72d1b0aaad --- /dev/null +++ b/doc/develop/commands.rst @@ -0,0 +1,226 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Implementing shell commands +=========================== + +Command definition +------------------ + +Commands are added to U-Boot by creating a new command structure. +This is done by first including command.h, then using the U_BOOT_CMD() or the +U_BOOT_CMD_COMPLETE macro to fill in a struct cmd_tbl structure. + +.. code-block:: c + + U_BOOT_CMD(name, maxargs, repeatable, command, "usage", "help") + U_BOOT_CMD_COMPLETE(name, maxargs, repeatable, command, "usage, "help", comp) + +name + The name of the command. This is **not** a string. + +maxargs + The maximum number of arguments this function takes including + the command itself. + +repeatable + Either 0 or 1 to indicate if autorepeat is allowed. + +command + Pointer to the command function. This is the function that is + called when the command is issued. + +usage + Short description. This is a string. + +help + Long description. This is a string. The long description is + only available if CONFIG_SYS_LONGHELP is defined. + +comp + Pointer to the completion function. May be NULL. + This function is called if the user hits the TAB key while + entering the command arguments to complete the entry. Command + completion is only available if CONFIG_AUTO_COMPLETE is defined. + +Sub-command definition +---------------------- + +Likewise an array of struct cmd_tbl holding sub-commands can be created using +either of the following macros: + +.. code-block:: c + + U_BOOT_CMD_MKENT(name, maxargs, repeatable, command, "usage", "help") + U_BOOT_CMD_MKENTCOMPLETE(name, maxargs, repeatable, command, "usage, "help", comp) + +This table has to be evaluated in the command function of the main command, e.g. + +.. code-block:: c + + static struct cmd_tbl cmd_sub[] = { + U_BOOT_CMD_MKENT(foo, CONFIG_SYS_MAXARGS, 1, do_foo, "", ""), + U_BOOT_CMD_MKENT(bar, CONFIG_SYS_MAXARGS, 1, do_bar, "", ""), + }; + + static int do_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) + { + struct cmd_tbl *cp; + + if (argc < 2) + return CMD_RET_USAGE; + + /* drop sub-command argument */ + argc--; + argv++; + + cp = find_cmd_tbl(argv[0], cmd_ut_sub, ARRAY_SIZE(cmd_sub)); + + if (cp) + return cp->cmd(cmdtp, flag, argc, argv); + + return CMD_RET_USAGE; + } + +Command function +---------------- + +The command function pointer has to be of type + +.. code-block:: c + + int (*cmd)(struct cmd_tbl *cmdtp, int flag, int argc, const char *argv[]); + +cmdtp + Table entry describing the command (see above). + +flag + A bitmap which may contain the following bits + + * CMD_FLAG_REPEAT - The last command is repeated. + * CMD_FLAG_BOOTD - The command is called by the bootd command. + * CMD_FLAG_ENV - The command is called by the run command. + +argc + Number of arguments including the command. + +argv + Arguments. + +Allowable return value are: + +CMD_RET_SUCCESS + The command was successfully executed. + +CMD_RET_FAILURE + The command failed. + +CMD_RET_USAGE + The command was called with invalid parameters. This value + leads to the display of the usage string. + +Completion function +------------------- + +The completion function pointer has to be of type + +.. code-block:: c + + int (*complete)(int argc, char *const argv[], char last_char, + int maxv, char *cmdv[]); + +argc + Number of arguments including the command. + +argv + Arguments. + +last_char + The last character in the command line buffer. + +maxv + Maximum number of possible completions that may be returned by + the function. + +cmdv + Used to return possible values for the last argument. The last + possible completion must be followed by NULL. + +The function returns the number of possible completions (without the terminating +NULL value). + +Behind the scene +---------------- + +The structure created is named with a special prefix and placed by +the linker in a special section using the linker lists mechanism +(see include/linker_lists.h) + +This makes it possible for the final link to extract all commands +compiled into any object code and construct a static array so the +command array can be iterated over using the linker lists macros. + +The linker lists feature ensures that the linker does not discard +these symbols when linking full U-Boot even though they are not +referenced in the source code as such. + +If a new board is defined do not forget to define the command section +by writing in u-boot.lds ($(srctree)/board/boardname/u-boot.lds) these +3 lines: + +.. code-block:: c + + .u_boot_list : { + KEEP(*(SORT(.u_boot_list*))); + } + +Writing tests +------------- + +All new commands should have tests. Tests for existing commands are very +welcome. + +It is fairly easy to write a test for a command. Enable it in sandbox, and +then add code that runs the command and checks the output. + +Here is an example: + +.. code-block:: c + + /* Test 'acpi items' command */ + static int dm_test_acpi_cmd_items(struct unit_test_state *uts) + { + struct acpi_ctx ctx; + void *buf; + + buf = malloc(BUF_SIZE); + ut_assertnonnull(buf); + + ctx.current = buf; + ut_assertok(acpi_fill_ssdt(&ctx)); + console_record_reset(); + run_command("acpi items", 0); + ut_assert_nextline("dev 'acpi-test', type 1, size 2"); + ut_assert_nextline("dev 'acpi-test2', type 1, size 2"); + ut_assert_console_end(); + + ctx.current = buf; + ut_assertok(acpi_inject_dsdt(&ctx)); + console_record_reset(); + run_command("acpi items", 0); + ut_assert_nextline("dev 'acpi-test', type 2, size 2"); + ut_assert_nextline("dev 'acpi-test2', type 2, size 2"); + ut_assert_console_end(); + + console_record_reset(); + run_command("acpi items -d", 0); + ut_assert_nextline("dev 'acpi-test', type 2, size 2"); + ut_assert_nextlines_are_dump(2); + ut_assert_nextline("%s", ""); + ut_assert_nextline("dev 'acpi-test2', type 2, size 2"); + ut_assert_nextlines_are_dump(2); + ut_assert_nextline("%s", ""); + ut_assert_console_end(); + + return 0; + } + DM_TEST(dm_test_acpi_cmd_items, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/doc/develop/global_data.rst b/doc/develop/global_data.rst index 9e7c8a24da0..230ebcd8604 100644 --- a/doc/develop/global_data.rst +++ b/doc/develop/global_data.rst @@ -33,8 +33,10 @@ On most architectures the global data pointer is stored in a register. +------------+----------+ | SuperH | r13 | +------------+----------+ +| x86 32bit | fs | ++------------+----------+ -The sandbox, x86, and Xtensa are notable exceptions. +The sandbox, x86_64, and Xtensa are notable exceptions. Clang for ARM does not support assigning a global register. When using Clang gd is defined as an inline function using assembly code. This adds a few bytes diff --git a/doc/develop/index.rst b/doc/develop/index.rst index 89e80eab945..0a7e204b343 100644 --- a/doc/develop/index.rst +++ b/doc/develop/index.rst @@ -8,6 +8,8 @@ Develop U-Boot :maxdepth: 2 coccinelle + commands crash_dumps global_data logging + trace diff --git a/doc/README.trace b/doc/develop/trace.rst index 2e7ca3319a9..7776c484286 100644 --- a/doc/README.trace +++ b/doc/develop/trace.rst @@ -1,6 +1,5 @@ -# SPDX-License-Identifier: GPL-2.0+ -# -# Copyright (c) 2013 The Chromium OS Authors. +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (c) 2013 The Chromium OS Authors. Tracing in U-Boot ================= @@ -33,73 +32,82 @@ this, follow these steps: Add the following to include/configs/sandbox.h (if not already there) -#define CONFIG_TRACE -#define CONFIG_CMD_TRACE -#define CONFIG_TRACE_BUFFER_SIZE (16 << 20) -#define CONFIG_TRACE_EARLY_SIZE (8 << 20) -#define CONFIG_TRACE_EARLY -#define CONFIG_TRACE_EARLY_ADDR 0x00100000 +.. code-block:: c + + #define CONFIG_TRACE + #define CONFIG_CMD_TRACE + #define CONFIG_TRACE_BUFFER_SIZE (16 << 20) + #define CONFIG_TRACE_EARLY_SIZE (8 << 20) + #define CONFIG_TRACE_EARLY + #define CONFIG_TRACE_EARLY_ADDR 0x00100000 Build sandbox U-Boot with tracing enabled: -$ make FTRACE=1 O=sandbox sandbox_config -$ make FTRACE=1 O=sandbox +.. code-block:: console + + $ make FTRACE=1 O=sandbox sandbox_config + $ make FTRACE=1 O=sandbox Run sandbox, wait for a bit of trace information to appear, and then capture a trace: -$ ./sandbox/u-boot - - -U-Boot 2013.04-rc2-00100-ga72fcef (Apr 17 2013 - 19:25:24) +.. code-block:: console + + $ ./sandbox/u-boot + + U-Boot 2013.04-rc2-00100-ga72fcef (Apr 17 2013 - 19:25:24) + + DRAM: 128 MiB + trace: enabled + Using default environment + + In: serial + Out: serial + Err: serial + =>trace stats + 671,406 function sites + 69,712 function calls + 0 untracked function calls + 73,373 traced function calls + 16 maximum observed call depth + 15 call depth limit + 66,491 calls not traced due to depth + =>trace stats + 671,406 function sites + 1,279,450 function calls + 0 untracked function calls + 950,490 traced function calls (333217 dropped due to overflow) + 16 maximum observed call depth + 15 call depth limit + 1,275,767 calls not traced due to depth + =>trace calls 0 e00000 + Call list dumped to 00000000, size 0xae0a40 + =>print + baudrate=115200 + profbase=0 + profoffset=ae0a40 + profsize=e00000 + stderr=serial + stdin=serial + stdout=serial -DRAM: 128 MiB -trace: enabled -Using default environment + Environment size: 117/8188 bytes + =>host save host 0 trace 0 ${profoffset} + 11405888 bytes written in 10 ms (1.1 GiB/s) + =>reset -In: serial -Out: serial -Err: serial -=>trace stats - 671,406 function sites - 69,712 function calls - 0 untracked function calls - 73,373 traced function calls - 16 maximum observed call depth - 15 call depth limit - 66,491 calls not traced due to depth -=>trace stats - 671,406 function sites - 1,279,450 function calls - 0 untracked function calls - 950,490 traced function calls (333217 dropped due to overflow) - 16 maximum observed call depth - 15 call depth limit - 1,275,767 calls not traced due to depth -=>trace calls 0 e00000 -Call list dumped to 00000000, size 0xae0a40 -=>print -baudrate=115200 -profbase=0 -profoffset=ae0a40 -profsize=e00000 -stderr=serial -stdin=serial -stdout=serial -Environment size: 117/8188 bytes -=>host save host 0 trace 0 ${profoffset} -11405888 bytes written in 10 ms (1.1 GiB/s) -=>reset +Then run proftool to convert the trace information to ftrace format +.. code-block:: console -Then run proftool to convert the trace information to ftrace format. + $ ./sandbox/tools/proftool -m sandbox/System.map -p trace dump-ftrace >trace.txt -$ ./sandbox/tools/proftool -m sandbox/System.map -p trace dump-ftrace >trace.txt +Finally run pytimechart to display it -Finally run pytimechart to display it: +.. code-block:: console -$ pytimechart trace.txt + $ pytimechart trace.txt Using this tool you can zoom and pan across the trace, with the function calls on the left and little marks representing the start and end of each @@ -109,31 +117,31 @@ function. CONFIG Options -------------- -- CONFIG_TRACE - Enables the trace feature in U-Boot. +CONFIG_TRACE + Enables the trace feature in U-Boot. -- CONFIG_CMD_TRACE - Enables the trace command. +CONFIG_CMD_TRACE + Enables the trace command. -- CONFIG_TRACE_BUFFER_SIZE - Size of trace buffer to allocate for U-Boot. This buffer is - used after relocation, as a place to put function tracing - information. The address of the buffer is determined by - the relocation code. +CONFIG_TRACE_BUFFER_SIZE + Size of trace buffer to allocate for U-Boot. This buffer is + used after relocation, as a place to put function tracing + information. The address of the buffer is determined by + the relocation code. -- CONFIG_TRACE_EARLY - Define this to start tracing early, before relocation. +CONFIG_TRACE_EARLY + Define this to start tracing early, before relocation. -- CONFIG_TRACE_EARLY_SIZE - Size of 'early' trace buffer. Before U-Boot has relocated - it doesn't have a proper trace buffer. On many boards - you can define an area of memory to use for the trace - buffer until the 'real' trace buffer is available after - relocation. The contents of this buffer are then copied to - the real buffer. +CONFIG_TRACE_EARLY_SIZE + Size of 'early' trace buffer. Before U-Boot has relocated + it doesn't have a proper trace buffer. On many boards + you can define an area of memory to use for the trace + buffer until the 'real' trace buffer is available after + relocation. The contents of this buffer are then copied to + the real buffer. -- CONFIG_TRACE_EARLY_ADDR - Address of early trace buffer +CONFIG_TRACE_EARLY_ADDR + Address of early trace buffer Building U-Boot with Tracing Enabled @@ -191,20 +199,20 @@ Commands The trace command has variable sub-commands: -- stats - Display tracing statistics +stats + Display tracing statistics -- pause - Pause tracing +pause + Pause tracing -- resume - Resume tracing +resume + Resume tracing -- funclist [<addr> <size>] - Dump a list of functions into the buffer +funclist [<addr> <size>] + Dump a list of functions into the buffer -- calls [<addr> <size>] - Dump function call trace into buffer +calls [<addr> <size>] + Dump function call trace into buffer If the address and size are not given, these are obtained from environment variables (see below). In any case the environment variables are updated @@ -216,14 +224,14 @@ Environment Variables The following are used: -- profbase - Base address of trace output buffer +profbase + Base address of trace output buffer -- profoffset - Offset of first unwritten byte in trace output buffer +profoffset + Offset of first unwritten byte in trace output buffer -- profsize - Size of trace output buffer +profsize + Size of trace output buffer All of these are set by the 'trace calls' command. @@ -231,18 +239,18 @@ These variables keep track of the amount of data written to the trace output buffer by the 'trace' command. The trace commands which write data to the output buffer can use these to specify the buffer to write to, and update profoffset each time. This allows successive commands to append data -to the same buffer, for example: +to the same buffer, for example:: - trace funclist 10000 e00000 - trace calls + => trace funclist 10000 e00000 + => trace calls (the latter command appends more data to the buffer). -- fakegocmd - Specifies commands to run just before booting the OS. This - is a useful time to write the trace data to the host for - processing. +fakegocmd + Specifies commands to run just before booting the OS. This + is a useful time to write the trace data to the host for + processing. Writing Out Trace Data @@ -250,11 +258,11 @@ Writing Out Trace Data Once the trace data is in an output buffer in memory there are various ways to transmit it to the host. Notably you can use tftput to send the data -over a network link: +over a network link:: -fakegocmd=trace pause; usb start; set autoload n; bootp; - trace calls 10000000 1000000; - tftpput ${profbase} ${profoffset} 192.168.1.4:/tftpboot/calls + fakegocmd=trace pause; usb start; set autoload n; bootp; + trace calls 10000000 1000000; + tftpput ${profbase} ${profoffset} 192.168.1.4:/tftpboot/calls This starts up USB (to talk to an attached USB Ethernet dongle), writes a trace log to address 10000000 and sends it to a host machine using @@ -272,16 +280,17 @@ This tool must be given the U-Boot map file and the trace data received from running that U-Boot. It produces a text output file. Options - -m <map_file> - Specify U-Boot map file - -p <trace_file> - Specifiy profile/trace file +-m <map_file> + Specify U-Boot map file + +-p <trace_file> + Specifiy profile/trace file Commands: -- dump-ftrace - Write a text dump of the file in Linux ftrace format to stdout +dump-ftrace + Write a text dump of the file in Linux ftrace format to stdout Viewing the Trace Data @@ -301,17 +310,17 @@ The following suggestions may be helpful if you are trying to reduce boot time: 1. Enable CONFIG_BOOTSTAGE and CONFIG_BOOTSTAGE_REPORT. This should get -you are helpful overall snapshot of the boot time. + you are helpful overall snapshot of the boot time. 2. Build U-Boot with tracing and run it. Note the difference in boot time -(it is common for tracing to add 10% to the time) + (it is common for tracing to add 10% to the time) 3. Collect the trace information as descibed above. Use this to find where -all the time is being spent. + all the time is being spent. 4. Take a look at that code and see if you can optimise it. Perhaps it is -possible to speed up the initialisation of a device, or remove an unused -feature. + possible to speed up the initialisation of a device, or remove an unused + feature. 5. Rebuild, run and collect again. Compare your results. diff --git a/doc/index.rst b/doc/index.rst index 68a083b16ba..4c44955d67f 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -25,6 +25,7 @@ trying to get it to work optimally on a given system. :maxdepth: 2 build/index + usage/index Developer-oriented documentation -------------------------------- @@ -109,13 +110,6 @@ Android-specific features available in U-Boot. android/index -Command line ------------- -.. toctree:: - :maxdepth: 2 - - pstore.rst - Indices and tables ================== diff --git a/doc/uefi/uefi.rst b/doc/uefi/uefi.rst index 07eb3f01b4e..dc930d92402 100644 --- a/doc/uefi/uefi.rst +++ b/doc/uefi/uefi.rst @@ -156,11 +156,11 @@ The whitelist database .. code-block:: bash - $ openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=TEST_db/ \ + openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=TEST_db/ \ -keyout db.key -out db.crt -nodes -days 365 - $ cert-to-efi-sig-list -g 11111111-2222-3333-4444-123456789abc \ + cert-to-efi-sig-list -g 11111111-2222-3333-4444-123456789abc \ db.crt db.esl - $ sign-efi-sig-list -c KEK.crt -k KEK.key db db.esl db.auth + sign-efi-sig-list -c KEK.crt -k KEK.key db db.esl db.auth Copy the \*.auth files to media, say mmc, that is accessible from U-Boot. diff --git a/doc/usage/bootmenu.rst b/doc/usage/bootmenu.rst new file mode 100644 index 00000000000..1f094ad6ed2 --- /dev/null +++ b/doc/usage/bootmenu.rst @@ -0,0 +1,95 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. (C) Copyright 2011-2012 Pali Rohár <pali@kernel.org> + +bootmenu command +================ + +The "bootmenu" command uses U-Boot menu interfaces and provides +a simple mechanism for creating menus with different boot items. +The cursor keys "Up" and "Down" are used for navigation through +the items. Current active menu item is highlighted and can be +selected using the "Enter" key. The selection of the highlighted +menu entry invokes an U-Boot command (or a list of commands) +associated with this menu entry. + +The "bootmenu" command interprets ANSI escape sequencies, so +an ANSI terminal is required for proper menu rendering and item +selection. + +The assembling of the menu is done via a set of environment variables +"bootmenu_<num>" and "bootmenu_delay", i.e.:: + + bootmenu_delay=<delay> + bootmenu_<num>="<title>=<commands>" + +<delay> + is the autoboot delay in seconds, after which the first + menu entry will be selected automatically + +<num> + is the boot menu entry number, starting from zero + +<title> + is the text of the menu entry shown on the console + or on the boot screen + +<commands> + are commands which will be executed when a menu + entry is selected + +Title and commands are separated by the first appearance of a '=' +character in the value of the environment variable. + +The first (optional) argument of the "bootmenu" command is a delay specifier +and it overrides the delay value defined by "bootmenu_delay" environment +variable. If the environment variable "bootmenu_delay" is not set or if +the argument of the "bootmenu" command is not specified, the default delay +will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on +the console (or on the screen) and the command of the first menu entry will +be called immediately. If delay is less then 0, bootmenu will be shown and +autoboot will be disabled. + +Bootmenu always adds menu entry "U-Boot console" at the end of all menu +entries specified by environment variables. When selecting this entry +the bootmenu terminates and the usual U-Boot command prompt is presented +to the user. + +Example environment:: + + setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000 # Set first menu entry + setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000 # Set second menu entry + setenv bootmenu_2 Reset board=reset # Set third menu entry + setenv bootmenu_3 U-Boot boot order=boot # Set fourth menu entry + bootmenu 20 # Run bootmenu with autoboot delay 20s + + +The above example will be rendered as below:: + + *** U-Boot Boot Menu *** + + Boot 1. kernel + Boot 2. kernel + Reset board + U-Boot boot order + U-Boot console + + Hit any key to stop autoboot: 20 + Press UP/DOWN to move, ENTER to select + +The selected menu entry will be highlighted - it will have inverted +background and text colors. + +The "bootmenu" cammand is enabled by:: + + CONFIG_CMD_BOOTMENU=y + +To run the bootmenu at startup add these additional settings:: + + CONFIG_AUTOBOOT_KEYED=y + CONFIG_BOOTDELAY=30 + CONFIG_AUTOBOOT_MENU_SHOW=y + +When you intend to use the bootmenu on a color frame buffer console, +make sure to additionally define:: + + CONFIG_CFB_CONSOLE_ANSI=y diff --git a/doc/usage/index.rst b/doc/usage/index.rst new file mode 100644 index 00000000000..d0f5a9f26e0 --- /dev/null +++ b/doc/usage/index.rst @@ -0,0 +1,15 @@ +Use U-Boot +========== + +.. toctree:: + + netconsole + +Shell commands +-------------- + +.. toctree:: + :maxdepth: 1 + + bootmenu + pstore diff --git a/doc/README.NetConsole b/doc/usage/netconsole.rst index af7fc6043a3..0156f0212d9 100644 --- a/doc/README.NetConsole +++ b/doc/usage/netconsole.rst @@ -1,3 +1,5 @@ +Network console +=============== In U-Boot, we implemented the networked console via the standard "devices" mechanism, which means that you can switch between the @@ -6,7 +8,8 @@ serial and network input/output devices by adjusting the 'stdin' and set either of these variables to "nc". Input and output can be switched independently. -CONFIG_NETCONSOLE_BUFFER_SIZE - Override the default buffer size +The default buffer size can be overridden by setting +CONFIG_NETCONSOLE_BUFFER_SIZE. We use an environment variable 'ncip' to set the IP address and the port of the destination. The format is <ip_addr>:<port>. If <port> is @@ -17,15 +20,16 @@ The source / listening port can be configured separately by setting the 'ncinport' environment variable and the destination port can be configured by setting the 'ncoutport' environment variable. -For example, if your server IP is 192.168.1.1, you could use: +For example, if your server IP is 192.168.1.1, you could use:: => setenv nc 'setenv stdout nc;setenv stdin nc' => setenv ncip 192.168.1.1 => saveenv => run nc +On the host side, please use this script to access the console -On the host side, please use this script to access the console: +.. code-block:: bash tools/netconsole <ip> [port] @@ -54,31 +58,37 @@ file for the original Ingo Molnar's documentation on how to pass parameters to the loadable module. The format of the kernel command line parameter (for the static -configuration) is as follows: +configuration) is as follows - netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr] +.. code-block:: bash + + netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr] where - src-port source for UDP packets - (defaults to 6665) - src-ip source IP to use - (defaults to the interface's address) - dev network interface - (defaults to eth0) - tgt-port port for logging agent - (defaults to 6666) - tgt-ip IP address for logging agent - (this is the required parameter) - tgt-macaddr ethernet MAC address for logging agent - (defaults to broadcast) - -Examples: +src-port + source for UDP packets (defaults to 6665) - netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc +src-ip + source IP to use (defaults to the interface's address) + +dev + network interface (defaults to eth0) + +tgt-port + port for logging agent (defaults to 6666) + +tgt-ip + IP address for logging agent (this is the required parameter) -or +tgt-macaddr + ethernet MAC address for logging agent (defaults to broadcast) +Examples + +.. code-block:: bash + + netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc netconsole=@/,@192.168.3.1/ Please note that for the Linux networked console to work, the @@ -91,6 +101,8 @@ in the ELDK-NFS-based environment. To browse the Linux network console output, use the 'netcat' tool invoked as follows: +.. code-block:: bash + nc -u -l -p 6666 Note that unlike the U-Boot implementation the Linux netconsole is diff --git a/doc/pstore.rst b/doc/usage/pstore.rst index 8427d8fd97a..8c4e5274aa1 100644 --- a/doc/pstore.rst +++ b/doc/usage/pstore.rst @@ -57,7 +57,9 @@ Generate kernel crash ~~~~~~~~~~~~~~~~~~~~~ For test purpose, you can generate a kernel crash by setting reboot timeout to -10 seconds and trigger a panic:: +10 seconds and trigger a panic + +.. code-block:: console $ sudo sh -c "echo 1 > /proc/sys/kernel/sysrq" $ sudo sh -c "echo 10 > /proc/sys/kernel/panic" diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index a936f71d2e5..222358d3959 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -449,6 +449,7 @@ static const struct udevice_id dwc3_glue_ids[] = { { .compatible = "rockchip,rk3328-dwc3" }, { .compatible = "rockchip,rk3399-dwc3" }, { .compatible = "qcom,dwc3" }, + { .compatible = "intel,tangier-dwc3" }, { } }; diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 82a3a365c5b..c9862260a38 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -369,6 +369,7 @@ #endif #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \ "bootcmd_dhcp=" \ + "setenv devtype " #devtypel "; " \ BOOTENV_RUN_NET_USB_START \ BOOTENV_RUN_PCI_ENUM \ "if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \ diff --git a/include/configs/chromebook_coral.h b/include/configs/chromebook_coral.h index d4d32758e99..6e8e8ec1709 100644 --- a/include/configs/chromebook_coral.h +++ b/include/configs/chromebook_coral.h @@ -15,10 +15,13 @@ "read mmc 2:2 100000 0 80; setexpr loader *001004f0; " \ "setexpr size *00100518; setexpr blocks $size / 200; " \ "read mmc 2:2 100000 80 $blocks; setexpr setup $loader - 1000; " \ - "setexpr cmdline $loader - 2000; " \ - "part uuid mmc 2:2 uuid; setenv bootargs_U $uuid; " \ - "zboot start 100000 0 0 0 $setup $cmdline; " \ - "zboot load; zboot setup; zboot dump; zboot go" + "setexpr cmdline_ptr $loader - 2000; " \ + "setexpr.s cmdline *$cmdline_ptr; " \ + "setexpr cmdline gsub %U \\\\${uuid}; " \ + "if part uuid mmc 2:2 uuid; then " \ + "zboot start 100000 0 0 0 $setup cmdline; " \ + "zboot load; zboot setup; zboot dump; zboot go;" \ + "fi" #include <configs/x86-common.h> #include <configs/x86-chromebook.h> diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index c0339dcc00d..55acc38d067 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -961,7 +961,6 @@ CONFIG_LCD_MENU CONFIG_LD9040 CONFIG_LEGACY CONFIG_LEGACY_BOOTCMD_ENV -CONFIG_LG4573 CONFIG_LINUX CONFIG_LINUX_RESET_VEC CONFIG_LITTLETON_LCD |