]> git.sur5r.net Git - u-boot/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-mips
authorTom Rini <trini@konsulko.com>
Fri, 1 Jun 2018 20:46:39 +0000 (16:46 -0400)
committerTom Rini <trini@konsulko.com>
Fri, 1 Jun 2018 20:46:39 +0000 (16:46 -0400)
406 files changed:
.gitignore
.travis.yml
MAINTAINERS
Makefile
README
arch/arc/Kconfig
arch/arc/cpu/u-boot.lds
arch/arc/dts/Makefile
arch/arc/dts/emdk.dts [new file with mode: 0644]
arch/arc/lib/cache.c
arch/arc/lib/relocate.c
arch/arc/lib/reset.c
arch/arm/Kconfig
arch/arm/cpu/armv8/zynqmp/clk.c
arch/arm/cpu/armv8/zynqmp/cpu.c
arch/arm/dts/Makefile
arch/arm/dts/armada-8040-db.dts
arch/arm/dts/armada-8040-mcbin.dts
arch/arm/dts/armada-ap806.dtsi
arch/arm/dts/armada-cp110-master.dtsi
arch/arm/dts/armada-cp110-slave.dtsi
arch/arm/dts/bitmain-antminer-s9.dts [new file with mode: 0644]
arch/arm/dts/dragonboard820c.dts
arch/arm/dts/kirkwood-d2net.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-dreamplug.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-ds109.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-is2.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-km_common.dtsi [new file with mode: 0644]
arch/arm/dts/kirkwood-km_kirkwood.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-lschlv2.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-lsxhl.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-lsxl.dtsi [new file with mode: 0644]
arch/arm/dts/kirkwood-net2big.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-netxbig.dtsi [new file with mode: 0644]
arch/arm/dts/kirkwood-ns2-common.dtsi [new file with mode: 0644]
arch/arm/dts/kirkwood-ns2.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-ns2lite.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-ns2max.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-ns2mini.dts [new file with mode: 0644]
arch/arm/dts/kirkwood-synology.dtsi [new file with mode: 0644]
arch/arm/dts/stm32f746.dtsi
arch/arm/dts/zynq-minized.dts [new file with mode: 0644]
arch/arm/dts/zynqmp-clk-ccf.dtsi
arch/arm/dts/zynqmp-zcu100-revC.dts
arch/arm/dts/zynqmp-zcu104-revA.dts
arch/arm/dts/zynqmp-zcu104-revC.dts
arch/arm/dts/zynqmp-zcu111-revA.dts
arch/arm/include/asm/arch-zynqmp/hardware.h
arch/arm/include/asm/arch-zynqmp/sys_proto.h
arch/arm/mach-mvebu/Makefile
arch/arm/mach-mvebu/sata.c [deleted file]
arch/arm/mach-omap2/boot-common.c
arch/arm/mach-omap2/utils.c
arch/arm/mach-rockchip/rk3128-board.c
arch/arm/mach-rockchip/rk322x-board.c
arch/arm/mach-snapdragon/Kconfig
arch/riscv/Kconfig
arch/riscv/config.mk
arch/riscv/cpu/ax25/Makefile [new file with mode: 0644]
arch/riscv/cpu/ax25/cpu.c [new file with mode: 0644]
arch/riscv/cpu/ax25/start.S [new file with mode: 0644]
arch/riscv/cpu/ax25/u-boot.lds [new file with mode: 0644]
arch/riscv/cpu/nx25/Makefile [deleted file]
arch/riscv/cpu/nx25/cpu.c [deleted file]
arch/riscv/cpu/nx25/start.S [deleted file]
arch/riscv/cpu/nx25/u-boot.lds [deleted file]
arch/riscv/dts/Makefile
arch/riscv/dts/ae250.dts [deleted file]
arch/riscv/dts/ae350.dts [new file with mode: 0644]
arch/riscv/include/asm/mach-types.h
arch/riscv/include/asm/setjmp.h [new file with mode: 0644]
arch/riscv/include/asm/u-boot-riscv.h
arch/riscv/lib/Makefile
arch/riscv/lib/bootm.c
arch/riscv/lib/crt0_riscv_efi.S [new file with mode: 0644]
arch/riscv/lib/elf_riscv32_efi.lds [new file with mode: 0644]
arch/riscv/lib/elf_riscv64_efi.lds [new file with mode: 0644]
arch/riscv/lib/reloc_riscv_efi.c [new file with mode: 0644]
arch/riscv/lib/setjmp.S [new file with mode: 0644]
arch/sandbox/dts/test.dts
board/AndesTech/ax25-ae350/Kconfig [new file with mode: 0644]
board/AndesTech/ax25-ae350/MAINTAINERS [new file with mode: 0644]
board/AndesTech/ax25-ae350/Makefile [new file with mode: 0644]
board/AndesTech/ax25-ae350/ax25-ae350.c [new file with mode: 0644]
board/AndesTech/nx25-ae250/Kconfig [deleted file]
board/AndesTech/nx25-ae250/MAINTAINERS [deleted file]
board/AndesTech/nx25-ae250/Makefile [deleted file]
board/AndesTech/nx25-ae250/nx25-ae250.c [deleted file]
board/amazon/kc1/kc1.c
board/bitmain/antminer_s9/MAINTAINERS [new file with mode: 0644]
board/bitmain/antminer_s9/Makefile [new file with mode: 0644]
board/bitmain/antminer_s9/bitmain-antminer-s9/ps7_init_gpl.c [new file with mode: 0644]
board/bitmain/antminer_s9/board.c [new file with mode: 0644]
board/eets/pdu001/Kconfig
board/lg/sniper/sniper.c
board/synopsys/emdk/Kconfig [new file with mode: 0644]
board/synopsys/emdk/MAINTAINERS [new file with mode: 0644]
board/synopsys/emdk/Makefile [new file with mode: 0644]
board/synopsys/emdk/emdk.c [new file with mode: 0644]
board/ti/am57xx/board.c
board/ti/common/Kconfig
board/ti/dra7xx/evm.c
board/xilinx/zynqmp/zynqmp.c
cmd/Kconfig
cmd/fastboot.c
cmd/fastboot/Kconfig [deleted file]
cmd/fpga.c
cmd/mmc.c
common/Makefile
common/fb_mmc.c [deleted file]
common/fb_nand.c [deleted file]
common/image-sparse.c [deleted file]
configs/A13-OLinuXino_defconfig
configs/A20-OLinuXino-Lime2-eMMC_defconfig
configs/A20-OLinuXino-Lime2_defconfig
configs/A20-Olimex-SOM204-EVB-eMMC_defconfig
configs/A20-Olimex-SOM204-EVB_defconfig
configs/Bananapi_m2m_defconfig
configs/Cubietruck_defconfig
configs/Sinlinx_SinA33_defconfig
configs/am335x_boneblack_defconfig
configs/am335x_boneblack_vboot_defconfig
configs/am335x_evm_defconfig
configs/am335x_evm_nor_defconfig
configs/am335x_evm_norboot_defconfig
configs/am335x_evm_spiboot_defconfig
configs/am335x_evm_usbspl_defconfig
configs/am57xx_evm_defconfig
configs/am57xx_hs_evm_defconfig
configs/ax25-ae350_defconfig [new file with mode: 0644]
configs/bcm23550_w1d_defconfig
configs/bcm28155_ap_defconfig
configs/birdland_bav335a_defconfig
configs/birdland_bav335b_defconfig
configs/bitmain_antminer_s9_defconfig [new file with mode: 0644]
configs/cgtqmx6eval_defconfig
configs/chromebit_mickey_defconfig
configs/chromebook_jerry_defconfig
configs/chromebook_minnie_defconfig
configs/d2net_v2_defconfig
configs/dra7xx_evm_defconfig
configs/dra7xx_hs_evm_defconfig
configs/dreamplug_defconfig
configs/ds109_defconfig
configs/emdk_defconfig [new file with mode: 0644]
configs/evb-rk3036_defconfig
configs/evb-rk3128_defconfig
configs/evb-rk3229_defconfig
configs/evb-rk3288_defconfig
configs/evb-rk3328_defconfig
configs/fennec-rk3288_defconfig
configs/firefly-rk3288_defconfig
configs/imx6dl_mamoj_defconfig
configs/inetspace_v2_defconfig
configs/kc1_defconfig
configs/km_kirkwood_128m16_defconfig
configs/km_kirkwood_defconfig
configs/km_kirkwood_pci_defconfig
configs/kmcoge5un_defconfig
configs/kmnusa_defconfig
configs/kmsugp1_defconfig
configs/kmsuv31_defconfig
configs/kylin-rk3036_defconfig
configs/lschlv2_defconfig
configs/lsxhl_defconfig
configs/mgcoge3un_defconfig
configs/miqi-rk3288_defconfig
configs/mvebu_db-88f3720_defconfig
configs/mvebu_db_armada8k_defconfig
configs/mvebu_espressobin-88f3720_defconfig
configs/mvebu_mcbin-88f8040_defconfig
configs/mx6qsabrelite_defconfig
configs/mx6sabresd_defconfig
configs/net2big_v2_defconfig
configs/netspace_lite_v2_defconfig
configs/netspace_max_v2_defconfig
configs/netspace_mini_v2_defconfig
configs/netspace_v2_defconfig
configs/nitrogen6dl2g_defconfig
configs/nitrogen6dl_defconfig
configs/nitrogen6q2g_defconfig
configs/nitrogen6q_defconfig
configs/nitrogen6s1g_defconfig
configs/nitrogen6s_defconfig
configs/nx25-ae250_defconfig [deleted file]
configs/omap3_beagle_defconfig
configs/omap3_evm_defconfig
configs/omap3_logic_defconfig
configs/parrot_r16_defconfig
configs/phycore-rk3288_defconfig
configs/popmetal-rk3288_defconfig
configs/rock2_defconfig
configs/sniper_defconfig
configs/stih410-b2260_defconfig
configs/tbs_a711_defconfig
configs/tinker-rk3288_defconfig
configs/turris_mox_defconfig
configs/xilinx_zynqmp_zc1232_revA_defconfig
configs/xilinx_zynqmp_zc1254_revA_defconfig
configs/xilinx_zynqmp_zc1275_revA_defconfig
configs/xilinx_zynqmp_zc1275_revB_defconfig
configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig
configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig
configs/xilinx_zynqmp_zcu102_rev1_0_defconfig
configs/xilinx_zynqmp_zcu102_revA_defconfig
configs/xilinx_zynqmp_zcu102_revB_defconfig
configs/xilinx_zynqmp_zcu106_revA_defconfig
configs/zynq_minized_defconfig [new file with mode: 0644]
doc/README.AX25 [new file with mode: 0644]
doc/README.NX25 [deleted file]
doc/README.ae250 [deleted file]
doc/README.ae350 [new file with mode: 0644]
doc/README.android-fastboot
doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt
drivers/Kconfig
drivers/Makefile
drivers/ata/Kconfig
drivers/ata/Makefile
drivers/ata/ahci_mvebu.c [new file with mode: 0644]
drivers/fastboot/Kconfig [new file with mode: 0644]
drivers/fastboot/Makefile [new file with mode: 0644]
drivers/fastboot/fb_command.c [new file with mode: 0644]
drivers/fastboot/fb_common.c [new file with mode: 0644]
drivers/fastboot/fb_getvar.c [new file with mode: 0644]
drivers/fastboot/fb_mmc.c [new file with mode: 0644]
drivers/fastboot/fb_nand.c [new file with mode: 0644]
drivers/fpga/fpga.c
drivers/fpga/xilinx.c
drivers/fpga/zynqmppl.c
drivers/mmc/ftsdc010_mci.c
drivers/mmc/sdhci.c
drivers/mmc/zynq_sdhci.c
drivers/mtd/Makefile
drivers/mtd/ftsmc020.c [deleted file]
drivers/mtd/spi/spi_flash.c
drivers/mtd/spi/spi_flash_ids.c
drivers/mtd/ubi/fastmap-wl.c
drivers/net/ftmac100.c
drivers/pinctrl/mvebu/pinctrl-mvebu.c
drivers/serial/serial_zynq.c
drivers/spi/atcspi200_spi.c
drivers/spi/fsl_qspi.c
drivers/spi/lpc32xx_ssp.c
drivers/spi/stm32_qspi.c
drivers/timer/cadence-ttc.c
drivers/usb/gadget/f_fastboot.c
drivers/usb/gadget/f_thor.c
drivers/usb/host/xhci-rcar.c
drivers/usb/host/xhci-rockchip.c
drivers/usb/host/xhci-zynqmp.c
drivers/usb/host/xhci.c
drivers/watchdog/cdns_wdt.c
fs/fs.c
include/config_distro_bootcmd.h
include/configs/ax25-ae350.h [new file with mode: 0644]
include/configs/bitmain_antminer_s9.h [new file with mode: 0644]
include/configs/dns325.h
include/configs/ds414.h
include/configs/emdk.h [new file with mode: 0644]
include/configs/goflexhome.h
include/configs/guruplug.h
include/configs/ib62x0.h
include/configs/iconnect.h
include/configs/mv-common.h
include/configs/mv-plug-common.h
include/configs/nsa310s.h
include/configs/nx25-ae250.h [deleted file]
include/configs/openrd.h
include/configs/pogo_e02.h
include/configs/sheevaplug.h
include/configs/xilinx_zynqmp_mini.h
include/configs/xilinx_zynqmp_zc1751_xm016_dc2.h [deleted file]
include/dt-bindings/leds/leds-netxbig.h [new file with mode: 0644]
include/dt-bindings/leds/leds-ns2.h [new file with mode: 0644]
include/dt_table.h [new file with mode: 0644]
include/efi_loader.h
include/fastboot-internal.h [new file with mode: 0644]
include/fastboot.h
include/fb_mmc.h
include/fb_nand.h
include/fpga.h
include/fs.h
include/image-sparse.h
include/linux/libfdt_env.h
include/net.h
include/net/fastboot.h [new file with mode: 0644]
include/xilinx.h
include/zynqmppl.h
lib/Kconfig
lib/Makefile
lib/efi_loader/Kconfig
lib/efi_loader/efi_image_loader.c
lib/efi_loader/efi_runtime.c
lib/image-sparse.c [new file with mode: 0644]
lib/libfdt/fdt_ro.c
net/Makefile
net/fastboot.c [new file with mode: 0644]
net/net.c
scripts/Makefile.build
scripts/Makefile.lib
scripts/config_whitelist.txt
scripts/dtc/.gitignore
scripts/dtc/Makefile
scripts/dtc/checks.c
scripts/dtc/dtc-lexer.lex.c_shipped [deleted file]
scripts/dtc/dtc-parser.tab.c_shipped [deleted file]
scripts/dtc/dtc-parser.tab.h_shipped [deleted file]
scripts/dtc/dtc-parser.y
scripts/dtc/dtc.c
scripts/dtc/dtc.h
scripts/dtc/flattree.c
scripts/dtc/libfdt/fdt.c
scripts/dtc/libfdt/fdt.h
scripts/dtc/libfdt/fdt_overlay.c
scripts/dtc/libfdt/fdt_ro.c
scripts/dtc/libfdt/fdt_rw.c
scripts/dtc/libfdt/fdt_sw.c
scripts/dtc/libfdt/fdt_wip.c
scripts/dtc/libfdt/libfdt.h
scripts/dtc/libfdt/libfdt_env.h
scripts/dtc/libfdt/libfdt_internal.h
scripts/dtc/livetree.c
scripts/dtc/srcpos.c
scripts/dtc/srcpos.h
scripts/dtc/update-dtc-source.sh
scripts/dtc/util.h
scripts/dtc/version_gen.h
scripts/kconfig/.gitignore
scripts/kconfig/Makefile
scripts/kconfig/check.sh
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kconfig/expr.c
scripts/kconfig/expr.h
scripts/kconfig/gconf.c
scripts/kconfig/kconf_id.c [new file with mode: 0644]
scripts/kconfig/kxgettext.c
scripts/kconfig/list.h
scripts/kconfig/lkc.h
scripts/kconfig/lkc_proto.h
scripts/kconfig/lxdialog/check-lxdialog.sh
scripts/kconfig/mconf.c
scripts/kconfig/menu.c
scripts/kconfig/nconf.c
scripts/kconfig/nconf.gui.c
scripts/kconfig/nconf.h
scripts/kconfig/streamline_config.pl
scripts/kconfig/symbol.c
scripts/kconfig/tests/auto_submenu/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/auto_submenu/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/auto_submenu/expected_stdout [new file with mode: 0644]
scripts/kconfig/tests/choice/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/choice/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/choice/alldef_expected_config [new file with mode: 0644]
scripts/kconfig/tests/choice/allmod_expected_config [new file with mode: 0644]
scripts/kconfig/tests/choice/allno_expected_config [new file with mode: 0644]
scripts/kconfig/tests/choice/allyes_expected_config [new file with mode: 0644]
scripts/kconfig/tests/choice/oldask0_expected_stdout [new file with mode: 0644]
scripts/kconfig/tests/choice/oldask1_config [new file with mode: 0644]
scripts/kconfig/tests/choice/oldask1_expected_stdout [new file with mode: 0644]
scripts/kconfig/tests/choice_value_with_m_dep/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/choice_value_with_m_dep/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/choice_value_with_m_dep/config [new file with mode: 0644]
scripts/kconfig/tests/choice_value_with_m_dep/expected_config [new file with mode: 0644]
scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout [new file with mode: 0644]
scripts/kconfig/tests/conftest.py [new file with mode: 0644]
scripts/kconfig/tests/err_recursive_inc/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/err_recursive_inc/Kconfig.inc1 [new file with mode: 0644]
scripts/kconfig/tests/err_recursive_inc/Kconfig.inc2 [new file with mode: 0644]
scripts/kconfig/tests/err_recursive_inc/Kconfig.inc3 [new file with mode: 0644]
scripts/kconfig/tests/err_recursive_inc/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/err_recursive_inc/expected_stderr [new file with mode: 0644]
scripts/kconfig/tests/inter_choice/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/inter_choice/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/inter_choice/defconfig [new file with mode: 0644]
scripts/kconfig/tests/inter_choice/expected_config [new file with mode: 0644]
scripts/kconfig/tests/new_choice_with_dep/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/new_choice_with_dep/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/new_choice_with_dep/config [new file with mode: 0644]
scripts/kconfig/tests/new_choice_with_dep/expected_stdout [new file with mode: 0644]
scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/no_write_if_dep_unmet/config [new file with mode: 0644]
scripts/kconfig/tests/no_write_if_dep_unmet/expected_config [new file with mode: 0644]
scripts/kconfig/tests/pytest.ini [new file with mode: 0644]
scripts/kconfig/tests/rand_nested_choice/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/rand_nested_choice/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/rand_nested_choice/expected_stdout0 [new file with mode: 0644]
scripts/kconfig/tests/rand_nested_choice/expected_stdout1 [new file with mode: 0644]
scripts/kconfig/tests/rand_nested_choice/expected_stdout2 [new file with mode: 0644]
scripts/kconfig/tests/warn_recursive_dep/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/warn_recursive_dep/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/warn_recursive_dep/expected_stderr [new file with mode: 0644]
scripts/kconfig/util.c
scripts/kconfig/zconf.gperf [deleted file]
scripts/kconfig/zconf.hash.c_shipped [deleted file]
scripts/kconfig/zconf.l
scripts/kconfig/zconf.lex.c_shipped [deleted file]
scripts/kconfig/zconf.tab.c_shipped [deleted file]
scripts/kconfig/zconf.y
snapshot.commit [deleted file]
test/dm/test-fdt.c
test/py/tests/test_log.py
tools/libfdt/fdt_rw.c
tools/logos/u-boot_logo.bmp [new file with mode: 0644]
tools/logos/u-boot_logo.svg [new file with mode: 0644]

index f1b801579ce7f4969d1268570e13ce8a8df7e194..9110eda6468fb70c6472b13aa086981a8855ed43 100644 (file)
@@ -13,6 +13,7 @@
 *.su
 *.mod.c
 *.i
+*.lex.c
 *.lst
 *.order
 *.elf
@@ -20,6 +21,7 @@
 *.bin
 *.patch
 *.cfgtmp
+*.tab.[ch]
 
 # host programs on Cygwin
 *.exe
@@ -46,7 +48,6 @@ fit-dtb.blob
 #
 # Generated files
 #
-/LOG
 /spl/
 /tpl/
 /defconfig
index 937f028d6da8531cda76f2c2fa45eee930fab736..7e90bc9b367e0c41d3464994122943b8dae70b8f 100644 (file)
@@ -87,9 +87,9 @@ before_script:
     fi
   - if [[ "${TOOLCHAIN}" == "powerpc" ]]; then ./tools/buildman/buildman --fetch-arch powerpc; fi
   - if [[ "${TOOLCHAIN}" == "riscv" ]]; then
-        wget https://github.com/PkmX/riscv-prebuilt-toolchains/releases/download/20180111/riscv32-unknown-elf-toolchain.tar.gz &&
-        tar -C /tmp -xf riscv32-unknown-elf-toolchain.tar.gz &&
-        echo -e "\n[toolchain-prefix]\nriscv = /tmp/riscv32-unknown-elf/bin/riscv32-unknown-elf-" >> ~/.buildman;
+        wget https://github.com/andestech/prebuilt/releases/download/20180530/riscv64-unknown-linux-gnu.tar.gz &&
+        tar -C /tmp -xf riscv64-unknown-linux-gnu.tar.gz &&
+        echo -e "\n[toolchain-prefix]\nriscv = /tmp/riscv64-unknown-linux-gnu/bin/riscv64-unknown-linux-gnu-" >> ~/.buildman;
     fi
   - if [[ "${QEMU_TARGET}" != "" ]]; then
        git clone git://git.qemu.org/qemu.git /tmp/qemu;
index 3209dcd3184444eba23e88ec50376f312cf8a55e..f5ff57e87d4b22ad2a1336117a03d28cbb595557 100644 (file)
@@ -60,6 +60,7 @@ S:    Maintained
 L:     uboot-snps-arc@synopsys.com
 T:     git git://git.denx.de/u-boot-arc.git
 F:     arch/arc/
+F:     board/synopsys/
 
 ARC HSDK CGU CLOCK
 M:     Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
@@ -135,6 +136,7 @@ S:  Maintained
 T:     git git://git.denx.de/u-boot-marvell.git
 F:     arch/arm/mach-kirkwood/
 F:     arch/arm/mach-mvebu/
+F:     drivers/ata/ahci_mvebu.c
 
 ARM MARVELL PXA
 M:     Marek Vasut <marex@denx.de>
index d08fb6a54d5a7bccd98272744e9b5744c144df05..2995a198910968df6cf933cdd51b36a5b6215565 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -353,9 +353,13 @@ LDR                = $(CROSS_COMPILE)ldr
 STRIP          = $(CROSS_COMPILE)strip
 OBJCOPY                = $(CROSS_COMPILE)objcopy
 OBJDUMP                = $(CROSS_COMPILE)objdump
+LEX            = flex
+YACC           = bison
 AWK            = awk
 PERL           = perl
 PYTHON         ?= python
+PYTHON2                = python2
+PYTHON3                = python3
 DTC            ?= $(objtree)/scripts/dtc/dtc
 CHECK          = sparse
 
@@ -378,7 +382,7 @@ export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
 export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
 export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
-export MAKE AWK PERL PYTHON
+export MAKE LEX YACC AWK PERL PYTHON PYTHON2 PYTHON3
 export HOSTCXX HOSTCXXFLAGS CHECK CHECKFLAGS DTC DTC_FLAGS
 
 export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS
@@ -514,7 +518,7 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
 # if auto.conf.cmd is missing then we are probably in a cleaned tree so
 # we execute the config step to be sure to catch updated Kconfig files
 include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
-       $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
+       $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
        @# If the following part fails, include/config/auto.conf should be
        @# deleted so "make silentoldconfig" will be re-run on the next build.
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf || \
@@ -1617,6 +1621,7 @@ clean: $(clean-dirs)
                \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
                -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \
                -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
+               -o -name '*.lex.c' -o -name '*.tab.[ch]' \
                -o -name '*.symtypes' -o -name 'modules.order' \
                -o -name modules.builtin -o -name '.tmp_*.o.*' \
                -o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \
diff --git a/README b/README
index df1d5d67b4ad72f9aab79b7195609423e3c6d64f..fb331f910d0cf73c7a6f33212a33febb589d14b2 100644 (file)
--- a/README
+++ b/README
@@ -331,11 +331,6 @@ The following options need to be configured:
 
 - Board Type:  Define exactly one, e.g. CONFIG_MPC8540ADS.
 
-- Marvell Family Member
-               CONFIG_SYS_MVFS         - define it if you want to enable
-                                         multiple fs option at one time
-                                         for marvell soc family
-
 - 85xx CPU Options:
                CONFIG_SYS_PPC64
 
index aee15d5353d4cc8816b614d7aa947e71fdfaa483..6f139d5bdc52edb28829fb64d9d9b5255faf8d76 100644 (file)
@@ -150,6 +150,10 @@ config TARGET_AXS101
 config TARGET_AXS103
        bool "Support Synopsys Designware SDP board AXS103"
 
+config TARGET_EMDK
+       bool "Synopsys EM Development kit"
+       select CPU_ARCEM6
+
 config TARGET_HSDK
        bool "Support Synpsys HS DevelopmentKit board"
 
@@ -158,6 +162,7 @@ endchoice
 source "board/abilis/tb100/Kconfig"
 source "board/synopsys/Kconfig"
 source "board/synopsys/axs10x/Kconfig"
+source "board/synopsys/emdk/Kconfig"
 source "board/synopsys/hsdk/Kconfig"
 
 endmenu
index 73c642ed6bd9c0b5eb725b87ccd001f420f50e58..e12145c76849e894efb7b4c15506c5935ebad997 100644 (file)
@@ -5,28 +5,29 @@
 
 #include <config.h>
 
-OUTPUT_FORMAT("elf32-littlearc", "elf32-littlearc", "elf32-littlearc")
+OUTPUT_FORMAT("elf32-littlearc", "elf32-bigarc", "elf32-littlearc")
 OUTPUT_ARCH(arc)
 ENTRY(_start)
 SECTIONS
 {
        . = CONFIG_SYS_TEXT_BASE;
        __image_copy_start = .;
-       __text_start = .;
-       .text : {
-               arch/arc/lib/start.o (.text*)
-               *(.text*)
-       }
-       __text_end = .;
-
        . = ALIGN(1024);
        __ivt_start = .;
        .ivt :
        {
-               *(.ivt)
+               KEEP(*(.ivt))
        }
        __ivt_end = .;
 
+       . = ALIGN(1024);
+       __text_start = .;
+       .text : {
+               arch/arc/lib/start.o (.text*)
+               *(.text*)
+       }
+       __text_end = .;
+
        . = ALIGN(4);
        .rodata : {
                *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
index 6eccec97dab26adb26e10235e5e2782523a35f17..491a4f40bbc759864ba1547aa779696e6c59c0da 100644 (file)
@@ -4,6 +4,7 @@ dtb-$(CONFIG_TARGET_AXS101) +=  axs101.dtb
 dtb-$(CONFIG_TARGET_AXS103) +=  axs103.dtb
 dtb-$(CONFIG_TARGET_NSIM) +=  nsim.dtb
 dtb-$(CONFIG_TARGET_TB100) +=  abilis_tb100.dtb
+dtb-$(CONFIG_TARGET_EMDK) +=  emdk.dtb
 dtb-$(CONFIG_TARGET_HSDK) +=  hsdk.dtb
 
 targets += $(dtb-y)
diff --git a/arch/arc/dts/emdk.dts b/arch/arc/dts/emdk.dts
new file mode 100644 (file)
index 0000000..5e853e3
--- /dev/null
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Synopsys, Inc. All rights reserved.
+ */
+/dts-v1/;
+
+#include "skeleton.dtsi"
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       aliases {
+               console = &uart0;
+       };
+
+       cpu_card {
+               core_clk: core_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";
+                       clock-frequency = <40000000>;
+                       u-boot,dm-pre-reloc;
+               };
+       };
+
+       uart0: serial0@f0004000 {
+               compatible = "snps,dw-apb-uart";
+               clock-frequency = <100000000>;
+               reg = <0xf0004000 0x1000>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+       };
+};
index 6f52877643cbd167a33bc8f6a6e134818a012532..8c1cb6e80090f6f87124d255e1c47b8e5ea30bb6 100644 (file)
@@ -432,9 +432,16 @@ void read_decode_cache_bcr(void)
        int dc_line_sz = 0, ic_line_sz = 0;
        union bcr_di_cache ibcr, dbcr;
 
+       /*
+        * We don't care much about I$ line length really as there're
+        * no per-line ops on I$ instead we only do full invalidation of it
+        * on occasion of relocation and right before jumping to the OS.
+        * Still we check insane config with zero-encoded line length in
+        * presense of version field in I$ BCR. Just in case.
+        */
        ibcr.word = read_aux_reg(ARC_BCR_IC_BUILD);
        if (ibcr.fields.ver) {
-               gd->arch.l1_line_sz = ic_line_sz = 8 << ibcr.fields.line_len;
+               ic_line_sz = 8 << ibcr.fields.line_len;
                if (!ic_line_sz)
                        panic("Instruction exists but line length is 0\n");
        }
@@ -445,9 +452,6 @@ void read_decode_cache_bcr(void)
                if (!dc_line_sz)
                        panic("Data cache exists but line length is 0\n");
        }
-
-       if (ic_line_sz && dc_line_sz && (ic_line_sz != dc_line_sz))
-               panic("Instruction and data cache line lengths differ\n");
 }
 
 void cache_init(void)
index a3b7428d851991c61067fcc052d858c26d5398c0..4ffba84eeb3ec2a3d022111f0b4f52182f947de7 100644 (file)
@@ -8,7 +8,9 @@
 #include <asm-generic/sections.h>
 
 extern ulong __image_copy_start;
+extern ulong __ivt_start;
 extern ulong __ivt_end;
+extern ulong __text_end;
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -48,7 +50,7 @@ int do_elf_reloc_fixups(void)
        debug("Section .rela.dyn is located at %08x-%08x\n",
              (unsigned int)re_src, (unsigned int)re_end);
 
-       Elf32_Addr *offset_ptr_rom, *last_offset = NULL;
+       Elf32_Addr *offset_ptr_rom;
        Elf32_Addr *offset_ptr_ram;
 
        do {
@@ -57,15 +59,28 @@ int do_elf_reloc_fixups(void)
 
                /* Check that the location of the relocation is in .text */
                if (offset_ptr_rom >= (Elf32_Addr *)&__image_copy_start &&
-                   offset_ptr_rom > last_offset) {
-                       unsigned int val;
+                   offset_ptr_rom < (Elf32_Addr *)&__image_copy_end) {
+                       unsigned int val, do_swap = 0;
                        /* Switch to the in-RAM version */
                        offset_ptr_ram = (Elf32_Addr *)((ulong)offset_ptr_rom +
                                                        gd->reloc_off);
 
-                       debug("Patching value @ %08x (relocated to %08x)\n",
+#ifdef __LITTLE_ENDIAN__
+                       /* If location in ".text" section swap value */
+                       if (((u32)offset_ptr_rom >= (u32)&__text_start &&
+                            (u32)offset_ptr_rom <= (u32)&__text_end)
+#if defined(__ARC700__) || defined(__ARC600__)
+                           || ((u32)offset_ptr_rom >= (u32)&__ivt_start &&
+                               (u32)offset_ptr_rom <= (u32)&__ivt_end)
+#endif
+                          )
+                               do_swap = 1;
+#endif
+
+                       debug("Patching value @ %08x (relocated to %08x)%s\n",
                              (unsigned int)offset_ptr_rom,
-                             (unsigned int)offset_ptr_ram);
+                             (unsigned int)offset_ptr_ram,
+                             do_swap ? ", middle-endian encoded" : "");
 
                        /*
                         * Use "memcpy" because target location might be
@@ -75,28 +90,45 @@ int do_elf_reloc_fixups(void)
                         */
                        memcpy(&val, offset_ptr_ram, sizeof(int));
 
-#ifdef __LITTLE_ENDIAN__
-                       /* If location in ".text" section swap value */
-                       if ((unsigned int)offset_ptr_rom <
-                           (unsigned int)&__ivt_end)
+                       if (do_swap)
                                val = (val << 16) | (val >> 16);
-#endif
 
                        /* Check that the target points into executable */
-                       if (val >= (unsigned int)&__image_copy_start && val <=
-                           (unsigned int)&__image_copy_end) {
-                               val += gd->reloc_off;
-#ifdef __LITTLE_ENDIAN__
-                               /* If location in ".text" section swap value */
-                               if ((unsigned int)offset_ptr_rom <
-                                   (unsigned int)&__ivt_end)
-                                       val = (val << 16) | (val >> 16);
-#endif
-                               memcpy(offset_ptr_ram, &val, sizeof(int));
+                       if (val < (unsigned int)&__image_copy_start ||
+                           val > (unsigned int)&__image_copy_end) {
+                               /* TODO: Use panic() instead of debug()
+                                *
+                                * For some reason GCC might generate
+                                * fake relocation even for LD/SC of constant
+                                * inderectly. See an example below:
+                                * ----------------------->8--------------------
+                                * static int setup_mon_len(void)
+                                * {
+                                *         gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
+                                *         return 0;
+                                * }
+                                * ----------------------->8--------------------
+                                *
+                                * And that's what we get in the binary:
+                                * ----------------------->8--------------------
+                                * 10005cb4 <setup_mon_len>:
+                                * 10005cb4:       193c 3f80 0003 2f80     st      0x32f80,[r25,60]
+                                *                         10005cb8: R_ARC_RELATIVE        *ABS*-0x10000000
+                                * 10005cbc:       7fe0                    j_s.d   [blink]
+                                * 10005cbe:       700c                    mov_s   r0,0
+                                * ----------------------->8--------------------
+                                */
+                               debug("Relocation target %08x points outside of image\n",
+                                     val);
                        }
-               }
-               last_offset = offset_ptr_rom;
 
+                       val += gd->reloc_off;
+
+                       if (do_swap)
+                               val = (val << 16) | (val >> 16);
+
+                       memcpy(offset_ptr_ram, &val, sizeof(int));
+               }
        } while (++re_src < re_end);
 
        return 0;
index 40fb0f1fbd10d5a77b959f03f6d93ecd1051c982..02e08df48de08234a7e751086ffd4da595220136 100644 (file)
@@ -6,13 +6,17 @@
 #include <command.h>
 #include <common.h>
 
+__weak void reset_cpu(ulong addr)
+{
+       /* Stop debug session here */
+       __builtin_arc_brk();
+}
+
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
-       printf("Put your restart handler here\n");
+       printf("Resetting the board...\n");
+
+       reset_cpu(0);
 
-#ifdef DEBUG
-       /* Stop debug session here */
-       __asm__("brk");
-#endif
        return 0;
 }
index 582e84cf4014555bd593459da994a17b65d7df7b..dde422bc5d53ce661747f86149fde1a33fe40bbd 100644 (file)
@@ -1258,9 +1258,7 @@ config ARCH_ROCKCHIP
        select DM_REGULATOR
        select ENABLE_ARM_SOC_BOOT0_HOOK
        select SPI
-       imply CMD_FASTBOOT
        imply DISTRO_DEFAULTS
-       imply FASTBOOT
        imply FAT_WRITE
        imply USB_FUNCTION_FASTBOOT
        imply SPL_SYSRESET
index 13e1977bfa1abf5aed60058ed9271673adb70efa..0593b6310fd5b1ea2e37a657e08d5f57f5d90fe5 100644 (file)
@@ -16,10 +16,6 @@ unsigned long zynqmp_get_system_timer_freq(void)
        u32 ver = zynqmp_get_silicon_version();
 
        switch (ver) {
-       case ZYNQMP_CSU_VERSION_VELOCE:
-               return 10000;
-       case ZYNQMP_CSU_VERSION_EP108:
-               return 4000000;
        case ZYNQMP_CSU_VERSION_QEMU:
                return 50000000;
        }
@@ -40,11 +36,7 @@ int set_cpu_clk_info(void)
 {
        gd->cpu_clk = get_tbclk();
 
-       /* Support Veloce to show at least 1MHz via bdi */
-       if (gd->cpu_clk > 1000000)
-               gd->bd->bi_arm_freq = gd->cpu_clk / 1000000;
-       else
-               gd->bd->bi_arm_freq = 1;
+       gd->bd->bi_arm_freq = gd->cpu_clk / 1000000;
 
        gd->bd->bi_dsp_freq = 0;
 
index 2748d65d14b4f3b94746d95ec2dc32001689612f..e122be59c747944cfc1b5b3e7a46bf7fdf10a1e0 100644 (file)
@@ -135,12 +135,8 @@ unsigned int zynqmp_get_silicon_version(void)
        gd->cpu_clk = get_tbclk();
 
        switch (gd->cpu_clk) {
-       case 0 ... 1000000:
-               return ZYNQMP_CSU_VERSION_VELOCE;
        case 50000000:
                return ZYNQMP_CSU_VERSION_QEMU;
-       case 4000000:
-               return ZYNQMP_CSU_VERSION_EP108;
        }
 
        return ZYNQMP_CSU_VERSION_SILICON;
@@ -177,8 +173,8 @@ int __maybe_unused invoke_smc(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2,
 
 #define ZYNQMP_SIP_SVC_GET_API_VERSION         0xC2000001
 
-#define ZYNQMP_PM_VERSION_MAJOR                0
-#define ZYNQMP_PM_VERSION_MINOR                3
+#define ZYNQMP_PM_VERSION_MAJOR                1
+#define ZYNQMP_PM_VERSION_MINOR                0
 #define ZYNQMP_PM_VERSION_MAJOR_SHIFT  16
 #define ZYNQMP_PM_VERSION_MINOR_MASK   0xFFFF
 
index a0349a89753afc16442596918a38e5ca83501f59..197639c4051ad0659155ee6d78f58d41d45baacf 100644 (file)
@@ -130,6 +130,7 @@ dtb-$(CONFIG_ARCH_ZYNQ) += \
        zynq-cc108.dtb \
        zynq-cse-qspi-single.dtb \
        zynq-microzed.dtb \
+       zynq-minized.dtb \
        zynq-picozed.dtb \
        zynq-syzygy-hub.dtb \
        zynq-topic-miami.dtb \
index fa589956ad76b5a354e4bf934f92985053aa6a1c..65b30bbc648591adbf1617941ebff842e16ac68e 100644 (file)
                     1 3 0 0 0 0 0 0 0 3 >;
 };
 
+&ap_sdhci0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&ap_emmc_pins>;
+       bus-width = <8>;
+       status = "okay";
+};
+
 &cpm_pinctl {
        /* MPP Bus:
         *      [0-31]  = 0xff: Keep default CP0_shared_pins
        status = "okay";
 };
 
+&cpm_sdhci0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&cpm_sdhci_pins>;
+       bus-width = <4>;
+       status = "okay";
+};
+
 &cps_pinctl {
        /* MPP Bus:
         *      [0-11]  RGMII0
index f912596c2cde63937174859aea53301bb7740b37..08f1d7df69aac8a95c85deb4f1d819dc3f1f5719 100644 (file)
        status = "okay";
 };
 
+/* uSD slot */
+&cpm_sdhci0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&cpm_sdhci_pins>;
+       bus-width = <4>;
+       status = "okay";
+};
+
 &cpm_comphy {
        /*
         * CP0 Serdes Configuration:
index e0d301682b957b329e0922e7725eb634c42821f2..ebdee514c09ae3c14f2741d470e78ffe5bf0940e 100644 (file)
                        };
 
                        ap_pinctl: ap-pinctl@6F4000 {
-                               compatible = "marvell,armada-ap806-pinctrl";
+                               compatible = "marvell,ap806-pinctrl";
                                bank-name ="apn-806";
                                reg = <0x6F4000 0x10>;
                                pin-count = <20>;
index 8c336f2c38fd0ba0277c4a9e4b3f38c35af3de92..551d00d7746485f736d08f488c2900be712cb028 100644 (file)
 
                        cpm_pinctl: cpm-pinctl@440000 {
                                compatible = "marvell,mvebu-pinctrl",
-                                            "marvell,a70x0-pinctrl",
-                                            "marvell,a80x0-cp0-pinctrl";
+                                            "marvell,armada-7k-pinctrl",
+                                            "marvell,armada-8k-cpm-pinctrl";
                                bank-name ="cp0-110";
                                reg = <0x440000 0x20>;
                                pin-count = <63>;
index 0cdb3d3ae3d67ef0bef154448a5ab981e67c4009..2ea9004f1d4962683b2f0335468e23c3d7985bee 100644 (file)
 
                        cps_pinctl: cps-pinctl@440000 {
                                compatible = "marvell,mvebu-pinctrl",
-                                            "marvell,a80x0-cp1-pinctrl";
+                                            "marvell,armada-8k-cps-pinctrl";
                                bank-name ="cp1-110";
                                reg = <0x440000 0x20>;
                                pin-count = <63>;
diff --git a/arch/arm/dts/bitmain-antminer-s9.dts b/arch/arm/dts/bitmain-antminer-s9.dts
new file mode 100644 (file)
index 0000000..7362ad4
--- /dev/null
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Bitmain Antminer S9 board DTS
+ *
+ * Copyright (C) 2018 Michal Simek
+ * Copyright (C) 2018 VanguardiaSur
+ */
+/dts-v1/;
+#include "zynq-7000.dtsi"
+
+/ {
+       model = "Bitmain Antminer S9 Board";
+       compatible = "bitmain,antminer-s9", "xlnx,zynq-7000";
+
+       aliases {
+               ethernet0 = &gem0;
+               serial0 = &uart1;
+               mmc0 = &sdhci0;
+               gpio0 = &gpio0;
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x40000000>;
+       };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               bootcount@efffff0 {
+                       reg = <0xefffff0 0x10>;
+                       no-map;
+               };
+
+               fpga_space@f000000 {
+                       reg = <0xf000000 0x1000000>;
+                       no-map;
+               };
+       };
+
+       chosen {
+               bootargs = "earlycon";
+               stdout-path = "serial0:115200n8";
+       };
+};
+
+&clkc {
+       ps-clk-frequency = <33333333>;
+};
+
+&gem0 {
+       status = "okay";
+       phy-mode = "rgmii-id";
+       phy-handle = <&ethernet_phy>;
+
+       /* 0362/5e62 */
+       ethernet_phy: ethernet-phy@1 {
+               reg = <1>;
+       };
+};
+
+&sdhci0 {
+       u-boot,dm-pre-reloc;
+       status = "okay";
+       disable-wp;
+};
+
+&uart1 {
+       u-boot,dm-pre-reloc;
+       status = "okay";
+};
+
+&watchdog0 {
+       reset-on-timeout;
+       timeout-sec = <200>;
+};
index 7bfae1c42669e893595f51dc18e7d075a7e9e3fa..7457d7b7e3ff2ab7e324019026d8090ab37c35e6 100644 (file)
@@ -50,6 +50,7 @@
                blsp2_uart1: serial@75b0000 {
                        compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
                        reg = <0x75b0000 0x1000>;
+                       clock = <&gcc 4>;
                };
 
                sdhc2: sdhci@74a4900 {
diff --git a/arch/arm/dts/kirkwood-d2net.dts b/arch/arm/dts/kirkwood-d2net.dts
new file mode 100644 (file)
index 0000000..bd3b266
--- /dev/null
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree file for d2 Network v2
+ *
+ * Copyright (C) 2014 Simon Guinot <simon.guinot@sequanux.org>
+ *
+*/
+
+/dts-v1/;
+
+#include <dt-bindings/leds/leds-ns2.h>
+#include "kirkwood-netxbig.dtsi"
+
+/ {
+       model = "LaCie d2 Network v2";
+       compatible = "lacie,d2net_v2", "lacie,netxbig", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x10000000>;
+       };
+
+       ns2-leds {
+               compatible = "lacie,ns2-leds";
+
+               blue-sata {
+                       label = "d2net_v2:blue:sata";
+                       slow-gpio = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+                       cmd-gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
+                       modes-map = <NS_V2_LED_OFF  1 0
+                                    NS_V2_LED_ON   0 1
+                                    NS_V2_LED_ON   1 1
+                                    NS_V2_LED_SATA 0 0>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               red-fail {
+                       label = "d2net_v2:red:fail";
+                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
diff --git a/arch/arm/dts/kirkwood-dreamplug.dts b/arch/arm/dts/kirkwood-dreamplug.dts
new file mode 100644 (file)
index 0000000..a647a65
--- /dev/null
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+       model = "Globalscale Technologies Dreamplug";
+       compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x20000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8 earlyprintk";
+               stdout-path = &uart0;
+       };
+
+       ocp@f1000000 {
+               pinctrl: pin-controller@10000 {
+                       pmx_led_bluetooth: pmx-led-bluetooth {
+                               marvell,pins = "mpp47";
+                               marvell,function = "gpio";
+                       };
+                       pmx_led_wifi: pmx-led-wifi {
+                               marvell,pins = "mpp48";
+                               marvell,function = "gpio";
+                       };
+                       pmx_led_wifi_ap: pmx-led-wifi-ap {
+                               marvell,pins = "mpp49";
+                               marvell,function = "gpio";
+                       };
+               };
+               serial@12000 {
+                       status = "ok";
+               };
+
+               spi@10600 {
+                       status = "okay";
+
+                       m25p40@0 {
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               compatible = "mxicy,mx25l1606e", "jedec,spi-nor", "spi-flash";
+                               reg = <0>;
+                               spi-max-frequency = <50000000>;
+                               mode = <0>;
+
+                               partition@0 {
+                                       reg = <0x0 0x80000>;
+                                       label = "u-boot";
+                               };
+
+                               partition@100000 {
+                                       reg = <0x100000 0x10000>;
+                                       label = "u-boot env";
+                               };
+
+                               partition@180000 {
+                                       reg = <0x180000 0x10000>;
+                                       label = "dtb";
+                               };
+                       };
+               };
+
+               sata@80000 {
+                       status = "okay";
+                       nr-ports = <1>;
+               };
+
+               mvsdio@90000 {
+                       pinctrl-0 = <&pmx_sdio>;
+                       pinctrl-names = "default";
+                       status = "okay";
+                       /* No CD or WP GPIOs */
+                       broken-cd;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pmx_led_bluetooth &pmx_led_wifi
+                            &pmx_led_wifi_ap >;
+               pinctrl-names = "default";
+
+               bluetooth {
+                       label = "dreamplug:blue:bluetooth";
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+               };
+               wifi {
+                       label = "dreamplug:green:wifi";
+                       gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
+               };
+               wifi-ap {
+                       label = "dreamplug:green:wifi_ap";
+                       gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&mdio {
+       status = "okay";
+
+       ethphy0: ethernet-phy@0 {
+               reg = <0>;
+       };
+
+       ethphy1: ethernet-phy@1 {
+               reg = <1>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+       ethernet0-port@0 {
+               phy-handle = <&ethphy0>;
+       };
+};
+
+&eth1 {
+       status = "okay";
+       ethernet1-port@0 {
+               phy-handle = <&ethphy1>;
+       };
+};
diff --git a/arch/arm/dts/kirkwood-ds109.dts b/arch/arm/dts/kirkwood-ds109.dts
new file mode 100644 (file)
index 0000000..29982e7
--- /dev/null
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Andrew Lunn <andrew@lunn.ch>
+ * Ben Peddell <klightspeed@killerwolves.net>
+ *
+ */
+
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+#include "kirkwood-synology.dtsi"
+
+/ {
+       model = "Synology DS109, DS110, DS110jv20";
+       compatible = "synology,ds109", "synology,ds110jv20",
+                    "synology,ds110", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x8000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8";
+               stdout-path = &uart0;
+       };
+
+       gpio-fan-150-32-35 {
+               status = "okay";
+       };
+
+       gpio-leds-hdd-21-1 {
+               status = "okay";
+       };
+};
+
+&rs5c372 {
+       status = "okay";
+};
diff --git a/arch/arm/dts/kirkwood-is2.dts b/arch/arm/dts/kirkwood-is2.dts
new file mode 100644 (file)
index 0000000..1bc16a5
--- /dev/null
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include <dt-bindings/leds/leds-ns2.h>
+#include "kirkwood-ns2-common.dtsi"
+
+/ {
+       model = "LaCie Internet Space v2";
+       compatible = "lacie,inetspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x8000000>;
+       };
+
+       ocp@f1000000 {
+               sata@80000 {
+                       pinctrl-0 = <&pmx_ns2_sata0>;
+                       pinctrl-names = "default";
+                       status = "okay";
+                       nr-ports = <1>;
+               };
+       };
+
+       ns2-leds {
+               compatible = "lacie,ns2-leds";
+
+               blue-sata {
+                       label = "ns2:blue:sata";
+                       slow-gpio = <&gpio0 29 0>;
+                       cmd-gpio = <&gpio0 30 0>;
+                       modes-map = <NS_V2_LED_OFF  1 0
+                                    NS_V2_LED_ON   0 1
+                                    NS_V2_LED_ON   1 1
+                                    NS_V2_LED_SATA 0 0>;
+               };
+       };
+};
+
+&ethphy0 { reg = <8>; };
diff --git a/arch/arm/dts/kirkwood-km_common.dtsi b/arch/arm/dts/kirkwood-km_common.dtsi
new file mode 100644 (file)
index 0000000..75dc839
--- /dev/null
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0
+/ {
+       chosen {
+               bootargs = "console=ttyS0,115200n8 earlyprintk";
+               stdout-path = &uart0;
+       };
+
+       ocp@f1000000 {
+               pinctrl: pin-controller@10000 {
+                       pinctrl-0 = < &pmx_i2c_gpio_sda &pmx_i2c_gpio_scl >;
+                       pinctrl-names = "default";
+
+                       pmx_i2c_gpio_sda: pmx-gpio-sda {
+                               marvell,pins = "mpp8";
+                               marvell,function = "gpio";
+                       };
+                       pmx_i2c_gpio_scl: pmx-gpio-scl {
+                               marvell,pins = "mpp9";
+                               marvell,function = "gpio";
+                       };
+               };
+
+               serial@12000 {
+                       status = "okay";
+               };
+       };
+
+       i2c {
+               compatible = "i2c-gpio";
+               gpios = < &gpio0 8 GPIO_ACTIVE_HIGH             /* sda */
+                         &gpio0 9 GPIO_ACTIVE_HIGH>;           /* scl */
+               i2c-gpio,delay-us = <2>;        /* ~100 kHz */
+       };
+};
+
+&nand {
+       status = "okay";
+       chip-delay = <25>;
+};
+
+&pciec {
+        status = "okay";
+};
+
+&pcie0 {
+       status = "okay";
+};
diff --git a/arch/arm/dts/kirkwood-km_kirkwood.dts b/arch/arm/dts/kirkwood-km_kirkwood.dts
new file mode 100644 (file)
index 0000000..f035eff
--- /dev/null
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-98dx4122.dtsi"
+#include "kirkwood-km_common.dtsi"
+
+/ {
+       model = "Keymile Kirkwood Reference Design";
+       compatible = "keymile,km_kirkwood", "marvell,kirkwood-98DX4122", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x08000000>;
+       };
+};
+
+&mdio {
+       status = "okay";
+
+       ethphy0: ethernet-phy@0 {
+               reg = <0>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+       ethernet0-port@0 {
+               phy-handle = <&ethphy0>;
+       };
+};
diff --git a/arch/arm/dts/kirkwood-lschlv2.dts b/arch/arm/dts/kirkwood-lschlv2.dts
new file mode 100644 (file)
index 0000000..1d737d9
--- /dev/null
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood-lsxl.dtsi"
+
+/ {
+       model = "Buffalo Linkstation LS-CHLv2";
+       compatible = "buffalo,lschlv2", "buffalo,lsxl", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x4000000>;
+       };
+
+       ocp@f1000000 {
+               serial@12000 {
+                       status = "okay";
+               };
+       };
+};
diff --git a/arch/arm/dts/kirkwood-lsxhl.dts b/arch/arm/dts/kirkwood-lsxhl.dts
new file mode 100644 (file)
index 0000000..a56e0d7
--- /dev/null
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood-lsxl.dtsi"
+
+/ {
+       model = "Buffalo Linkstation LS-XHL";
+       compatible = "buffalo,lsxhl", "buffalo,lsxl", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x10000000>;
+       };
+
+       ocp@f1000000 {
+               serial@12000 {
+                       status = "okay";
+               };
+       };
+};
diff --git a/arch/arm/dts/kirkwood-lsxl.dtsi b/arch/arm/dts/kirkwood-lsxl.dtsi
new file mode 100644 (file)
index 0000000..92b11c7
--- /dev/null
@@ -0,0 +1,237 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+       chosen {
+               bootargs = "console=ttyS0,115200n8 earlyprintk";
+               stdout-path = &uart0;
+       };
+
+       ocp@f1000000 {
+               pinctrl: pin-controller@10000 {
+                       pmx_power_hdd: pmx-power-hdd {
+                               marvell,pins = "mpp10";
+                               marvell,function = "gpo";
+                       };
+                       pmx_usb_vbus: pmx-usb-vbus {
+                               marvell,pins = "mpp11";
+                               marvell,function = "gpio";
+                       };
+                       pmx_fan_high: pmx-fan-high {
+                               marvell,pins = "mpp18";
+                               marvell,function = "gpo";
+                       };
+                       pmx_fan_low: pmx-fan-low {
+                               marvell,pins = "mpp19";
+                               marvell,function = "gpo";
+                       };
+                       pmx_led_function_blue: pmx-led-function-blue {
+                               marvell,pins = "mpp36";
+                               marvell,function = "gpio";
+                       };
+                       pmx_led_alarm: pmx-led-alarm {
+                               marvell,pins = "mpp37";
+                               marvell,function = "gpio";
+                       };
+                       pmx_led_info: pmx-led-info {
+                               marvell,pins = "mpp38";
+                               marvell,function = "gpio";
+                       };
+                       pmx_led_power: pmx-led-power {
+                               marvell,pins = "mpp39";
+                               marvell,function = "gpio";
+                       };
+                       pmx_fan_lock: pmx-fan-lock {
+                               marvell,pins = "mpp40";
+                               marvell,function = "gpio";
+                       };
+                       pmx_button_function: pmx-button-function {
+                               marvell,pins = "mpp41";
+                               marvell,function = "gpio";
+                       };
+                       pmx_power_switch: pmx-power-switch {
+                               marvell,pins = "mpp42";
+                               marvell,function = "gpio";
+                       };
+                       pmx_power_auto_switch: pmx-power-auto-switch {
+                               marvell,pins = "mpp43";
+                               marvell,function = "gpio";
+                       };
+                       pmx_led_function_red: pmx-led-function_red {
+                               marvell,pins = "mpp48";
+                               marvell,function = "gpio";
+                       };
+
+               };
+               sata@80000 {
+                       status = "okay";
+                       nr-ports = <1>;
+               };
+
+               spi@10600 {
+                       status = "okay";
+
+                       m25p40@0 {
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               compatible = "m25p40", "jedec,spi-nor", "spi-flash";
+                               reg = <0>;
+                               spi-max-frequency = <25000000>;
+                               mode = <0>;
+
+                               partition@0 {
+                                       reg = <0x0 0x60000>;
+                                       label = "uboot";
+                                       read-only;
+                               };
+
+                               partition@60000 {
+                                       reg = <0x60000 0x10000>;
+                                       label = "dtb";
+                                       read-only;
+                               };
+
+                               partition@70000 {
+                                       reg = <0x70000 0x10000>;
+                                       label = "uboot_env";
+                               };
+                       };
+               };
+       };
+
+       gpio_keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-0 = <&pmx_button_function &pmx_power_switch
+                            &pmx_power_auto_switch>;
+               pinctrl-names = "default";
+
+               option {
+                       label = "Function Button";
+                       linux,code = <KEY_OPTION>;
+                       gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+               };
+               reserved {
+                       label = "Power-on Switch";
+                       linux,code = <KEY_RESERVED>;
+                       linux,input-type = <5>;
+                       gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+               };
+               power {
+                       label = "Power-auto Switch";
+                       linux,code = <KEY_ESC>;
+                       linux,input-type = <5>;
+                       gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio_leds {
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pmx_led_function_red &pmx_led_alarm
+                            &pmx_led_info &pmx_led_power
+                            &pmx_led_function_blue>;
+               pinctrl-names = "default";
+
+               func_blue {
+                       label = "lsxl:blue:func";
+                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+               };
+
+               alarm {
+                       label = "lsxl:red:alarm";
+                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
+               };
+
+               info {
+                       label = "lsxl:amber:info";
+                       gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+               };
+
+               power {
+                       label = "lsxl:blue:power";
+                       gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
+               };
+
+               func_red {
+                       label = "lsxl:red:func";
+                       gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio_fan {
+               compatible = "gpio-fan";
+               pinctrl-0 = <&pmx_fan_low &pmx_fan_high &pmx_fan_lock>;
+               pinctrl-names = "default";
+               gpios = <&gpio0 19 GPIO_ACTIVE_LOW
+                        &gpio0 18 GPIO_ACTIVE_LOW>;
+               gpio-fan,speed-map = <0    3
+                                     1500 2
+                                     3250 1
+                                     5000 0>;
+               alarm-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
+       };
+
+       restart_poweroff {
+               compatible = "restart-poweroff";
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-0 = <&pmx_power_hdd &pmx_usb_vbus>;
+               pinctrl-names = "default";
+
+               usb_power: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "USB Power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       gpio = <&gpio0 11 0>;
+               };
+               hdd_power: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "HDD Power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       gpio = <&gpio0 10 0>;
+               };
+       };
+};
+
+&mdio {
+       status = "okay";
+
+       ethphy0: ethernet-phy@0 {
+               reg = <0>;
+       };
+
+       ethphy1: ethernet-phy@8 {
+               reg = <8>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+       ethernet0-port@0 {
+               phy-handle = <&ethphy0>;
+       };
+};
+
+&eth1 {
+       status = "okay";
+       ethernet1-port@0 {
+               phy-handle = <&ethphy1>;
+       };
+};
diff --git a/arch/arm/dts/kirkwood-net2big.dts b/arch/arm/dts/kirkwood-net2big.dts
new file mode 100644 (file)
index 0000000..3e3ac28
--- /dev/null
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree file for LaCie 2Big Network v2
+ *
+ * Copyright (C) 2014
+ *
+ * Andrew Lunn <andrew@lunn.ch>
+ *
+ * Based on netxbig_v2-setup.c,
+ * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
+ *
+*/
+
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+#include "kirkwood-netxbig.dtsi"
+
+/ {
+       model = "LaCie 2Big Network v2";
+       compatible = "lacie,net2big_v2", "lacie,netxbig", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x10000000>;
+       };
+
+       fan {
+               compatible = "gpio-fan";
+               alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&regulators {
+       regulator@2 {
+               compatible = "regulator-fixed";
+               reg = <2>;
+               regulator-name = "hdd1power";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               enable-active-high;
+               regulator-always-on;
+               regulator-boot-on;
+               gpio = <&gpio0 17 GPIO_ACTIVE_HIGH>;
+       };
+
+       clocks {
+              g762_clk: g762-oscillator {
+                        compatible = "fixed-clock";
+                        #clock-cells = <0>;
+                        clock-frequency = <32768>;
+              };
+       };
+};
+
+&i2c0 {
+       g762@3e {
+               compatible = "gmt,g762";
+               reg = <0x3e>;
+               clocks = <&g762_clk>;
+       };
+};
diff --git a/arch/arm/dts/kirkwood-netxbig.dtsi b/arch/arm/dts/kirkwood-netxbig.dtsi
new file mode 100644 (file)
index 0000000..135ac80
--- /dev/null
@@ -0,0 +1,232 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree common file for LaCie 2Big and 5Big Network v2
+ *
+ * Copyright (C) 2014
+ *
+ * Andrew Lunn <andrew@lunn.ch>
+ *
+ * Based on netxbig_v2-setup.c,
+ * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
+ *
+*/
+
+#include <dt-bindings/leds/leds-netxbig.h>
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+       chosen {
+               bootargs = "console=ttyS0,115200n8";
+               stdout-path = &uart0;
+       };
+
+       ocp@f1000000 {
+               serial@12000 {
+                       status = "okay";
+               };
+
+               spi@10600 {
+                       status = "okay";
+
+                       flash@0 {
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               compatible = "mxicy,mx25l4005a", "jedec,spi-nor", "spi-flash";
+                               reg = <0>;
+                               spi-max-frequency = <20000000>;
+                               mode = <0>;
+
+                               partition@0 {
+                                       reg = <0x0 0x80000>;
+                                       label = "u-boot";
+                               };
+                       };
+               };
+
+               sata@80000 {
+                       status = "okay";
+                       nr-ports = <2>;
+               };
+
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               /*
+                * esc and power represent a three position rocker
+                * switch. Thus the conventional KEY_POWER does not fit
+                */
+               exc {
+                       label = "Back power switch (on|auto)";
+                       linux,code = <KEY_ESC>;
+                       linux,input-type = <5>;
+                       gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+               };
+               power {
+                       label = "Back power switch (auto|off)";
+                       linux,code = <KEY_1>;
+                       linux,input-type = <5>;
+                       gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
+               };
+               option {
+                       label = "Function button";
+                       linux,code = <KEY_OPTION>;
+                       gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
+               };
+
+       };
+
+       gpio-poweroff {
+               compatible = "gpio-poweroff";
+               gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
+       };
+
+       regulators: regulators {
+               status = "okay";
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+
+               regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "hdd0power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       gpio = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       netxbig_gpio_ext: netxbig-gpio-ext {
+               compatible = "lacie,netxbig-gpio-ext";
+
+               addr-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH
+                             &gpio1 16 GPIO_ACTIVE_HIGH
+                             &gpio1 17 GPIO_ACTIVE_HIGH>;
+               data-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH
+                             &gpio1 13 GPIO_ACTIVE_HIGH
+                             &gpio1 14 GPIO_ACTIVE_HIGH>;
+               enable-gpio = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+       };
+
+       netxbig-leds {
+               compatible = "lacie,netxbig-leds";
+
+               gpio-ext = <&netxbig_gpio_ext>;
+
+               timers = <NETXBIG_LED_TIMER1 500 500
+                         NETXBIG_LED_TIMER2 500 1000>;
+
+               blue-power {
+                       label = "netxbig:blue:power";
+                       mode-addr = <0>;
+                       mode-val = <NETXBIG_LED_OFF 0
+                                   NETXBIG_LED_ON 1
+                                   NETXBIG_LED_TIMER1 3
+                                   NETXBIG_LED_TIMER2 7>;
+                       bright-addr = <1>;
+                       max-brightness = <7>;
+               };
+               red-power {
+                       label = "netxbig:red:power";
+                       mode-addr = <0>;
+                       mode-val = <NETXBIG_LED_OFF 0
+                                   NETXBIG_LED_ON 2
+                                   NETXBIG_LED_TIMER1 4>;
+                       bright-addr = <1>;
+                       max-brightness = <7>;
+               };
+               blue-sata0 {
+                       label = "netxbig:blue:sata0";
+                       mode-addr = <3>;
+                       mode-val = <NETXBIG_LED_OFF 0
+                                   NETXBIG_LED_ON 7
+                                   NETXBIG_LED_SATA 1
+                                   NETXBIG_LED_TIMER1 3>;
+                       bright-addr = <2>;
+                       max-brightness = <7>;
+               };
+               red-sata0 {
+                       label = "netxbig:red:sata0";
+                       mode-addr = <3>;
+                       mode-val = <NETXBIG_LED_OFF 0
+                                   NETXBIG_LED_ON 2
+                                   NETXBIG_LED_TIMER1 4>;
+                       bright-addr = <2>;
+                       max-brightness = <7>;
+               };
+               blue-sata1 {
+                       label = "netxbig:blue:sata1";
+                       mode-addr = <4>;
+                       mode-val = <NETXBIG_LED_OFF 0
+                                   NETXBIG_LED_ON 7
+                                   NETXBIG_LED_SATA 1
+                                   NETXBIG_LED_TIMER1 3>;
+                       bright-addr = <2>;
+                       max-brightness = <7>;
+               };
+               red-sata1 {
+                       label = "netxbig:red:sata1";
+                       mode-addr = <4>;
+                       mode-val = <NETXBIG_LED_OFF 0
+                                   NETXBIG_LED_ON 2
+                                   NETXBIG_LED_TIMER1 4>;
+                       bright-addr = <2>;
+                       max-brightness = <7>;
+               };
+       };
+};
+
+&mdio {
+       status = "okay";
+
+       ethphy0: ethernet-phy@0 {
+               reg = <8>;
+       };
+
+       ethphy1: ethernet-phy@1 {
+               reg = <0>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+       ethernet0-port@0 {
+               phy-handle = <&ethphy0>;
+       };
+};
+
+&pinctrl {
+       pinctrl-names = "default";
+
+       pmx_button_function: pmx-button-function {
+               marvell,pins = "mpp34";
+               marvell,function = "gpio";
+       };
+       pmx_button_power_off: pmx-button-power-off {
+               marvell,pins = "mpp15";
+               marvell,function = "gpio";
+       };
+       pmx_button_power_on: pmx-button-power-on {
+               marvell,pins = "mpp13";
+               marvell,function = "gpio";
+       };
+};
+
+&i2c0 {
+       status = "okay";
+
+       eeprom@50 {
+               compatible = "atmel,24c04";
+               pagesize = <16>;
+               reg = <0x50>;
+       };
+};
diff --git a/arch/arm/dts/kirkwood-ns2-common.dtsi b/arch/arm/dts/kirkwood-ns2-common.dtsi
new file mode 100644 (file)
index 0000000..f997bb4
--- /dev/null
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+       chosen {
+               bootargs = "console=ttyS0,115200n8";
+               stdout-path = &uart0;
+       };
+
+       ocp@f1000000 {
+               pinctrl: pin-controller@10000 {
+                       pmx_ns2_sata0: pmx-ns2-sata0 {
+                               marvell,pins = "mpp21";
+                               marvell,function = "sata0";
+                       };
+                       pmx_ns2_sata1: pmx-ns2-sata1 {
+                               marvell,pins = "mpp20";
+                               marvell,function = "sata1";
+                       };
+               };
+
+               serial@12000 {
+                       status = "okay";
+               };
+
+               spi@10600 {
+                       status = "okay";
+
+                       flash@0 {
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               compatible = "mxicy,mx25l4005a", "jedec,spi-nor", "spi-flash";
+                               reg = <0>;
+                               spi-max-frequency = <20000000>;
+                               mode = <0>;
+
+                               partition@0 {
+                                       reg = <0x0 0x80000>;
+                                       label = "u-boot";
+                               };
+                       };
+               };
+
+               i2c@11000 {
+                       status = "okay";
+
+                       eeprom@50 {
+                               compatible = "atmel,24c04";
+                               pagesize = <16>;
+                               reg = <0x50>;
+                       };
+               };
+       };
+
+       gpio_keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               power {
+                       label = "Power push button";
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               red-fail {
+                       label = "ns2:red:fail";
+                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       gpio_poweroff {
+               compatible = "gpio-poweroff";
+               gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
+       };
+
+};
+
+&mdio {
+       status = "okay";
+
+       ethphy0: ethernet-phy@X {
+                /* overwrite reg property in board file */
+       };
+};
+
+&eth0 {
+       status = "okay";
+       ethernet0-port@0 {
+               phy-handle = <&ethphy0>;
+       };
+};
diff --git a/arch/arm/dts/kirkwood-ns2.dts b/arch/arm/dts/kirkwood-ns2.dts
new file mode 100644 (file)
index 0000000..7b67083
--- /dev/null
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include <dt-bindings/leds/leds-ns2.h>
+#include "kirkwood-ns2-common.dtsi"
+
+/ {
+       model = "LaCie Network Space v2";
+       compatible = "lacie,netspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x10000000>;
+       };
+
+       ocp@f1000000 {
+               sata@80000 {
+                       pinctrl-0 = <&pmx_ns2_sata0>;
+                       pinctrl-names = "default";
+                       status = "okay";
+                       nr-ports = <1>;
+               };
+       };
+
+       ns2-leds {
+               compatible = "lacie,ns2-leds";
+
+               blue-sata {
+                       label = "ns2:blue:sata";
+                       slow-gpio = <&gpio0 29 0>;
+                       cmd-gpio = <&gpio0 30 0>;
+                       modes-map = <NS_V2_LED_OFF  1 0
+                                    NS_V2_LED_ON   0 1
+                                    NS_V2_LED_ON   1 1
+                                    NS_V2_LED_SATA 0 0>;
+               };
+       };
+};
+
+&ethphy0 { reg = <8>; };
diff --git a/arch/arm/dts/kirkwood-ns2lite.dts b/arch/arm/dts/kirkwood-ns2lite.dts
new file mode 100644 (file)
index 0000000..b0cb590
--- /dev/null
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood-ns2-common.dtsi"
+
+/ {
+       model = "LaCie Network Space Lite v2";
+       compatible = "lacie,netspace_lite_v2", "marvell,kirkwood-88f6192", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x8000000>;
+       };
+
+       ocp@f1000000 {
+               sata@80000 {
+                       pinctrl-0 = <&pmx_ns2_sata0>;
+                       pinctrl-names = "default";
+                       status = "okay";
+                       nr-ports = <1>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               blue-sata {
+                       label = "ns2:blue:sata";
+                       gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "disk-activity";
+               };
+       };
+};
+
+&ethphy0 { reg = <0>; };
diff --git a/arch/arm/dts/kirkwood-ns2max.dts b/arch/arm/dts/kirkwood-ns2max.dts
new file mode 100644 (file)
index 0000000..c0a087e
--- /dev/null
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include <dt-bindings/leds/leds-ns2.h>
+#include "kirkwood-ns2-common.dtsi"
+
+/ {
+       model = "LaCie Network Space Max v2";
+       compatible = "lacie,netspace_max_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x10000000>;
+       };
+
+       ocp@f1000000 {
+               sata@80000 {
+                       pinctrl-0 = <&pmx_ns2_sata0 &pmx_ns2_sata1>;
+                       pinctrl-names = "default";
+                       status = "okay";
+                       nr-ports = <2>;
+               };
+       };
+
+       gpio_fan {
+               compatible = "gpio-fan";
+               gpios = <&gpio0 22 GPIO_ACTIVE_LOW
+                        &gpio0  7 GPIO_ACTIVE_LOW
+                        &gpio1  1 GPIO_ACTIVE_LOW
+                        &gpio0 23 GPIO_ACTIVE_LOW>;
+               gpio-fan,speed-map =
+                       <   0  0
+                        1500 15
+                        1700 14
+                        1800 13
+                        2100 12
+                        3100 11
+                        3300 10
+                        4300  9
+                        5500  8>;
+               alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
+       };
+
+       ns2-leds {
+               compatible = "lacie,ns2-leds";
+
+               blue-sata {
+                       label = "ns2:blue:sata";
+                       slow-gpio = <&gpio0 29 0>;
+                       cmd-gpio = <&gpio0 30 0>;
+                       modes-map = <NS_V2_LED_OFF  1 0
+                                    NS_V2_LED_ON   0 1
+                                    NS_V2_LED_ON   1 1
+                                    NS_V2_LED_SATA 0 0>;
+               };
+       };
+};
+
+&ethphy0 { reg = <8>; };
diff --git a/arch/arm/dts/kirkwood-ns2mini.dts b/arch/arm/dts/kirkwood-ns2mini.dts
new file mode 100644 (file)
index 0000000..5b9fa14
--- /dev/null
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include <dt-bindings/leds/leds-ns2.h>
+#include "kirkwood-ns2-common.dtsi"
+
+/ {
+       /* This machine is embedded in the first LaCie CloudBox product. */
+       model = "LaCie Network Space Mini v2";
+       compatible = "lacie,netspace_mini_v2", "marvell,kirkwood-88f6192", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x8000000>;
+       };
+
+       ocp@f1000000 {
+               sata@80000 {
+                       pinctrl-0 = <&pmx_ns2_sata0>;
+                       pinctrl-names = "default";
+                       status = "okay";
+                       nr-ports = <1>;
+               };
+       };
+
+       gpio_fan {
+               compatible = "gpio-fan";
+               gpios = <&gpio0 22 GPIO_ACTIVE_LOW
+                        &gpio0  7 GPIO_ACTIVE_LOW
+                        &gpio1  1 GPIO_ACTIVE_LOW
+                        &gpio0 23 GPIO_ACTIVE_LOW>;
+               gpio-fan,speed-map =
+                       <   0  0
+                        3000 15
+                        3180 14
+                        4140 13
+                        4570 12
+                        6760 11
+                        7140 10
+                        7980  9
+                        9200  8>;
+               alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
+       };
+
+       ns2-leds {
+               compatible = "lacie,ns2-leds";
+
+               blue-sata {
+                       label = "ns2:blue:sata";
+                       slow-gpio = <&gpio0 29 0>;
+                       cmd-gpio = <&gpio0 30 0>;
+                       modes-map = <NS_V2_LED_OFF  1 0
+                                    NS_V2_LED_ON   0 1
+                                    NS_V2_LED_ON   1 1
+                                    NS_V2_LED_SATA 0 0>;
+               };
+       };
+};
+
+&ethphy0 { reg = <0>; };
diff --git a/arch/arm/dts/kirkwood-synology.dtsi b/arch/arm/dts/kirkwood-synology.dtsi
new file mode 100644 (file)
index 0000000..b80d8ee
--- /dev/null
@@ -0,0 +1,855 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Nodes for Marvell 628x Synology devices
+ *
+ * Andrew Lunn <andrew@lunn.ch>
+ * Ben Peddell <klightspeed@killerwolves.net>
+ *
+ */
+
+/ {
+       ocp@f1000000 {
+               pinctrl: pin-controller@10000 {
+                       pmx_alarmled_12: pmx-alarmled-12 {
+                               marvell,pins = "mpp12";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_fanctrl_15: pmx-fanctrl-15 {
+                               marvell,pins = "mpp15";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_fanctrl_16: pmx-fanctrl-16 {
+                               marvell,pins = "mpp16";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_fanctrl_17: pmx-fanctrl-17 {
+                               marvell,pins = "mpp17";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_fanalarm_18: pmx-fanalarm-18 {
+                               marvell,pins = "mpp18";
+                               marvell,function = "gpo";
+                       };
+
+                       pmx_hddled_20: pmx-hddled-20 {
+                               marvell,pins = "mpp20";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_21: pmx-hddled-21 {
+                               marvell,pins = "mpp21";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_22: pmx-hddled-22 {
+                               marvell,pins = "mpp22";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_23: pmx-hddled-23 {
+                               marvell,pins = "mpp23";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_24: pmx-hddled-24 {
+                               marvell,pins = "mpp24";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_25: pmx-hddled-25 {
+                               marvell,pins = "mpp25";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_26: pmx-hddled-26 {
+                               marvell,pins = "mpp26";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_27: pmx-hddled-27 {
+                               marvell,pins = "mpp27";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_28: pmx-hddled-28 {
+                               marvell,pins = "mpp28";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hdd1_pwr_29: pmx-hdd1-pwr-29 {
+                               marvell,pins = "mpp29";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hdd1_pwr_30: pmx-hdd-pwr-30 {
+                               marvell,pins = "mpp30";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hdd2_pwr_31: pmx-hdd2-pwr-31 {
+                               marvell,pins = "mpp31";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_fanctrl_32: pmx-fanctrl-32 {
+                               marvell,pins = "mpp32";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_fanctrl_33: pmx-fanctrl-33 {
+                               marvell,pins = "mpp33";
+                               marvell,function = "gpo";
+                       };
+
+                       pmx_fanctrl_34: pmx-fanctrl-34 {
+                               marvell,pins = "mpp34";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hdd2_pwr_34: pmx-hdd2-pwr-34 {
+                               marvell,pins = "mpp34";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_fanalarm_35: pmx-fanalarm-35 {
+                               marvell,pins = "mpp35";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_36: pmx-hddled-36 {
+                               marvell,pins = "mpp36";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_37: pmx-hddled-37 {
+                               marvell,pins = "mpp37";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_38: pmx-hddled-38 {
+                               marvell,pins = "mpp38";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_39: pmx-hddled-39 {
+                               marvell,pins = "mpp39";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_40: pmx-hddled-40 {
+                               marvell,pins = "mpp40";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_41: pmx-hddled-41 {
+                               marvell,pins = "mpp41";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_42: pmx-hddled-42 {
+                               marvell,pins = "mpp42";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_43: pmx-hddled-43 {
+                               marvell,pins = "mpp43";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_44: pmx-hddled-44 {
+                               marvell,pins = "mpp44";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hddled_45: pmx-hddled-45 {
+                               marvell,pins = "mpp45";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hdd3_pwr_44: pmx-hdd3-pwr-44 {
+                               marvell,pins = "mpp44";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_hdd4_pwr_45: pmx-hdd4-pwr-45 {
+                               marvell,pins = "mpp45";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_fanalarm_44: pmx-fanalarm-44 {
+                               marvell,pins = "mpp44";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_fanalarm_45: pmx-fanalarm-45 {
+                               marvell,pins = "mpp45";
+                               marvell,function = "gpio";
+                       };
+               };
+
+               rtc@10300 {
+                       status = "disabled";
+               };
+
+               spi@10600 {
+                       status = "okay";
+
+                       m25p80@0 {
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               compatible = "st,m25p80", "jedec,spi-nor", "spi-flash";
+                               reg = <0>;
+                               spi-max-frequency = <20000000>;
+                               mode = <0>;
+
+                               partition@0 {
+                                       reg = <0x00000000 0x00080000>;
+                                       label = "RedBoot";
+                               };
+
+                               partition@80000 {
+                                       reg = <0x00080000 0x00200000>;
+                                       label = "zImage";
+                               };
+
+                               partition@280000 {
+                                       reg = <0x00280000 0x00140000>;
+                                       label = "rd.gz";
+                               };
+
+                               partition@3c0000 {
+                                       reg = <0x003c0000 0x00010000>;
+                                       label = "vendor";
+                               };
+
+                               partition@3d0000 {
+                                       reg = <0x003d0000 0x00020000>;
+                                       label = "RedBoot config";
+                               };
+
+                               partition@3f0000 {
+                                       reg = <0x003f0000 0x00010000>;
+                                       label = "FIS directory";
+                               };
+                       };
+               };
+
+               i2c@11000 {
+                       status = "okay";
+                       clock-frequency = <400000>;
+
+                       rs5c372: rs5c372@32 {
+                               status = "disabled";
+                               compatible = "ricoh,rs5c372";
+                               reg = <0x32>;
+                       };
+
+                       s35390a: s35390a@30 {
+                               status = "disabled";
+                               compatible = "sii,s35390a";
+                               reg = <0x30>;
+                       };
+               };
+
+               serial@12000 {
+                       status = "okay";
+               };
+
+               serial@12100 {
+                       status = "okay";
+               };
+
+               poweroff@12100 {
+                       compatible = "synology,power-off";
+                       reg = <0x12100 0x100>;
+                       clocks = <&gate_clk 7>;
+               };
+
+               sata@80000 {
+                       pinctrl-0 = <&pmx_sata0 &pmx_sata1>;
+                       pinctrl-names = "default";
+                       status = "okay";
+                       nr-ports = <2>;
+               };
+       };
+
+       gpio-fan-150-32-35 {
+               status = "disabled";
+               compatible = "gpio-fan";
+               pinctrl-0 = <&pmx_fanctrl_32 &pmx_fanctrl_33 &pmx_fanctrl_34
+                            &pmx_fanalarm_35>;
+               pinctrl-names = "default";
+               gpios = <&gpio1 0 GPIO_ACTIVE_HIGH
+                        &gpio1 1 GPIO_ACTIVE_HIGH
+                        &gpio1 2 GPIO_ACTIVE_HIGH>;
+               gpio-fan,speed-map = <    0 0
+                                      2200 1
+                                      2500 2
+                                      3000 4
+                                      3300 3
+                                      3700 5
+                                      3800 6
+                                      4200 7 >;
+       };
+
+       gpio-fan-150-15-18 {
+               status = "disabled";
+               compatible = "gpio-fan";
+               pinctrl-0 = <&pmx_fanctrl_15 &pmx_fanctrl_16 &pmx_fanctrl_17
+                            &pmx_fanalarm_18>;
+               pinctrl-names = "default";
+               gpios = <&gpio0 15 GPIO_ACTIVE_HIGH
+                        &gpio0 16 GPIO_ACTIVE_HIGH
+                        &gpio0 17 GPIO_ACTIVE_HIGH>;
+               alarm-gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
+               gpio-fan,speed-map = <    0 0
+                                      2200 1
+                                      2500 2
+                                      3000 4
+                                      3300 3
+                                      3700 5
+                                      3800 6
+                                      4200 7 >;
+       };
+
+       gpio-fan-100-32-35 {
+               status = "disabled";
+               compatible = "gpio-fan";
+               pinctrl-0 = <&pmx_fanctrl_32 &pmx_fanctrl_33 &pmx_fanctrl_34
+                            &pmx_fanalarm_35>;
+               pinctrl-names = "default";
+               gpios = <&gpio1 0 GPIO_ACTIVE_HIGH
+                        &gpio1 1 GPIO_ACTIVE_HIGH
+                        &gpio1 2 GPIO_ACTIVE_HIGH>;
+               alarm-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
+               gpio-fan,speed-map = <    0 0
+                                      2500 1
+                                      3100 2
+                                      3800 3
+                                      4600 4
+                                      4800 5
+                                      4900 6
+                                      5000 7 >;
+       };
+
+       gpio-fan-100-15-18 {
+               status = "disabled";
+               compatible = "gpio-fan";
+               pinctrl-0 = <&pmx_fanctrl_15 &pmx_fanctrl_16 &pmx_fanctrl_17
+                            &pmx_fanalarm_18>;
+               pinctrl-names = "default";
+               gpios = <&gpio0 15 GPIO_ACTIVE_HIGH
+                        &gpio0 16 GPIO_ACTIVE_HIGH
+                        &gpio0 17 GPIO_ACTIVE_HIGH>;
+               alarm-gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
+               gpio-fan,speed-map = <    0 0
+                                      2500 1
+                                      3100 2
+                                      3800 3
+                                      4600 4
+                                      4800 5
+                                      4900 6
+                                      5000 7 >;
+       };
+
+       gpio-fan-100-15-35-1 {
+               status = "disabled";
+               compatible = "gpio-fan";
+               pinctrl-0 = <&pmx_fanctrl_15 &pmx_fanctrl_16 &pmx_fanctrl_17
+                            &pmx_fanalarm_35>;
+               pinctrl-names = "default";
+               gpios = <&gpio0 15 GPIO_ACTIVE_HIGH
+                        &gpio0 16 GPIO_ACTIVE_HIGH
+                        &gpio0 17 GPIO_ACTIVE_HIGH>;
+               alarm-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
+               gpio-fan,speed-map = <    0 0
+                                      2500 1
+                                      3100 2
+                                      3800 3
+                                      4600 4
+                                      4800 5
+                                      4900 6
+                                      5000 7 >;
+       };
+
+       gpio-fan-100-15-35-3 {
+               status = "disabled";
+               compatible = "gpio-fan";
+               pinctrl-0 = <&pmx_fanctrl_15 &pmx_fanctrl_16 &pmx_fanctrl_17
+                            &pmx_fanalarm_35 &pmx_fanalarm_44 &pmx_fanalarm_45>;
+               pinctrl-names = "default";
+               gpios = <&gpio0 15 GPIO_ACTIVE_HIGH
+                        &gpio0 16 GPIO_ACTIVE_HIGH
+                        &gpio0 17 GPIO_ACTIVE_HIGH>;
+               alarm-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH
+                              &gpio1 12 GPIO_ACTIVE_HIGH
+                              &gpio1 13 GPIO_ACTIVE_HIGH>;
+               gpio-fan,speed-map = <    0 0
+                                      2500 1
+                                      3100 2
+                                      3800 3
+                                      4600 4
+                                      4800 5
+                                      4900 6
+                                      5000 7 >;
+       };
+
+       gpio-leds-alarm-12 {
+               status = "disabled";
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pmx_alarmled_12>;
+               pinctrl-names = "default";
+
+               hdd1-green {
+                       label = "synology:alarm";
+                       gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-leds-hdd-20 {
+               status = "disabled";
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pmx_hddled_20 &pmx_hddled_21 &pmx_hddled_22
+                            &pmx_hddled_23 &pmx_hddled_24 &pmx_hddled_25
+                            &pmx_hddled_26 &pmx_hddled_27>;
+               pinctrl-names = "default";
+
+               hdd1-green {
+                       label = "synology:green:hdd1";
+                       gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd1-amber {
+                       label = "synology:amber:hdd1";
+                       gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd2-green {
+                       label = "synology:green:hdd2";
+                       gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd2-amber {
+                       label = "synology:amber:hdd2";
+                       gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd3-green {
+                       label = "synology:green:hdd3";
+                       gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd3-amber {
+                       label = "synology:amber:hdd3";
+                       gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd4-green {
+                       label = "synology:green:hdd4";
+                       gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd4-amber {
+                       label = "synology:amber:hdd4";
+                       gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-leds-hdd-21-1 {
+               status = "disabled";
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pmx_hddled_21 &pmx_hddled_23>;
+               pinctrl-names = "default";
+
+               hdd1-green {
+                       label = "synology:green:hdd1";
+                       gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd1-amber {
+                       label = "synology:amber:hdd1";
+                       gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-leds-hdd-21-2 {
+               status = "disabled";
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pmx_hddled_21 &pmx_hddled_23 &pmx_hddled_20 &pmx_hddled_22>;
+               pinctrl-names = "default";
+
+               hdd1-green {
+                       label = "synology:green:hdd1";
+                       gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd1-amber {
+                       label = "synology:amber:hdd1";
+                       gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd2-green {
+                       label = "synology:green:hdd2";
+                       gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd2-amber {
+                       label = "synology:amber:hdd2";
+                       gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-leds-hdd-36 {
+               status = "disabled";
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pmx_hddled_36 &pmx_hddled_37 &pmx_hddled_38
+                            &pmx_hddled_39 &pmx_hddled_40 &pmx_hddled_41
+                            &pmx_hddled_42 &pmx_hddled_43 &pmx_hddled_44
+                            &pmx_hddled_45>;
+               pinctrl-names = "default";
+
+               hdd1-green {
+                       label = "synology:green:hdd1";
+                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd1-amber {
+                       label = "synology:amber:hdd1";
+                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd2-green {
+                       label = "synology:green:hdd2";
+                       gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd2-amber {
+                       label = "synology:amber:hdd2";
+                       gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd3-green {
+                       label = "synology:green:hdd3";
+                       gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd3-amber {
+                       label = "synology:amber:hdd3";
+                       gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd4-green {
+                       label = "synology:green:hdd4";
+                       gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd4-amber {
+                       label = "synology:amber:hdd4";
+                       gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd5-green {
+                       label = "synology:green:hdd5";
+                       gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd5-amber {
+                       label = "synology:amber:hdd5";
+                       gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-leds-hdd-38 {
+               status = "disabled";
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pmx_hddled_38 &pmx_hddled_39 &pmx_hddled_36 &pmx_hddled_37>;
+               pinctrl-names = "default";
+
+               hdd1-green {
+                       label = "synology:green:hdd1";
+                       gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd1-amber {
+                       label = "synology:amber:hdd1";
+                       gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd2-green {
+                       label = "synology:green:hdd2";
+                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd2-amber {
+                       label = "synology:amber:hdd2";
+                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       regulators-hdd-29 {
+               status = "disabled";
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-0 = <&pmx_hdd1_pwr_29 &pmx_hdd2_pwr_31>;
+               pinctrl-names = "default";
+
+               regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "hdd1power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+               };
+
+               regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "hdd2power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio0 31 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       regulators-hdd-30-1 {
+               status = "disabled";
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-0 = <&pmx_hdd1_pwr_30>;
+               pinctrl-names = "default";
+
+               regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "hdd1power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       regulators-hdd-30-2 {
+               status = "disabled";
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-0 = <&pmx_hdd1_pwr_30 &pmx_hdd2_pwr_34>;
+               pinctrl-names = "default";
+
+               regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "hdd1power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
+               };
+
+               regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "hdd2power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       regulators-hdd-30-4 {
+               status = "disabled";
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-0 = <&pmx_hdd1_pwr_30 &pmx_hdd2_pwr_34
+                            &pmx_hdd3_pwr_44 &pmx_hdd4_pwr_45>;
+               pinctrl-names = "default";
+
+               regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "hdd1power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
+               };
+
+               regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "hdd2power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+               };
+
+               regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "hdd3power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
+               };
+
+               regulator@4 {
+                       compatible = "regulator-fixed";
+                       reg = <4>;
+                       regulator-name = "hdd4power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       regulators-hdd-31 {
+               status = "disabled";
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-0 = <&pmx_hdd2_pwr_31>;
+               pinctrl-names = "default";
+
+               regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "hdd2power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio0 31 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       regulators-hdd-34 {
+               status = "disabled";
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-0 = <&pmx_hdd2_pwr_34 &pmx_hdd3_pwr_44
+                            &pmx_hdd4_pwr_45>;
+               pinctrl-names = "default";
+
+               regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "hdd2power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+               };
+
+               regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "hdd3power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
+               };
+
+               regulator@4 {
+                       compatible = "regulator-fixed";
+                       reg = <4>;
+                       regulator-name = "hdd4power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       startup-delay-us = <5000000>;
+                       gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&mdio {
+       status = "okay";
+
+       ethphy0: ethernet-phy@0 {
+               device_type = "ethernet-phy";
+               reg = <8>;
+       };
+
+       ethphy1: ethernet-phy@1 {
+               device_type = "ethernet-phy";
+               reg = <9>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       ethernet0-port@0 {
+               phy-handle = <&ethphy0>;
+       };
+};
+
+&eth1 {
+       status = "disabled";
+
+       ethernet1-port@0 {
+               phy-handle = <&ethphy1>;
+       };
+};
+
+&pciec {
+        status = "okay";
+};
+
+&pcie0 {
+       status = "okay";
+};
index 8581df9a2778e85187ffa43242810db328af781c..afa7832f8936349817c8f36e812730a4cee828bd 100644 (file)
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0xA0001000 0x1000>, <0x90000000 0x10000000>;
-                       reg-names = "QuadSPI", "QuadSPI-memory";
+                       reg-names = "qspi", "qspi_mm";
                        interrupts = <92>;
                        spi-max-frequency = <108000000>;
                        clocks = <&rcc 0 STM32F7_AHB3_CLOCK(QSPI)>;
+                       resets = <&rcc STM32F7_AHB3_RESET(QSPI)>;
                        status = "disabled";
                };
                usart1: serial@40011000 {
diff --git a/arch/arm/dts/zynq-minized.dts b/arch/arm/dts/zynq-minized.dts
new file mode 100644 (file)
index 0000000..525921e
--- /dev/null
@@ -0,0 +1,106 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * dts file for Avnet MiniZed board
+ *
+ * (C) Copyright 2017 - 2018, Xilinx, Inc.
+ *
+ * Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
+ */
+
+/dts-v1/;
+#include "zynq-7000.dtsi"
+
+/ {
+       model = "Avnet Zynq MiniZed Development Board";
+       compatible = "avnet,minized", "xlnx,zynq-7000";
+
+       aliases {
+               serial0 = &uart1;
+               serial1 = &uart0;
+               spi0 = &qspi;
+               mmc0 = &sdhci0;
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x20000000>;
+       };
+
+       chosen {
+               bootargs = "";
+               stdout-path = "serial0:115200n8";
+       };
+
+       usb_phy0: phy0 {
+               compatible = "usb-nop-xceiv";
+               #phy-cells = <0>;
+       };
+};
+
+&qspi {
+       status = "okay";
+       is-dual = <0>;
+       num-cs = <1>;
+       flash@0 {
+               compatible = "micron,m25p128";
+               reg = <0x0>;
+               spi-tx-bus-width = <4>;
+               spi-rx-bus-width = <4>;
+               spi-max-frequency = <50000000>;
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       partition@0 {
+                               label = "boot";
+                               reg = <0x0 0xff0000>;
+                       };
+
+                       partition@270000 {
+                               label = "kernel";
+                               reg = <0x270000 0xd80000>;
+                       };
+
+                       partition@ff0000 {
+                               label = "bootenv";
+                               reg = <0xff0000 0x10000>;
+                       };
+
+                       partition@1000000 {
+                               label = "spare";
+                               reg = <0x1000000 0x0>;
+                       };
+               };
+       };
+};
+
+&uart0 {
+       status = "okay";
+};
+
+&uart1 {
+       u-boot,dm-pre-reloc;
+       status = "okay";
+};
+
+&usb0 {
+       status = "okay";
+       dr_mode = "host";
+       usb-phy = <&usb_phy0>;
+       usb-reset = <&gpio0 7 0>; /* USB_RST_N-MIO7 */
+};
+
+&sdhci1 {
+       status = "okay";
+       non-removable;
+       bus-width = <4>;
+       max-frequency = <12000000>;
+
+       #address-cells = <1>;
+       #size-cells = <0>;
+       mmccard: mmccard@0 {
+               compatible = "mmc-card";
+               reg = <0>;
+               broken-hpi;
+       };
+};
index b18d8d19c30480d2c907c37121ac1f4def7f9935..247a35f9219dd861f0745ad20e22953223fbb468 100644 (file)
        clocks = <&clkc 59>, <&clkc 31>;
 };
 
+&ttc0 {
+       clocks = <&clkc 31>;
+};
+
+&ttc1 {
+       clocks = <&clkc 31>;
+};
+
+&ttc2 {
+       clocks = <&clkc 31>;
+};
+
+&ttc3 {
+       clocks = <&clkc 31>;
+};
+
 &uart0 {
        clocks = <&clkc 56>,  <&clkc 31>;
 };
index bcd9c3958ffa795efd8cf3d05165a7b3f2ab656b..c6aaa08a0042e671ccfc5f1b18fb5f4a75188a8a 100644 (file)
 &sdhci0 {
        status = "okay";
        no-1-8-v;
-       broken-cd; /* CD has to be enabled by default */
        disable-wp;
        xlnx,mio_bank = <0>;
 };
index a0e13d8dc5b0de977042433e1b3684e5a1776695..6a4b701ab812cb2d20b4d636942a7c15b0fd4170 100644 (file)
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <4>;
-                       tca6416_u97: gpio@21 {
+                       tca6416_u97: gpio@20 {
                                compatible = "ti,tca6416";
-                               reg = <0x21>;
+                               reg = <0x20>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                /*
index 6e3cf5a97f3e21297a508c8028a7dc5b8c259f85..fe742b894b8993cd58ea759737a122d572ae6f0f 100644 (file)
@@ -74,9 +74,9 @@
        status = "okay";
        clock-frequency = <400000>;
 
-       tca6416_u97: gpio@21 {
+       tca6416_u97: gpio@20 {
                compatible = "ti,tca6416";
-               reg = <0x21>;
+               reg = <0x20>;
                gpio-controller;
                #gpio-cells = <2>;
                /*
                        };
                };
 
-               i2c@4 {
+               i2c@3 {
                        #address-cells = <1>;
                        #size-cells = <0>;
-                       reg = <4>;
+                       reg = <3>;
+                       ina226@40 { /* u183 */
+                               compatible = "ti,ina226";
+                               reg = <0x40>;
+                               shunt-resistor = <5000>;
+                       };
                };
 
                i2c@5 {
                        reg = <7>;
                };
 
-               /* 3, 6 not connected */
+               /* 4, 6 not connected */
        };
 };
 
index 4002d7880610f00bc264e2b6b651fc26f3bb2f52..aa9055b7152a78314d8f65e761e7ccdbc196eec8 100644 (file)
 &sdhci1 {
        status = "okay";
        no-1-8-v;
+       disable-wp;
        xlnx,mio_bank = <1>;
 };
 
index acc68251be94275d37eda634164bb863f2b42082..8a505edab3cc32b4cf809bce878adab97beab883 100644 (file)
 #define PS_MODE2       BIT(2)
 #define PS_MODE3       BIT(3)
 
+#define RESET_REASON_DEBUG_SYS BIT(6)
+#define RESET_REASON_SOFT      BIT(5)
+#define RESET_REASON_SRST      BIT(4)
+#define RESET_REASON_PSONLY    BIT(3)
+#define RESET_REASON_PMU       BIT(2)
+#define RESET_REASON_INTERNAL  BIT(1)
+#define RESET_REASON_EXTERNAL  BIT(0)
+
 struct crlapb_regs {
        u32 reserved0[36];
        u32 cpu_r5_ctrl; /* 0x90 */
@@ -37,7 +45,9 @@ struct crlapb_regs {
        u32 timestamp_ref_ctrl; /* 0x128 */
        u32 reserved2[53];
        u32 boot_mode; /* 0x200 */
-       u32 reserved3[14];
+       u32 reserved3_0[7];
+       u32 reset_reason; /* 0x220 */
+       u32 reserved3_1[6];
        u32 rst_lpd_top; /* 0x23C */
        u32 reserved4[4];
        u32 boot_pin_ctrl; /* 0x250 */
@@ -120,8 +130,6 @@ struct apu_regs {
 /* Board version value */
 #define ZYNQMP_CSU_BASEADDR            0xFFCA0000
 #define ZYNQMP_CSU_VERSION_SILICON     0x0
-#define ZYNQMP_CSU_VERSION_EP108       0x1
-#define ZYNQMP_CSU_VERSION_VELOCE      0x2
 #define ZYNQMP_CSU_VERSION_QEMU                0x3
 
 #define ZYNQMP_CSU_VERSION_EMPTY_SHIFT         20
index 6056bc6c0c56b72390421b51aa32eaf5ff70c17c..773b930512bc2d0c7eb6ca1b809c6ef3ef183273 100644 (file)
 #define ZYNQMP_SIP_SVC_PM_SECURE_IMG_LOAD      0xC200002D
 #define KEY_PTR_LEN    32
 
+#define ZYNQMP_FPGA_BIT_AUTH_DDR       1
+#define ZYNQMP_FPGA_BIT_AUTH_OCM       2
+#define ZYNQMP_FPGA_BIT_ENC_USR_KEY    3
+#define ZYNQMP_FPGA_BIT_ENC_DEV_KEY    4
 #define ZYNQMP_FPGA_BIT_NS             5
 
+#define ZYNQMP_FPGA_AUTH_DDR   1
+
 enum {
        IDCODE,
        VERSION,
index 3b9a8116d8e69fe644a00bfa3bbb516fffae1206..ade7b870646f9cc8bbbde70fe4c7ff8e2875b587 100644 (file)
@@ -7,7 +7,6 @@ ifdef CONFIG_ARM64
 obj-$(CONFIG_ARMADA_3700) += armada3700/
 obj-$(CONFIG_ARMADA_8K) += armada8k/
 obj-y += arm64-common.o
-obj-$(CONFIG_AHCI) += sata.o
 
 else # CONFIG_ARM64
 
diff --git a/arch/arm/mach-mvebu/sata.c b/arch/arm/mach-mvebu/sata.c
deleted file mode 100644 (file)
index 3ae8dae..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2016 Stefan Roese <sr@denx.de>
- */
-
-#include <common.h>
-#include <ahci.h>
-#include <dm.h>
-
-/*
- * Dummy implementation that can be overwritten by a board
- * specific function
- */
-__weak int board_ahci_enable(void)
-{
-       return 0;
-}
-
-#ifdef CONFIG_ARMADA_8K
-/* CP110 has different AHCI port addresses */
-void __iomem *ahci_port_base(void __iomem *base, u32 port)
-{
-       return base + 0x10000 + (port * 0x10000);
-}
-#endif
-
-static int mvebu_ahci_probe(struct udevice *dev)
-{
-       /*
-        * Board specific SATA / AHCI enable code, e.g. enable the
-        * AHCI power or deassert reset
-        */
-       board_ahci_enable();
-
-       ahci_init(devfdt_get_addr_ptr(dev));
-
-       return 0;
-}
-
-static const struct udevice_id mvebu_ahci_ids[] = {
-       { .compatible = "marvell,armada-3700-ahci" },
-       { .compatible = "marvell,armada-8k-ahci" },
-       { }
-};
-
-U_BOOT_DRIVER(ahci_mvebu_drv) = {
-       .name           = "ahci_mvebu",
-       .id             = UCLASS_AHCI,
-       .of_match       = mvebu_ahci_ids,
-       .probe          = mvebu_ahci_probe,
-};
index 0e9fd03fefb05d645859d8822c6d245d6e809b9c..d4a1e2e42c4e299434ceb4a431dd0eb2ccf15d96 100644 (file)
@@ -236,13 +236,3 @@ void arch_preboot_os(void)
        ahci_reset((void __iomem *)DWC_AHSATA_BASE);
 }
 #endif
-
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT) && !defined(CONFIG_ENV_IS_NOWHERE)
-int fb_set_reboot_flag(void)
-{
-       printf("Setting reboot to fastboot flag ...\n");
-       env_set("dofastboot", "1");
-       env_save();
-       return 0;
-}
-#endif
index dc7b37f1643500d864e3defcfd59d3735fde0220..edf5edcb6808c86c35fb8a1fee183287c3fd0a89 100644 (file)
@@ -85,7 +85,7 @@ static void omap_set_fastboot_board_rev(void)
        env_set("fastboot.board_rev", board_rev);
 }
 
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 static u32 omap_mmc_get_part_size(const char *part)
 {
        int res;
@@ -128,7 +128,7 @@ static void omap_set_fastboot_userdata_size(void)
 static inline void omap_set_fastboot_userdata_size(void)
 {
 }
-#endif /* CONFIG_FASTBOOT_FLASH_MMC_DEV */
+#endif /* CONFIG_FASTBOOT_FLASH_MMC */
 void omap_set_fastboot_vars(void)
 {
        omap_set_fastboot_cpu();
index 48cd8ba81e08d9a9002381c3333f650fd7dbf537..7fd667a0b8ec94a43df1f27b488c758892035e94 100644 (file)
@@ -111,8 +111,8 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 }
 #endif
 
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
-int fb_set_reboot_flag(void)
+#if CONFIG_IS_ENABLED(FASTBOOT)
+int fastboot_set_reboot_flag(void)
 {
        struct rk3128_grf *grf;
 
index 99a60c4e2ee62178da8b9d6315b43c6ac83c5aeb..7366d45ab6c0ef7ffd4df31ccdddb5740a708add 100644 (file)
@@ -139,8 +139,8 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 }
 #endif
 
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
-int fb_set_reboot_flag(void)
+#if CONFIG_IS_ENABLED(FASTBOOT)
+int fastboot_set_reboot_flag(void)
 {
        struct rk322x_grf *grf;
 
index d55dc1aaa1d02212117bedd44692a19c5cadb2e6..bfd99db6e271ae901dc50dc859ab06da589d0a6c 100644 (file)
@@ -3,6 +3,12 @@ if ARCH_SNAPDRAGON
 config SYS_SOC
        default "snapdragon"
 
+config SYS_MALLOC_F_LEN
+       default 0x2000
+
+config SPL_SYS_MALLOC_F_LEN
+       default 0x2000
+
 choice
        prompt "Snapdragon board select"
 
index c50be37c9797af590cbe96fe7045a6feee9a8cbc..20a43d88e37b31d9ae7d71ecfe6755cc3aa99f1f 100644 (file)
@@ -8,12 +8,12 @@ choice
        prompt "Target select"
        optional
 
-config TARGET_NX25_AE250
-       bool "Support nx25-ae250"
+config TARGET_AX25_AE350
+       bool "Support ax25-ae350"
 
 endchoice
 
-source "board/AndesTech/nx25-ae250/Kconfig"
+source "board/AndesTech/ax25-ae350/Kconfig"
 
 choice
        prompt "CPU selection"
index a7448e2095aa5f531f720c602019472aae46942b..219e66683d2f7c82c8b5f3ddf19ad5ba264a0fbc 100644 (file)
@@ -19,15 +19,20 @@ endif
 
 ifdef CONFIG_32BIT
 PLATFORM_LDFLAGS       += -m $(32bit-emul)
+EFI_LDS                        := elf_riscv32_efi.lds
 endif
 
 ifdef CONFIG_64BIT
 PLATFORM_LDFLAGS       += -m $(64bit-emul)
+EFI_LDS                        := elf_riscv64_efi.lds
 endif
 
 CONFIG_STANDALONE_LOAD_ADDR = 0x00000000 \
                              -T $(srctree)/examples/standalone/riscv.lds
 
 PLATFORM_CPPFLAGS      += -ffixed-gp -fpic
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2
+PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 -ffunction-sections
 LDFLAGS_u-boot += --gc-sections -static -pie
+
+EFI_CRT0               := crt0_riscv_efi.o
+EFI_RELOC              := reloc_riscv_efi.o
diff --git a/arch/riscv/cpu/ax25/Makefile b/arch/riscv/cpu/ax25/Makefile
new file mode 100644 (file)
index 0000000..c3f164c
--- /dev/null
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2017 Andes Technology Corporation
+# Rick Chen, Andes Technology Corporation <rick@andestech.com>
+
+extra-y        = start.o
+
+obj-y  := cpu.o
diff --git a/arch/riscv/cpu/ax25/cpu.c b/arch/riscv/cpu/ax25/cpu.c
new file mode 100644 (file)
index 0000000..ab05b57
--- /dev/null
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017 Andes Technology Corporation
+ * Rick Chen, Andes Technology Corporation <rick@andestech.com>
+ */
+
+/* CPU specific code */
+#include <common.h>
+#include <command.h>
+#include <watchdog.h>
+#include <asm/cache.h>
+
+/*
+ * cleanup_before_linux() is called just before we call linux
+ * it prepares the processor for linux
+ *
+ * we disable interrupt and caches.
+ */
+int cleanup_before_linux(void)
+{
+       disable_interrupts();
+
+       /* turn off I/D-cache */
+
+       return 0;
+}
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       disable_interrupts();
+       panic("ax25-ae350 wdt not support yet.\n");
+}
diff --git a/arch/riscv/cpu/ax25/start.S b/arch/riscv/cpu/ax25/start.S
new file mode 100644 (file)
index 0000000..7cd7755
--- /dev/null
@@ -0,0 +1,292 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Startup Code for RISC-V Core
+ *
+ * Copyright (c) 2017 Microsemi Corporation.
+ * Copyright (c) 2017 Padmarao Begari <Padmarao.Begari@microsemi.com>
+ *
+ * Copyright (C) 2017 Andes Technology Corporation
+ * Rick Chen, Andes Technology Corporation <rick@andestech.com>
+ */
+
+#include <asm-offsets.h>
+#include <config.h>
+#include <common.h>
+#include <elf.h>
+#include <asm/encoding.h>
+
+#ifdef CONFIG_32BIT
+#define LREG                   lw
+#define SREG                   sw
+#define REGBYTES               4
+#define RELOC_TYPE             R_RISCV_32
+#define SYM_INDEX              0x8
+#define SYM_SIZE               0x10
+#else
+#define LREG                   ld
+#define SREG                   sd
+#define REGBYTES               8
+#define RELOC_TYPE             R_RISCV_64
+#define SYM_INDEX              0x20
+#define SYM_SIZE               0x18
+#endif
+
+.section      .text
+.globl _start
+_start:
+       j handle_reset
+
+nmi_vector:
+       j nmi_vector
+
+trap_vector:
+       j trap_entry
+
+.global trap_entry
+handle_reset:
+       li t0, CONFIG_SYS_SDRAM_BASE
+       SREG a2, 0(t0)
+       la t0, trap_entry
+       csrw mtvec, t0
+       csrwi mstatus, 0
+       csrwi mie, 0
+
+/*
+ * Do CPU critical regs init only at reboot,
+ * not when booting from ram
+ */
+#ifdef CONFIG_INIT_CRITICAL
+       jal cpu_init_crit       /* Do CPU critical regs init */
+#endif
+
+/*
+ * Set stackpointer in internal/ex RAM to call board_init_f
+ */
+call_board_init_f:
+       li  t0, -16
+       li  t1, CONFIG_SYS_INIT_SP_ADDR
+       and sp, t1, t0  /* force 16 byte alignment */
+
+#ifdef CONFIG_DEBUG_UART
+       jal     debug_uart_init
+#endif
+
+call_board_init_f_0:
+       mv      a0, sp
+       jal     board_init_f_alloc_reserve
+       mv      sp, a0
+       jal     board_init_f_init_reserve
+
+       mv  a0, zero    /* a0 <-- boot_flags = 0 */
+       la t5, board_init_f
+       jr t5           /* jump to board_init_f() */
+
+/*
+ * void relocate_code (addr_sp, gd, addr_moni)
+ *
+ * This "function" does not return, instead it continues in RAM
+ * after relocating the monitor code.
+ *
+ */
+.globl relocate_code
+relocate_code:
+       mv  s2, a0      /* save addr_sp */
+       mv  s3, a1      /* save addr of gd */
+       mv  s4, a2      /* save addr of destination */
+
+/*
+ *Set up the stack
+ */
+stack_setup:
+       mv sp, s2
+       la t0, _start
+       sub t6, s4, t0  /* t6 <- relocation offset */
+       beq t0, s4, clear_bss   /* skip relocation */
+
+       mv t1, s4       /* t1 <- scratch for copy_loop */
+       la t3, __bss_start
+       sub t3, t3, t0  /* t3 <- __bss_start_ofs */
+       add t2, t0, t3  /* t2 <- source end address */
+
+copy_loop:
+       LREG t5, 0(t0)
+       addi t0, t0, REGBYTES
+       SREG t5, 0(t1)
+       addi t1, t1, REGBYTES
+       blt t0, t2, copy_loop
+
+/*
+ * Update dynamic relocations after board_init_f
+ */
+fix_rela_dyn:
+       la  t1, __rel_dyn_start
+       la  t2, __rel_dyn_end
+       beq t1, t2, clear_bss
+       add t1, t1, t6                  /* t1 <- rela_dyn_start in RAM */
+       add t2, t2, t6                  /* t2 <- rela_dyn_end in RAM */
+
+/*
+ * skip first reserved entry: address, type, addend
+ */
+       bne t1, t2, 7f
+
+6:
+       LREG  t5, -(REGBYTES*2)(t1)     /* t5 <-- relocation info:type */
+       li  t3, R_RISCV_RELATIVE        /* reloc type R_RISCV_RELATIVE */
+       bne t5, t3, 8f                  /* skip non-RISCV_RELOC entries */
+       LREG t3, -(REGBYTES*3)(t1)
+       LREG t5, -(REGBYTES)(t1)        /* t5 <-- addend */
+       add t5, t5, t6                  /* t5 <-- location to fix up in RAM */
+       add t3, t3, t6                  /* t3 <-- location to fix up in RAM */
+       SREG t5, 0(t3)
+7:
+       addi t1, t1, (REGBYTES*3)
+       ble t1, t2, 6b
+
+8:
+       la  t4, __dyn_sym_start
+       add t4, t4, t6
+
+9:
+       LREG  t5, -(REGBYTES*2)(t1)     /* t5 <-- relocation info:type */
+       srli t0, t5, SYM_INDEX          /* t0 <--- sym table index */
+       andi t5, t5, 0xFF               /* t5 <--- relocation type */
+       li  t3, RELOC_TYPE
+       bne t5, t3, 10f                 /* skip non-addned entries */
+
+       LREG t3, -(REGBYTES*3)(t1)
+       li t5, SYM_SIZE
+       mul t0, t0, t5
+       add s1, t4, t0
+       LREG t5, REGBYTES(s1)
+       add t5, t5, t6                  /* t5 <-- location to fix up in RAM */
+       add t3, t3, t6                  /* t3 <-- location to fix up in RAM */
+       SREG t5, 0(t3)
+10:
+       addi t1, t1, (REGBYTES*3)
+       ble t1, t2, 9b
+
+/*
+ * trap update
+*/
+       la t0, trap_entry
+       add t0, t0, t6
+       csrw mtvec, t0
+
+clear_bss:
+       la t0, __bss_start              /* t0 <- rel __bss_start in FLASH */
+       add t0, t0, t6                  /* t0 <- rel __bss_start in RAM */
+       la t1, __bss_end                /* t1 <- rel __bss_end in FLASH */
+       add t1, t1, t6                  /* t1 <- rel __bss_end in RAM */
+       li t2, 0x00000000               /* clear */
+       beq t0, t1, call_board_init_r
+
+clbss_l:
+       SREG t2, 0(t0)                  /* clear loop... */
+       addi t0, t0, REGBYTES
+       bne t0, t1, clbss_l
+
+/*
+ * We are done. Do not return, instead branch to second part of board
+ * initialization, now running from RAM.
+ */
+call_board_init_r:
+       la t0, board_init_r
+       mv t4, t0                       /* offset of board_init_r() */
+       add t4, t4, t6                  /* real address of board_init_r() */
+/*
+ * setup parameters for board_init_r
+ */
+       mv a0, s3                       /* gd_t */
+       mv a1, s4                       /* dest_addr */
+
+/*
+ * jump to it ...
+ */
+       jr t4                           /* jump to board_init_r() */
+
+/*
+ * trap entry
+ */
+trap_entry:
+       addi sp, sp, -32*REGBYTES
+       SREG x1, 1*REGBYTES(sp)
+       SREG x2, 2*REGBYTES(sp)
+       SREG x3, 3*REGBYTES(sp)
+       SREG x4, 4*REGBYTES(sp)
+       SREG x5, 5*REGBYTES(sp)
+       SREG x6, 6*REGBYTES(sp)
+       SREG x7, 7*REGBYTES(sp)
+       SREG x8, 8*REGBYTES(sp)
+       SREG x9, 9*REGBYTES(sp)
+       SREG x10, 10*REGBYTES(sp)
+       SREG x11, 11*REGBYTES(sp)
+       SREG x12, 12*REGBYTES(sp)
+       SREG x13, 13*REGBYTES(sp)
+       SREG x14, 14*REGBYTES(sp)
+       SREG x15, 15*REGBYTES(sp)
+       SREG x16, 16*REGBYTES(sp)
+       SREG x17, 17*REGBYTES(sp)
+       SREG x18, 18*REGBYTES(sp)
+       SREG x19, 19*REGBYTES(sp)
+       SREG x20, 20*REGBYTES(sp)
+       SREG x21, 21*REGBYTES(sp)
+       SREG x22, 22*REGBYTES(sp)
+       SREG x23, 23*REGBYTES(sp)
+       SREG x24, 24*REGBYTES(sp)
+       SREG x25, 25*REGBYTES(sp)
+       SREG x26, 26*REGBYTES(sp)
+       SREG x27, 27*REGBYTES(sp)
+       SREG x28, 28*REGBYTES(sp)
+       SREG x29, 29*REGBYTES(sp)
+       SREG x30, 30*REGBYTES(sp)
+       SREG x31, 31*REGBYTES(sp)
+       csrr a0, mcause
+       csrr a1, mepc
+       mv a2, sp
+       jal handle_trap
+       csrw mepc, a0
+
+/*
+ * Remain in M-mode after mret
+ */
+       li t0, MSTATUS_MPP
+       csrs mstatus, t0
+       LREG x1, 1*REGBYTES(sp)
+       LREG x2, 2*REGBYTES(sp)
+       LREG x3, 3*REGBYTES(sp)
+       LREG x4, 4*REGBYTES(sp)
+       LREG x5, 5*REGBYTES(sp)
+       LREG x6, 6*REGBYTES(sp)
+       LREG x7, 7*REGBYTES(sp)
+       LREG x8, 8*REGBYTES(sp)
+       LREG x9, 9*REGBYTES(sp)
+       LREG x10, 10*REGBYTES(sp)
+       LREG x11, 11*REGBYTES(sp)
+       LREG x12, 12*REGBYTES(sp)
+       LREG x13, 13*REGBYTES(sp)
+       LREG x14, 14*REGBYTES(sp)
+       LREG x15, 15*REGBYTES(sp)
+       LREG x16, 16*REGBYTES(sp)
+       LREG x17, 17*REGBYTES(sp)
+       LREG x18, 18*REGBYTES(sp)
+       LREG x19, 19*REGBYTES(sp)
+       LREG x20, 20*REGBYTES(sp)
+       LREG x21, 21*REGBYTES(sp)
+       LREG x22, 22*REGBYTES(sp)
+       LREG x23, 23*REGBYTES(sp)
+       LREG x24, 24*REGBYTES(sp)
+       LREG x25, 25*REGBYTES(sp)
+       LREG x26, 26*REGBYTES(sp)
+       LREG x27, 27*REGBYTES(sp)
+       LREG x28, 28*REGBYTES(sp)
+       LREG x29, 29*REGBYTES(sp)
+       LREG x30, 30*REGBYTES(sp)
+       LREG x31, 31*REGBYTES(sp)
+       addi sp, sp, 32*REGBYTES
+       mret
+
+#ifdef CONFIG_INIT_CRITICAL
+cpu_init_crit:
+    ret
+#endif
diff --git a/arch/riscv/cpu/ax25/u-boot.lds b/arch/riscv/cpu/ax25/u-boot.lds
new file mode 100644 (file)
index 0000000..1589bab
--- /dev/null
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2017 Andes Technology Corporation
+ * Rick Chen, Andes Technology Corporation <rick@andestech.com>
+ */
+OUTPUT_ARCH("riscv")
+ENTRY(_start)
+
+SECTIONS
+{
+       . = ALIGN(4);
+       .text :
+       {
+               arch/riscv/cpu/ax25/start.o     (.text)
+               *(.text)
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+       . = ALIGN(4);
+       .data : {
+               __global_pointer$ = . + 0x800;
+               *(.data*)
+       }
+       . = ALIGN(4);
+
+       .got : {
+          __got_start = .;
+          *(.got.plt) *(.got)
+          __got_end = .;
+    }
+
+       . = ALIGN(4);
+
+       .u_boot_list : {
+               KEEP(*(SORT(.u_boot_list*)));
+       }
+
+    . = ALIGN(4);
+
+       .efi_runtime : {
+                __efi_runtime_start = .;
+               *(efi_runtime_text)
+               *(efi_runtime_data)
+                __efi_runtime_stop = .;
+       }
+
+       .efi_runtime_rel : {
+                __efi_runtime_rel_start = .;
+               *(.relaefi_runtime_text)
+               *(.relaefi_runtime_data)
+                __efi_runtime_rel_stop = .;
+       }
+
+    . = ALIGN(4);
+
+    /DISCARD/ : { *(.rela.plt*) }
+    .rela.dyn : {
+        __rel_dyn_start = .;
+        *(.rela*)
+        __rel_dyn_end = .;
+    }
+
+    . = ALIGN(4);
+
+    .dynsym : {
+        __dyn_sym_start = .;
+        *(.dynsym)
+        __dyn_sym_end = .;
+    }
+
+    . = ALIGN(4);
+
+       _end = .;
+
+       .bss : {
+        __bss_start = .;
+        *(.bss)
+               . = ALIGN(4);
+               __bss_end = .;
+       }
+
+}
diff --git a/arch/riscv/cpu/nx25/Makefile b/arch/riscv/cpu/nx25/Makefile
deleted file mode 100644 (file)
index c3f164c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2017 Andes Technology Corporation
-# Rick Chen, Andes Technology Corporation <rick@andestech.com>
-
-extra-y        = start.o
-
-obj-y  := cpu.o
diff --git a/arch/riscv/cpu/nx25/cpu.c b/arch/riscv/cpu/nx25/cpu.c
deleted file mode 100644 (file)
index 091e9ef..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2017 Andes Technology Corporation
- * Rick Chen, Andes Technology Corporation <rick@andestech.com>
- */
-
-/* CPU specific code */
-#include <common.h>
-#include <command.h>
-#include <watchdog.h>
-#include <asm/cache.h>
-
-/*
- * cleanup_before_linux() is called just before we call linux
- * it prepares the processor for linux
- *
- * we disable interrupt and caches.
- */
-int cleanup_before_linux(void)
-{
-       disable_interrupts();
-
-       /* turn off I/D-cache */
-
-       return 0;
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-       disable_interrupts();
-       panic("nx25-ae250 wdt not support yet.\n");
-}
diff --git a/arch/riscv/cpu/nx25/start.S b/arch/riscv/cpu/nx25/start.S
deleted file mode 100644 (file)
index 7cd7755..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Startup Code for RISC-V Core
- *
- * Copyright (c) 2017 Microsemi Corporation.
- * Copyright (c) 2017 Padmarao Begari <Padmarao.Begari@microsemi.com>
- *
- * Copyright (C) 2017 Andes Technology Corporation
- * Rick Chen, Andes Technology Corporation <rick@andestech.com>
- */
-
-#include <asm-offsets.h>
-#include <config.h>
-#include <common.h>
-#include <elf.h>
-#include <asm/encoding.h>
-
-#ifdef CONFIG_32BIT
-#define LREG                   lw
-#define SREG                   sw
-#define REGBYTES               4
-#define RELOC_TYPE             R_RISCV_32
-#define SYM_INDEX              0x8
-#define SYM_SIZE               0x10
-#else
-#define LREG                   ld
-#define SREG                   sd
-#define REGBYTES               8
-#define RELOC_TYPE             R_RISCV_64
-#define SYM_INDEX              0x20
-#define SYM_SIZE               0x18
-#endif
-
-.section      .text
-.globl _start
-_start:
-       j handle_reset
-
-nmi_vector:
-       j nmi_vector
-
-trap_vector:
-       j trap_entry
-
-.global trap_entry
-handle_reset:
-       li t0, CONFIG_SYS_SDRAM_BASE
-       SREG a2, 0(t0)
-       la t0, trap_entry
-       csrw mtvec, t0
-       csrwi mstatus, 0
-       csrwi mie, 0
-
-/*
- * Do CPU critical regs init only at reboot,
- * not when booting from ram
- */
-#ifdef CONFIG_INIT_CRITICAL
-       jal cpu_init_crit       /* Do CPU critical regs init */
-#endif
-
-/*
- * Set stackpointer in internal/ex RAM to call board_init_f
- */
-call_board_init_f:
-       li  t0, -16
-       li  t1, CONFIG_SYS_INIT_SP_ADDR
-       and sp, t1, t0  /* force 16 byte alignment */
-
-#ifdef CONFIG_DEBUG_UART
-       jal     debug_uart_init
-#endif
-
-call_board_init_f_0:
-       mv      a0, sp
-       jal     board_init_f_alloc_reserve
-       mv      sp, a0
-       jal     board_init_f_init_reserve
-
-       mv  a0, zero    /* a0 <-- boot_flags = 0 */
-       la t5, board_init_f
-       jr t5           /* jump to board_init_f() */
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- */
-.globl relocate_code
-relocate_code:
-       mv  s2, a0      /* save addr_sp */
-       mv  s3, a1      /* save addr of gd */
-       mv  s4, a2      /* save addr of destination */
-
-/*
- *Set up the stack
- */
-stack_setup:
-       mv sp, s2
-       la t0, _start
-       sub t6, s4, t0  /* t6 <- relocation offset */
-       beq t0, s4, clear_bss   /* skip relocation */
-
-       mv t1, s4       /* t1 <- scratch for copy_loop */
-       la t3, __bss_start
-       sub t3, t3, t0  /* t3 <- __bss_start_ofs */
-       add t2, t0, t3  /* t2 <- source end address */
-
-copy_loop:
-       LREG t5, 0(t0)
-       addi t0, t0, REGBYTES
-       SREG t5, 0(t1)
-       addi t1, t1, REGBYTES
-       blt t0, t2, copy_loop
-
-/*
- * Update dynamic relocations after board_init_f
- */
-fix_rela_dyn:
-       la  t1, __rel_dyn_start
-       la  t2, __rel_dyn_end
-       beq t1, t2, clear_bss
-       add t1, t1, t6                  /* t1 <- rela_dyn_start in RAM */
-       add t2, t2, t6                  /* t2 <- rela_dyn_end in RAM */
-
-/*
- * skip first reserved entry: address, type, addend
- */
-       bne t1, t2, 7f
-
-6:
-       LREG  t5, -(REGBYTES*2)(t1)     /* t5 <-- relocation info:type */
-       li  t3, R_RISCV_RELATIVE        /* reloc type R_RISCV_RELATIVE */
-       bne t5, t3, 8f                  /* skip non-RISCV_RELOC entries */
-       LREG t3, -(REGBYTES*3)(t1)
-       LREG t5, -(REGBYTES)(t1)        /* t5 <-- addend */
-       add t5, t5, t6                  /* t5 <-- location to fix up in RAM */
-       add t3, t3, t6                  /* t3 <-- location to fix up in RAM */
-       SREG t5, 0(t3)
-7:
-       addi t1, t1, (REGBYTES*3)
-       ble t1, t2, 6b
-
-8:
-       la  t4, __dyn_sym_start
-       add t4, t4, t6
-
-9:
-       LREG  t5, -(REGBYTES*2)(t1)     /* t5 <-- relocation info:type */
-       srli t0, t5, SYM_INDEX          /* t0 <--- sym table index */
-       andi t5, t5, 0xFF               /* t5 <--- relocation type */
-       li  t3, RELOC_TYPE
-       bne t5, t3, 10f                 /* skip non-addned entries */
-
-       LREG t3, -(REGBYTES*3)(t1)
-       li t5, SYM_SIZE
-       mul t0, t0, t5
-       add s1, t4, t0
-       LREG t5, REGBYTES(s1)
-       add t5, t5, t6                  /* t5 <-- location to fix up in RAM */
-       add t3, t3, t6                  /* t3 <-- location to fix up in RAM */
-       SREG t5, 0(t3)
-10:
-       addi t1, t1, (REGBYTES*3)
-       ble t1, t2, 9b
-
-/*
- * trap update
-*/
-       la t0, trap_entry
-       add t0, t0, t6
-       csrw mtvec, t0
-
-clear_bss:
-       la t0, __bss_start              /* t0 <- rel __bss_start in FLASH */
-       add t0, t0, t6                  /* t0 <- rel __bss_start in RAM */
-       la t1, __bss_end                /* t1 <- rel __bss_end in FLASH */
-       add t1, t1, t6                  /* t1 <- rel __bss_end in RAM */
-       li t2, 0x00000000               /* clear */
-       beq t0, t1, call_board_init_r
-
-clbss_l:
-       SREG t2, 0(t0)                  /* clear loop... */
-       addi t0, t0, REGBYTES
-       bne t0, t1, clbss_l
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-call_board_init_r:
-       la t0, board_init_r
-       mv t4, t0                       /* offset of board_init_r() */
-       add t4, t4, t6                  /* real address of board_init_r() */
-/*
- * setup parameters for board_init_r
- */
-       mv a0, s3                       /* gd_t */
-       mv a1, s4                       /* dest_addr */
-
-/*
- * jump to it ...
- */
-       jr t4                           /* jump to board_init_r() */
-
-/*
- * trap entry
- */
-trap_entry:
-       addi sp, sp, -32*REGBYTES
-       SREG x1, 1*REGBYTES(sp)
-       SREG x2, 2*REGBYTES(sp)
-       SREG x3, 3*REGBYTES(sp)
-       SREG x4, 4*REGBYTES(sp)
-       SREG x5, 5*REGBYTES(sp)
-       SREG x6, 6*REGBYTES(sp)
-       SREG x7, 7*REGBYTES(sp)
-       SREG x8, 8*REGBYTES(sp)
-       SREG x9, 9*REGBYTES(sp)
-       SREG x10, 10*REGBYTES(sp)
-       SREG x11, 11*REGBYTES(sp)
-       SREG x12, 12*REGBYTES(sp)
-       SREG x13, 13*REGBYTES(sp)
-       SREG x14, 14*REGBYTES(sp)
-       SREG x15, 15*REGBYTES(sp)
-       SREG x16, 16*REGBYTES(sp)
-       SREG x17, 17*REGBYTES(sp)
-       SREG x18, 18*REGBYTES(sp)
-       SREG x19, 19*REGBYTES(sp)
-       SREG x20, 20*REGBYTES(sp)
-       SREG x21, 21*REGBYTES(sp)
-       SREG x22, 22*REGBYTES(sp)
-       SREG x23, 23*REGBYTES(sp)
-       SREG x24, 24*REGBYTES(sp)
-       SREG x25, 25*REGBYTES(sp)
-       SREG x26, 26*REGBYTES(sp)
-       SREG x27, 27*REGBYTES(sp)
-       SREG x28, 28*REGBYTES(sp)
-       SREG x29, 29*REGBYTES(sp)
-       SREG x30, 30*REGBYTES(sp)
-       SREG x31, 31*REGBYTES(sp)
-       csrr a0, mcause
-       csrr a1, mepc
-       mv a2, sp
-       jal handle_trap
-       csrw mepc, a0
-
-/*
- * Remain in M-mode after mret
- */
-       li t0, MSTATUS_MPP
-       csrs mstatus, t0
-       LREG x1, 1*REGBYTES(sp)
-       LREG x2, 2*REGBYTES(sp)
-       LREG x3, 3*REGBYTES(sp)
-       LREG x4, 4*REGBYTES(sp)
-       LREG x5, 5*REGBYTES(sp)
-       LREG x6, 6*REGBYTES(sp)
-       LREG x7, 7*REGBYTES(sp)
-       LREG x8, 8*REGBYTES(sp)
-       LREG x9, 9*REGBYTES(sp)
-       LREG x10, 10*REGBYTES(sp)
-       LREG x11, 11*REGBYTES(sp)
-       LREG x12, 12*REGBYTES(sp)
-       LREG x13, 13*REGBYTES(sp)
-       LREG x14, 14*REGBYTES(sp)
-       LREG x15, 15*REGBYTES(sp)
-       LREG x16, 16*REGBYTES(sp)
-       LREG x17, 17*REGBYTES(sp)
-       LREG x18, 18*REGBYTES(sp)
-       LREG x19, 19*REGBYTES(sp)
-       LREG x20, 20*REGBYTES(sp)
-       LREG x21, 21*REGBYTES(sp)
-       LREG x22, 22*REGBYTES(sp)
-       LREG x23, 23*REGBYTES(sp)
-       LREG x24, 24*REGBYTES(sp)
-       LREG x25, 25*REGBYTES(sp)
-       LREG x26, 26*REGBYTES(sp)
-       LREG x27, 27*REGBYTES(sp)
-       LREG x28, 28*REGBYTES(sp)
-       LREG x29, 29*REGBYTES(sp)
-       LREG x30, 30*REGBYTES(sp)
-       LREG x31, 31*REGBYTES(sp)
-       addi sp, sp, 32*REGBYTES
-       mret
-
-#ifdef CONFIG_INIT_CRITICAL
-cpu_init_crit:
-    ret
-#endif
diff --git a/arch/riscv/cpu/nx25/u-boot.lds b/arch/riscv/cpu/nx25/u-boot.lds
deleted file mode 100644 (file)
index 86ebc9f..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2017 Andes Technology Corporation
- * Rick Chen, Andes Technology Corporation <rick@andestech.com>
- */
-OUTPUT_ARCH("riscv")
-ENTRY(_start)
-
-SECTIONS
-{
-       . = ALIGN(4);
-       .text :
-       {
-               arch/riscv/cpu/nx25/start.o     (.text)
-               *(.text)
-       }
-
-       . = ALIGN(4);
-       .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
-
-       . = ALIGN(4);
-       .data : {
-               __global_pointer$ = . + 0x800;
-               *(.data*)
-       }
-       . = ALIGN(4);
-
-       .got : {
-          __got_start = .;
-          *(.got.plt) *(.got)
-          __got_end = .;
-    }
-
-       . = ALIGN(4);
-
-       .u_boot_list : {
-               KEEP(*(SORT(.u_boot_list*)));
-       }
-
-    . = ALIGN(4);
-
-    /DISCARD/ : { *(.rela.plt*) }
-    .rela.dyn : {
-        __rel_dyn_start = .;
-        *(.rela*)
-        __rel_dyn_end = .;
-    }
-
-    . = ALIGN(4);
-
-    .dynsym : {
-        __dyn_sym_start = .;
-        *(.dynsym)
-        __dyn_sym_end = .;
-    }
-
-    . = ALIGN(4);
-
-       _end = .;
-
-       .bss : {
-        __bss_start = .;
-        *(.bss)
-               . = ALIGN(4);
-               __bss_end = .;
-       }
-
-}
index 793677524a3493cf16a26e819b04ad899079e421..a1b06ffc6f0e27d3b143840265fa32db33a6423d 100644 (file)
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 
-dtb-$(CONFIG_TARGET_NX25_AE250) += ae250.dtb
+dtb-$(CONFIG_TARGET_AX25_AE350) += ae350.dtb
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
diff --git a/arch/riscv/dts/ae250.dts b/arch/riscv/dts/ae250.dts
deleted file mode 100644 (file)
index 9a38345..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/dts-v1/;
-/ {
-       compatible = "riscv32 nx25";
-       #address-cells = <1>;
-       #size-cells = <1>;
-       interrupt-parent = <&intc>;
-
-       aliases {
-               uart0 = &serial0;
-               ethernet0 = &mac0;
-               spi0 = &spi;
-       } ;
-
-       chosen {
-               bootargs = "console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0xf0300000 debug loglevel=7";
-               stdout-path = "uart0:38400n8";
-               tick-timer = &timer0;
-       };
-
-       memory@0 {
-               device_type = "memory";
-               reg = <0x00000000 0x40000000>;
-       };
-
-       spiclk: virt_100mhz {
-               #clock-cells = <0>;
-               compatible = "fixed-clock";
-               clock-frequency = <100000000>;
-       };
-
-       cpus {
-               #address-cells = <1>;
-               #size-cells = <0>;
-               cpu@0 {
-                       compatible = "andestech,n13";
-                       reg = <0>;
-                       /* FIXME: to fill correct frqeuency */
-                       clock-frequency = <60000000>;
-               };
-       };
-
-       intc: interrupt-controller {
-               compatible = "andestech,atnointc010";
-               #interrupt-cells = <1>;
-               interrupt-controller;
-       };
-
-       serial0: serial@f0300000 {
-               compatible = "andestech,uart16550", "ns16550a";
-               reg = <0xf0300000 0x1000>;
-               interrupts = <7 4>;
-               clock-frequency = <19660800>;
-               reg-shift = <2>;
-               reg-offset = <32>;
-               no-loopback-test = <1>;
-       };
-
-       timer0: timer@f0400000 {
-               compatible = "andestech,atcpit100";
-               reg = <0xf0400000 0x1000>;
-               interrupts = <2 4>;
-               clock-frequency = <40000000>;
-       };
-
-       mac0: mac@e0100000 {
-               compatible = "andestech,atmac100";
-               reg = <0xe0100000 0x1000>;
-               interrupts = <25 4>;
-       };
-
-       mmc0: mmc@f0e00000 {
-               compatible = "andestech,atsdc010";
-               max-frequency = <100000000>;
-               fifo-depth = <0x10>;
-               reg = <0xf0e00000 0x1000>;
-               interrupts = <17 4>;
-               cap-sd-highspeed;
-       };
-
-       spi: spi@f0b00000 {
-               compatible = "andestech,atcspi200";
-               reg = <0xf0b00000 0x1000>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-               num-cs = <1>;
-               clocks = <&spiclk>;
-               interrupts = <3 4>;
-                       flash@0 {
-                       compatible = "spi-flash";
-                       spi-max-frequency = <50000000>;
-                       reg = <0>;
-                       spi-cpol;
-                       spi-cpha;
-               };
-       };
-
-};
diff --git a/arch/riscv/dts/ae350.dts b/arch/riscv/dts/ae350.dts
new file mode 100644 (file)
index 0000000..2927e41
--- /dev/null
@@ -0,0 +1,149 @@
+/dts-v1/;
+
+/ {
+  #address-cells = <2>;
+  #size-cells = <2>;
+  compatible = "andestech,ax25";
+  model = "andestech,ax25";
+
+       aliases {
+               uart0 = &serial0;
+               spi0 = &spi;
+       } ;
+
+       chosen {
+               bootargs = "console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0xf0300000 debug loglevel=7";
+               stdout-path = "uart0:38400n8";
+  };
+
+  cpus {
+    #address-cells = <1>;
+    #size-cells = <0>;
+    timebase-frequency = <10000000>;
+    CPU0: cpu@0 {
+      device_type = "cpu";
+      reg = <0>;
+      status = "okay";
+      compatible = "riscv";
+      riscv,isa = "rv64imafdc";
+      mmu-type = "riscv,sv39";
+      clock-frequency = <60000000>;
+      CPU0_intc: interrupt-controller {
+        #interrupt-cells = <1>;
+        interrupt-controller;
+        compatible = "riscv,cpu-intc";
+      };
+    };
+       };
+
+       memory@0 {
+               device_type = "memory";
+    reg = <0x0 0x00000000 0x0 0x40000000>;
+       };
+
+  soc {
+    #address-cells = <2>;
+    #size-cells = <2>;
+    compatible = "andestech,riscv-ae350-soc";
+    ranges;
+       };
+
+  plmt0@e6000000 {
+    compatible = "riscv,plmt0";
+    interrupts-extended = <&CPU0_intc 7>;
+    reg = <0x0 0xe6000000 0x0 0x100000>;
+               };
+
+  plic0: interrupt-controller@e4000000 {
+    compatible = "riscv,plic0";
+    #address-cells = <2>;
+    #interrupt-cells = <2>;
+    interrupt-controller;
+    reg = <0x0 0xe4000000 0x0 0x2000000>;
+    riscv,ndev=<31>;
+    interrupts-extended = <&CPU0_intc 11 &CPU0_intc 9>;
+       };
+
+  plic1: interrupt-controller@e6400000 {
+    compatible = "riscv,plic1";
+    #address-cells = <2>;
+    #interrupt-cells = <2>;
+               interrupt-controller;
+    reg = <0x0 0xe6400000 0x0 0x400000>;
+    riscv,ndev=<1>;
+    interrupts-extended = <&CPU0_intc 3>;
+  };
+
+  spiclk: virt_100mhz {
+    #clock-cells = <0>;
+    compatible = "fixed-clock";
+    clock-frequency = <100000000>;
+  };
+
+  timer0: timer@f0400000 {
+    compatible = "andestech,atcpit100";
+    reg = <0x0 0xf0400000 0x0 0x1000>;
+    clock-frequency = <40000000>;
+    interrupts = <3 4>;
+    interrupt-parent = <&plic0>;
+       };
+
+       serial0: serial@f0300000 {
+               compatible = "andestech,uart16550", "ns16550a";
+    reg = <0x0 0xf0300000 0x0 0x1000>;
+    interrupts = <9 4>;
+               clock-frequency = <19660800>;
+               reg-shift = <2>;
+               reg-offset = <32>;
+               no-loopback-test = <1>;
+    interrupt-parent = <&plic0>;
+       };
+
+       mac0: mac@e0100000 {
+               compatible = "andestech,atmac100";
+    reg = <0x0 0xe0100000 0x0 0x1000>;
+    interrupts = <19 4>;
+    interrupt-parent = <&plic0>;
+       };
+
+       mmc0: mmc@f0e00000 {
+    compatible = "andestech,atfsdc010";
+               max-frequency = <100000000>;
+    clock-freq-min-max = <400000 100000000>;
+               fifo-depth = <0x10>;
+    reg = <0x0 0xf0e00000 0x0 0x1000>;
+    interrupts = <18 4>;
+               cap-sd-highspeed;
+    interrupt-parent = <&plic0>;
+       };
+
+  smc0: smc@e0400000 {
+    compatible = "andestech,atfsmc020";
+    reg = <0x0 0xe0400000 0x0 0x1000>;
+  };
+
+  nor@0,0 {
+    compatible = "cfi-flash";
+    reg = <0x0 0x88000000 0x0 0x1000>;
+    bank-width = <2>;
+    device-width = <1>;
+  };
+
+       spi: spi@f0b00000 {
+               compatible = "andestech,atcspi200";
+    reg = <0x0 0xf0b00000 0x0 0x1000>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               num-cs = <1>;
+               clocks = <&spiclk>;
+               interrupts = <3 4>;
+    interrupt-parent = <&plic0>;
+                       flash@0 {
+                       compatible = "spi-flash";
+                       spi-max-frequency = <50000000>;
+                       reg = <0>;
+                       spi-cpol;
+                       spi-cpha;
+               };
+       };
+};
index 93afff70b350b13dc8edbe57dcf93b36d3a522cc..f219cedfd3100d98702d79f550d099d0f7bb2286 100644 (file)
 extern unsigned int __machine_arch_type;
 #endif
 
-#define MACH_TYPE_AE250                1
+#define MACH_TYPE_AE350                1
 
-#ifdef CONFIG_ARCH_AE250
+#ifdef CONFIG_ARCH_AE350
 # ifdef machine_arch_type
 #  undef machine_arch_type
 #  define machine_arch_type __machine_arch_type
 # else
-#  define machine_arch_type MACH_TYPE_AE250
+#  define machine_arch_type MACH_TYPE_AE350
 # endif
-# define machine_is_ae250() (machine_arch_type == MACH_TYPE_AE250)
+# define machine_is_ae350() (machine_arch_type == MACH_TYPE_AE350)
 #else
-# define machine_is_ae250() (1)
+# define machine_is_ae350() (1)
 #endif
 
 #endif /* __ASM_RISCV_MACH_TYPE_H */
diff --git a/arch/riscv/include/asm/setjmp.h b/arch/riscv/include/asm/setjmp.h
new file mode 100644 (file)
index 0000000..72383d4
--- /dev/null
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018 Alexander Graf <agraf@suse.de>
+ */
+
+#ifndef _SETJMP_H_
+#define _SETJMP_H_     1
+
+/*
+ * This really should be opaque, but the EFI implementation wrongly
+ * assumes that a 'struct jmp_buf_data' is defined.
+ */
+struct jmp_buf_data {
+       /* x2, x8, x9, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, sp */
+       unsigned long s_regs[12];       /* s0 - s11 */
+       unsigned long ra;
+       unsigned long sp;
+};
+
+typedef struct jmp_buf_data jmp_buf[1];
+
+int setjmp(jmp_buf jmp);
+void longjmp(jmp_buf jmp, int ret);
+
+#endif /* _SETJMP_H_ */
index c4c068f9e24dd7b3c0a6846b0dbaee8c09d57e3b..49febd588102a825f3c6edae199358ed46b76a01 100644 (file)
@@ -16,5 +16,6 @@ int cleanup_before_linux(void);
 
 /* board/.../... */
 int board_init(void);
+void board_quiesce_devices(void);
 
 #endif /* _U_BOOT_RISCV_H_ */
index 0b671f70863aead654c063a31cf6cdbb2dcc7c48..cc562f935a7ac1038d948cf4b24f62aebae64f1a 100644 (file)
@@ -10,3 +10,15 @@ obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-$(CONFIG_CMD_GO) += boot.o
 obj-y  += cache.o
 obj-y  += interrupts.o
+obj-y   += setjmp.o
+
+# For building EFI apps
+CFLAGS_$(EFI_CRT0) := $(CFLAGS_EFI)
+CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI)
+
+CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI)
+CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI)
+
+extra-$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE) += $(EFI_CRT0) $(EFI_RELOC)
+extra-$(CONFIG_CMD_BOOTEFI_SELFTEST) += $(EFI_CRT0) $(EFI_RELOC)
+extra-$(CONFIG_EFI) += $(EFI_CRT0) $(EFI_RELOC)
index 8ede0485d4703a74faa4b4fb5e9e6746480879f7..2610a57bbff32e6d9f9c0d63840177c43973bfeb 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+__weak void board_quiesce_devices(void)
+{
+}
+
 int arch_fixup_fdt(void *blob)
 {
        return 0;
diff --git a/arch/riscv/lib/crt0_riscv_efi.S b/arch/riscv/lib/crt0_riscv_efi.S
new file mode 100644 (file)
index 0000000..18f61f5
--- /dev/null
@@ -0,0 +1,151 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * crt0-efi-riscv.S - PE/COFF header for RISC-V EFI applications
+ *
+ * Copright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
+ * Copright (C) 2018 Alexander Graf <agraf@suse.de>
+ *
+ * This file is inspired by arch/arm/lib/crt0_aarch64_efi.S
+ */
+
+#include <asm-generic/pe.h>
+
+#if __riscv_xlen == 64
+#define SIZE_LONG      8
+#define SAVE_LONG(reg, idx)    sd      reg, (idx*SIZE_LONG)(sp)
+#define LOAD_LONG(reg, idx)    ld      reg, (idx*SIZE_LONG)(sp)
+#define PE_MACHINE     0x5064
+#else
+#define SIZE_LONG      4
+#define SAVE_LONG(reg, idx)    sw      reg, (idx*SIZE_LONG)(sp)
+#define LOAD_LONG(reg, idx)    lw      reg, (idx*SIZE_LONG)(sp)
+#define PE_MACHINE     0x5032
+#endif
+
+
+       .section        .text.head
+
+       /*
+        * Magic "MZ" signature for PE/COFF
+        */
+       .globl  ImageBase
+ImageBase:
+       .ascii  "MZ"
+       .skip   58                              /* 'MZ' + pad + offset == 64 */
+       .long   pe_header - ImageBase           /* Offset to the PE header */
+pe_header:
+       .ascii  "PE"
+       .short  0
+coff_header:
+       .short  PE_MACHINE                      /* RISC-V 64/32-bit */
+       .short  2                               /* nr_sections */
+       .long   0                               /* TimeDateStamp */
+       .long   0                               /* PointerToSymbolTable */
+       .long   1                               /* NumberOfSymbols */
+       .short  section_table - optional_header /* SizeOfOptionalHeader */
+       /*
+        * Characteristics: IMAGE_FILE_DEBUG_STRIPPED |
+        * IMAGE_FILE_EXECUTABLE_IMAGE | IMAGE_FILE_LINE_NUMS_STRIPPED
+        */
+       .short  0x206
+optional_header:
+       .short  0x20b                           /* PE32+ format */
+       .byte   0x02                            /* MajorLinkerVersion */
+       .byte   0x14                            /* MinorLinkerVersion */
+       .long   _edata - _start                 /* SizeOfCode */
+       .long   0                               /* SizeOfInitializedData */
+       .long   0                               /* SizeOfUninitializedData */
+       .long   _start - ImageBase              /* AddressOfEntryPoint */
+       .long   _start - ImageBase              /* BaseOfCode */
+
+extra_header_fields:
+       .quad   0                               /* ImageBase */
+       .long   0x20                            /* SectionAlignment */
+       .long   0x8                             /* FileAlignment */
+       .short  0                               /* MajorOperatingSystemVersion */
+       .short  0                               /* MinorOperatingSystemVersion */
+       .short  0                               /* MajorImageVersion */
+       .short  0                               /* MinorImageVersion */
+       .short  0                               /* MajorSubsystemVersion */
+       .short  0                               /* MinorSubsystemVersion */
+       .long   0                               /* Win32VersionValue */
+
+       .long   _edata - ImageBase              /* SizeOfImage */
+
+       /*
+        * Everything before the kernel image is considered part of the header
+        */
+       .long   _start - ImageBase              /* SizeOfHeaders */
+       .long   0                               /* CheckSum */
+       .short  IMAGE_SUBSYSTEM_EFI_APPLICATION /* Subsystem */
+       .short  0                               /* DllCharacteristics */
+       .quad   0                               /* SizeOfStackReserve */
+       .quad   0                               /* SizeOfStackCommit */
+       .quad   0                               /* SizeOfHeapReserve */
+       .quad   0                               /* SizeOfHeapCommit */
+       .long   0                               /* LoaderFlags */
+       .long   0x6                             /* NumberOfRvaAndSizes */
+
+       .quad   0                               /* ExportTable */
+       .quad   0                               /* ImportTable */
+       .quad   0                               /* ResourceTable */
+       .quad   0                               /* ExceptionTable */
+       .quad   0                               /* CertificationTable */
+       .quad   0                               /* BaseRelocationTable */
+
+       /* Section table */
+section_table:
+
+       /*
+        * The EFI application loader requires a relocation section
+        * because EFI applications must be relocatable.  This is a
+        * dummy section as far as we are concerned.
+        */
+       .ascii  ".reloc"
+       .byte   0
+       .byte   0                       /* end of 0 padding of section name */
+       .long   0
+       .long   0
+       .long   0                       /* SizeOfRawData */
+       .long   0                       /* PointerToRawData */
+       .long   0                       /* PointerToRelocations */
+       .long   0                       /* PointerToLineNumbers */
+       .short  0                       /* NumberOfRelocations */
+       .short  0                       /* NumberOfLineNumbers */
+       .long   0x42100040              /* Characteristics (section flags) */
+
+
+       .ascii  ".text"
+       .byte   0
+       .byte   0
+       .byte   0                       /* end of 0 padding of section name */
+       .long   _edata - _start         /* VirtualSize */
+       .long   _start - ImageBase      /* VirtualAddress */
+       .long   _edata - _start         /* SizeOfRawData */
+       .long   _start - ImageBase      /* PointerToRawData */
+
+       .long   0               /* PointerToRelocations (0 for executables) */
+       .long   0               /* PointerToLineNumbers (0 for executables) */
+       .short  0               /* NumberOfRelocations  (0 for executables) */
+       .short  0               /* NumberOfLineNumbers  (0 for executables) */
+       .long   0xe0500020      /* Characteristics (section flags) */
+
+_start:
+       addi            sp, sp, -(SIZE_LONG * 3)
+       SAVE_LONG(a0, 0)
+       SAVE_LONG(a1, 1)
+       SAVE_LONG(ra, 2)
+
+       lla             a0, ImageBase
+       lla             a1, _DYNAMIC
+       call            _relocate
+       bne             a0, zero, 0f
+
+       LOAD_LONG(a1, 1)
+       LOAD_LONG(a0, 0)
+       call            efi_main
+
+       LOAD_LONG(ra, 2)
+
+0:     addi            sp, sp, (SIZE_LONG * 3)
+       ret
diff --git a/arch/riscv/lib/elf_riscv32_efi.lds b/arch/riscv/lib/elf_riscv32_efi.lds
new file mode 100644 (file)
index 0000000..629705f
--- /dev/null
@@ -0,0 +1,71 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * U-Boot riscv32 EFI linker script
+ *
+ * SPDX-License-Identifier:    BSD-2-Clause
+ *
+ * Modified from arch/arm/lib/elf_aarch64_efi.lds
+ */
+
+OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv", "elf32-littleriscv")
+OUTPUT_ARCH(riscv)
+ENTRY(_start)
+SECTIONS
+{
+       .text 0x0 : {
+               _text = .;
+               *(.text.head)
+               *(.text)
+               *(.text.*)
+               *(.gnu.linkonce.t.*)
+               *(.srodata)
+               *(.rodata*)
+               . = ALIGN(16);
+       }
+       _etext = .;
+       _text_size = . - _text;
+       .dynamic  : { *(.dynamic) }
+       .data : {
+               _data = .;
+               *(.sdata)
+               *(.data)
+               *(.data1)
+               *(.data.*)
+               *(.got.plt)
+               *(.got)
+
+               /*
+                * The EFI loader doesn't seem to like a .bss section, so we
+                * stick it all into .data:
+                */
+               . = ALIGN(16);
+               _bss = .;
+               *(.sbss)
+               *(.scommon)
+               *(.dynbss)
+               *(.bss)
+               *(.bss.*)
+               *(COMMON)
+               . = ALIGN(16);
+               _bss_end = .;
+               _edata = .;
+       }
+       .rela.dyn : { *(.rela.dyn) }
+       .rela.plt : { *(.rela.plt) }
+       .rela.got : { *(.rela.got) }
+       .rela.data : { *(.rela.data) *(.rela.data*) }
+       _data_size = . - _etext;
+
+       . = ALIGN(4096);
+       .dynsym   : { *(.dynsym) }
+       . = ALIGN(4096);
+       .dynstr   : { *(.dynstr) }
+       . = ALIGN(4096);
+       .note.gnu.build-id : { *(.note.gnu.build-id) }
+       /DISCARD/ : {
+               *(.rel.reloc)
+               *(.eh_frame)
+               *(.note.GNU-stack)
+       }
+       .comment 0 : { *(.comment) }
+}
diff --git a/arch/riscv/lib/elf_riscv64_efi.lds b/arch/riscv/lib/elf_riscv64_efi.lds
new file mode 100644 (file)
index 0000000..aece030
--- /dev/null
@@ -0,0 +1,71 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * U-Boot riscv64 EFI linker script
+ *
+ * SPDX-License-Identifier:    BSD-2-Clause
+ *
+ * Modified from arch/arm/lib/elf_aarch64_efi.lds
+ */
+
+OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
+OUTPUT_ARCH(riscv)
+ENTRY(_start)
+SECTIONS
+{
+       .text 0x0 : {
+               _text = .;
+               *(.text.head)
+               *(.text)
+               *(.text.*)
+               *(.gnu.linkonce.t.*)
+               *(.srodata)
+               *(.rodata*)
+               . = ALIGN(16);
+       }
+       _etext = .;
+       _text_size = . - _text;
+       .dynamic  : { *(.dynamic) }
+       .data : {
+               _data = .;
+               *(.sdata)
+               *(.data)
+               *(.data1)
+               *(.data.*)
+               *(.got.plt)
+               *(.got)
+
+               /*
+                * The EFI loader doesn't seem to like a .bss section, so we
+                * stick it all into .data:
+                */
+               . = ALIGN(16);
+               _bss = .;
+               *(.sbss)
+               *(.scommon)
+               *(.dynbss)
+               *(.bss)
+               *(.bss.*)
+               *(COMMON)
+               . = ALIGN(16);
+               _bss_end = .;
+               _edata = .;
+       }
+       .rela.dyn : { *(.rela.dyn) }
+       .rela.plt : { *(.rela.plt) }
+       .rela.got : { *(.rela.got) }
+       .rela.data : { *(.rela.data) *(.rela.data*) }
+       _data_size = . - _etext;
+
+       . = ALIGN(4096);
+       .dynsym   : { *(.dynsym) }
+       . = ALIGN(4096);
+       .dynstr   : { *(.dynstr) }
+       . = ALIGN(4096);
+       .note.gnu.build-id : { *(.note.gnu.build-id) }
+       /DISCARD/ : {
+               *(.rel.reloc)
+               *(.eh_frame)
+               *(.note.GNU-stack)
+       }
+       .comment 0 : { *(.comment) }
+}
diff --git a/arch/riscv/lib/reloc_riscv_efi.c b/arch/riscv/lib/reloc_riscv_efi.c
new file mode 100644 (file)
index 0000000..8b4b2b1
--- /dev/null
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: GPL-2.0+
+/* reloc_riscv.c - position independent ELF shared object relocator
+   Copyright (C) 2018 Alexander Graf <agraf@suse.de>
+   Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
+   Copyright (C) 1999 Hewlett-Packard Co.
+       Contributed by David Mosberger <davidm@hpl.hp.com>.
+
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials
+      provided with the distribution.
+    * Neither the name of Hewlett-Packard Co. nor the names of its
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+    CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+    BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+    THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+    SUCH DAMAGE.
+*/
+
+#include <efi.h>
+
+#include <elf.h>
+
+#if __riscv_xlen == 64
+#define Elf_Dyn                Elf64_Dyn
+#define Elf_Rela       Elf64_Rela
+#define ELF_R_TYPE     ELF64_R_TYPE
+#else
+#define Elf_Dyn                Elf32_Dyn
+#define Elf_Rela       Elf32_Rela
+#define ELF_R_TYPE     ELF32_R_TYPE
+#endif
+
+efi_status_t _relocate(long ldbase, Elf_Dyn *dyn, efi_handle_t image,
+                      struct efi_system_table *systab)
+{
+       long relsz = 0, relent = 0;
+       Elf_Rela *rel = 0;
+       unsigned long *addr;
+       int i;
+
+       for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
+               switch (dyn[i].d_tag) {
+               case DT_RELA:
+                       rel = (Elf_Rela *)((ulong)dyn[i].d_un.d_ptr + ldbase);
+                       break;
+               case DT_RELASZ:
+                       relsz = dyn[i].d_un.d_val;
+                       break;
+               case DT_RELAENT:
+                       relent = dyn[i].d_un.d_val;
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       if (!rel && relent == 0)
+               return EFI_SUCCESS;
+
+       if (!rel || relent == 0)
+               return EFI_LOAD_ERROR;
+
+       while (relsz > 0) {
+               /* apply the relocs */
+               switch (ELF_R_TYPE(rel->r_info)) {
+               case R_RISCV_RELATIVE:
+                       addr = (ulong *)(ldbase + rel->r_offset);
+                       *addr = ldbase + rel->r_addend;
+                       break;
+               default:
+                       /* Panic */
+                       while (1) ;
+               }
+               rel = (Elf_Rela *)((char *)rel + relent);
+               relsz -= relent;
+       }
+       return EFI_SUCCESS;
+}
diff --git a/arch/riscv/lib/setjmp.S b/arch/riscv/lib/setjmp.S
new file mode 100644 (file)
index 0000000..8f5a6a2
--- /dev/null
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) 2018 Alexander Graf <agraf@suse.de>
+ */
+
+#include <config.h>
+#include <linux/linkage.h>
+
+#ifdef CONFIG_CPU_RISCV_64
+#define STORE_IDX(reg, idx)    sd reg, (idx*8)(a0)
+#define LOAD_IDX(reg, idx)     ld reg, (idx*8)(a0)
+#else
+#define STORE_IDX(reg, idx)    sw reg, (idx*4)(a0)
+#define LOAD_IDX(reg, idx)     lw reg, (idx*4)(a0)
+#endif
+
+.pushsection .text.setjmp, "ax"
+ENTRY(setjmp)
+       /* Preserve all callee-saved registers and the SP */
+       STORE_IDX(s0, 0)
+       STORE_IDX(s1, 1)
+       STORE_IDX(s2, 2)
+       STORE_IDX(s3, 3)
+       STORE_IDX(s4, 4)
+       STORE_IDX(s5, 5)
+       STORE_IDX(s6, 6)
+       STORE_IDX(s7, 7)
+       STORE_IDX(s8, 8)
+       STORE_IDX(s9, 9)
+       STORE_IDX(s10, 10)
+       STORE_IDX(s11, 11)
+       STORE_IDX(ra, 12)
+       STORE_IDX(sp, 13)
+       li  a0, 0
+       ret
+ENDPROC(setjmp)
+.popsection
+
+.pushsection .text.longjmp, "ax"
+ENTRY(longjmp)
+       LOAD_IDX(s0, 0)
+       LOAD_IDX(s1, 1)
+       LOAD_IDX(s2, 2)
+       LOAD_IDX(s3, 3)
+       LOAD_IDX(s4, 4)
+       LOAD_IDX(s5, 5)
+       LOAD_IDX(s6, 6)
+       LOAD_IDX(s7, 7)
+       LOAD_IDX(s8, 8)
+       LOAD_IDX(s9, 9)
+       LOAD_IDX(s10, 10)
+       LOAD_IDX(s11, 11)
+       LOAD_IDX(ra, 12)
+       LOAD_IDX(sp, 13)
+
+       /* Move the return value in place, but return 1 if passed 0. */
+       beq a1, zero, longjmp_1
+       mv a0, a1
+       ret
+
+       longjmp_1:
+       li a0, 1
+       ret
+ENDPROC(longjmp)
+.popsection
index f2e5d65dad987555dae0680ae1adc59f27f1febf..5752bf547e667459a7c1f31408a42b09a18bc8cc 100644 (file)
                testfdt3 = "/b-test";
                testfdt5 = "/some-bus/c-test@5";
                testfdt8 = "/a-test";
-               fdt_dummy0 = "/translation-test@8000/dev@0,0";
-               fdt_dummy1 = "/translation-test@8000/dev@1,100";
-               fdt_dummy2 = "/translation-test@8000/dev@2,200";
-               fdt_dummy3 = "/translation-test@8000/noxlatebus@3,300/dev@42";
+               fdt-dummy0 = "/translation-test@8000/dev@0,0";
+               fdt-dummy1 = "/translation-test@8000/dev@1,100";
+               fdt-dummy2 = "/translation-test@8000/dev@2,200";
+               fdt-dummy3 = "/translation-test@8000/noxlatebus@3,300/dev@42";
                usb0 = &usb_0;
                usb1 = &usb_1;
                usb2 = &usb_2;
diff --git a/board/AndesTech/ax25-ae350/Kconfig b/board/AndesTech/ax25-ae350/Kconfig
new file mode 100644 (file)
index 0000000..bb69ea3
--- /dev/null
@@ -0,0 +1,24 @@
+if TARGET_AX25_AE350
+
+config SYS_CPU
+       default "ax25"
+
+config SYS_BOARD
+       default "ax25-ae350"
+
+config SYS_VENDOR
+       default "AndesTech"
+
+config SYS_SOC
+       default "ae350"
+
+config SYS_CONFIG_NAME
+       default "ax25-ae350"
+
+config ENV_SIZE
+       default 0x2000 if ENV_IS_IN_SPI_FLASH
+
+config ENV_OFFSET
+       default 0x140000 if ENV_IS_IN_SPI_FLASH
+
+endif
diff --git a/board/AndesTech/ax25-ae350/MAINTAINERS b/board/AndesTech/ax25-ae350/MAINTAINERS
new file mode 100644 (file)
index 0000000..508c6ac
--- /dev/null
@@ -0,0 +1,6 @@
+AX25-AE350 BOARD
+M:     Rick Chen <rick@andestech.com>
+S:     Maintained
+F:     board/AndesTech/ax25-ae350/
+F:     include/configs/ax25-ae350.h
+F:     configs/ax25-ae350_defconfig
diff --git a/board/AndesTech/ax25-ae350/Makefile b/board/AndesTech/ax25-ae350/Makefile
new file mode 100644 (file)
index 0000000..0e4ba8d
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2017 Andes Technology Corporation.
+# Rick Chen, Andes Technology Corporation <rick@andestech.com>
+
+obj-y  := ax25-ae350.o
diff --git a/board/AndesTech/ax25-ae350/ax25-ae350.c b/board/AndesTech/ax25-ae350/ax25-ae350.c
new file mode 100644 (file)
index 0000000..fd5aaa1
--- /dev/null
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017 Andes Technology Corporation
+ * Rick Chen, Andes Technology Corporation <rick@andestech.com>
+ */
+
+#include <asm/mach-types.h>
+#include <common.h>
+#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
+#include <netdev.h>
+#endif
+#include <linux/io.h>
+#include <faraday/ftsmc020.h>
+#include <fdtdec.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Miscellaneous platform dependent initializations
+ */
+
+int board_init(void)
+{
+       gd->bd->bi_arch_number = MACH_TYPE_AE350;
+       gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400;
+
+       return 0;
+}
+
+int dram_init(void)
+{
+       unsigned long sdram_base = PHYS_SDRAM_0;
+       unsigned long expected_size = PHYS_SDRAM_0_SIZE + PHYS_SDRAM_1_SIZE;
+       unsigned long actual_size;
+
+       actual_size = get_ram_size((void *)sdram_base, expected_size);
+       gd->ram_size = actual_size;
+
+       if (expected_size != actual_size) {
+               printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
+                       actual_size >> 20, expected_size >> 20);
+       }
+
+       return 0;
+}
+
+int dram_init_banksize(void)
+{
+       gd->bd->bi_dram[0].start = PHYS_SDRAM_0;
+       gd->bd->bi_dram[0].size =  PHYS_SDRAM_0_SIZE;
+       gd->bd->bi_dram[1].start = PHYS_SDRAM_1;
+       gd->bd->bi_dram[1].size =  PHYS_SDRAM_1_SIZE;
+
+       return 0;
+}
+
+#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
+int board_eth_init(bd_t *bd)
+{
+       return ftmac100_initialize(bd);
+}
+#endif
+
+ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
+{
+       return 0;
+}
+
+void *board_fdt_blob_setup(void)
+{
+       void **ptr = (void *)CONFIG_SYS_SDRAM_BASE;
+       if (fdt_magic(*ptr) == FDT_MAGIC)
+                       return (void *)*ptr;
+
+       return (void *)CONFIG_SYS_FDT_BASE;
+}
+
+int smc_init(void)
+{
+       int node = -1;
+       const char *compat = "andestech,atfsmc020";
+       void *blob = (void *)gd->fdt_blob;
+       fdt_addr_t addr;
+       struct ftsmc020_bank *regs;
+
+       node = fdt_node_offset_by_compatible(blob, -1, compat);
+       if (node < 0)
+               return -FDT_ERR_NOTFOUND;
+
+       addr = fdtdec_get_addr(blob, node, "reg");
+
+       if (addr == FDT_ADDR_T_NONE)
+               return -EINVAL;
+
+       regs = (struct ftsmc020_bank *)addr;
+       regs->cr &= ~FTSMC020_BANK_WPROT;
+
+       return 0;
+}
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f(void)
+{
+       smc_init();
+
+       return 0;
+}
+#endif
diff --git a/board/AndesTech/nx25-ae250/Kconfig b/board/AndesTech/nx25-ae250/Kconfig
deleted file mode 100644 (file)
index 2fb3234..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-if TARGET_NX25_AE250
-
-config SYS_CPU
-       default "nx25"
-
-config SYS_BOARD
-       default "nx25-ae250"
-
-config SYS_VENDOR
-       default "AndesTech"
-
-config SYS_SOC
-       default "ae250"
-
-config SYS_CONFIG_NAME
-       default "nx25-ae250"
-
-config ENV_SIZE
-       default 0x2000 if ENV_IS_IN_SPI_FLASH
-
-config ENV_OFFSET
-       default 0x140000 if ENV_IS_IN_SPI_FLASH
-
-endif
diff --git a/board/AndesTech/nx25-ae250/MAINTAINERS b/board/AndesTech/nx25-ae250/MAINTAINERS
deleted file mode 100644 (file)
index 1bff127..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-NX25-AE250 BOARD
-M:     Rick Chen <rick@andestech.com>
-S:     Maintained
-F:     board/AndesTech/nx25-ae250/
-F:     include/configs/nx25-ae250.h
-F:     configs/nx25-ae250_defconfig
diff --git a/board/AndesTech/nx25-ae250/Makefile b/board/AndesTech/nx25-ae250/Makefile
deleted file mode 100644 (file)
index e30b2d3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2017 Andes Technology Corporation.
-# Rick Chen, Andes Technology Corporation <rick@andestech.com>
-
-obj-y  := nx25-ae250.o
diff --git a/board/AndesTech/nx25-ae250/nx25-ae250.c b/board/AndesTech/nx25-ae250/nx25-ae250.c
deleted file mode 100644 (file)
index 4bb618b..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2017 Andes Technology Corporation
- * Rick Chen, Andes Technology Corporation <rick@andestech.com>
- */
-
-#include <asm/mach-types.h>
-#include <common.h>
-#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
-#include <netdev.h>
-#endif
-#include <linux/io.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/*
- * Miscellaneous platform dependent initializations
- */
-
-int board_init(void)
-{
-       gd->bd->bi_arch_number = MACH_TYPE_AE250;
-       gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400;
-
-       return 0;
-}
-
-int dram_init(void)
-{
-       unsigned long sdram_base = PHYS_SDRAM_0;
-       unsigned long expected_size = PHYS_SDRAM_0_SIZE + PHYS_SDRAM_1_SIZE;
-       unsigned long actual_size;
-
-       actual_size = get_ram_size((void *)sdram_base, expected_size);
-       gd->ram_size = actual_size;
-
-       if (expected_size != actual_size) {
-               printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
-                       actual_size >> 20, expected_size >> 20);
-       }
-
-       return 0;
-}
-
-int dram_init_banksize(void)
-{
-       gd->bd->bi_dram[0].start = PHYS_SDRAM_0;
-       gd->bd->bi_dram[0].size =  PHYS_SDRAM_0_SIZE;
-       gd->bd->bi_dram[1].start = PHYS_SDRAM_1;
-       gd->bd->bi_dram[1].size =  PHYS_SDRAM_1_SIZE;
-
-       return 0;
-}
-
-#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
-int board_eth_init(bd_t *bd)
-{
-       return ftmac100_initialize(bd);
-}
-#endif
-
-ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
-{
-       return 0;
-}
-
-void *board_fdt_blob_setup(void)
-{
-       void **ptr = (void *)CONFIG_SYS_SDRAM_BASE;
-       if (fdt_magic(*ptr) == FDT_MAGIC)
-                       return (void *)*ptr;
-
-       return (void *)CONFIG_SYS_FDT_BASE;
-}
index d9ca18363cda8dd769e4bebbd290e40f012c106a..031fd110923c5e5c87602ada5ffef9282878223c 100644 (file)
@@ -161,7 +161,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
        omap_die_id_get_board_serial(serialnr);
 }
 
-int fb_set_reboot_flag(void)
+int fastboot_set_reboot_flag(void)
 {
        return omap_reboot_mode_store("b");
 }
diff --git a/board/bitmain/antminer_s9/MAINTAINERS b/board/bitmain/antminer_s9/MAINTAINERS
new file mode 100644 (file)
index 0000000..302dd48
--- /dev/null
@@ -0,0 +1,6 @@
+Bitmain Antminer S9
+M:     Michal Simek <monstr@monstr.eu>
+S:     Maintained
+F:     board/bitmain/antminer_s9
+F:     include/configs/bitmain_antminer_s9.h
+F:     configs/bitmain_antminer_s9_defconfig
diff --git a/board/bitmain/antminer_s9/Makefile b/board/bitmain/antminer_s9/Makefile
new file mode 100644 (file)
index 0000000..93a1e77
--- /dev/null
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-y  := board.o
+
+# Remove quotes
+hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE))
+
+obj-$(CONFIG_SPL_BUILD) += $(hw-platform-y)/ps7_init_gpl.o
diff --git a/board/bitmain/antminer_s9/bitmain-antminer-s9/ps7_init_gpl.c b/board/bitmain/antminer_s9/bitmain-antminer-s9/ps7_init_gpl.c
new file mode 100644 (file)
index 0000000..aee2029
--- /dev/null
@@ -0,0 +1,280 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * (C) Copyright 2018 Michal Simek
+ */
+
+#include <asm/arch/ps7_init_gpl.h>
+
+static unsigned long ps7_pll_init_data_3_0[] = {
+       EMIT_MASKWRITE(0xf8000008, 0x0000ffff, 0x0000df0d),
+       EMIT_MASKWRITE(0xf8000110, 0x003ffff0, 0x000fa220),
+       EMIT_MASKWRITE(0xf8000100, 0x0007f000, 0x00028000),
+       EMIT_MASKWRITE(0xf8000100, 0x00000010, 0x00000010),
+       EMIT_MASKWRITE(0xf8000100, 0x00000001, 0x00000001),
+       EMIT_MASKWRITE(0xf8000100, 0x00000001, 0x00000000),
+       EMIT_MASKPOLL(0xf800010c, 0x00000001),
+       EMIT_MASKWRITE(0xf8000100, 0x00000010, 0x00000000),
+       EMIT_MASKWRITE(0xf8000120, 0x1f003f30, 0x1f000200),
+       EMIT_MASKWRITE(0xf8000114, 0x003ffff0, 0x0012c220),
+       EMIT_MASKWRITE(0xf8000104, 0x0007f000, 0x00020000),
+       EMIT_MASKWRITE(0xf8000104, 0x00000010, 0x00000010),
+       EMIT_MASKWRITE(0xf8000104, 0x00000001, 0x000000),
+       EMIT_MASKWRITE(0xf8000104, 0x00000001, 0x00000000),
+       EMIT_MASKPOLL(0xf800010c, 0x00000002),
+       EMIT_MASKWRITE(0xf8000104, 0x00000010, 0x00000000),
+       EMIT_MASKWRITE(0xf8000124, 0xfff00003, 0x0c200003),
+       EMIT_MASKWRITE(0xf8000118, 0x003ffff0, 0x001452c0),
+       EMIT_MASKWRITE(0xf8000108, 0x0007f000, 0x0001e000),
+       EMIT_MASKWRITE(0xf8000108, 0x00000010, 0x00000010),
+       EMIT_MASKWRITE(0xf8000108, 0x00000001, 0x00000001),
+       EMIT_MASKWRITE(0xf8000108, 0x00000001, 0x00000000),
+       EMIT_MASKPOLL(0xf800010c, 0x00000004),
+       EMIT_MASKWRITE(0xf8000108, 0x00000010, 0x00000000),
+       EMIT_MASKWRITE(0xf8000004, 0x0000ffff, 0x0000767b),
+       EMIT_EXIT(),
+};
+
+static unsigned long ps7_clock_init_data_3_0[] = {
+       EMIT_MASKWRITE(0xf8000008, 0x0000ffff, 0x0000df0d),
+       EMIT_MASKWRITE(0xf8000128, 0x03f03f01, 0x00302301),
+       EMIT_MASKWRITE(0xf8000138, 0x00000011, 0x00000001),
+       EMIT_MASKWRITE(0xf8000140, 0x03f03f71, 0x00100801),
+       EMIT_MASKWRITE(0xf8000148, 0x00003f31, 0x00000a01),
+       EMIT_MASKWRITE(0xf8000150, 0x00003f33, 0x00002801),
+       EMIT_MASKWRITE(0xf8000154, 0x00003f33, 0x00001402),
+       EMIT_MASKWRITE(0xf8000168, 0x00003f31, 0x00000501),
+       EMIT_MASKWRITE(0xf8000170, 0x03f03f30, 0x00101400),
+       EMIT_MASKWRITE(0xf8000180, 0x03f03f30, 0x00100a00),
+       EMIT_MASKWRITE(0xf8000190, 0x03f03f30, 0x00101e00),
+       EMIT_MASKWRITE(0xf80001a0, 0x03f03f30, 0x00101400),
+       EMIT_MASKWRITE(0xf80001c4, 0x00000001, 0x00000001),
+       EMIT_MASKWRITE(0xf800012c, 0x01ffcccd, 0x016c044d),
+       EMIT_MASKWRITE(0xf8000004, 0x0000ffff, 0x0000767b),
+       EMIT_EXIT(),
+};
+
+static unsigned long ps7_ddr_init_data_3_0[] = {
+       EMIT_MASKWRITE(0xf8006000, 0x0001ffff, 0x00000080),
+       EMIT_MASKWRITE(0xf8006004, 0x0007ffff, 0x00001081),
+       EMIT_MASKWRITE(0xf8006008, 0x03ffffff, 0x03c0780f),
+       EMIT_MASKWRITE(0xf800600c, 0x03ffffff, 0x02001001),
+       EMIT_MASKWRITE(0xf8006010, 0x03ffffff, 0x00014001),
+       EMIT_MASKWRITE(0xf8006014, 0x001fffff, 0x0004281b),
+       EMIT_MASKWRITE(0xf8006018, 0xf7ffffff, 0x44e458d1),
+       EMIT_MASKWRITE(0xf800601c, 0xffffffff, 0xb2023584),
+       EMIT_MASKWRITE(0xf8006020, 0x7fdffffc, 0x2b08b2d0),
+       EMIT_MASKWRITE(0xf8006024, 0x0fffffc3, 0x00000000),
+       EMIT_MASKWRITE(0xf8006028, 0x00003fff, 0x00002007),
+       EMIT_MASKWRITE(0xf800602c, 0xffffffff, 0x00000000),
+       EMIT_MASKWRITE(0xf8006030, 0xffffffff, 0x00040970),
+       EMIT_MASKWRITE(0xf8006034, 0x13ff3fff, 0x000116d4),
+       EMIT_MASKWRITE(0xf8006038, 0x00000003, 0x00000000),
+       EMIT_MASKWRITE(0xf800603c, 0x000fffff, 0x00000777),
+       EMIT_MASKWRITE(0xf8006040, 0xffffffff, 0xfff00000),
+       EMIT_MASKWRITE(0xf8006044, 0x0fffffff, 0x0f666666),
+       EMIT_MASKWRITE(0xf8006048, 0x0003f03f, 0x0003c008),
+       EMIT_MASKWRITE(0xf8006050, 0xff0f8fff, 0x77010800),
+       EMIT_MASKWRITE(0xf8006058, 0x00010000, 0x00000000),
+       EMIT_MASKWRITE(0xf800605c, 0x0000ffff, 0x00005003),
+       EMIT_MASKWRITE(0xf8006060, 0x000017ff, 0x0000003e),
+       EMIT_MASKWRITE(0xf8006064, 0x00021fe0, 0x00020000),
+       EMIT_MASKWRITE(0xf8006068, 0x03ffffff, 0x00284545),
+       EMIT_MASKWRITE(0xf800606c, 0x0000ffff, 0x00001610),
+       EMIT_MASKWRITE(0xf8006078, 0x03ffffff, 0x00466111),
+       EMIT_MASKWRITE(0xf800607c, 0x000fffff, 0x00032222),
+       EMIT_MASKWRITE(0xf80060a4, 0xffffffff, 0x10200802),
+       EMIT_MASKWRITE(0xf80060a8, 0x0fffffff, 0x0690cb73),
+       EMIT_MASKWRITE(0xf80060ac, 0x000001ff, 0x000001fe),
+       EMIT_MASKWRITE(0xf80060b0, 0x1fffffff, 0x1cffffff),
+       EMIT_MASKWRITE(0xf80060b4, 0x00000200, 0x00000200),
+       EMIT_MASKWRITE(0xf80060b8, 0x01ffffff, 0x0020006a),
+       EMIT_MASKWRITE(0xf80060c4, 0x00000003, 0x00000003),
+       EMIT_MASKWRITE(0xf80060c4, 0x00000003, 0x00000000),
+       EMIT_MASKWRITE(0xf80060c8, 0x000000ff, 0x00000000),
+       EMIT_MASKWRITE(0xf80060dc, 0x00000001, 0x00000000),
+       EMIT_MASKWRITE(0xf80060f0, 0x0000ffff, 0x00000000),
+       EMIT_MASKWRITE(0xf80060f4, 0x0000000f, 0x00000008),
+       EMIT_MASKWRITE(0xf8006114, 0x000000ff, 0x00000000),
+       EMIT_MASKWRITE(0xf8006118, 0x7fffffcf, 0x40000001),
+       EMIT_MASKWRITE(0xf800611c, 0x7fffffcf, 0x40000001),
+       EMIT_MASKWRITE(0xf8006120, 0x7fffffcf, 0x40000001),
+       EMIT_MASKWRITE(0xf8006124, 0x7fffffcf, 0x40000001),
+       EMIT_MASKWRITE(0xf800612c, 0x000fffff, 0x0002c000),
+       EMIT_MASKWRITE(0xf8006130, 0x000fffff, 0x0002c400),
+       EMIT_MASKWRITE(0xf8006134, 0x000fffff, 0x0002f003),
+       EMIT_MASKWRITE(0xf8006138, 0x000fffff, 0x0002ec03),
+       EMIT_MASKWRITE(0xf8006140, 0x000fffff, 0x00000035),
+       EMIT_MASKWRITE(0xf8006144, 0x000fffff, 0x00000035),
+       EMIT_MASKWRITE(0xf8006148, 0x000fffff, 0x00000035),
+       EMIT_MASKWRITE(0xf800614c, 0x000fffff, 0x00000035),
+       EMIT_MASKWRITE(0xf8006154, 0x000fffff, 0x00000077),
+       EMIT_MASKWRITE(0xf8006158, 0x000fffff, 0x00000077),
+       EMIT_MASKWRITE(0xf800615c, 0x000fffff, 0x00000083),
+       EMIT_MASKWRITE(0xf8006160, 0x000fffff, 0x00000083),
+       EMIT_MASKWRITE(0xf8006168, 0x001fffff, 0x00000105),
+       EMIT_MASKWRITE(0xf800616c, 0x001fffff, 0x00000106),
+       EMIT_MASKWRITE(0xf8006170, 0x001fffff, 0x00000111),
+       EMIT_MASKWRITE(0xf8006174, 0x001fffff, 0x00000110),
+       EMIT_MASKWRITE(0xf800617c, 0x000fffff, 0x000000b7),
+       EMIT_MASKWRITE(0xf8006180, 0x000fffff, 0x000000b7),
+       EMIT_MASKWRITE(0xf8006184, 0x000fffff, 0x000000c3),
+       EMIT_MASKWRITE(0xf8006188, 0x000fffff, 0x000000c3),
+       EMIT_MASKWRITE(0xf8006190, 0x6ffffefe, 0x00040080),
+       EMIT_MASKWRITE(0xf8006194, 0x000fffff, 0x0001fd01),
+       EMIT_MASKWRITE(0xf8006204, 0xffffffff, 0x00000000),
+       EMIT_MASKWRITE(0xf8006208, 0x000703ff, 0x000003ff),
+       EMIT_MASKWRITE(0xf800620c, 0x000703ff, 0x000003ff),
+       EMIT_MASKWRITE(0xf8006210, 0x000703ff, 0x000003ff),
+       EMIT_MASKWRITE(0xf8006214, 0x000703ff, 0x000003ff),
+       EMIT_MASKWRITE(0xf8006218, 0x000f03ff, 0x000003ff),
+       EMIT_MASKWRITE(0xf800621c, 0x000f03ff, 0x000003ff),
+       EMIT_MASKWRITE(0xf8006220, 0x000f03ff, 0x000003ff),
+       EMIT_MASKWRITE(0xf8006224, 0x000f03ff, 0x000003ff),
+       EMIT_MASKWRITE(0xf80062a8, 0x00000ff5, 0x00000000),
+       EMIT_MASKWRITE(0xf80062ac, 0xffffffff, 0x00000000),
+       EMIT_MASKWRITE(0xf80062b0, 0x003fffff, 0x00005125),
+       EMIT_MASKWRITE(0xf80062b4, 0x0003ffff, 0x000012a8),
+       EMIT_MASKPOLL(0xf8000b74, 0x00002000),
+       EMIT_MASKWRITE(0xf8006000, 0x0001ffff, 0x00000081),
+       EMIT_MASKPOLL(0xf8006054, 0x00000007),
+       EMIT_EXIT(),
+};
+
+static unsigned long ps7_mio_init_data_3_0[] = {
+       EMIT_MASKWRITE(0xf8000008, 0x0000ffff, 0x0000df0d),
+       EMIT_MASKWRITE(0xf8000b40, 0x00000fff, 0x00000600),
+       EMIT_MASKWRITE(0xf8000b44, 0x00000fff, 0x00000600),
+       EMIT_MASKWRITE(0xf8000b48, 0x00000fff, 0x00000672),
+       EMIT_MASKWRITE(0xf8000b4c, 0x00000fff, 0x00000672),
+       EMIT_MASKWRITE(0xf8000b50, 0x00000fff, 0x00000674),
+       EMIT_MASKWRITE(0xf8000b54, 0x00000fff, 0x00000674),
+       EMIT_MASKWRITE(0xf8000b58, 0x00000fff, 0x00000600),
+       EMIT_MASKWRITE(0xf8000b5c, 0xffffffff, 0x0018c068),
+       EMIT_MASKWRITE(0xf8000b60, 0xffffffff, 0x00f98068),
+       EMIT_MASKWRITE(0xf8000b64, 0xffffffff, 0x00f98068),
+       EMIT_MASKWRITE(0xf8000b68, 0xffffffff, 0x00f98068),
+       EMIT_MASKWRITE(0xf8000b6c, 0x00007fff, 0x00000205),
+       EMIT_MASKWRITE(0xf8000b70, 0x00000001, 0x00000001),
+       EMIT_MASKWRITE(0xf8000b70, 0x00000021, 0x00000020),
+       EMIT_MASKWRITE(0xf8000b70, 0x07feffff, 0x00000823),
+       EMIT_MASKWRITE(0xf8000700, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000704, 0x00003fff, 0x00000600),
+       EMIT_MASKWRITE(0xf8000708, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf800070c, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000710, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000714, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000718, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf800071c, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000720, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000724, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000728, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf800072c, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000730, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000734, 0x00003fff, 0x00000610),
+       EMIT_MASKWRITE(0xf8000738, 0x00003fff, 0x00000611),
+       EMIT_MASKWRITE(0xf800073c, 0x00003fff, 0x00000600),
+       EMIT_MASKWRITE(0xf8000740, 0x00003fff, 0x00000202),
+       EMIT_MASKWRITE(0xf8000744, 0x00003fff, 0x00000202),
+       EMIT_MASKWRITE(0xf8000748, 0x00003fff, 0x00000202),
+       EMIT_MASKWRITE(0xf800074c, 0x00003fff, 0x00000202),
+       EMIT_MASKWRITE(0xf8000750, 0x00003fff, 0x00000202),
+       EMIT_MASKWRITE(0xf8000754, 0x00003fff, 0x00000202),
+       EMIT_MASKWRITE(0xf8000758, 0x00003fff, 0x00000203),
+       EMIT_MASKWRITE(0xf800075c, 0x00003fff, 0x00000203),
+       EMIT_MASKWRITE(0xf8000760, 0x00003fff, 0x00000203),
+       EMIT_MASKWRITE(0xf8000764, 0x00003fff, 0x00000203),
+       EMIT_MASKWRITE(0xf8000768, 0x00003fff, 0x00000203),
+       EMIT_MASKWRITE(0xf800076c, 0x00003fff, 0x00000203),
+       EMIT_MASKWRITE(0xf8000770, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf8000774, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf8000778, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf800077c, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf8000780, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf8000784, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf8000788, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf800078c, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf8000790, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf8000794, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf8000798, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf800079c, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf80007a0, 0x00003fff, 0x00000280),
+       EMIT_MASKWRITE(0xf80007a4, 0x00003fff, 0x00000280),
+       EMIT_MASKWRITE(0xf80007a8, 0x00003fff, 0x00000280),
+       EMIT_MASKWRITE(0xf80007ac, 0x00003fff, 0x00000280),
+       EMIT_MASKWRITE(0xf80007b0, 0x00003fff, 0x00000280),
+       EMIT_MASKWRITE(0xf80007b4, 0x00003fff, 0x00000280),
+       EMIT_MASKWRITE(0xf80007b8, 0x00003f01, 0x00000201),
+       EMIT_MASKWRITE(0xf80007bc, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf80007c0, 0x00003fff, 0x000002e0),
+       EMIT_MASKWRITE(0xf80007c4, 0x00003fff, 0x000002e1),
+       EMIT_MASKWRITE(0xf80007c8, 0x00003f01, 0x00000201),
+       EMIT_MASKWRITE(0xf80007cc, 0x00003fff, 0x00000200),
+       EMIT_MASKWRITE(0xf80007d0, 0x00003fff, 0x00000280),
+       EMIT_MASKWRITE(0xf80007d4, 0x00003fff, 0x00000280),
+       EMIT_MASKWRITE(0xf8000830, 0x003f003f, 0x002e0032),
+       EMIT_MASKWRITE(0xf8000004, 0x0000ffff, 0x0000767b),
+       EMIT_EXIT(),
+};
+
+static unsigned long ps7_peripherals_init_data_3_0[] = {
+       EMIT_MASKWRITE(0xf8000008, 0x0000ffff, 0x0000df0d),
+       EMIT_MASKWRITE(0xf8000b48, 0x00000180, 0x00000180),
+       EMIT_MASKWRITE(0xf8000b4c, 0x00000180, 0x00000180),
+       EMIT_MASKWRITE(0xf8000b50, 0x00000180, 0x00000180),
+       EMIT_MASKWRITE(0xf8000b54, 0x00000180, 0x00000180),
+       EMIT_MASKWRITE(0xf8000004, 0x0000ffff, 0x0000767b),
+       EMIT_MASKWRITE(0xe0001034, 0x000000ff, 0x00000006),
+       EMIT_MASKWRITE(0xe0001018, 0x0000ffff, 0x0000003e),
+       EMIT_MASKWRITE(0xe0001000, 0x000001ff, 0x00000017),
+       EMIT_MASKWRITE(0xe0001004, 0x000003ff, 0x00000020),
+       EMIT_MASKWRITE(0xe000d000, 0x00080000, 0x00080000),
+       EMIT_MASKWRITE(0xf8007000, 0x20000000, 0x00000000),
+       EMIT_MASKWRITE(0xe000e014, 0x00ffffff, 0x00449144),
+       EMIT_MASKWRITE(0xe000e018, 0x00000003, 0x00000000),
+       EMIT_MASKWRITE(0xe000e010, 0x03e00000, 0x02400000),
+       EMIT_MASKDELAY(0xf8f00200, 0x00000001),
+       EMIT_MASKDELAY(0xf8f00200, 0x00000001),
+       EMIT_MASKDELAY(0xf8f00200, 0x00000001),
+       EMIT_MASKDELAY(0xf8f00200, 0x00000001),
+       EMIT_MASKDELAY(0xf8f00200, 0x00000001),
+       EMIT_MASKDELAY(0xf8f00200, 0x00000001),
+       EMIT_EXIT(),
+};
+
+static unsigned long ps7_post_config_3_0[] = {
+       EMIT_MASKWRITE(0xf8000008, 0x0000ffff, 0x0000df0d),
+       EMIT_MASKWRITE(0xf8000900, 0x0000000f, 0x0000000f),
+       EMIT_MASKWRITE(0xf8000240, 0xffffffff, 0x00000000),
+       EMIT_MASKWRITE(0xf8008000, 0x00000001, 0x00000001),
+       EMIT_MASKWRITE(0xf8008014, 0x00000001, 0x00000001),
+       EMIT_MASKWRITE(0xf8000004, 0x0000ffff, 0x0000767b),
+       EMIT_EXIT(),
+};
+
+int ps7_init(void)
+{
+       int ret;
+
+       ret = ps7_config(ps7_mio_init_data_3_0);
+       if (ret != PS7_INIT_SUCCESS)
+               return ret;
+       ret = ps7_config(ps7_pll_init_data_3_0);
+       if (ret != PS7_INIT_SUCCESS)
+               return ret;
+       ret = ps7_config(ps7_clock_init_data_3_0);
+       if (ret != PS7_INIT_SUCCESS)
+               return ret;
+       ret = ps7_config(ps7_ddr_init_data_3_0);
+       if (ret != PS7_INIT_SUCCESS)
+               return ret;
+       ret = ps7_config(ps7_peripherals_init_data_3_0);
+       if (ret != PS7_INIT_SUCCESS)
+               return ret;
+
+       return PS7_INIT_SUCCESS;
+}
+
+int ps7_post_config(void)
+{
+       return ps7_config(ps7_post_config_3_0);
+}
diff --git a/board/bitmain/antminer_s9/board.c b/board/bitmain/antminer_s9/board.c
new file mode 100644 (file)
index 0000000..bb7cef3
--- /dev/null
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "../../xilinx/zynq/board.c"
index f28ba6e7bff2455d0ccf9e4ffab29d6e114bddea..e64ae28875b10f1edb6de812e87b8f873f5034c6 100644 (file)
@@ -19,7 +19,7 @@ config SYS_CONFIG_NAME
 
 choice
        prompt "State of Run LED"
-       default PDU001_RUN_LED_RED
+       default RUN_LED_RED
        help
          The PDU001 has a bi-color (red/green) LED labeled 'Run' which
          can be used to indicate the operating state of the board. By
index 34a7a11f053dbde5d01ed78147c8562bc76a7aba..a7de4c21674c4eaa114aa5d096ac418df55d6879 100644 (file)
@@ -173,7 +173,7 @@ void reset_misc(void)
        omap_reboot_mode_store(reboot_mode);
 }
 
-int fb_set_reboot_flag(void)
+int fastboot_set_reboot_flag(void)
 {
        return omap_reboot_mode_store("b");
 }
diff --git a/board/synopsys/emdk/Kconfig b/board/synopsys/emdk/Kconfig
new file mode 100644 (file)
index 0000000..a9b834d
--- /dev/null
@@ -0,0 +1,12 @@
+if TARGET_EMDK
+
+config SYS_BOARD
+       default "emdk"
+
+config SYS_VENDOR
+       default "synopsys"
+
+config SYS_CONFIG_NAME
+       default "emdk"
+
+endif
diff --git a/board/synopsys/emdk/MAINTAINERS b/board/synopsys/emdk/MAINTAINERS
new file mode 100644 (file)
index 0000000..605e338
--- /dev/null
@@ -0,0 +1,5 @@
+EM DEVELOPMENT KIT BOARD
+M:     Alexey Brodkin <abrodkin@synopsys.com>
+S:     Maintained
+F:     board/synopsys/emdk/
+F:     configs/emdk_defconfig
diff --git a/board/synopsys/emdk/Makefile b/board/synopsys/emdk/Makefile
new file mode 100644 (file)
index 0000000..4926c4e
--- /dev/null
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2018 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y  += emdk.o
diff --git a/board/synopsys/emdk/emdk.c b/board/synopsys/emdk/emdk.c
new file mode 100644 (file)
index 0000000..bbb946a
--- /dev/null
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Synopsys, Inc. All rights reserved.
+ */
+
+#include <common.h>
+#include <dwmmc.h>
+#include <malloc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define ARC_PERIPHERAL_BASE    0xF0000000
+#define SDIO_BASE              (ARC_PERIPHERAL_BASE + 0x10000)
+
+int board_mmc_init(bd_t *bis)
+{
+       struct dwmci_host *host = NULL;
+
+       host = malloc(sizeof(struct dwmci_host));
+       if (!host) {
+               printf("dwmci_host malloc fail!\n");
+               return 1;
+       }
+
+       memset(host, 0, sizeof(struct dwmci_host));
+       host->name = "Synopsys Mobile storage";
+       host->ioaddr = (void *)SDIO_BASE;
+       host->buswidth = 4;
+       host->dev_index = 0;
+       host->bus_hz = 50000000;
+
+       add_dwmci(host, host->bus_hz / 2, 400000);
+
+       return 0;
+}
+
+#define CREG_BASE              0xF0001000
+#define CREG_BOOT_OFFSET       0
+#define CREG_BOOT_WP_OFFSET    8
+
+#define CGU_BASE               0xF0000000
+#define CGU_IP_SW_RESET                0x0FF0
+
+void reset_cpu(ulong addr)
+{
+       writel(1, (u32 *)(CGU_BASE + CGU_IP_SW_RESET));
+       while (1)
+               ; /* loop forever till reset */
+}
+
+static int do_emdk_rom(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       u32 creg_boot = readl((u32 *)(CREG_BASE + CREG_BOOT_OFFSET));
+
+       if (!strcmp(argv[1], "unlock"))
+               creg_boot &= ~BIT(CREG_BOOT_WP_OFFSET);
+       else if (!strcmp(argv[1], "lock"))
+               creg_boot |= BIT(CREG_BOOT_WP_OFFSET);
+       else
+               return CMD_RET_USAGE;
+
+       writel(creg_boot, (u32 *)(CREG_BASE + CREG_BOOT_OFFSET));
+
+       return CMD_RET_SUCCESS;
+}
+
+cmd_tbl_t cmd_emdk[] = {
+       U_BOOT_CMD_MKENT(rom, 2, 0, do_emdk_rom, "", ""),
+};
+
+static int do_emdk(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       cmd_tbl_t *c;
+
+       c = find_cmd_tbl(argv[1], cmd_emdk, ARRAY_SIZE(cmd_emdk));
+
+       /* Strip off leading 'emdk' command */
+       argc--;
+       argv++;
+
+       if (c == NULL || argc > c->maxargs)
+               return CMD_RET_USAGE;
+
+       return c->cmd(cmdtp, flag, argc, argv);
+}
+
+U_BOOT_CMD(
+       emdk, CONFIG_SYS_MAXARGS, 0, do_emdk,
+       "Synopsys EMDK specific commands",
+       "rom unlock - Unlock non-volatile memory for writing\n"
+       "emdk rom lock - Lock non-volatile memory to prevent writing\n"
+);
index fd9d20779bef5c5ac11d5109138a56724f05f77f..177a3246c3dbc2d7b35b57415cddc42546b4e1c6 100644 (file)
@@ -1178,5 +1178,15 @@ void board_tee_image_process(ulong tee_image, size_t tee_size)
        secure_tee_install((u32)tee_image);
 }
 
+#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
+int fastboot_set_reboot_flag(void)
+{
+       printf("Setting reboot to fastboot flag ...\n");
+       env_set("dofastboot", "1");
+       env_save();
+       return 0;
+}
+#endif
+
 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TEE, board_tee_image_process);
 #endif
index c21eb8c2d2e39c9d17c8ec3616a1faa8c0fbf413..b1956b810035ab5e1ff64427942353453fcb0d05 100644 (file)
@@ -25,7 +25,6 @@ config TI_COMMON_CMD_OPTIONS
        imply CMD_EXT2
        imply CMD_EXT4
        imply CMD_EXT4_WRITE
-       imply CMD_FASTBOOT if FASTBOOT
        imply CMD_FAT
        imply FAT_WRITE if CMD_FAT
        imply CMD_FS_GENERIC
index 6918f4de01f31ac9b00e9d320d99bc8a3ff402e6..bbe54450aeec83d540fdba0660cd3e8e066a2f38 100644 (file)
@@ -1188,5 +1188,15 @@ void board_tee_image_process(ulong tee_image, size_t tee_size)
        secure_tee_install((u32)tee_image);
 }
 
+#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
+int fastboot_set_reboot_flag(void)
+{
+       printf("Setting reboot to fastboot flag ...\n");
+       env_set("dofastboot", "1");
+       env_save();
+       return 0;
+}
+#endif
+
 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TEE, board_tee_image_process);
 #endif
index e41fec32df3176c0440788378324868c92724d5d..080fb59ef7bdaa458cc7d2ad833a846f06a85066 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/psu_init_gpl.h>
 #include <asm/io.h>
+#include <dm/device.h>
 #include <dm/uclass.h>
 #include <usb.h>
 #include <dwc3-uboot.h>
@@ -449,10 +450,54 @@ void reset_cpu(ulong addr)
 {
 }
 
+static const struct {
+       u32 bit;
+       const char *name;
+} reset_reasons[] = {
+       { RESET_REASON_DEBUG_SYS, "DEBUG" },
+       { RESET_REASON_SOFT, "SOFT" },
+       { RESET_REASON_SRST, "SRST" },
+       { RESET_REASON_PSONLY, "PS-ONLY" },
+       { RESET_REASON_PMU, "PMU" },
+       { RESET_REASON_INTERNAL, "INTERNAL" },
+       { RESET_REASON_EXTERNAL, "EXTERNAL" },
+       {}
+};
+
+static u32 reset_reason(void)
+{
+       u32 ret;
+       int i;
+       const char *reason = NULL;
+
+       ret = readl(&crlapb_base->reset_reason);
+
+       puts("Reset reason:\t");
+
+       for (i = 0; i < ARRAY_SIZE(reset_reasons); i++) {
+               if (ret & reset_reasons[i].bit) {
+                       reason = reset_reasons[i].name;
+                       printf("%s ", reset_reasons[i].name);
+                       break;
+               }
+       }
+
+       puts("\n");
+
+       env_set("reset_reason", reason);
+
+       writel(~0, &crlapb_base->reset_reason);
+
+       return ret;
+}
+
 int board_late_init(void)
 {
        u32 reg = 0;
        u8 bootmode;
+       struct udevice *dev;
+       int bootseq = -1;
+       int bootseq_len = 0;
        int env_targets_len = 0;
        const char *mode;
        char *new_targets;
@@ -498,7 +543,15 @@ int board_late_init(void)
                break;
        case SD_MODE:
                puts("SD_MODE\n");
-               mode = "mmc0";
+               if (uclass_get_device_by_name(UCLASS_MMC,
+                                             "sdhci@ff160000", &dev)) {
+                       puts("Boot from SD0 but without SD0 enabled!\n");
+                       return -1;
+               }
+               debug("mmc0 device found at %p, seq %d\n", dev, dev->seq);
+
+               mode = "mmc";
+               bootseq = dev->seq;
                env_set("modeboot", "sdboot");
                break;
        case SD1_LSHFT_MODE:
@@ -506,12 +559,15 @@ int board_late_init(void)
                /* fall through */
        case SD_MODE1:
                puts("SD_MODE1\n");
-#if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1)
-               mode = "mmc1";
-               env_set("sdbootdev", "1");
-#else
-               mode = "mmc0";
-#endif
+               if (uclass_get_device_by_name(UCLASS_MMC,
+                                             "sdhci@ff170000", &dev)) {
+                       puts("Boot from SD1 but without SD1 enabled!\n");
+                       return -1;
+               }
+               debug("mmc1 device found at %p, seq %d\n", dev, dev->seq);
+
+               mode = "mmc";
+               bootseq = dev->seq;
                env_set("modeboot", "sdboot");
                break;
        case NAND_MODE:
@@ -525,6 +581,11 @@ int board_late_init(void)
                break;
        }
 
+       if (bootseq >= 0) {
+               bootseq_len = snprintf(NULL, 0, "%i", bootseq);
+               debug("Bootseq len: %x\n", bootseq_len);
+       }
+
        /*
         * One terminating char + one byte for space between mode
         * and default boot_targets
@@ -533,13 +594,20 @@ int board_late_init(void)
        if (env_targets)
                env_targets_len = strlen(env_targets);
 
-       new_targets = calloc(1, strlen(mode) + env_targets_len + 2);
+       new_targets = calloc(1, strlen(mode) + env_targets_len + 2 +
+                            bootseq_len);
 
-       sprintf(new_targets, "%s %s", mode,
-               env_targets ? env_targets : "");
+       if (bootseq >= 0)
+               sprintf(new_targets, "%s%x %s", mode, bootseq,
+                       env_targets ? env_targets : "");
+       else
+               sprintf(new_targets, "%s %s", mode,
+                       env_targets ? env_targets : "");
 
        env_set("boot_targets", new_targets);
 
+       reset_reason();
+
        return 0;
 }
 
index d532c9fc41c05f8b43ee2553c2d441d43ebed211..e283cb9a8aceacf9d47602504fcccf5aef1b55f0 100644 (file)
@@ -137,8 +137,6 @@ config AUTOBOOT_STOP_STR_SHA256
 
 endmenu
 
-source "cmd/fastboot/Kconfig"
-
 config BUILD_BIN2C
        bool
 
@@ -228,7 +226,7 @@ config CMD_BOOTEFI
 
 config CMD_BOOTEFI_HELLO_COMPILE
        bool "Compile a standard EFI hello world binary for testing"
-       depends on CMD_BOOTEFI && (ARM || X86)
+       depends on CMD_BOOTEFI && (ARM || X86 || RISCV)
        default y
        help
          This compiles a standard EFI hello world application with U-Boot so
@@ -650,6 +648,18 @@ config CMD_DM
          can be useful to see the state of driver model for debugging or
          interest.
 
+config CMD_FASTBOOT
+       bool "fastboot - Android fastboot support"
+       depends on FASTBOOT
+       help
+         This enables the command "fastboot" which enables the Android
+         fastboot mode for the platform. Fastboot is a protocol for
+         downloading images, flashing and device control used on
+         Android devices. Fastboot requires either the network stack
+         enabled or support for acting as a USB device.
+
+         See doc/README.android-fastboot for more information.
+
 config CMD_FDC
        bool "fdcboot - Boot from floppy device"
        help
@@ -697,6 +707,13 @@ config CMD_FPGA_LOADP
          Supports loading an FPGA device from a bitstream buffer containing
          a partial bitstream.
 
+config CMD_FPGA_LOAD_SECURE
+       bool "fpga loads - loads secure bitstreams (Xilinx only)"
+       depends on CMD_FPGA
+       help
+         Enables the fpga loads command which is used to load secure
+         (authenticated or encrypted or both) bitstreams on to FPGA.
+
 config CMD_FPGAD
        bool "fpgad - dump FPGA registers"
        help
@@ -823,6 +840,14 @@ config CMD_MMC_RPMB
          Enable the commands for reading, writing and programming the
          key for the Replay Protection Memory Block partition in eMMC.
 
+config CMD_MMC_SWRITE
+       bool "mmc swrite"
+       depends on CMD_MMC && MMC_WRITE
+       select IMAGE_SPARSE
+       help
+         Enable support for the "mmc swrite" command to write Android sparse
+         images to eMMC.
+
 config CMD_NAND
        bool "nand"
        default y if NAND_SUNXI
index a5ec5f46f63300052d4eb9f23f6092f09ebe0c1f..557257aef8437bcb79d60824a62574645740b931 100644 (file)
 #include <command.h>
 #include <console.h>
 #include <g_dnl.h>
+#include <fastboot.h>
+#include <net.h>
 #include <usb.h>
 
-static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_fastboot_udp(int argc, char *const argv[],
+                          uintptr_t buf_addr, size_t buf_size)
 {
+#if CONFIG_IS_ENABLED(UDP_FUNCTION_FASTBOOT)
+       int err = net_loop(FASTBOOT);
+
+       if (err < 0) {
+               printf("fastboot udp error: %d\n", err);
+               return CMD_RET_FAILURE;
+       }
+
+       return CMD_RET_SUCCESS;
+#else
+       pr_err("Fastboot UDP not enabled\n");
+       return CMD_RET_FAILURE;
+#endif
+}
+
+static int do_fastboot_usb(int argc, char *const argv[],
+                          uintptr_t buf_addr, size_t buf_size)
+{
+#if CONFIG_IS_ENABLED(USB_FUNCTION_FASTBOOT)
        int controller_index;
        char *usb_controller;
        int ret;
@@ -58,11 +80,70 @@ exit:
        board_usb_cleanup(controller_index, USB_INIT_DEVICE);
 
        return ret;
+#else
+       pr_err("Fastboot USB not enabled\n");
+       return CMD_RET_FAILURE;
+#endif
+}
+
+static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       uintptr_t buf_addr = (uintptr_t)NULL;
+       size_t buf_size = 0;
+
+       if (argc < 2)
+               return CMD_RET_USAGE;
+
+       while (argc > 1 && **(argv + 1) == '-') {
+               char *arg = *++argv;
+
+               --argc;
+               while (*++arg) {
+                       switch (*arg) {
+                       case 'l':
+                               if (--argc <= 0)
+                                       return CMD_RET_USAGE;
+                               buf_addr = simple_strtoul(*++argv, NULL, 16);
+                               goto NXTARG;
+
+                       case 's':
+                               if (--argc <= 0)
+                                       return CMD_RET_USAGE;
+                               buf_size = simple_strtoul(*++argv, NULL, 16);
+                               goto NXTARG;
+
+                       default:
+                               return CMD_RET_USAGE;
+                       }
+               }
+NXTARG:
+               ;
+       }
+
+       fastboot_init((void *)buf_addr, buf_size);
+
+       if (!strcmp(argv[1], "udp"))
+               return do_fastboot_udp(argc, argv, buf_addr, buf_size);
+
+       if (!strcmp(argv[1], "usb")) {
+               argv++;
+               argc--;
+       }
+
+       return do_fastboot_usb(argc, argv, buf_addr, buf_size);
 }
 
+#ifdef CONFIG_SYS_LONGHELP
+static char fastboot_help_text[] =
+       "[-l addr] [-s size] usb <controller> | udp\n"
+       "\taddr - address of buffer used during data transfers ("
+       __stringify(CONFIG_FASTBOOT_BUF_ADDR) ")\n"
+       "\tsize - size of buffer used during data transfers ("
+       __stringify(CONFIG_FASTBOOT_BUF_SIZE) ")"
+       ;
+#endif
+
 U_BOOT_CMD(
-       fastboot, 2, 1, do_fastboot,
-       "use USB Fastboot protocol",
-       "<USB_controller>\n"
-       "    - run as a fastboot usb device"
+       fastboot, CONFIG_SYS_MAXARGS, 1, do_fastboot,
+       "run as a fastboot usb or udp device", fastboot_help_text
 );
diff --git a/cmd/fastboot/Kconfig b/cmd/fastboot/Kconfig
deleted file mode 100644 (file)
index 0d2c2f1..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-comment "FASTBOOT"
-
-menuconfig FASTBOOT
-       bool "Fastboot support"
-       depends on USB_GADGET
-       default y if ARCH_SUNXI && USB_MUSB_GADGET
-
-if FASTBOOT
-
-config USB_FUNCTION_FASTBOOT
-       bool "Enable USB fastboot gadget"
-       default y
-       select USB_GADGET_DOWNLOAD
-       imply ANDROID_BOOT_IMAGE
-       imply CMD_FASTBOOT
-       help
-         This enables the USB part of the fastboot gadget.
-
-config CMD_FASTBOOT
-       bool "Enable FASTBOOT command"
-       help
-         This enables the command "fastboot" which enables the Android
-         fastboot mode for the platform's USB device. Fastboot is a USB
-         protocol for downloading images, flashing and device control
-         used on Android devices.
-
-         See doc/README.android-fastboot for more information.
-
-if USB_FUNCTION_FASTBOOT
-
-config FASTBOOT_BUF_ADDR
-       hex "Define FASTBOOT buffer address"
-       default 0x82000000 if MX6SX || MX6SL || MX6UL || MX6SLL
-       default 0x81000000 if ARCH_OMAP2PLUS
-       default 0x42000000 if ARCH_SUNXI && !MACH_SUN9I
-       default 0x22000000 if ARCH_SUNXI && MACH_SUN9I
-       default 0x60800800 if ROCKCHIP_RK3036 || ROCKCHIP_RK3188 || \
-                               ROCKCHIP_RK322X
-       default 0x800800 if ROCKCHIP_RK3288 || ROCKCHIP_RK3329 || \
-                               ROCKCHIP_RK3399
-       default 0x280000 if ROCKCHIP_RK3368
-       default 0x100000 if ARCH_ZYNQMP
-       help
-         The fastboot protocol requires a large memory buffer for
-         downloads. Define this to the starting RAM address to use for
-         downloaded images.
-
-config FASTBOOT_BUF_SIZE
-       hex "Define FASTBOOT buffer size"
-       default 0x8000000 if ARCH_ROCKCHIP
-       default 0x6000000 if ARCH_ZYNQMP
-       default 0x2000000 if ARCH_SUNXI
-       default 0x7000000
-       help
-         The fastboot protocol requires a large memory buffer for
-         downloads. This buffer should be as large as possible for a
-         platform. Define this to the size available RAM for fastboot.
-
-config FASTBOOT_USB_DEV
-       int "USB controller number"
-       default 0
-       help
-         Some boards have USB OTG controller other than 0. Define this
-         option so it can be used in compiled environment (e.g. in
-         CONFIG_BOOTCOMMAND).
-
-config FASTBOOT_FLASH
-       bool "Enable FASTBOOT FLASH command"
-       default y if ARCH_SUNXI
-       help
-         The fastboot protocol includes a "flash" command for writing
-         the downloaded image to a non-volatile storage device. Define
-         this to enable the "fastboot flash" command.
-
-choice
-       prompt "Flash provider for FASTBOOT"
-       depends on FASTBOOT_FLASH
-
-config FASTBOOT_FLASH_MMC
-       bool "FASTBOOT on MMC"
-       depends on MMC
-
-config FASTBOOT_FLASH_NAND
-       bool "FASTBOOT on NAND"
-       depends on NAND
-
-endchoice
-
-config FASTBOOT_FLASH_MMC_DEV
-       int "Define FASTBOOT MMC FLASH default device"
-       depends on FASTBOOT_FLASH_MMC
-       default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
-       default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
-       help
-         The fastboot "flash" command requires additional information
-         regarding the non-volatile storage device. Define this to
-         the eMMC device that fastboot should use to store the image.
-
-config FASTBOOT_FLASH_NAND_DEV
-       int "Define FASTBOOT NAND FLASH default device"
-       depends on FASTBOOT_FLASH_NAND
-       depends on CMD_MTDPARTS
-       default 0 if ARCH_SUNXI && NAND_SUNXI
-       help
-         The fastboot "flash" command requires additional information
-         regarding the non-volatile storage device. Define this to
-         the NAND device that fastboot should use to store the image.
-
-config FASTBOOT_GPT_NAME
-       string "Target name for updating GPT"
-       depends on FASTBOOT_FLASH
-       default "gpt"
-       help
-         The fastboot "flash" command supports writing the downloaded
-         image to the Protective MBR and the Primary GUID Partition
-         Table. (Additionally, this downloaded image is post-processed
-         to generate and write the Backup GUID Partition Table.)
-         This occurs when the specified "partition name" on the
-         "fastboot flash" command line matches the value defined here.
-         The default target name for updating GPT is "gpt".
-
-config FASTBOOT_MBR_NAME
-       string "Target name for updating MBR"
-       depends on FASTBOOT_FLASH
-       default "mbr"
-       help
-         The fastboot "flash" command allows to write the downloaded image
-         to the Master Boot Record. This occurs when the "partition name"
-         specified on the "fastboot flash" command line matches the value
-         defined here. The default target name for updating MBR is "mbr".
-
-endif # USB_FUNCTION_FASTBOOT
-
-endif # FASTBOOT
index 14ad4e52666abd4a0b1db6c5f99918f973cc1119..74ae80c807e20a3698da0a3bf8d040611cd59d31 100644 (file)
@@ -27,6 +27,7 @@ enum {
        FPGA_LOADP,
        FPGA_LOADBP,
        FPGA_LOADFS,
+       FPGA_LOADS,
 };
 
 /* ------------------------------------------------------------------------- */
@@ -54,21 +55,55 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
        fpga_fs_info fpga_fsinfo;
        fpga_fsinfo.fstype = FS_TYPE_ANY;
 #endif
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+       struct fpga_secure_info fpga_sec_info;
+
+       memset(&fpga_sec_info, 0, sizeof(fpga_sec_info));
+#endif
 
        if (devstr)
                dev = (int) simple_strtoul(devstr, NULL, 16);
        if (datastr)
                fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
 
-       switch (argc) {
+       if (argc > 9 || argc < 2) {
+               debug("%s: Too many or too few args (%d)\n", __func__, argc);
+               return CMD_RET_USAGE;
+       }
+
+       op = (int)fpga_get_op(argv[1]);
+
+       switch (op) {
 #if defined(CONFIG_CMD_FPGA_LOADFS)
-       case 9:
+       case FPGA_LOADFS:
+               if (argc < 9)
+                       return CMD_RET_USAGE;
                fpga_fsinfo.blocksize = (unsigned int)
-                                            simple_strtoul(argv[5], NULL, 16);
+                                       simple_strtoul(argv[5], NULL, 16);
                fpga_fsinfo.interface = argv[6];
                fpga_fsinfo.dev_part = argv[7];
                fpga_fsinfo.filename = argv[8];
+               argc = 5;
+               break;
+#endif
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+       case FPGA_LOADS:
+               if (argc < 7)
+                       return CMD_RET_USAGE;
+               if (argc == 8)
+                       fpga_sec_info.userkey_addr = (u8 *)(uintptr_t)
+                                                    simple_strtoull(argv[7],
+                                                                    NULL, 16);
+               fpga_sec_info.encflag = (u8)simple_strtoul(argv[6], NULL, 16);
+               fpga_sec_info.authflag = (u8)simple_strtoul(argv[5], NULL, 16);
+               argc = 5;
+               break;
 #endif
+       default:
+               break;
+       }
+
+       switch (argc) {
        case 5:         /* fpga <op> <dev> <data> <datasize> */
                data_size = simple_strtoul(argv[4], NULL, 16);
 
@@ -117,15 +152,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                              __func__, (ulong)fpga_data);
                        dev = FPGA_INVALID_DEVICE;      /* reset device num */
                }
-
-       case 2:         /* fpga <op> */
-               op = (int)fpga_get_op(argv[1]);
-               break;
-
-       default:
-               debug("%s: Too many or too few args (%d)\n", __func__, argc);
-               op = FPGA_NONE; /* force usage display */
-               break;
        }
 
        if (dev == FPGA_INVALID_DEVICE) {
@@ -143,6 +169,22 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                if (!fpga_fsinfo.interface || !fpga_fsinfo.dev_part ||
                    !fpga_fsinfo.filename)
                        wrong_parms = 1;
+               break;
+#endif
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+       case FPGA_LOADS:
+               if (fpga_sec_info.authflag >= FPGA_NO_ENC_OR_NO_AUTH &&
+                   fpga_sec_info.encflag >= FPGA_NO_ENC_OR_NO_AUTH) {
+                       puts("ERR: use <fpga load> for NonSecure bitstream\n");
+                       wrong_parms = 1;
+               }
+
+               if (fpga_sec_info.encflag == FPGA_ENC_USR_KEY &&
+                   !fpga_sec_info.userkey_addr) {
+                       wrong_parms = 1;
+                       puts("ERR:User key not provided\n");
+               }
+               break;
 #endif
        case FPGA_LOAD:
        case FPGA_LOADP:
@@ -199,6 +241,12 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                break;
 #endif
 
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+       case FPGA_LOADS:
+               rc = fpga_loads(dev, fpga_data, data_size, &fpga_sec_info);
+               break;
+#endif
+
 #if defined(CONFIG_CMD_FPGA_LOADMK)
        case FPGA_LOADMK:
                switch (genimg_get_format(fpga_data)) {
@@ -332,6 +380,10 @@ static int fpga_get_op(char *opstr)
 #endif
        else if (!strcmp("dump", opstr))
                op = FPGA_DUMP;
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+       else if (!strcmp("loads", opstr))
+               op = FPGA_LOADS;
+#endif
 
        if (op == FPGA_NONE)
                printf("Unknown fpga operation \"%s\"\n", opstr);
@@ -339,7 +391,7 @@ static int fpga_get_op(char *opstr)
        return op;
 }
 
-#if defined(CONFIG_CMD_FPGA_LOADFS)
+#if defined(CONFIG_CMD_FPGA_LOADFS) || defined(CONFIG_CMD_FPGA_LOAD_SECURE)
 U_BOOT_CMD(fpga, 9, 1, do_fpga,
 #else
 U_BOOT_CMD(fpga, 6, 1, do_fpga,
@@ -374,4 +426,19 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga,
           "\tsubimage unit name in the form of addr:<subimg_uname>"
 #endif
 #endif
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+          "Load encrypted bitstream (Xilinx only)\n"
+          "  loads [dev] [address] [size] [auth-OCM-0/DDR-1/noauth-2]\n"
+          "        [enc-devkey(0)/userkey(1)/nenc(2) [Userkey address]\n"
+          "Loads the secure bistreams(authenticated/encrypted/both\n"
+          "authenticated and encrypted) of [size] from [address].\n"
+          "The auth-OCM/DDR flag specifies to perform authentication\n"
+          "in OCM or in DDR. 0 for OCM, 1 for DDR, 2 for no authentication.\n"
+          "The enc flag specifies which key to be used for decryption\n"
+          "0-device key, 1-user key, 2-no encryption.\n"
+          "The optional Userkey address specifies from which address key\n"
+          "has to be used for decryption if user key is selected.\n"
+          "NOTE: the sceure bitstream has to be created using xilinx\n"
+          "bootgen tool only.\n"
+#endif
 );
index a3357eff8faa632ed817df9313e68b8696111a61..c2ee2d9c0af1d9e77d4339621a2173411e92d07a 100644 (file)
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -308,8 +308,7 @@ static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
        return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
 }
 
-#if CONFIG_IS_ENABLED(MMC_WRITE)
-#if defined(CONFIG_FASTBOOT_FLASH)
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
 static lbaint_t mmc_sparse_write(struct sparse_storage *info, lbaint_t blk,
                                 lbaint_t blkcnt, const void *buffer)
 {
@@ -367,13 +366,14 @@ static int do_mmc_sparse_write(cmd_tbl_t *cmdtp, int flag,
        sparse.mssg = NULL;
        sprintf(dest, "0x" LBAF, sparse.start * sparse.blksz);
 
-       if (write_sparse_image(&sparse, dest, addr))
+       if (write_sparse_image(&sparse, dest, addr, NULL))
                return CMD_RET_FAILURE;
        else
                return CMD_RET_SUCCESS;
 }
 #endif
 
+#if CONFIG_IS_ENABLED(MMC_WRITE)
 static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
                        int argc, char * const argv[])
 {
@@ -868,10 +868,10 @@ static cmd_tbl_t cmd_mmc[] = {
        U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
 #if CONFIG_IS_ENABLED(MMC_WRITE)
        U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""),
-#if defined(CONFIG_FASTBOOT_FLASH)
-       U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
-#endif
        U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""),
+#endif
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
+       U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
 #endif
        U_BOOT_CMD_MKENT(rescan, 1, 1, do_mmc_rescan, "", ""),
        U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
@@ -927,7 +927,7 @@ U_BOOT_CMD(
        "info - display info of the current MMC device\n"
        "mmc read addr blk# cnt\n"
        "mmc write addr blk# cnt\n"
-#if defined(CONFIG_FASTBOOT_FLASH)
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
        "mmc swrite addr blk#\n"
 #endif
        "mmc erase blk# cnt\n"
index d0681c7dd96ac87f0636d6d18501a03164fee9bb..b3da72ebb2c94ee3ca23a104cb8d79a1be51f5eb 100644 (file)
@@ -29,7 +29,6 @@ obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
 
 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
-
 obj-$(CONFIG_MII) += miiphyutil.o
 obj-$(CONFIG_CMD_MII) += miiphyutil.o
 obj-$(CONFIG_PHYLIB) += miiphyutil.o
@@ -109,19 +108,6 @@ obj-$(CONFIG_IO_TRACE) += iotrace.o
 obj-y += memsize.o
 obj-y += stdio.o
 
-ifndef CONFIG_SPL_BUILD
-# This option is not just y/n - it can have a numeric value
-ifdef CONFIG_FASTBOOT_FLASH
-obj-y += image-sparse.o
-ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-obj-y += fb_mmc.o
-endif
-ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
-obj-y += fb_nand.o
-endif
-endif
-endif
-
 ifdef CONFIG_CMD_EEPROM_LAYOUT
 obj-y += eeprom/eeprom_field.o eeprom/eeprom_layout.o
 endif
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
deleted file mode 100644 (file)
index 46f0073..0000000
+++ /dev/null
@@ -1,406 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2014 Broadcom Corporation.
- */
-
-#include <config.h>
-#include <common.h>
-#include <blk.h>
-#include <fastboot.h>
-#include <fb_mmc.h>
-#include <image-sparse.h>
-#include <part.h>
-#include <mmc.h>
-#include <div64.h>
-#include <linux/compat.h>
-#include <android_image.h>
-
-/*
- * FIXME: Ensure we always set these names via Kconfig once xxx_PARTITION is
- * migrated
- */
-#ifndef CONFIG_FASTBOOT_GPT_NAME
-#define CONFIG_FASTBOOT_GPT_NAME "gpt"
-#endif
-
-
-#ifndef CONFIG_FASTBOOT_MBR_NAME
-#define CONFIG_FASTBOOT_MBR_NAME "mbr"
-#endif
-
-#define BOOT_PARTITION_NAME "boot"
-
-struct fb_mmc_sparse {
-       struct blk_desc *dev_desc;
-};
-
-static int part_get_info_by_name_or_alias(struct blk_desc *dev_desc,
-               const char *name, disk_partition_t *info)
-{
-       int ret;
-
-       ret = part_get_info_by_name(dev_desc, name, info);
-       if (ret < 0) {
-               /* strlen("fastboot_partition_alias_") + 32(part_name) + 1 */
-               char env_alias_name[25 + 32 + 1];
-               char *aliased_part_name;
-
-               /* check for alias */
-               strcpy(env_alias_name, "fastboot_partition_alias_");
-               strncat(env_alias_name, name, 32);
-               aliased_part_name = env_get(env_alias_name);
-               if (aliased_part_name != NULL)
-                       ret = part_get_info_by_name(dev_desc,
-                                       aliased_part_name, info);
-       }
-       return ret;
-}
-
-static lbaint_t fb_mmc_sparse_write(struct sparse_storage *info,
-               lbaint_t blk, lbaint_t blkcnt, const void *buffer)
-{
-       struct fb_mmc_sparse *sparse = info->priv;
-       struct blk_desc *dev_desc = sparse->dev_desc;
-
-       return blk_dwrite(dev_desc, blk, blkcnt, buffer);
-}
-
-static lbaint_t fb_mmc_sparse_reserve(struct sparse_storage *info,
-               lbaint_t blk, lbaint_t blkcnt)
-{
-       return blkcnt;
-}
-
-static void write_raw_image(struct blk_desc *dev_desc, disk_partition_t *info,
-               const char *part_name, void *buffer,
-               unsigned int download_bytes)
-{
-       lbaint_t blkcnt;
-       lbaint_t blks;
-
-       /* determine number of blocks to write */
-       blkcnt = ((download_bytes + (info->blksz - 1)) & ~(info->blksz - 1));
-       blkcnt = lldiv(blkcnt, info->blksz);
-
-       if (blkcnt > info->size) {
-               pr_err("too large for partition: '%s'\n", part_name);
-               fastboot_fail("too large for partition");
-               return;
-       }
-
-       puts("Flashing Raw Image\n");
-
-       blks = blk_dwrite(dev_desc, info->start, blkcnt, buffer);
-       if (blks != blkcnt) {
-               pr_err("failed writing to device %d\n", dev_desc->devnum);
-               fastboot_fail("failed writing to device");
-               return;
-       }
-
-       printf("........ wrote " LBAFU " bytes to '%s'\n", blkcnt * info->blksz,
-              part_name);
-       fastboot_okay("");
-}
-
-#ifdef CONFIG_ANDROID_BOOT_IMAGE
-/**
- * Read Android boot image header from boot partition.
- *
- * @param[in] dev_desc MMC device descriptor
- * @param[in] info Boot partition info
- * @param[out] hdr Where to store read boot image header
- *
- * @return Boot image header sectors count or 0 on error
- */
-static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
-                                      disk_partition_t *info,
-                                      struct andr_img_hdr *hdr)
-{
-       ulong sector_size;              /* boot partition sector size */
-       lbaint_t hdr_sectors;           /* boot image header sectors count */
-       int res;
-
-       /* Calculate boot image sectors count */
-       sector_size = info->blksz;
-       hdr_sectors = DIV_ROUND_UP(sizeof(struct andr_img_hdr), sector_size);
-       if (hdr_sectors == 0) {
-               pr_err("invalid number of boot sectors: 0");
-               fastboot_fail("invalid number of boot sectors: 0");
-               return 0;
-       }
-
-       /* Read the boot image header */
-       res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr);
-       if (res != hdr_sectors) {
-               pr_err("cannot read header from boot partition");
-               fastboot_fail("cannot read header from boot partition");
-               return 0;
-       }
-
-       /* Check boot header magic string */
-       res = android_image_check_header(hdr);
-       if (res != 0) {
-               pr_err("bad boot image magic");
-               fastboot_fail("boot partition not initialized");
-               return 0;
-       }
-
-       return hdr_sectors;
-}
-
-/**
- * Write downloaded zImage to boot partition and repack it properly.
- *
- * @param dev_desc MMC device descriptor
- * @param download_buffer Address to fastboot buffer with zImage in it
- * @param download_bytes Size of fastboot buffer, in bytes
- *
- * @return 0 on success or -1 on error
- */
-static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
-                               void *download_buffer,
-                               unsigned int download_bytes)
-{
-       uintptr_t hdr_addr;                     /* boot image header address */
-       struct andr_img_hdr *hdr;               /* boot image header */
-       lbaint_t hdr_sectors;                   /* boot image header sectors */
-       u8 *ramdisk_buffer;
-       u32 ramdisk_sector_start;
-       u32 ramdisk_sectors;
-       u32 kernel_sector_start;
-       u32 kernel_sectors;
-       u32 sectors_per_page;
-       disk_partition_t info;
-       int res;
-
-       puts("Flashing zImage\n");
-
-       /* Get boot partition info */
-       res = part_get_info_by_name(dev_desc, BOOT_PARTITION_NAME, &info);
-       if (res < 0) {
-               pr_err("cannot find boot partition");
-               fastboot_fail("cannot find boot partition");
-               return -1;
-       }
-
-       /* Put boot image header in fastboot buffer after downloaded zImage */
-       hdr_addr = (uintptr_t)download_buffer + ALIGN(download_bytes, PAGE_SIZE);
-       hdr = (struct andr_img_hdr *)hdr_addr;
-
-       /* Read boot image header */
-       hdr_sectors = fb_mmc_get_boot_header(dev_desc, &info, hdr);
-       if (hdr_sectors == 0) {
-               pr_err("unable to read boot image header");
-               fastboot_fail("unable to read boot image header");
-               return -1;
-       }
-
-       /* Check if boot image has second stage in it (we don't support it) */
-       if (hdr->second_size > 0) {
-               pr_err("moving second stage is not supported yet");
-               fastboot_fail("moving second stage is not supported yet");
-               return -1;
-       }
-
-       /* Extract ramdisk location */
-       sectors_per_page = hdr->page_size / info.blksz;
-       ramdisk_sector_start = info.start + sectors_per_page;
-       ramdisk_sector_start += DIV_ROUND_UP(hdr->kernel_size, hdr->page_size) *
-                                            sectors_per_page;
-       ramdisk_sectors = DIV_ROUND_UP(hdr->ramdisk_size, hdr->page_size) *
-                                      sectors_per_page;
-
-       /* Read ramdisk and put it in fastboot buffer after boot image header */
-       ramdisk_buffer = (u8 *)hdr + (hdr_sectors * info.blksz);
-       res = blk_dread(dev_desc, ramdisk_sector_start, ramdisk_sectors,
-                       ramdisk_buffer);
-       if (res != ramdisk_sectors) {
-               pr_err("cannot read ramdisk from boot partition");
-               fastboot_fail("cannot read ramdisk from boot partition");
-               return -1;
-       }
-
-       /* Write new kernel size to boot image header */
-       hdr->kernel_size = download_bytes;
-       res = blk_dwrite(dev_desc, info.start, hdr_sectors, (void *)hdr);
-       if (res == 0) {
-               pr_err("cannot writeback boot image header");
-               fastboot_fail("cannot write back boot image header");
-               return -1;
-       }
-
-       /* Write the new downloaded kernel */
-       kernel_sector_start = info.start + sectors_per_page;
-       kernel_sectors = DIV_ROUND_UP(hdr->kernel_size, hdr->page_size) *
-                                     sectors_per_page;
-       res = blk_dwrite(dev_desc, kernel_sector_start, kernel_sectors,
-                        download_buffer);
-       if (res == 0) {
-               pr_err("cannot write new kernel");
-               fastboot_fail("cannot write new kernel");
-               return -1;
-       }
-
-       /* Write the saved ramdisk back */
-       ramdisk_sector_start = info.start + sectors_per_page;
-       ramdisk_sector_start += DIV_ROUND_UP(hdr->kernel_size, hdr->page_size) *
-                                            sectors_per_page;
-       res = blk_dwrite(dev_desc, ramdisk_sector_start, ramdisk_sectors,
-                        ramdisk_buffer);
-       if (res == 0) {
-               pr_err("cannot write back original ramdisk");
-               fastboot_fail("cannot write back original ramdisk");
-               return -1;
-       }
-
-       puts("........ zImage was updated in boot partition\n");
-       fastboot_okay("");
-       return 0;
-}
-#endif
-
-void fb_mmc_flash_write(const char *cmd, void *download_buffer,
-                       unsigned int download_bytes)
-{
-       struct blk_desc *dev_desc;
-       disk_partition_t info;
-
-       dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
-       if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
-               pr_err("invalid mmc device\n");
-               fastboot_fail("invalid mmc device");
-               return;
-       }
-
-#if CONFIG_IS_ENABLED(EFI_PARTITION)
-       if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
-               printf("%s: updating MBR, Primary and Backup GPT(s)\n",
-                      __func__);
-               if (is_valid_gpt_buf(dev_desc, download_buffer)) {
-                       printf("%s: invalid GPT - refusing to write to flash\n",
-                              __func__);
-                       fastboot_fail("invalid GPT partition");
-                       return;
-               }
-               if (write_mbr_and_gpt_partitions(dev_desc, download_buffer)) {
-                       printf("%s: writing GPT partitions failed\n", __func__);
-                       fastboot_fail("writing GPT partitions failed");
-                       return;
-               }
-               printf("........ success\n");
-               fastboot_okay("");
-               return;
-       }
-#endif
-
-#if CONFIG_IS_ENABLED(DOS_PARTITION)
-       if (strcmp(cmd, CONFIG_FASTBOOT_MBR_NAME) == 0) {
-               printf("%s: updating MBR\n", __func__);
-               if (is_valid_dos_buf(download_buffer)) {
-                       printf("%s: invalid MBR - refusing to write to flash\n",
-                              __func__);
-                       fastboot_fail("invalid MBR partition");
-                       return;
-               }
-               if (write_mbr_partition(dev_desc, download_buffer)) {
-                       printf("%s: writing MBR partition failed\n", __func__);
-                       fastboot_fail("writing MBR partition failed");
-                       return;
-               }
-               printf("........ success\n");
-               fastboot_okay("");
-               return;
-       }
-#endif
-
-#ifdef CONFIG_ANDROID_BOOT_IMAGE
-       if (strncasecmp(cmd, "zimage", 6) == 0) {
-               fb_mmc_update_zimage(dev_desc, download_buffer, download_bytes);
-               return;
-       }
-#endif
-
-       if (part_get_info_by_name_or_alias(dev_desc, cmd, &info) < 0) {
-               pr_err("cannot find partition: '%s'\n", cmd);
-               fastboot_fail("cannot find partition");
-               return;
-       }
-
-       if (is_sparse_image(download_buffer)) {
-               struct fb_mmc_sparse sparse_priv;
-               struct sparse_storage sparse;
-               int err;
-
-               sparse_priv.dev_desc = dev_desc;
-
-               sparse.blksz = info.blksz;
-               sparse.start = info.start;
-               sparse.size = info.size;
-               sparse.write = fb_mmc_sparse_write;
-               sparse.reserve = fb_mmc_sparse_reserve;
-               sparse.mssg = fastboot_fail;
-
-               printf("Flashing sparse image at offset " LBAFU "\n",
-                      sparse.start);
-
-               sparse.priv = &sparse_priv;
-               err = write_sparse_image(&sparse, cmd, download_buffer);
-               if (!err)
-                       fastboot_okay("");
-       } else {
-               write_raw_image(dev_desc, &info, cmd, download_buffer,
-                               download_bytes);
-       }
-}
-
-void fb_mmc_erase(const char *cmd)
-{
-       int ret;
-       struct blk_desc *dev_desc;
-       disk_partition_t info;
-       lbaint_t blks, blks_start, blks_size, grp_size;
-       struct mmc *mmc = find_mmc_device(CONFIG_FASTBOOT_FLASH_MMC_DEV);
-
-       if (mmc == NULL) {
-               pr_err("invalid mmc device");
-               fastboot_fail("invalid mmc device");
-               return;
-       }
-
-       dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
-       if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
-               pr_err("invalid mmc device");
-               fastboot_fail("invalid mmc device");
-               return;
-       }
-
-       ret = part_get_info_by_name_or_alias(dev_desc, cmd, &info);
-       if (ret < 0) {
-               pr_err("cannot find partition: '%s'", cmd);
-               fastboot_fail("cannot find partition");
-               return;
-       }
-
-       /* Align blocks to erase group size to avoid erasing other partitions */
-       grp_size = mmc->erase_grp_size;
-       blks_start = (info.start + grp_size - 1) & ~(grp_size - 1);
-       if (info.size >= grp_size)
-               blks_size = (info.size - (blks_start - info.start)) &
-                               (~(grp_size - 1));
-       else
-               blks_size = 0;
-
-       printf("Erasing blocks " LBAFU " to " LBAFU " due to alignment\n",
-              blks_start, blks_start + blks_size);
-
-       blks = blk_derase(dev_desc, blks_start, blks_size);
-       if (blks != blks_size) {
-               pr_err("failed erasing from device %d", dev_desc->devnum);
-               fastboot_fail("failed erasing from device");
-               return;
-       }
-
-       printf("........ erased " LBAFU " bytes from '%s'\n",
-              blks_size * info.blksz, cmd);
-       fastboot_okay("");
-}
diff --git a/common/fb_nand.c b/common/fb_nand.c
deleted file mode 100644 (file)
index c07655e..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2014 Broadcom Corporation.
- * Copyright 2015 Free Electrons.
- */
-
-#include <config.h>
-#include <common.h>
-
-#include <fastboot.h>
-#include <image-sparse.h>
-
-#include <linux/mtd/mtd.h>
-#include <jffs2/jffs2.h>
-#include <nand.h>
-
-struct fb_nand_sparse {
-       struct mtd_info         *mtd;
-       struct part_info        *part;
-};
-
-__weak int board_fastboot_erase_partition_setup(char *name)
-{
-       return 0;
-}
-
-__weak int board_fastboot_write_partition_setup(char *name)
-{
-       return 0;
-}
-
-static int fb_nand_lookup(const char *partname,
-                         struct mtd_info **mtd,
-                         struct part_info **part)
-{
-       struct mtd_device *dev;
-       int ret;
-       u8 pnum;
-
-       ret = mtdparts_init();
-       if (ret) {
-               pr_err("Cannot initialize MTD partitions\n");
-               fastboot_fail("cannot init mtdparts");
-               return ret;
-       }
-
-       ret = find_dev_and_part(partname, &dev, &pnum, part);
-       if (ret) {
-               pr_err("cannot find partition: '%s'", partname);
-               fastboot_fail("cannot find partition");
-               return ret;
-       }
-
-       if (dev->id->type != MTD_DEV_TYPE_NAND) {
-               pr_err("partition '%s' is not stored on a NAND device",
-                     partname);
-               fastboot_fail("not a NAND device");
-               return -EINVAL;
-       }
-
-       *mtd = get_nand_dev_by_index(dev->id->num);
-
-       return 0;
-}
-
-static int _fb_nand_erase(struct mtd_info *mtd, struct part_info *part)
-{
-       nand_erase_options_t opts;
-       int ret;
-
-       memset(&opts, 0, sizeof(opts));
-       opts.offset = part->offset;
-       opts.length = part->size;
-       opts.quiet = 1;
-
-       printf("Erasing blocks 0x%llx to 0x%llx\n",
-              part->offset, part->offset + part->size);
-
-       ret = nand_erase_opts(mtd, &opts);
-       if (ret)
-               return ret;
-
-       printf("........ erased 0x%llx bytes from '%s'\n",
-              part->size, part->name);
-
-       return 0;
-}
-
-static int _fb_nand_write(struct mtd_info *mtd, struct part_info *part,
-                         void *buffer, unsigned int offset,
-                         unsigned int length, size_t *written)
-{
-       int flags = WITH_WR_VERIFY;
-
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_TRIMFFS
-       flags |= WITH_DROP_FFS;
-#endif
-
-       return nand_write_skip_bad(mtd, offset, &length, written,
-                                  part->size - (offset - part->offset),
-                                  buffer, flags);
-}
-
-static lbaint_t fb_nand_sparse_write(struct sparse_storage *info,
-               lbaint_t blk, lbaint_t blkcnt, const void *buffer)
-{
-       struct fb_nand_sparse *sparse = info->priv;
-       size_t written;
-       int ret;
-
-       ret = _fb_nand_write(sparse->mtd, sparse->part, (void *)buffer,
-                            blk * info->blksz,
-                            blkcnt * info->blksz, &written);
-       if (ret < 0) {
-               printf("Failed to write sparse chunk\n");
-               return ret;
-       }
-
-/* TODO - verify that the value "written" includes the "bad-blocks" ... */
-
-       /*
-        * the return value must be 'blkcnt' ("good-blocks") plus the
-        * number of "bad-blocks" encountered within this space...
-        */
-       return written / info->blksz;
-}
-
-static lbaint_t fb_nand_sparse_reserve(struct sparse_storage *info,
-               lbaint_t blk, lbaint_t blkcnt)
-{
-       int bad_blocks = 0;
-
-/*
- * TODO - implement a function to determine the total number
- * of blocks which must be used in order to reserve the specified
- * number ("blkcnt") of "good-blocks", starting at "blk"...
- * ( possibly something like the "check_skip_len()" function )
- */
-
-       /*
-        * the return value must be 'blkcnt' ("good-blocks") plus the
-        * number of "bad-blocks" encountered within this space...
-        */
-       return blkcnt + bad_blocks;
-}
-
-void fb_nand_flash_write(const char *cmd, void *download_buffer,
-                        unsigned int download_bytes)
-{
-       struct part_info *part;
-       struct mtd_info *mtd = NULL;
-       int ret;
-
-       ret = fb_nand_lookup(cmd, &mtd, &part);
-       if (ret) {
-               pr_err("invalid NAND device");
-               fastboot_fail("invalid NAND device");
-               return;
-       }
-
-       ret = board_fastboot_write_partition_setup(part->name);
-       if (ret)
-               return;
-
-       if (is_sparse_image(download_buffer)) {
-               struct fb_nand_sparse sparse_priv;
-               struct sparse_storage sparse;
-
-               sparse_priv.mtd = mtd;
-               sparse_priv.part = part;
-
-               sparse.blksz = mtd->writesize;
-               sparse.start = part->offset / sparse.blksz;
-               sparse.size = part->size / sparse.blksz;
-               sparse.write = fb_nand_sparse_write;
-               sparse.reserve = fb_nand_sparse_reserve;
-               sparse.mssg = fastboot_fail;
-
-               printf("Flashing sparse image at offset " LBAFU "\n",
-                      sparse.start);
-
-               sparse.priv = &sparse_priv;
-               ret = write_sparse_image(&sparse, cmd, download_buffer);
-               if (!ret)
-                       fastboot_okay("");
-       } else {
-               printf("Flashing raw image at offset 0x%llx\n",
-                      part->offset);
-
-               ret = _fb_nand_write(mtd, part, download_buffer, part->offset,
-                                    download_bytes, NULL);
-
-               printf("........ wrote %u bytes to '%s'\n",
-                      download_bytes, part->name);
-       }
-
-       if (ret) {
-               fastboot_fail("error writing the image");
-               return;
-       }
-
-       fastboot_okay("");
-}
-
-void fb_nand_erase(const char *cmd)
-{
-       struct part_info *part;
-       struct mtd_info *mtd = NULL;
-       int ret;
-
-       ret = fb_nand_lookup(cmd, &mtd, &part);
-       if (ret) {
-               pr_err("invalid NAND device");
-               fastboot_fail("invalid NAND device");
-               return;
-       }
-
-       ret = board_fastboot_erase_partition_setup(part->name);
-       if (ret)
-               return;
-
-       ret = _fb_nand_erase(mtd, part);
-       if (ret) {
-               pr_err("failed erasing from device %s", mtd->name);
-               fastboot_fail("failed erasing from device");
-               return;
-       }
-
-       fastboot_okay("");
-}
diff --git a/common/image-sparse.c b/common/image-sparse.c
deleted file mode 100644 (file)
index 9223b9a..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright (c) 2009, Google Inc.
- * All rights reserved.
- *
- * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
- * Portions Copyright 2014 Broadcom Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of The Linux Foundation nor
- *       the names of its contributors may be used to endorse or promote
- *       products derived from this software without specific prior written
- *       permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * NOTE:
- *   Although it is very similar, this license text is not identical
- *   to the "BSD-3-Clause", therefore, DO NOT MODIFY THIS LICENSE TEXT!
- */
-
-#include <config.h>
-#include <common.h>
-#include <image-sparse.h>
-#include <div64.h>
-#include <malloc.h>
-#include <part.h>
-#include <sparse_format.h>
-
-#include <linux/math64.h>
-
-#ifndef CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE
-#define CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE (1024 * 512)
-#endif
-
-static void default_log(const char *ignored) {}
-
-int write_sparse_image(struct sparse_storage *info,
-                      const char *part_name, void *data)
-{
-       lbaint_t blk;
-       lbaint_t blkcnt;
-       lbaint_t blks;
-       uint32_t bytes_written = 0;
-       unsigned int chunk;
-       unsigned int offset;
-       unsigned int chunk_data_sz;
-       uint32_t *fill_buf = NULL;
-       uint32_t fill_val;
-       sparse_header_t *sparse_header;
-       chunk_header_t *chunk_header;
-       uint32_t total_blocks = 0;
-       int fill_buf_num_blks;
-       int i;
-       int j;
-
-       fill_buf_num_blks = CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE / info->blksz;
-
-       /* Read and skip over sparse image header */
-       sparse_header = (sparse_header_t *)data;
-
-       data += sparse_header->file_hdr_sz;
-       if (sparse_header->file_hdr_sz > sizeof(sparse_header_t)) {
-               /*
-                * Skip the remaining bytes in a header that is longer than
-                * we expected.
-                */
-               data += (sparse_header->file_hdr_sz - sizeof(sparse_header_t));
-       }
-
-       if (!info->mssg)
-               info->mssg = default_log;
-
-       debug("=== Sparse Image Header ===\n");
-       debug("magic: 0x%x\n", sparse_header->magic);
-       debug("major_version: 0x%x\n", sparse_header->major_version);
-       debug("minor_version: 0x%x\n", sparse_header->minor_version);
-       debug("file_hdr_sz: %d\n", sparse_header->file_hdr_sz);
-       debug("chunk_hdr_sz: %d\n", sparse_header->chunk_hdr_sz);
-       debug("blk_sz: %d\n", sparse_header->blk_sz);
-       debug("total_blks: %d\n", sparse_header->total_blks);
-       debug("total_chunks: %d\n", sparse_header->total_chunks);
-
-       /*
-        * Verify that the sparse block size is a multiple of our
-        * storage backend block size
-        */
-       div_u64_rem(sparse_header->blk_sz, info->blksz, &offset);
-       if (offset) {
-               printf("%s: Sparse image block size issue [%u]\n",
-                      __func__, sparse_header->blk_sz);
-               info->mssg("sparse image block size issue");
-               return -1;
-       }
-
-       puts("Flashing Sparse Image\n");
-
-       /* Start processing chunks */
-       blk = info->start;
-       for (chunk = 0; chunk < sparse_header->total_chunks; chunk++) {
-               /* Read and skip over chunk header */
-               chunk_header = (chunk_header_t *)data;
-               data += sizeof(chunk_header_t);
-
-               if (chunk_header->chunk_type != CHUNK_TYPE_RAW) {
-                       debug("=== Chunk Header ===\n");
-                       debug("chunk_type: 0x%x\n", chunk_header->chunk_type);
-                       debug("chunk_data_sz: 0x%x\n", chunk_header->chunk_sz);
-                       debug("total_size: 0x%x\n", chunk_header->total_sz);
-               }
-
-               if (sparse_header->chunk_hdr_sz > sizeof(chunk_header_t)) {
-                       /*
-                        * Skip the remaining bytes in a header that is longer
-                        * than we expected.
-                        */
-                       data += (sparse_header->chunk_hdr_sz -
-                                sizeof(chunk_header_t));
-               }
-
-               chunk_data_sz = sparse_header->blk_sz * chunk_header->chunk_sz;
-               blkcnt = chunk_data_sz / info->blksz;
-               switch (chunk_header->chunk_type) {
-               case CHUNK_TYPE_RAW:
-                       if (chunk_header->total_sz !=
-                           (sparse_header->chunk_hdr_sz + chunk_data_sz)) {
-                               info->mssg("Bogus chunk size for chunk type Raw");
-                               return -1;
-                       }
-
-                       if (blk + blkcnt > info->start + info->size) {
-                               printf(
-                                   "%s: Request would exceed partition size!\n",
-                                   __func__);
-                               info->mssg("Request would exceed partition size!");
-                               return -1;
-                       }
-
-                       blks = info->write(info, blk, blkcnt, data);
-                       /* blks might be > blkcnt (eg. NAND bad-blocks) */
-                       if (blks < blkcnt) {
-                               printf("%s: %s" LBAFU " [" LBAFU "]\n",
-                                      __func__, "Write failed, block #",
-                                      blk, blks);
-                               info->mssg("flash write failure");
-                               return -1;
-                       }
-                       blk += blks;
-                       bytes_written += blkcnt * info->blksz;
-                       total_blocks += chunk_header->chunk_sz;
-                       data += chunk_data_sz;
-                       break;
-
-               case CHUNK_TYPE_FILL:
-                       if (chunk_header->total_sz !=
-                           (sparse_header->chunk_hdr_sz + sizeof(uint32_t))) {
-                               info->mssg("Bogus chunk size for chunk type FILL");
-                               return -1;
-                       }
-
-                       fill_buf = (uint32_t *)
-                                  memalign(ARCH_DMA_MINALIGN,
-                                           ROUNDUP(
-                                               info->blksz * fill_buf_num_blks,
-                                               ARCH_DMA_MINALIGN));
-                       if (!fill_buf) {
-                               info->mssg("Malloc failed for: CHUNK_TYPE_FILL");
-                               return -1;
-                       }
-
-                       fill_val = *(uint32_t *)data;
-                       data = (char *)data + sizeof(uint32_t);
-
-                       for (i = 0;
-                            i < (info->blksz * fill_buf_num_blks /
-                                 sizeof(fill_val));
-                            i++)
-                               fill_buf[i] = fill_val;
-
-                       if (blk + blkcnt > info->start + info->size) {
-                               printf(
-                                   "%s: Request would exceed partition size!\n",
-                                   __func__);
-                               info->mssg("Request would exceed partition size!");
-                               return -1;
-                       }
-
-                       for (i = 0; i < blkcnt;) {
-                               j = blkcnt - i;
-                               if (j > fill_buf_num_blks)
-                                       j = fill_buf_num_blks;
-                               blks = info->write(info, blk, j, fill_buf);
-                               /* blks might be > j (eg. NAND bad-blocks) */
-                               if (blks < j) {
-                                       printf("%s: %s " LBAFU " [%d]\n",
-                                              __func__,
-                                              "Write failed, block #",
-                                              blk, j);
-                                       info->mssg("flash write failure");
-                                       free(fill_buf);
-                                       return -1;
-                               }
-                               blk += blks;
-                               i += j;
-                       }
-                       bytes_written += blkcnt * info->blksz;
-                       total_blocks += chunk_data_sz / sparse_header->blk_sz;
-                       free(fill_buf);
-                       break;
-
-               case CHUNK_TYPE_DONT_CARE:
-                       blk += info->reserve(info, blk, blkcnt);
-                       total_blocks += chunk_header->chunk_sz;
-                       break;
-
-               case CHUNK_TYPE_CRC32:
-                       if (chunk_header->total_sz !=
-                           sparse_header->chunk_hdr_sz) {
-                               info->mssg("Bogus chunk size for chunk type Dont Care");
-                               return -1;
-                       }
-                       total_blocks += chunk_header->chunk_sz;
-                       data += chunk_data_sz;
-                       break;
-
-               default:
-                       printf("%s: Unknown chunk type: %x\n", __func__,
-                              chunk_header->chunk_type);
-                       info->mssg("Unknown chunk type");
-                       return -1;
-               }
-       }
-
-       debug("Wrote %d blocks, expected to write %d blocks\n",
-             total_blocks, sparse_header->total_blks);
-       printf("........ wrote %u bytes to '%s'\n", bytes_written, part_name);
-
-       if (total_blocks != sparse_header->total_blks) {
-               info->mssg("sparse image write failure");
-               return -1;
-       }
-
-       return 0;
-}
index 8e160d7cc4a8feb46b994f0908b357d43cdbaf4b..b8ec1e54dbcb4b83858632ced0872f8d30a8c314 100644 (file)
@@ -22,6 +22,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_AXP_ALDO3_VOLT=3300
 CONFIG_CONS_INDEX=2
 CONFIG_USB_EHCI_HCD=y
index 9d043e856a424403b57721cbd042bfa611f92e65..5657fc2594c2db153026824317f270893ad2bc3f 100644 (file)
@@ -20,6 +20,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_RGMII=y
 CONFIG_SUN7I_GMAC=y
index f2997c6fe54ca0567716b8a8f278de3a7fb917b2..134d1d3fef69add316087f88976d5a0b00e04209 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_RGMII=y
 CONFIG_SUN7I_GMAC=y
index 847945b6490801d09c38c808a265240188747939..3bb8c4c7e66702ef75d18e23564db3ad4e90c725 100644 (file)
@@ -18,6 +18,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_PHY_ADDR=3
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
index e56f2c71109b4da390cbed4ad6f002e1d592e303..cfb7ffa556f2c4c4bd07572e43c75a5d8ce35e1e 100644 (file)
@@ -17,6 +17,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_PHY_ADDR=3
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
index 2032a4aef8d9034a4cb53cc3d94fb98daeb7ec2a..2316437c9441c0b03662b67343cbdd4edf96f4c8 100644 (file)
@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="sun8i-r16-bananapi-m2m"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
 CONFIG_USB_FUNCTION_MASS_STORAGE=y
index f0bb4c9d5ce7155b73721c625fb91dfab5b14c06..601eb3ca0c0c4fb474b55afff6ae1d93d3de4bd3 100644 (file)
@@ -21,6 +21,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_RGMII=y
 CONFIG_SUN7I_GMAC=y
index 9e6267200b75ae36f74f830cca5b5e519ed533c8..394534b8b55ecd6e7365414c4f1461af84ab93e4 100644 (file)
@@ -18,6 +18,7 @@ CONFIG_CMD_DFU=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
index 5c01b20dff188ebd6249547ec804b100c7126801..31d2fe9cbfd19bece231a45262b2dc1a71483589 100644 (file)
@@ -16,9 +16,6 @@ CONFIG_AUTOBOOT_KEYED=y
 CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
 CONFIG_AUTOBOOT_DELAY_STR="d"
 CONFIG_AUTOBOOT_STOP_STR=" "
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 CONFIG_CMD_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
@@ -28,6 +25,10 @@ CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DFU_TFTP=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
index abbacdc77ec4b1657141fa51acdd38295c101d9e..baaae36d288c5a9822e5dadefc0644859049deff 100644 (file)
@@ -19,7 +19,7 @@ CONFIG_AUTOBOOT_KEYED=y
 CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
 CONFIG_AUTOBOOT_DELAY_STR="d"
 CONFIG_AUTOBOOT_STOP_STR=" "
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_CMD_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
index 6732013b03f5bf4a0beec22f36ec7e31f9febcb1..cc556d1c3d7b01e46889ac990058d51373619d6e 100644 (file)
@@ -13,7 +13,7 @@ CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_MUSB_NEW_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_CMD_SPL=y
 CONFIG_CMD_SPL_NAND_OFS=0x00080000
 # CONFIG_CMD_FLASH is not set
index bbde07fb1d64da69e73a5d6cf4a1ce7acef8eaa8..41a5c79604d6c746e7e3edf7dc6a58d25558cec1 100644 (file)
@@ -12,7 +12,7 @@ CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_MUSB_NEW_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_CMD_SPL=y
 CONFIG_CMD_SPL_NAND_OFS=0x00080000
 CONFIG_CMD_NAND=y
index 3ddcf649423c48a3665dd12052773f68c3d8655e..75d0793f2d2c7ee01e032d071ff26f81e2c463c8 100644 (file)
@@ -12,7 +12,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=physmap-flash.0"
index 10eb0fe1ee8cbf7914129ec033373fbd46c67e56..b2678875ecab6e9b9b838bafa650cfd6cee3273e 100644 (file)
@@ -15,7 +15,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_MUSB_NEW_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_MTDPARTS=y
index dc9ac216c215a2d215f6de72007e6bf9605bf546..44012919a366c741dcac5575d2763a2bd7beda75 100644 (file)
@@ -19,7 +19,7 @@ CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_USB_GADGET_SUPPORT=y
 CONFIG_SPL_USB_ETHER=y
 # CONFIG_SPL_YMODEM_SUPPORT is not set
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_CMD_SPL=y
 CONFIG_CMD_SPL_NAND_OFS=0x00080000
 # CONFIG_CMD_FLASH is not set
index 0e992684412ce8bf6b5d8d171234ab3693aaaffa..2d8e64e613aab3f03b34f7fff88d74eeb65a3e4e 100644 (file)
@@ -24,12 +24,6 @@ CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x82000000
-CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
-CONFIG_FASTBOOT_USB_DEV=1
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 CONFIG_CMD_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
@@ -45,6 +39,13 @@ CONFIG_SCSI_AHCI=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x82000000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
+CONFIG_FASTBOOT_USB_DEV=1
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
index 165c2a40ba084fa65a773bedfef459c3daca953c..3a73fdb2ca9d276d16cb0898b09eff6de73ded08 100644 (file)
@@ -29,12 +29,6 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x82000000
-CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
-CONFIG_FASTBOOT_USB_DEV=1
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_OF_CONTROL=y
@@ -48,6 +42,13 @@ CONFIG_SCSI_AHCI=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x82000000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
+CONFIG_FASTBOOT_USB_DEV=1
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
diff --git a/configs/ax25-ae350_defconfig b/configs/ax25-ae350_defconfig
new file mode 100644 (file)
index 0000000..5a69eb5
--- /dev/null
@@ -0,0 +1,47 @@
+CONFIG_RISCV=y
+CONFIG_SYS_TEXT_BASE=0x00000000
+CONFIG_DEFAULT_DEVICE_TREE="ae350"
+CONFIG_TARGET_AX25_AE350=y
+CONFIG_FIT=y
+CONFIG_BOOTDELAY=3
+CONFIG_BOARD_EARLY_INIT_F=y
+# CONFIG_AUTO_COMPLETE is not set
+CONFIG_SYS_PROMPT="RISC-V # "
+CONFIG_CMD_IMLS=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_SF_TEST=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_BOARD=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM=y
+CONFIG_CLK=y
+CONFIG_MMC=y
+CONFIG_DM_MMC=y
+CONFIG_FTSDC010=y
+CONFIG_FTSDC010_SDIO=y
+CONFIG_MTD=y
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_CFI_FLASH=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_DM_ETH=y
+CONFIG_FTMAC100=y
+CONFIG_BAUDRATE=38400
+CONFIG_DM_SERIAL=y
+CONFIG_SYS_NS16550=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_ATCSPI200_SPI=y
+CONFIG_TIMER=y
+CONFIG_ATCPIT100_TIMER=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_CPU_RISCV_64=y
index 9a986ca9ae8a8500ae75bb340e59e84c3ce3b4b8..de4fa60df7c9cc5bf336302a47cf8d285d0f27fc 100644 (file)
@@ -7,7 +7,7 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_HUSH_PARSER=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x80000000
 CONFIG_FASTBOOT_BUF_SIZE=0x1D000000
 CONFIG_FASTBOOT_FLASH=y
index d26cde5b0ed0954f063dbe71fb2808e2d37e255c..4f7a58e362a85c12b8eaa4ea487f527e11f462c4 100644 (file)
@@ -8,7 +8,7 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_HUSH_PARSER=y
 # CONFIG_AUTOBOOT is not set
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x80000000
 CONFIG_FASTBOOT_BUF_SIZE=0x7FF00000
 CONFIG_FASTBOOT_FLASH=y
index 51b3e6b4e1a1bbe9b9e5bfeef1fdb59bb8c41f84..3efd5669a74924c101bc01e844756eafd8b6d42a 100644 (file)
@@ -25,7 +25,7 @@ CONFIG_SPL_MUSB_NEW_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_YMODEM_SUPPORT=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x82000000
 CONFIG_CMD_SPL=y
 CONFIG_CMD_ASKENV=y
index 29b223a58062382f8fe96910427c81cda294cec2..2f981168734959abd53c06f8bfca747fdb2e307f 100644 (file)
@@ -25,7 +25,7 @@ CONFIG_SPL_MUSB_NEW_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_YMODEM_SUPPORT=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x82000000
 CONFIG_CMD_SPL=y
 CONFIG_CMD_ASKENV=y
diff --git a/configs/bitmain_antminer_s9_defconfig b/configs/bitmain_antminer_s9_defconfig
new file mode 100644 (file)
index 0000000..fc52da0
--- /dev/null
@@ -0,0 +1,66 @@
+CONFIG_ARM=y
+CONFIG_SYS_VENDOR="bitmain"
+CONFIG_SYS_BOARD="antminer_s9"
+CONFIG_SYS_CONFIG_NAME="bitmain_antminer_s9"
+CONFIG_ARCH_ZYNQ=y
+CONFIG_SYS_TEXT_BASE=0x4000000
+CONFIG_SPL=y
+CONFIG_SPL_STACK_R_ADDR=0x200000
+CONFIG_DEFAULT_DEVICE_TREE="bitmain-antminer-s9"
+CONFIG_DEBUG_UART=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_BOOTDELAY=3
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_SPL_STACK_R=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="antminer> "
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_ELF is not set
+# CONFIG_CMD_DM is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_FPGA_LOADBP=y
+CONFIG_CMD_FPGA_LOADFS=y
+CONFIG_CMD_FPGA_LOADMK=y
+CONFIG_CMD_FPGA_LOADP=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_NAND_LOCK_UNLOCK=y
+CONFIG_CMD_PART=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_PXE=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_OF_EMBED=y
+CONFIG_ENV_IS_IN_NAND=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xEFFFFF0
+CONFIG_FPGA_XILINX=y
+CONFIG_FPGA_ZYNQPL=y
+CONFIG_DM_GPIO=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ZYNQ=y
+CONFIG_NAND=y
+CONFIG_NAND_ZYNQ=y
+CONFIG_NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS=y
+CONFIG_ZYNQ_GEM=y
+CONFIG_DEBUG_UART_ZYNQ=y
+CONFIG_DEBUG_UART_BASE=0xe0001000
+CONFIG_DEBUG_UART_CLOCK=50000000
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_ZYNQ_SERIAL=y
+# CONFIG_WATCHDOG is not set
+CONFIG_WDT=y
+CONFIG_WDT_CDNS=y
+# CONFIG_EFI_LOADER is not set
index d4204aa7122067231fd256383894aa4192188ff5..241e9582a5a255a8a4263d2f964d98f7100f4730 100644 (file)
@@ -24,7 +24,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="CGT-QMX6-Quad U-Boot > "
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_DFU=y
index d1728ef6395ca67d891dc8efdd012de1445f8fa1..72ecdc69f6bfba160b7d8b4eacf86e8c24bb6f42 100644 (file)
@@ -16,8 +16,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -44,6 +42,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_SYS_I2C_ROCKCHIP=y
index 43d93f4637ad5ad74d4f9a7136c142254756cc0a..fb8400d06ef879ff8986216755e1c3733180fdc1 100644 (file)
@@ -18,8 +18,6 @@ CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -46,6 +44,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_SYS_I2C_ROCKCHIP=y
index 706809ca53fb8d70f8b1e699ba808acbef32c93b..a8776c9adfb80dd8fcaae2e91f10213bde793b3e 100644 (file)
@@ -17,8 +17,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -45,6 +43,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_SYS_I2C_ROCKCHIP=y
index 72db1e74a0aaa0703fcd918e8b249a8c8745d3ea..d054c21780c37293fd10a3db0f46677c331b29f9 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_NET2BIG_V2=y
 CONFIG_IDENT_STRING=" D2 v2"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-d2net"
 CONFIG_SYS_EXTRA_OPTIONS="D2NET_V2"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -26,6 +27,7 @@ CONFIG_CMD_FAT=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 # CONFIG_PARTITION_UUIDS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
@@ -39,4 +41,3 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT=y
index 9b81b0cc7168c1e27388efd1d7ad9654fea08b83..182f9a9ebfab6daf8838c5b9b52e8f5c1de96c8a 100644 (file)
@@ -25,11 +25,6 @@ CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x82000000
-CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 CONFIG_CMD_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
@@ -50,6 +45,12 @@ CONFIG_DWC_AHCI=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x82000000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_DM_GPIO=y
 CONFIG_PCF8575_GPIO=y
 CONFIG_DM_I2C=y
index 536946eb29007db39d6f247660f850308c4983a0..8584d41f1aa4100dd938329b07cc06b631492996 100644 (file)
@@ -30,11 +30,6 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x82000000
-CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_OF_CONTROL=y
@@ -50,6 +45,12 @@ CONFIG_DWC_AHCI=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x82000000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_DM_GPIO=y
 CONFIG_PCF8575_GPIO=y
 CONFIG_DM_I2C=y
index cbd2fb68ad928d4e31a37a37f902b23eeb9fc7fe..8090c9a377935656e1ab387baaf5483130abcf1d 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_DREAMPLUG=y
 CONFIG_IDENT_STRING="\nMarvell-DreamPlug"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-dreamplug"
 CONFIG_BOOTDELAY=3
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_HUSH_PARSER=y
@@ -19,6 +20,7 @@ CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_ISO_PARTITION=y
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
@@ -32,4 +34,3 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT=y
index 43e92d7ef29010d2f4c901ee1299e3399ca54b5e..c9207433b374d2fec33c43e3f5d2e020c2afeb20 100644 (file)
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_DS109=y
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-ds109"
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_IDE=y
@@ -14,6 +15,7 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_DATE=y
 CONFIG_CMD_FAT=y
 CONFIG_ISO_PARTITION=y
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
diff --git a/configs/emdk_defconfig b/configs/emdk_defconfig
new file mode 100644 (file)
index 0000000..e3bccd2
--- /dev/null
@@ -0,0 +1,31 @@
+CONFIG_ARC=y
+CONFIG_ISA_ARCV2=y
+CONFIG_CPU_ARCEM6=y
+CONFIG_TARGET_EMDK=y
+CONFIG_SYS_TEXT_BASE=0x00000000
+CONFIG_SYS_CLK_FREQ=40000000
+CONFIG_DEFAULT_DEVICE_TREE="emdk"
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_VERSION_VARIABLE=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="emdk# "
+# CONFIG_CMD_BOOTD is not set
+# CONFIG_CMD_ELF is not set
+# CONFIG_CMD_XIMG is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_EMBED=y
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_ENV_FAT_INTERFACE="mmc"
+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
+# CONFIG_NET is not set
+CONFIG_DM=y
+CONFIG_MMC=y
+CONFIG_MMC_DW=y
+CONFIG_DM_SERIAL=y
+CONFIG_SYS_NS16550=y
+CONFIG_FS_FAT_MAX_CLUSTSIZE=4096
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_PANIC_HANG=y
index 33775e8cdddbf1592aaf375a0b67f9c730dc6d8c..b9242e83e0a24501750ec20dcad59f6bad96d05e 100644 (file)
@@ -15,8 +15,6 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x0
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 # CONFIG_SPL_FRAMEWORK is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -31,6 +29,9 @@ CONFIG_SPL_PARTITION_UUIDS=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_LED=y
index 796d0ec92e67110a50af9c8f174980d4b84412ad..9c8252e95f6bae3b5a2452f7d11d7fdbe6530432 100644 (file)
@@ -7,10 +7,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_FASTBOOT_BUF_ADDR=0x60800800
-CONFIG_FASTBOOT_BUF_SIZE=0x04000000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -20,6 +16,11 @@ CONFIG_CMD_TIME=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_FASTBOOT_BUF_ADDR=0x60800800
+CONFIG_FASTBOOT_BUF_SIZE=0x04000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index 710b0b4e1a99afc8eab17d3a4eab88a849c9b333..7298bf1963ee7c6e6bcb94c9a441bc72b328947e 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_SETEXPR is not set
@@ -30,6 +28,9 @@ CONFIG_SYSCON=y
 CONFIG_SPL_SYSCON=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index 7695277daf350427d1b3b20688ba5a1fbb423ad8..a7beaa67288494f6124fd3ea14e608da3f641d31 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -41,6 +39,9 @@ CONFIG_SYSCON=y
 CONFIG_SPL_SYSCON=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_LED=y
index 78ae24b56b27fecf4e2d5c14c47ab317e72b6b9a..59bf9e519787fd429844e9d24d6ef60b5eb3959b 100644 (file)
@@ -8,9 +8,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_FASTBOOT_BUF_ADDR=0x800800
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
@@ -23,6 +20,10 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_FASTBOOT_BUF_ADDR=0x800800
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index efdd583cf6e5b34786aeea37cc55a27eeb8880b8..dbd6be55e240721f392af91c2fa6c4a0918310a7 100644 (file)
@@ -15,8 +15,6 @@ CONFIG_CONSOLE_MUX=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index b252d2746403e16cbaa1fb072945c50749ff8b00..83b4968c4a7fa3f3adaeae876ecb8edb6e9a8ef2 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_DM_KEYBOARD=y
index 0001457f5d08f702f34d963dd2b1bb21693be4df..40a128b8cbcc5032b1bfa6534870553b1c2836b3 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6dl-mamoj"
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 CONFIG_BOOTDELAY=3
 CONFIG_HUSH_PARSER=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_FASTBOOT_BUF_SIZE=0x10000000
 CONFIG_FASTBOOT_FLASH=y
index 9f8677b74471f43b54088e7a1784dca49e81ee84..2fb7209f31a68ca687b1134ce420f2d286121cbd 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_NETSPACE_V2=y
 CONFIG_IDENT_STRING=" IS v2"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-is2"
 CONFIG_SYS_EXTRA_OPTIONS="INETSPACE_V2"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -26,6 +27,7 @@ CONFIG_CMD_FAT=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 # CONFIG_PARTITION_UUIDS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
@@ -39,4 +41,3 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT=y
index 534d60484a078196137e796ff3f499304073bdd0..ce71e37011aeeef66af2d9900ed04f7930b3dd57 100644 (file)
@@ -12,7 +12,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=2
 CONFIG_SYS_PROMPT="kc1 # "
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x82000000
 CONFIG_FASTBOOT_BUF_SIZE=0x2000000
 CONFIG_FASTBOOT_FLASH=y
index 5d5b485cf716d44335e90d704490cdc013ac7a24..e41ec8990d98cebdea5145b47089ad193b9ff71e 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d00000
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile Kirkwood 128M16"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_KIRKWOOD_128M16"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_EEPROM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
index b07f36beaf477fabeea7ef6367c35f230f9f1ab1..fcab051ad63a132576e093dbda5188131cc1e61c 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d00000
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile Kirkwood"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_KIRKWOOD"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_EEPROM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
index 31dcd0ca1b17e99b589c2bf91128519c236fe567..4fc83a5ec8132b18f9d42acd7396dc0bcada961d 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d00000
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile Kirkwood PCI"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_KIRKWOOD_PCI"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_EEPROM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
index 116369acf79befce8ce7f787c1df48cc4983fdc1..4b1edb4c0a5a617118edbc9fe101888034454e96 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d00000
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile COGE5UN"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_COGE5UN"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
index be7421ca58a41e439b56287f517bbfdc0957e484..90d9a557b3f4f5e21fd29cb4ed826f395efbb22c 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d00000
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile NUSA"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_NUSA"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
index 535e8693b06703345f2e7e44965897a75bb1cd10..132db201ef3eec2078f743529572cd303573895b 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d00000
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile SUGP1"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_SUGP1"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
index 59522e733e6c1304b6135e51d8a322c944035695..7b5b016f2854c388f70b3407d5c44489d625dc88 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d00000
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile SUV31"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_SUV31"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
index ca53005ecb3de0fad14fd90c07121abf839948eb..373764aaf18e3831ee96b020e9cbd876d69a88ef 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x0
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 # CONFIG_SPL_FRAMEWORK is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -31,6 +29,9 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_LED=y
index 1ca3d1272c97b380bce45d7f93b9bf1723b66051..23e68a00ea5ddbf1f3908aa433dc022cfde19de3 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_LSXL=y
 CONFIG_IDENT_STRING=" LS-CHLv2"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-lschlv2"
 CONFIG_SYS_EXTRA_OPTIONS="LSCHLV2"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -28,6 +29,7 @@ CONFIG_CMD_FS_GENERIC=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 # CONFIG_PARTITION_UUIDS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_MVSATA_IDE=y
@@ -42,4 +44,3 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT=y
index c88fe37ab163d2baf968b5847aab0477e439c149..b523b68284aaecbfc6d699a90cb6f34d87d682f3 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_LSXL=y
 CONFIG_IDENT_STRING=" LS-XHL"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-lsxhl"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_EXTRA_OPTIONS="LSXHL"
 CONFIG_API=y
@@ -19,6 +20,7 @@ CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_MVSATA_IDE=y
@@ -33,4 +35,3 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT=y
index abf9cdcbfaacce7855d96d3a0f0e48824729545e..baee230c70410f24da313ac016c9d03099807fdf 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d00000
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile COGE3UN"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_MGCOGE3UN"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_EEPROM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
index f44537c88f40d7dc4d8ceaa1edf69df09ce6cd6d..5bfcb0c90bf14fdaa65e0b815de0215fba6dcc4f 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index e6f7cb9966db5d22261f16f794f22bb88a641368..4ba287fd09f260368da259ff4f2e38f2046b61b5 100644 (file)
@@ -30,7 +30,7 @@ CONFIG_CMD_MVEBU_BUBT=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_GPIO=y
 # CONFIG_MVEBU_GPIO is not set
index 63f210309b1d590b1d4e968f57be0109add46106..b7694ec24ac539b462a177840afdacdde92309a7 100644 (file)
@@ -30,7 +30,7 @@ CONFIG_CMD_MVEBU_BUBT=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MVTWSI=y
index 5a6d1e6b2a1b06b683d657484465c629d12f05fd..db11e515a5e0969af49a4b4a9ff453987a0abfc8 100644 (file)
@@ -30,7 +30,7 @@ CONFIG_CMD_MVEBU_BUBT=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
index de682d18f1fe2bd3ae0758ad30b97b847b4f8c19..545bb4fc05ae3547382ca3a01ce19c92aa26f298 100644 (file)
@@ -32,7 +32,7 @@ CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
index 966e823b40d7901c6248e0cfaa9714846bf97168..a4740d49cf428d240688b91313a96d3bbc4711d5 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_BOOTDELAY=3
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_CMD_MEMTEST=y
 CONFIG_SYS_ALT_MEMTEST=y
index ca37d8bef80ec8164f9ab6fbfc4a6ed9a53500a4..5c8e9de0819ffb91f27266e34d522bc5097d0abe 100644 (file)
@@ -22,7 +22,7 @@ CONFIG_SPL_USB_HOST_SUPPORT=y
 CONFIG_SPL_USB_GADGET_SUPPORT=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
 CONFIG_HUSH_PARSER=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_FASTBOOT_BUF_SIZE=0x10000000
 CONFIG_FASTBOOT_FLASH=y
index d486e4cd7bd2a607354e217b4b39132967a420b6..e7216556be926f13a66edc6de9e33b5079806079 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_NET2BIG_V2=y
 CONFIG_IDENT_STRING=" 2Big v2"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-net2big"
 CONFIG_SYS_EXTRA_OPTIONS="NET2BIG_V2"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -26,6 +27,7 @@ CONFIG_CMD_FAT=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 # CONFIG_PARTITION_UUIDS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
@@ -39,4 +41,3 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT=y
index d37146dc94bb6642a47c3dee84c21248408e2888..c0e3651e6e038c7f3e2ec25144cf6873c8c8740a 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_NETSPACE_V2=y
 CONFIG_IDENT_STRING=" NS v2 Lite"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-ns2lite"
 CONFIG_SYS_EXTRA_OPTIONS="NETSPACE_LITE_V2"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -26,6 +27,7 @@ CONFIG_CMD_FAT=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 # CONFIG_PARTITION_UUIDS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
@@ -39,4 +41,3 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT=y
index 9b639c017b3050171819fe20e182771a21dd4f3b..db75e6d550608718534d4d2b0d6ee933cd6a8873 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_NETSPACE_V2=y
 CONFIG_IDENT_STRING=" NS Max v2"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-ns2max"
 CONFIG_SYS_EXTRA_OPTIONS="NETSPACE_MAX_V2"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -26,6 +27,7 @@ CONFIG_CMD_FAT=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 # CONFIG_PARTITION_UUIDS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
@@ -39,4 +41,3 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT=y
index ee7554fd3f98ca6b4a697c83d901c2b938850cdc..fd774c722afb4be2a071bc4cfade78c2a604b83f 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_NETSPACE_V2=y
 CONFIG_IDENT_STRING=" NS v2 Mini"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-ns2mini"
 CONFIG_SYS_EXTRA_OPTIONS="NETSPACE_MINI_V2"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -24,6 +25,7 @@ CONFIG_CMD_EXT2=y
 CONFIG_CMD_FAT=y
 CONFIG_EFI_PARTITION=y
 # CONFIG_PARTITION_UUIDS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
@@ -34,4 +36,3 @@ CONFIG_MVGBE=y
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
-CONFIG_OF_LIBFDT=y
index 6421706de043aee326c03cb84daeb2da81e1fe62..ebdb16b16f5817f6100d0a21c9fd182a4e022243 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_NETSPACE_V2=y
 CONFIG_IDENT_STRING=" NS v2"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-ns2"
 CONFIG_SYS_EXTRA_OPTIONS="NETSPACE_V2"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -26,6 +27,7 @@ CONFIG_CMD_FAT=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 # CONFIG_PARTITION_UUIDS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
@@ -39,4 +41,3 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT=y
index 6ef4226db910a23d84dbc3fad26e8fc27539577b..cfb2ed8889d238d8445e2fba0d8f2789cbcc927c 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_MEMTEST=y
index b9784a2d23fed3698b6845392c4b41a1b49c386c..9cb7ac22d5441bccda5a75448b6dc02ef7d59f3f 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_MEMTEST=y
index 61688ba49e48fdf6b45291f3a4d9074c94ead62f..e31521a0609a685193725cc8dbff37a362978933 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_MEMTEST=y
index cfee7ba88916972ae84a0613e5d23232dda35ec7..85c352c6f0030acd00fcfb091bfc5bab78be4f13 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_MEMTEST=y
index 0f29a56c4646e6d3ce039ff29d9a64b7eb4d0ace..1f3732019da77e27028cafc55c92e2d3460006f7 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_MEMTEST=y
index 7ad1584af27fecab669e219899cc628d41e1283a..0696f09d5e68c3b8d834fc6b43819962071d1c98 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x12000000
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_MEMTEST=y
diff --git a/configs/nx25-ae250_defconfig b/configs/nx25-ae250_defconfig
deleted file mode 100644 (file)
index 4250775..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-CONFIG_RISCV=y
-CONFIG_SYS_TEXT_BASE=0x00000000
-CONFIG_DEFAULT_DEVICE_TREE="ae250"
-CONFIG_TARGET_NX25_AE250=y
-CONFIG_FIT=y
-CONFIG_BOOTDELAY=3
-# CONFIG_AUTO_COMPLETE is not set
-CONFIG_SYS_PROMPT="RISC-V # "
-CONFIG_CMD_MMC=y
-CONFIG_CMD_SF=y
-CONFIG_CMD_SF_TEST=y
-# CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_PING=y
-CONFIG_CMD_CACHE=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_FAT=y
-CONFIG_OF_CONTROL=y
-CONFIG_OF_BOARD=y
-CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_NET_RANDOM_ETHADDR=y
-CONFIG_DM=y
-CONFIG_CLK=y
-CONFIG_MMC=y
-CONFIG_DM_MMC=y
-CONFIG_FTSDC010=y
-CONFIG_FTSDC010_SDIO=y
-CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH=y
-CONFIG_SPI_FLASH_MACRONIX=y
-CONFIG_DM_ETH=y
-CONFIG_FTMAC100=y
-CONFIG_BAUDRATE=38400
-CONFIG_DM_SERIAL=y
-CONFIG_SYS_NS16550=y
-CONFIG_SPI=y
-CONFIG_DM_SPI=y
-CONFIG_ATCSPI200_SPI=y
-CONFIG_TIMER=y
-CONFIG_ATCPIT100_TIMER=y
index 7b81b039c9fd94a0cd6bb0b6af1ad80fb0123ad9..05dc73755f326f00ec54418be620a35f6cf3c0a0 100644 (file)
@@ -13,7 +13,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="BeagleBoard # "
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x82000000
 CONFIG_CMD_SPL=y
 CONFIG_CMD_SPL_NAND_OFS=0x280000
index 20795c3170fdd5492eacd439e039964c13f894e1..52285cc1651f82e64322c41d80ac517d321628df 100644 (file)
@@ -12,7 +12,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="OMAP3_EVM # "
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x82000000
 CONFIG_CMD_SPL=y
 CONFIG_CMD_SPL_NAND_OFS=0x280000
index 5a31e46dbaf5b00836aceaa06675ffe9914b2996..953980c95c962583be9f66593371bbf7ef9fdf9b 100644 (file)
@@ -13,7 +13,7 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="OMAP Logic # "
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x82000000
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_SPL=y
index 991e9b99aaba75eef2ff2051366cdb48cda39fdc..553a8d6572886519c9e5b899672f786148b15959 100644 (file)
@@ -15,6 +15,7 @@ CONFIG_DEFAULT_DEVICE_TREE="sun8i-r16-parrot"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_CONS_INDEX=5
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
index d78b6d57b6b87a9fc315bff0258db1b35bff1013..fc3b81c43c11ec114a65e39ab02afdd9d0139995 100644 (file)
@@ -17,8 +17,6 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_POWER_SUPPORT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -44,6 +42,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
index 2670b4b75aef890af8add7d19bdf55ee4a5ee55c..84c099560fa19c0b296581e00a33ccfac54290f4 100644 (file)
@@ -15,8 +15,6 @@ CONFIG_CONSOLE_MUX=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index cd9a82197464f7ed87091355e95be54719512b11..01d53ac1c394b81393c06a5050be189e604f2afd 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index ad22a1cbe2ff1f683479dc5c1773a41f5f9b8de5..70e485fab27c865376e46149ef488d12fbaac288 100644 (file)
@@ -13,7 +13,7 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=2
 # CONFIG_SPL_EXT_SUPPORT is not set
 CONFIG_SYS_PROMPT="sniper # "
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x82000000
 CONFIG_FASTBOOT_BUF_SIZE=0x2000000
 CONFIG_FASTBOOT_FLASH=y
index 67391bdfdf73e2e5c5e3d6ded08f027f9ac0d311..ba1ff25d355487e3c3329eb6e34dd072572a5ed3 100644 (file)
@@ -10,11 +10,6 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAS1,115200 CONSOLE=/dev/ttyAS1 consoleblank=0 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait mem=992M@0x40000000 vmalloc=256m"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SYS_PROMPT="stih410-b2260 => "
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x40000000
-CONFIG_FASTBOOT_BUF_SIZE=0x3DF00000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -26,6 +21,12 @@ CONFIG_OF_CONTROL=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x40000000
+CONFIG_FASTBOOT_BUF_SIZE=0x3DF00000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_MISC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_STI=y
index 3e3de4fbb30906a80af685ae067c387aeff1251e..5d58f5ceb4e24b4b5dc39f3696a764fd6e062007 100644 (file)
@@ -16,6 +16,7 @@ CONFIG_DEFAULT_DEVICE_TREE="sun8i-a83t-tbs-a711"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_AXP_DCDC5_VOLT=1200
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
index fb6bfa57ad7f917008020650cace9dadc371dc5f..e1c99c3828d7662abdd9903df131f852c21719de 100644 (file)
@@ -16,8 +16,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_I2C_SUPPORT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -43,6 +41,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
index 7dea7157dcde4032aa845749cfa3637a14a01fb7..3eb0479c6159d7b06817a8ecee16b516172514fa 100644 (file)
@@ -62,6 +62,8 @@ CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_MVEBU_A3700_UART=y
 CONFIG_MVEBU_A3700_SPI=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
index 70dc870fa99eb8aa8f1b942c5f146e8ab2f2b917..d5c083836da50fb56a1d0c3e1d1020d26ac290e5 100644 (file)
@@ -2,9 +2,9 @@ CONFIG_ARM=y
 CONFIG_ARCH_ZYNQMP=y
 CONFIG_SYS_TEXT_BASE=0x8000000
 CONFIG_SYS_MALLOC_F_LEN=0x8000
-# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_SPL=y
 # CONFIG_SPL_FAT_SUPPORT is not set
+# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_DEFAULT_DEVICE_TREE="zynqmp-zc1232-revA"
 CONFIG_DEBUG_UART=y
 CONFIG_DISTRO_DEFAULTS=y
index 09de18d8ffc5f055b82b42b1022fef458dafe7cc..40baccc07cd7c7803cfd7b5ae0a4e34a57a202cd 100644 (file)
@@ -2,9 +2,9 @@ CONFIG_ARM=y
 CONFIG_ARCH_ZYNQMP=y
 CONFIG_SYS_TEXT_BASE=0x8000000
 CONFIG_SYS_MALLOC_F_LEN=0x8000
-# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_SPL=y
 # CONFIG_SPL_FAT_SUPPORT is not set
+# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_DEFAULT_DEVICE_TREE="zynqmp-zc1254-revA"
 CONFIG_DEBUG_UART=y
 CONFIG_DISTRO_DEFAULTS=y
index a7e79f5d0e9018b026f312338815029716447901..542bfe2f449dbd3640f6bae6f384b70813cb2e08 100644 (file)
@@ -2,9 +2,9 @@ CONFIG_ARM=y
 CONFIG_ARCH_ZYNQMP=y
 CONFIG_SYS_TEXT_BASE=0x8000000
 CONFIG_SYS_MALLOC_F_LEN=0x8000
-# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_SPL=y
 # CONFIG_SPL_FAT_SUPPORT is not set
+# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_DEFAULT_DEVICE_TREE="zynqmp-zc1275-revA"
 CONFIG_DEBUG_UART=y
 CONFIG_DISTRO_DEFAULTS=y
index 823b50392c647fffb6103fe350af092b946f5147..92bb15ad03b2a9be49dab440bc5169a6ac94913c 100644 (file)
@@ -3,9 +3,9 @@ CONFIG_SYS_CONFIG_NAME="xilinx_zynqmp_zc1275_revB"
 CONFIG_ARCH_ZYNQMP=y
 CONFIG_SYS_TEXT_BASE=0x8000000
 CONFIG_SYS_MALLOC_F_LEN=0x8000
-# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_SPL=y
 # CONFIG_SPL_FAT_SUPPORT is not set
+# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_DEFAULT_DEVICE_TREE="zynqmp-zc1275-revB"
 CONFIG_DEBUG_UART=y
 CONFIG_DISTRO_DEFAULTS=y
index f5a33342fa64164836c1e42f1479123d367c35a4..779270c8cce20fb5dbaf7f042f0b28d44e801e62 100644 (file)
@@ -19,9 +19,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_MEMTEST=y
 CONFIG_SYS_ALT_MEMTEST=y
@@ -47,6 +44,10 @@ CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
@@ -54,6 +55,7 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_CADENCE=y
 CONFIG_MISC=y
 CONFIG_DM_MMC=y
+CONFIG_MMC_HS200_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ZYNQ=y
 CONFIG_SPI_FLASH=y
index 7f7ee558ee7ef25d14e8d826004ec263c142581d..b269696bc4763b41678081f073524c00f3179a76 100644 (file)
@@ -1,11 +1,10 @@
 CONFIG_ARM=y
-CONFIG_SYS_CONFIG_NAME="xilinx_zynqmp_zc1751_xm016_dc2"
 CONFIG_ARCH_ZYNQMP=y
 CONFIG_SYS_TEXT_BASE=0x8000000
 CONFIG_SYS_MALLOC_F_LEN=0x8000
-# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_SPL=y
 # CONFIG_SPL_FAT_SUPPORT is not set
+# CONFIG_SPL_LIBDISK_SUPPORT is not set
 CONFIG_ZYNQMP_USB=y
 CONFIG_DEFAULT_DEVICE_TREE="zynqmp-zc1751-xm016-dc2"
 CONFIG_DEBUG_UART=y
@@ -20,7 +19,7 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_MEMTEST=y
index 4cb3959f3626b655e1baddcfb64009839187b403..11708f7bd3886fb8add8893eb8a8473e73551f77 100644 (file)
@@ -19,9 +19,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_MEMTEST=y
@@ -31,6 +28,7 @@ CONFIG_CMD_DFU=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_FPGA_LOADBP=y
 CONFIG_CMD_FPGA_LOADP=y
+CONFIG_CMD_FPGA_LOAD_SECURE=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -50,6 +48,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_SATA_CEVA=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
index e989d1635c3092ee361f97811ce8a7c7161d59dd..3420ce5dc34aab6639c7c5c058e9a674f8410db7 100644 (file)
@@ -19,9 +19,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_MEMTEST=y
@@ -50,6 +47,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_SATA_CEVA=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
index bd67df904a2df1b7371896af379a3e72f7f8101a..a9ba4a17e9a3acb17a487d3c0f206811cfed2a39 100644 (file)
@@ -19,9 +19,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_MEMTEST=y
@@ -50,6 +47,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_SATA_CEVA=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
index a5fa33e366aec95201cca465f6271366cd92cf8c..32c6f232106c675e80947b150d2fc7e00bc3077f 100644 (file)
@@ -18,9 +18,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_MEMTEST=y
@@ -48,6 +45,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_SATA_CEVA=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
diff --git a/configs/zynq_minized_defconfig b/configs/zynq_minized_defconfig
new file mode 100644 (file)
index 0000000..8cf3215
--- /dev/null
@@ -0,0 +1,66 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ZYNQ=y
+CONFIG_SYS_TEXT_BASE=0x4000000
+CONFIG_SPL=y
+CONFIG_SPL_STACK_R_ADDR=0x200000
+CONFIG_DEFAULT_DEVICE_TREE="zynq-minized"
+CONFIG_DEBUG_UART=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_OS_BOOT=y
+CONFIG_SYS_PROMPT="Zynq> "
+CONFIG_CMD_THOR_DOWNLOAD=y
+CONFIG_CMD_DFU=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_FPGA_LOADBP=y
+CONFIG_CMD_FPGA_LOADFS=y
+CONFIG_CMD_FPGA_LOADMK=y
+CONFIG_CMD_FPGA_LOADP=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_TFTPPUT=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_FPGA_XILINX=y
+CONFIG_FPGA_ZYNQPL=y
+CONFIG_DM_GPIO=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ZYNQ=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_BAR=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_PHY_MARVELL=y
+CONFIG_PHY_REALTEK=y
+CONFIG_PHY_XILINX=y
+CONFIG_ZYNQ_GEM=y
+CONFIG_DEBUG_UART_ZYNQ=y
+CONFIG_DEBUG_UART_BASE=0xe0001000
+CONFIG_DEBUG_UART_CLOCK=50000000
+CONFIG_ZYNQ_SERIAL=y
+CONFIG_ZYNQ_QSPI=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_ULPI_VIEWPORT=y
+CONFIG_USB_ULPI=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="Xilinx"
+CONFIG_USB_GADGET_VENDOR_NUM=0x03fd
+CONFIG_USB_GADGET_PRODUCT_NUM=0x0300
+CONFIG_CI_UDC=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_FUNCTION_THOR=y
diff --git a/doc/README.AX25 b/doc/README.AX25
new file mode 100644 (file)
index 0000000..7a607dd
--- /dev/null
@@ -0,0 +1,46 @@
+AX25 is Andes CPU IP to adopt RISC-V architecture.
+
+Features
+========
+
+CPU Core
+ - 5-stage in-order execution pipeline
+ - Hardware Multiplier
+        - radix-2/radix-4/radix-16/radix-256/fast
+ - Hardware Divider
+ - Optional branch prediction
+ - Machine mode and optional user mode
+ - Optional performance monitoring
+
+ISA
+ - RV64I base integer instructions
+ - RVC for 16-bit compressed instructions
+ - RVM for multiplication and division instructions
+
+Memory subsystem
+ - I & D local memory
+   - Size: 4KB to 16MB
+ - Memory subsyetem soft-error protection
+   - Protection scheme: parity-checking or error-checking-and-correction (ECC)
+   - Automatic hardware error correction
+
+Bus
+ - Interface Protocol
+   - Synchronous AHB (32-bit/64-bit data-width), or
+   - Synchronous AXI4 (64-bit data-width)
+
+Power management
+ - Wait for interrupt (WFI) mode
+
+Debug
+ - Configurable number of breakpoints: 2/4/8
+ - External Debug Module
+   - AHB slave port
+ - External JTAG debug transport module
+
+Platform Level Interrupt Controller (PLIC)
+ - AHB slave port
+ - Configurable number of interrupts: 1-1023
+ - Configurable number of interrupt priorities: 3/7/15/63/127/255
+ - Configurable number of targets:  1-16
+ - Preempted interrupt priority stack
diff --git a/doc/README.NX25 b/doc/README.NX25
deleted file mode 100644 (file)
index 9f054e5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-NX25 is Andes CPU IP to adopt RISC-V architecture.
-
-Features
-========
-
-CPU Core
- - 5-stage in-order execution pipeline
- - Hardware Multiplier
-        - radix-2/radix-4/radix-16/radix-256/fast
- - Hardware Divider
- - Optional branch prediction
- - Machine mode and optional user mode
- - Optional performance monitoring
-
-ISA
- - RV64I base integer instructions
- - RVC for 16-bit compressed instructions
- - RVM for multiplication and division instructions
-
-Memory subsystem
- - I & D local memory
-   - Size: 4KB to 16MB
- - Memory subsyetem soft-error protection
-   - Protection scheme: parity-checking or error-checking-and-correction (ECC)
-   - Automatic hardware error correction
-
-Bus
- - Interface Protocol
-   - Synchronous AHB (32-bit/64-bit data-width), or
-   - Synchronous AXI4 (64-bit data-width)
-
-Power management
- - Wait for interrupt (WFI) mode
-
-Debug
- - Configurable number of breakpoints: 2/4/8
- - External Debug Module
-   - AHB slave port
- - External JTAG debug transport module
-
-Platform Level Interrupt Controller (PLIC)
- - AHB slave port
- - Configurable number of interrupts: 1-1023
- - Configurable number of interrupt priorities: 3/7/15/63/127/255
- - Configurable number of targets:  1-16
- - Preempted interrupt priority stack
diff --git a/doc/README.ae250 b/doc/README.ae250
deleted file mode 100644 (file)
index 77c168a..0000000
+++ /dev/null
@@ -1,275 +0,0 @@
-Andes Technology SoC AE250
-===========================
-
-AE250 is the mainline SoC produced by Andes Technology using NX25 CPU core
-base on RISC-V architecture.
-
-AE250 has integrated both AHB and APB bus and many periphals for application
-and product development.
-
-NX25-AE250
-=========
-
-NX25-AE250 is the SoC with AE250 hardcore CPU.
-
-Configurations
-==============
-
-CONFIG_SKIP_LOWLEVEL_INIT:
-       If you want to boot this system from SPI ROM and bypass e-bios (the
-       other boot loader on ROM). You should undefine CONFIG_SKIP_LOWLEVEL_INIT
-       in "include/configs/nx25-ae250.h".
-
-Build and boot steps
-====================
-
-build:
-1. Prepare the toolchains and make sure the $PATH to toolchains is correct.
-2. Use `make nx25-ae250_defconfig` in u-boot root to build the image.
-
-Verification
-====================
-
-Target
-====================
-1. startup
-2. relocation
-3. timer driver
-4. uart driver
-5. mac driver
-6. mmc driver
-7. spi driver
-
-Steps
-====================
-1. Define CONFIG_SKIP_LOWLEVEL_INIT to build u-boot which is loaded via gdb from ram.
-2. Undefine CONFIG_SKIP_LOWLEVEL_INIT to build u-boot which is booted from spi rom.
-3. Ping a server by mac driver
-4. Scan sd card and copy u-boot image which is booted from flash to ram by sd driver.
-5. Burn this u-boot image to spi rom by spi driver
-6. Re-boot u-boot from spi flash with power off and power on.
-
-Messages of U-Boot boot on AE250 board
-======================================
-U-Boot 2018.01-rc2-00033-g824f89a (Dec 21 2017 - 16:51:26 +0800)
-
-DRAM:  1 GiB
-MMC:   mmc@f0e00000: 0
-SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
-In:    serial@f0300000
-Out:   serial@f0300000
-Err:   serial@f0300000
-Net:
-Warning: mac@e0100000 (eth0) using random MAC address - be:dd:d7:e4:e8:10
-eth0: mac@e0100000
-
-RISC-V # version
-U-Boot 2018.01-rc2-00033-gb265b91-dirty (Dec 22 2017 - 13:54:21 +0800)
-
-riscv32-unknown-linux-gnu-gcc (GCC) 7.2.0
-GNU ld (GNU Binutils) 2.29
-
-RISC-V # setenv ipaddr 10.0.4.200 ;
-RISC-V # setenv serverip 10.0.4.97 ;
-RISC-V # ping 10.0.4.97 ;
-Using mac@e0100000 device
-host 10.0.4.97 is alive
-
-RISC-V # mmc rescan
-RISC-V # fatls mmc 0:1
-   318907   u-boot-ae250-64.bin
-     1252   hello_world_ae250_32.bin
-   328787   u-boot-ae250-32.bin
-
-3 file(s), 0 dir(s)
-
-RISC-V # sf probe 0:0 50000000 0
-SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
-
-RISC-V # sf test 0x100000 0x1000
-SPI flash test:
-0 erase: 36 ticks, 111 KiB/s 0.888 Mbps
-1 check: 29 ticks, 137 KiB/s 1.096 Mbps
-2 write: 40 ticks, 100 KiB/s 0.800 Mbps
-3 read: 20 ticks, 200 KiB/s 1.600 Mbps
-Test passed
-0 erase: 36 ticks, 111 KiB/s 0.888 Mbps
-1 check: 29 ticks, 137 KiB/s 1.096 Mbps
-2 write: 40 ticks, 100 KiB/s 0.800 Mbps
-3 read: 20 ticks, 200 KiB/s 1.600 Mbps
-
-RISC-V # fatload mmc 0:1 0x600000 u-boot-ae250-32.bin
-reading u-boot-ae250-32.bin
-328787 bytes read in 324 ms (990.2 KiB/s)
-
-RISC-V # sf erase 0x0 0x51000
-SF: 331776 bytes @ 0x0 Erased: OK
-
-RISC-V # sf write 0x600000 0x0 0x50453
-device 0 offset 0x0, size 0x50453
-SF: 328787 bytes @ 0x0 Written: OK
-
-RISC-V # crc32 0x600000 0x50453
-crc32 for 00600000 ... 00650452 ==> 692dc44a
-
-RISC-V # crc32 0x80000000 0x50453
-crc32 for 80000000 ... 80050452 ==> 692dc44a
-RISC-V #
-
-*** power-off and power-on, this U-Boot is booted from spi flash       ***
-
-U-Boot 2018.01-rc2-00032-gf67dd47-dirty (Dec 21 2017 - 13:56:03 +0800)
-
-DRAM:  1 GiB
-MMC:   mmc@f0e00000: 0
-SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
-In:    serial@f0300000
-Out:   serial@f0300000
-Err:   serial@f0300000
-Net:
-Warning: mac@e0100000 (eth0) using random MAC address - ee:4c:58:29:32:f5
-eth0: mac@e0100000
-RISC-V #
-
-
-Boot bbl and riscv-linux via U-Boot on QEMU
-===========================================
-1. Build riscv-linux
-2. Build bbl and riscv-linux with --with-payload
-3. Prepare ae250.dtb
-4. Creating OS-kernel images
-       ./mkimage -A riscv -O linux -T kernel -C none -a 0x0000 -e 0x0000 -d bbl.bin bootmImage-bbl.bin
-       Image Name:
-       Created:      Tue Mar 13 10:06:42 2018
-       Image Type:   RISC-V Linux Kernel Image (uncompressed)
-       Data Size:    17901204 Bytes = 17481.64 KiB = 17.07 MiB
-       Load Address: 00000000
-       Entry Point:  00000000
-
-4. Copy bootmImage-bbl.bin and ae250.dtb to qemu sd card image
-5. Message of booting riscv-linux from bbl via u-boot on qemu
-
-U-Boot 2018.03-rc4-00031-g2631273 (Mar 13 2018 - 15:02:55 +0800)
-
-DRAM:  1 GiB
-main-loop: WARNING: I/O thread spun for 1000 iterations
-MMC:   mmc@f0e00000: 0
-Loading Environment from SPI Flash... *** Warning - spi_flash_probe_bus_cs() failed, using default environment
-
-Failed (-22)
-In:    serial@f0300000
-Out:   serial@f0300000
-Err:   serial@f0300000
-Net:
-Warning: mac@e0100000 (eth0) using random MAC address - 02:00:00:00:00:00
-eth0: mac@e0100000
-RISC-V # mmc rescan
-RISC-V # mmc part
-
-Partition Map for MMC device 0  --   Partition Type: DOS
-
-Part    Start Sector    Num Sectors     UUID            Type
-RISC-V # fatls mmc 0:0
- 17901268   bootmImage-bbl.bin
-     1954   ae2xx.dtb
-
-2 file(s), 0 dir(s)
-
-RISC-V # fatload mmc 0:0 0x00600000 bootmImage-bbl.bin
-17901268 bytes read in 4642 ms (3.7 MiB/s)
-RISC-V # fatload mmc 0:0 0x2000000 ae250.dtb
-1954 bytes read in 1 ms (1.9 MiB/s)
-RISC-V # setenv bootm_size 0x2000000
-RISC-V # setenv fdt_high 0x1f00000
-RISC-V # bootm 0x00600000 - 0x2000000
-## Booting kernel from Legacy Image at 00600000 ...
-   Image Name:
-   Image Type:   RISC-V Linux Kernel Image (uncompressed)
-   Data Size:    17901204 Bytes = 17.1 MiB
-   Load Address: 00000000
-   Entry Point:  00000000
-   Verifying Checksum ... OK
-## Flattened Device Tree blob at 02000000
-   Booting using the fdt blob at 0x2000000
-   Loading Kernel Image ... OK
-   Loading Device Tree to 0000000001efc000, end 0000000001eff7a1 ... OK
-[    0.000000] OF: fdt: Ignoring memory range 0x0 - 0x200000
-[    0.000000] Linux version 4.14.0-00046-gf3e439f-dirty (rick@atcsqa06) (gcc version 7.1.1 20170509 (GCC)) #1 Tue Jan 9 16:34:25 CST 2018
-[    0.000000] bootconsole [early0] enabled
-[    0.000000] Initial ramdisk at: 0xffffffe000016a98 (12267008 bytes)
-[    0.000000] Zone ranges:
-[    0.000000]   DMA      [mem 0x0000000000200000-0x000000007fffffff]
-[    0.000000]   Normal   empty
-[    0.000000] Movable zone start for each node
-[    0.000000] Early memory node ranges
-[    0.000000]   node   0: [mem 0x0000000000200000-0x000000007fffffff]
-[    0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x000000007fffffff]
-[    0.000000] elf_hwcap is 0x112d
-[    0.000000] random: fast init done
-[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 516615
-[    0.000000] Kernel command line: console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0xf0300000 debug loglevel=7
-[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
-[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
-[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
-[    0.000000] Sorting __ex_table...
-[    0.000000] Memory: 2047832K/2095104K available (1856K kernel code, 204K rwdata, 532K rodata, 12076K init, 756K bss, 47272K reserved, 0K cma-reserved)
-[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
-[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
-[    0.000000] riscv,cpu_intc,0: 64 local interrupts mapped
-[    0.000000] riscv,plic0,e4000000: mapped 31 interrupts to 1/2 handlers
-[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
-[    0.000000] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
-[    0.000000] pid_max: default: 32768 minimum: 301
-[    0.004000] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
-[    0.004000] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
-[    0.056000] devtmpfs: initialized
-[    0.060000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
-[    0.064000] futex hash table entries: 256 (order: 0, 6144 bytes)
-[    0.068000] NET: Registered protocol family 16
-[    0.080000] vgaarb: loaded
-[    0.084000] clocksource: Switched to clocksource riscv_clocksource
-[    0.088000] NET: Registered protocol family 2
-[    0.092000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
-[    0.096000] TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
-[    0.096000] TCP: Hash tables configured (established 16384 bind 16384)
-[    0.100000] UDP hash table entries: 1024 (order: 3, 32768 bytes)
-[    0.100000] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
-[    0.104000] NET: Registered protocol family 1
-[    0.616000] Unpacking initramfs...
-[    1.220000] workingset: timestamp_bits=62 max_order=19 bucket_order=0
-[    1.244000] io scheduler noop registered
-[    1.244000] io scheduler cfq registered (default)
-[    1.244000] io scheduler mq-deadline registered
-[    1.248000] io scheduler kyber registered
-[    1.360000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
-[    1.368000] console [ttyS0] disabled
-[    1.372000] f0300000.serial: ttyS0 at MMIO 0xf0300020 (irq = 10, base_baud = 1228800) is a 16550A
-[    1.392000] console [ttyS0] enabled
-[    1.392000] ftmac100: Loading version 0.2 ...
-[    1.396000] ftmac100 e0100000.mac eth0: irq 8, mapped at ffffffd002005000
-[    1.400000] ftmac100 e0100000.mac eth0: generated random MAC address 6e:ac:c3:92:36:c0
-[    1.404000] IR NEC protocol handler initialized
-[    1.404000] IR RC5(x/sz) protocol handler initialized
-[    1.404000] IR RC6 protocol handler initialized
-[    1.404000] IR JVC protocol handler initialized
-[    1.408000] IR Sony protocol handler initialized
-[    1.408000] IR SANYO protocol handler initialized
-[    1.408000] IR Sharp protocol handler initialized
-[    1.408000] IR MCE Keyboard/mouse protocol handler initialized
-[    1.412000] IR XMP protocol handler initialized
-[    1.456000] ftsdc010 f0e00000.mmc: mmc0 - using hw SDIO IRQ
-[    1.464000] bootconsole [early0] uses init memory and must be disabled even before the real one is ready
-[    1.464000] bootconsole [early0] disabled
-[    1.508000] Freeing unused kernel memory: 12076K
-[    1.512000] This architecture does not have kernel memory protection.
-[    1.520000] mmc0: new SD card at address 4567
-[    1.524000] mmcblk0: mmc0:4567 QEMU! 20.0 MiB
-[    1.844000]  mmcblk0:
-Wed Dec  1 10:00:00 CST 2010
-/ #
-
-
-
-TODO
-==================================================
-Boot bbl and riscv-linux via U-Boot on AE250 board
diff --git a/doc/README.ae350 b/doc/README.ae350
new file mode 100644 (file)
index 0000000..fe75b80
--- /dev/null
@@ -0,0 +1,275 @@
+Andes Technology SoC AE350
+===========================
+
+AE350 is the mainline SoC produced by Andes Technology using AX25 CPU core
+base on RISC-V architecture.
+
+AE350 has integrated both AHB and APB bus and many periphals for application
+and product development.
+
+AX25-AE350
+=========
+
+AX25-AE350 is the SoC with AE350 hardcore CPU.
+
+Configurations
+==============
+
+CONFIG_SKIP_LOWLEVEL_INIT:
+       If you want to boot this system from SPI ROM and bypass e-bios (the
+       other boot loader on ROM). You should undefine CONFIG_SKIP_LOWLEVEL_INIT
+       in "include/configs/ax25-ae350.h".
+
+Build and boot steps
+====================
+
+build:
+1. Prepare the toolchains and make sure the $PATH to toolchains is correct.
+2. Use `make ax25-ae350_defconfig` in u-boot root to build the image.
+
+Verification
+====================
+
+Target
+====================
+1. startup
+2. relocation
+3. timer driver
+4. uart driver
+5. mac driver
+6. mmc driver
+7. spi driver
+
+Steps
+====================
+1. Define CONFIG_SKIP_LOWLEVEL_INIT to build u-boot which is loaded via gdb from ram.
+2. Undefine CONFIG_SKIP_LOWLEVEL_INIT to build u-boot which is booted from spi rom.
+3. Ping a server by mac driver
+4. Scan sd card and copy u-boot image which is booted from flash to ram by sd driver.
+5. Burn this u-boot image to spi rom by spi driver
+6. Re-boot u-boot from spi flash with power off and power on.
+
+Messages of U-Boot boot on AE350 board
+======================================
+U-Boot 2018.01-rc2-00033-g824f89a (Dec 21 2017 - 16:51:26 +0800)
+
+DRAM:  1 GiB
+MMC:   mmc@f0e00000: 0
+SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
+In:    serial@f0300000
+Out:   serial@f0300000
+Err:   serial@f0300000
+Net:
+Warning: mac@e0100000 (eth0) using random MAC address - be:dd:d7:e4:e8:10
+eth0: mac@e0100000
+
+RISC-V # version
+U-Boot 2018.01-rc2-00033-gb265b91-dirty (Dec 22 2017 - 13:54:21 +0800)
+
+riscv32-unknown-linux-gnu-gcc (GCC) 7.2.0
+GNU ld (GNU Binutils) 2.29
+
+RISC-V # setenv ipaddr 10.0.4.200 ;
+RISC-V # setenv serverip 10.0.4.97 ;
+RISC-V # ping 10.0.4.97 ;
+Using mac@e0100000 device
+host 10.0.4.97 is alive
+
+RISC-V # mmc rescan
+RISC-V # fatls mmc 0:1
+   318907   u-boot-ae350-64.bin
+     1252   hello_world_ae350_32.bin
+   328787   u-boot-ae350-32.bin
+
+3 file(s), 0 dir(s)
+
+RISC-V # sf probe 0:0 50000000 0
+SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
+
+RISC-V # sf test 0x100000 0x1000
+SPI flash test:
+0 erase: 36 ticks, 111 KiB/s 0.888 Mbps
+1 check: 29 ticks, 137 KiB/s 1.096 Mbps
+2 write: 40 ticks, 100 KiB/s 0.800 Mbps
+3 read: 20 ticks, 200 KiB/s 1.600 Mbps
+Test passed
+0 erase: 36 ticks, 111 KiB/s 0.888 Mbps
+1 check: 29 ticks, 137 KiB/s 1.096 Mbps
+2 write: 40 ticks, 100 KiB/s 0.800 Mbps
+3 read: 20 ticks, 200 KiB/s 1.600 Mbps
+
+RISC-V # fatload mmc 0:1 0x600000 u-boot-ae350-32.bin
+reading u-boot-ae350-32.bin
+328787 bytes read in 324 ms (990.2 KiB/s)
+
+RISC-V # sf erase 0x0 0x51000
+SF: 331776 bytes @ 0x0 Erased: OK
+
+RISC-V # sf write 0x600000 0x0 0x50453
+device 0 offset 0x0, size 0x50453
+SF: 328787 bytes @ 0x0 Written: OK
+
+RISC-V # crc32 0x600000 0x50453
+crc32 for 00600000 ... 00650452 ==> 692dc44a
+
+RISC-V # crc32 0x80000000 0x50453
+crc32 for 80000000 ... 80050452 ==> 692dc44a
+RISC-V #
+
+*** power-off and power-on, this U-Boot is booted from spi flash       ***
+
+U-Boot 2018.01-rc2-00032-gf67dd47-dirty (Dec 21 2017 - 13:56:03 +0800)
+
+DRAM:  1 GiB
+MMC:   mmc@f0e00000: 0
+SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
+In:    serial@f0300000
+Out:   serial@f0300000
+Err:   serial@f0300000
+Net:
+Warning: mac@e0100000 (eth0) using random MAC address - ee:4c:58:29:32:f5
+eth0: mac@e0100000
+RISC-V #
+
+
+Boot bbl and riscv-linux via U-Boot on QEMU
+===========================================
+1. Build riscv-linux
+2. Build bbl and riscv-linux with --with-payload
+3. Prepare ae350.dtb
+4. Creating OS-kernel images
+       ./mkimage -A riscv -O linux -T kernel -C none -a 0x0000 -e 0x0000 -d bbl.bin bootmImage-bbl.bin
+       Image Name:
+       Created:      Tue Mar 13 10:06:42 2018
+       Image Type:   RISC-V Linux Kernel Image (uncompressed)
+       Data Size:    17901204 Bytes = 17481.64 KiB = 17.07 MiB
+       Load Address: 00000000
+       Entry Point:  00000000
+
+4. Copy bootmImage-bbl.bin and ae350.dtb to qemu sd card image
+5. Message of booting riscv-linux from bbl via u-boot on qemu
+
+U-Boot 2018.03-rc4-00031-g2631273 (Mar 13 2018 - 15:02:55 +0800)
+
+DRAM:  1 GiB
+main-loop: WARNING: I/O thread spun for 1000 iterations
+MMC:   mmc@f0e00000: 0
+Loading Environment from SPI Flash... *** Warning - spi_flash_probe_bus_cs() failed, using default environment
+
+Failed (-22)
+In:    serial@f0300000
+Out:   serial@f0300000
+Err:   serial@f0300000
+Net:
+Warning: mac@e0100000 (eth0) using random MAC address - 02:00:00:00:00:00
+eth0: mac@e0100000
+RISC-V # mmc rescan
+RISC-V # mmc part
+
+Partition Map for MMC device 0  --   Partition Type: DOS
+
+Part    Start Sector    Num Sectors     UUID            Type
+RISC-V # fatls mmc 0:0
+ 17901268   bootmImage-bbl.bin
+     1954   ae2xx.dtb
+
+2 file(s), 0 dir(s)
+
+RISC-V # fatload mmc 0:0 0x00600000 bootmImage-bbl.bin
+17901268 bytes read in 4642 ms (3.7 MiB/s)
+RISC-V # fatload mmc 0:0 0x2000000 ae350.dtb
+1954 bytes read in 1 ms (1.9 MiB/s)
+RISC-V # setenv bootm_size 0x2000000
+RISC-V # setenv fdt_high 0x1f00000
+RISC-V # bootm 0x00600000 - 0x2000000
+## Booting kernel from Legacy Image at 00600000 ...
+   Image Name:
+   Image Type:   RISC-V Linux Kernel Image (uncompressed)
+   Data Size:    17901204 Bytes = 17.1 MiB
+   Load Address: 00000000
+   Entry Point:  00000000
+   Verifying Checksum ... OK
+## Flattened Device Tree blob at 02000000
+   Booting using the fdt blob at 0x2000000
+   Loading Kernel Image ... OK
+   Loading Device Tree to 0000000001efc000, end 0000000001eff7a1 ... OK
+[    0.000000] OF: fdt: Ignoring memory range 0x0 - 0x200000
+[    0.000000] Linux version 4.14.0-00046-gf3e439f-dirty (rick@atcsqa06) (gcc version 7.1.1 20170509 (GCC)) #1 Tue Jan 9 16:34:25 CST 2018
+[    0.000000] bootconsole [early0] enabled
+[    0.000000] Initial ramdisk at: 0xffffffe000016a98 (12267008 bytes)
+[    0.000000] Zone ranges:
+[    0.000000]   DMA      [mem 0x0000000000200000-0x000000007fffffff]
+[    0.000000]   Normal   empty
+[    0.000000] Movable zone start for each node
+[    0.000000] Early memory node ranges
+[    0.000000]   node   0: [mem 0x0000000000200000-0x000000007fffffff]
+[    0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x000000007fffffff]
+[    0.000000] elf_hwcap is 0x112d
+[    0.000000] random: fast init done
+[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 516615
+[    0.000000] Kernel command line: console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0xf0300000 debug loglevel=7
+[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
+[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
+[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
+[    0.000000] Sorting __ex_table...
+[    0.000000] Memory: 2047832K/2095104K available (1856K kernel code, 204K rwdata, 532K rodata, 12076K init, 756K bss, 47272K reserved, 0K cma-reserved)
+[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
+[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
+[    0.000000] riscv,cpu_intc,0: 64 local interrupts mapped
+[    0.000000] riscv,plic0,e4000000: mapped 31 interrupts to 1/2 handlers
+[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
+[    0.000000] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
+[    0.000000] pid_max: default: 32768 minimum: 301
+[    0.004000] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
+[    0.004000] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
+[    0.056000] devtmpfs: initialized
+[    0.060000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
+[    0.064000] futex hash table entries: 256 (order: 0, 6144 bytes)
+[    0.068000] NET: Registered protocol family 16
+[    0.080000] vgaarb: loaded
+[    0.084000] clocksource: Switched to clocksource riscv_clocksource
+[    0.088000] NET: Registered protocol family 2
+[    0.092000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
+[    0.096000] TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
+[    0.096000] TCP: Hash tables configured (established 16384 bind 16384)
+[    0.100000] UDP hash table entries: 1024 (order: 3, 32768 bytes)
+[    0.100000] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
+[    0.104000] NET: Registered protocol family 1
+[    0.616000] Unpacking initramfs...
+[    1.220000] workingset: timestamp_bits=62 max_order=19 bucket_order=0
+[    1.244000] io scheduler noop registered
+[    1.244000] io scheduler cfq registered (default)
+[    1.244000] io scheduler mq-deadline registered
+[    1.248000] io scheduler kyber registered
+[    1.360000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
+[    1.368000] console [ttyS0] disabled
+[    1.372000] f0300000.serial: ttyS0 at MMIO 0xf0300020 (irq = 10, base_baud = 1228800) is a 16550A
+[    1.392000] console [ttyS0] enabled
+[    1.392000] ftmac100: Loading version 0.2 ...
+[    1.396000] ftmac100 e0100000.mac eth0: irq 8, mapped at ffffffd002005000
+[    1.400000] ftmac100 e0100000.mac eth0: generated random MAC address 6e:ac:c3:92:36:c0
+[    1.404000] IR NEC protocol handler initialized
+[    1.404000] IR RC5(x/sz) protocol handler initialized
+[    1.404000] IR RC6 protocol handler initialized
+[    1.404000] IR JVC protocol handler initialized
+[    1.408000] IR Sony protocol handler initialized
+[    1.408000] IR SANYO protocol handler initialized
+[    1.408000] IR Sharp protocol handler initialized
+[    1.408000] IR MCE Keyboard/mouse protocol handler initialized
+[    1.412000] IR XMP protocol handler initialized
+[    1.456000] ftsdc010 f0e00000.mmc: mmc0 - using hw SDIO IRQ
+[    1.464000] bootconsole [early0] uses init memory and must be disabled even before the real one is ready
+[    1.464000] bootconsole [early0] disabled
+[    1.508000] Freeing unused kernel memory: 12076K
+[    1.512000] This architecture does not have kernel memory protection.
+[    1.520000] mmc0: new SD card at address 4567
+[    1.524000] mmcblk0: mmc0:4567 QEMU! 20.0 MiB
+[    1.844000]  mmcblk0:
+Wed Dec  1 10:00:00 CST 2010
+/ #
+
+
+
+TODO
+==================================================
+Boot bbl and riscv-linux via U-Boot on AE350 board
index 2c3ee7810a4fc8940e93e87e972f13fbac1a2423..431191c473f267e05b4df4774c9de49c020834b1 100644 (file)
+================
 Android Fastboot
-~~~~~~~~~~~~~~~~
+================
 
 Overview
 ========
-The protocol that is used over USB is described in
-README.android-fastboot-protocol in same directory.
 
-The current implementation is a minimal support of the erase command,the
-"oem format" command and flash command;it only supports eMMC devices.
+The protocol that is used over USB and UDP is described in the
+``README.android-fastboot-protocol`` file in the same directory.
+
+The current implementation supports the following standard commands:
+
+- ``boot``
+- ``continue``
+- ``download``
+- ``erase`` (if enabled)
+- ``flash`` (if enabled)
+- ``getvar``
+- ``reboot``
+- ``reboot-bootloader``
+- ``set_active`` (only a stub implementation which always succeeds)
+
+The following OEM commands are supported (if enabled):
+
+- oem format - this executes ``gpt write mmc %x $partitions``
+
+Support for both eMMC and NAND devices is included.
 
 Client installation
 ===================
-The counterpart to this gadget is the fastboot client which can
-be found in Android's platform/system/core repository in the fastboot
-folder. It runs on Windows, Linux and even OSX. Linux user are lucky since
-they only need libusb.
-Windows users need to bring some time until they have Android SDK (currently
-http://dl.google.com/android/installer_r12-windows.exe) installed. You
-need to install ADB package which contains the required glue libraries for
-accessing USB. Also you need "Google USB driver package" and "SDK platform
-tools". Once installed the usb driver is placed in your SDK folder under
-extras\google\usb_driver. The android_winusb.inf needs a line like
-
-   %SingleBootLoaderInterface% = USB_Install, USB\VID_0451&PID_D022
-
-either in the [Google.NTx86] section for 32bit Windows or [Google.NTamd64]
-for 64bit Windows. VID and PID should match whatever the fastboot is
-advertising.
+
+The counterpart to this is the fastboot client which can be found in
+Android's ``platform/system/core`` repository in the fastboot
+folder. It runs on Windows, Linux and OSX. The fastboot client is
+part of the Android SDK Platform-Tools and can be downloaded from:
+
+https://developer.android.com/studio/releases/platform-tools
 
 Board specific
 ==============
+
+USB configuration
+-----------------
+
 The fastboot gadget relies on the USB download gadget, so the following
 options must be configured:
 
-CONFIG_USB_GADGET_DOWNLOAD
-CONFIG_USB_GADGET_VENDOR_NUM
-CONFIG_USB_GADGET_PRODUCT_NUM
-CONFIG_USB_GADGET_MANUFACTURER
+::
+
+   CONFIG_USB_GADGET_DOWNLOAD
+   CONFIG_USB_GADGET_VENDOR_NUM
+   CONFIG_USB_GADGET_PRODUCT_NUM
+   CONFIG_USB_GADGET_MANUFACTURER
 
-NOTE: The CONFIG_USB_GADGET_VENDOR_NUM must be one of the numbers supported by
-the fastboot client. The list of vendor IDs supported can be found in the
-fastboot client source code (fastboot.c) mentioned above.
+NOTE: The ``CONFIG_USB_GADGET_VENDOR_NUM`` must be one of the numbers
+supported by the fastboot client. The list of vendor IDs supported can
+be found in the fastboot client source code.
 
-The fastboot function is enabled by defining CONFIG_USB_FUNCTION_FASTBOOT,
-CONFIG_CMD_FASTBOOT and CONFIG_ANDROID_BOOT_IMAGE.
+General configuration
+---------------------
 
-The fastboot protocol requires a large memory buffer for downloads. This
-buffer should be as large as possible for a platform. The location of the
-buffer and size are set with CONFIG_FASTBOOT_BUF_ADDR and
-CONFIG_FASTBOOT_BUF_SIZE.
+The fastboot protocol requires a large memory buffer for
+downloads. This buffer should be as large as possible for a
+platform. The location of the buffer and size are set with
+``CONFIG_FASTBOOT_BUF_ADDR`` and ``CONFIG_FASTBOOT_BUF_SIZE``. These
+may be overridden on the fastboot command line using ``-l`` and
+``-s``.
+
+Fastboot environment variables
+==============================
+
+Partition aliases
+-----------------
 
 Fastboot partition aliases can also be defined for devices where GPT
 limitations prevent user-friendly partition names such as "boot", "system"
 and "cache".  Or, where the actual partition name doesn't match a standard
-partition name used commonly with fastboot.  Current implentation checks
-aliases when accessing partitions by name (flash_write and erase functions).
-To define a partition alias add an environment variable similar to:
-fastboot_partition_alias_<alias partition name>=<actual partition name>
-Example: fastboot_partition_alias_boot=LNX
+partition name used commonly with fastboot.
+
+The current implementation checks aliases when accessing partitions by
+name (flash_write and erase functions).  To define a partition alias
+add an environment variable similar to:
+
+``fastboot_partition_alias_<alias partition name>=<actual partition name>``
+
+for example:
+
+``fastboot_partition_alias_boot=LNX``
+
+Variable overrides
+------------------
+
+Variables retrived through ``getvar`` can be overridden by defining
+environment variables of the form ``fastboot.<variable>``. These are
+looked up first so can be used to override values which would
+otherwise be returned. Using this mechanism you can also return types
+for NAND filesystems, as the fully parameterised variable is looked
+up, e.g.
+
+``fastboot.partition-type:boot=jffs2``
+
+Boot command
+------------
+
+When executing the fastboot ``boot`` command, if ``fastboot_bootcmd`` is set then
+that will be executed in place of ``bootm <CONFIG_FASTBOOT_BUF_ADDR>``.
 
 Partition Names
 ===============
-The Fastboot implementation in U-boot allows to write images into disk
-partitions (currently on eMMC). Target partitions are referred on the host
-computer by their names.
+
+The Fastboot implementation in U-Boot allows to write images into disk
+partitions. Target partitions are referred on the host computer by
+their names.
 
 For GPT/EFI the respective partition name is used.
 
 For MBR the partitions are referred by generic names according to the
 following schema:
 
-  <device type> <device index letter> <partition index>
+  <device type><device index letter><partition index>
 
-Example: hda3, sdb1, usbda1
+Example: ``hda3``, ``sdb1``, ``usbda1``
 
 The device type is as follows:
 
-  * IDE, ATAPI and SATA disks: hd
-  * SCSI disks: sd
-  * USB media: usbd
-  * MMC and SD cards: mmcsd
-  * Disk on chip: docd
-  * other: xx
+  * IDE, ATAPI and SATA disks: ``hd``
+  * SCSI disks: ``sd``
+  * USB media: ``usbd``
+  * MMC and SD cards: ``mmcsd``
+  * Disk on chip: ``docd``
+  * other: ``xx``
 
-The device index starts from 'a' and refers to the interface (e.g. USB
+The device index starts from ``a`` and refers to the interface (e.g. USB
 controller, SD/MMC controller) or disk index. The partition index starts
-from 1 and describes the partition number on the particular device.
+from ``1`` and describes the partition number on the particular device.
 
 Writing Partition Table
 =======================
+
 Fastboot also allows to write the partition table to the media. This can be
 done by writing the respective partition table image to a special target
 "gpt" or "mbr". These names can be customized by defining the following
 configuration options:
 
-CONFIG_FASTBOOT_GPT_NAME
-CONFIG_FASTBOOT_MBR_NAME
+::
+
+   CONFIG_FASTBOOT_GPT_NAME
+   CONFIG_FASTBOOT_MBR_NAME
 
 In Action
 =========
-Enter into fastboot by executing the fastboot command in u-boot and you
-should see:
-|GADGET DRIVER: usb_dnl_fastboot
+
+Enter into fastboot by executing the fastboot command in U-Boot for either USB:
+
+::
+
+   => fastboot usb 0
+
+or UDP:
+
+::
+
+   => fastboot udp
+   link up on port 0, speed 100, full duplex
+   Using ethernet@4a100000 device
+   Listening for fastboot command on 192.168.0.102
 
 On the client side you can fetch the bootloader version for instance:
-|>fastboot getvar bootloader-version
-|bootloader-version: U-Boot 2014.04-00005-gd24cabc
-|finished. total time: 0.000s
+
+::
+
+   $ fastboot getvar bootloader-version
+   bootloader-version: U-Boot 2014.04-00005-gd24cabc
+   finished. total time: 0.000s
 
 or initiate a reboot:
-|>fastboot reboot
+
+::
+
+   $ fastboot reboot
 
 and once the client comes back, the board should reset.
 
 You can also specify a kernel image to boot. You have to either specify
-the an image in Android format _or_ pass a binary kernel and let the
+the an image in Android format *or* pass a binary kernel and let the
 fastboot client wrap the Android suite around it. On OMAP for instance you
 take zImage kernel and pass it to the fastboot client:
 
-|>fastboot -b 0x80000000 -c "console=ttyO2 earlyprintk root=/dev/ram0
-|      mem=128M" boot zImage
-|creating boot image...
-|creating boot image - 1847296 bytes
-|downloading 'boot.img'...
-|OKAY [  2.766s]
-|booting...
-|OKAY [ -0.000s]
-|finished. total time: 2.766s
-
-and on the gadget side you should see:
-|Starting download of 1847296 bytes
-|........................................................
-|downloading of 1847296 bytes finished
-|Booting kernel..
-|## Booting Android Image at 0x81000000 ...
-|Kernel load addr 0x80008000 size 1801 KiB
-|Kernel command line: console=ttyO2 earlyprintk root=/dev/ram0 mem=128M
-|   Loading Kernel Image ... OK
-|OK
-|
-|Starting kernel ...
+::
+
+   $ fastboot -b 0x80000000 -c "console=ttyO2 earlyprintk root=/dev/ram0 mem=128M" boot zImage
+   creating boot image...
+   creating boot image - 1847296 bytes
+   downloading 'boot.img'...
+   OKAY [  2.766s]
+   booting...
+   OKAY [ -0.000s]
+   finished. total time: 2.766s
+
+and on the U-Boot side you should see:
+
+::
+
+   Starting download of 1847296 bytes
+   ........................................................
+   downloading of 1847296 bytes finished
+   Booting kernel..
+   ## Booting Android Image at 0x81000000 ...
+   Kernel load addr 0x80008000 size 1801 KiB
+   Kernel command line: console=ttyO2 earlyprintk root=/dev/ram0 mem=128M
+      Loading Kernel Image ... OK
+   OK
+
+   Starting kernel ...
index 5f86c0a00bfa75c5c04cd7cfc76509f6b746a2b4..1fc1bc66456a0062c3c69275f9979c77736cd7d1 100644 (file)
@@ -6,10 +6,10 @@ mpp pins or group of pins and a mpp function common to all pins.
 
 Required properties for the pinctrl driver:
 - compatible:  "marvell,mvebu-pinctrl",
-               "marvell,armada-ap806-pinctrl",
-               "marvell,a70x0-pinctrl",
-               "marvell,a80x0-cp0-pinctrl",
-               "marvell,a80x0-cp1-pinctrl"
+               "marvell,ap806-pinctrl",
+               "marvell,armada-7k-pinctrl",
+               "marvell,armada-8k-cpm-pinctrl",
+               "marvell,armada-8k-cps-pinctrl"
 - bank-name:   A string defining the pinc controller bank name
 - reg:                 A pair of values defining the pin controller base address
                and the address space
@@ -31,7 +31,7 @@ Example:
                config-space {
                        pinctl: pinctl@6F4000 {
                                compatible = "marvell,mvebu-pinctrl",
-                                            "marvell,armada-ap806-pinctrl";
+                                            "marvell,ap806-pinctrl";
                                bank-name ="apn-806";
                                reg = <0x6F4000 0x10>;
                                pin-count = <20>;
@@ -52,8 +52,8 @@ Example:
                config-space {
                        cpm_pinctl: pinctl@44000 {
                                compatible = "marvell,mvebu-pinctrl",
-                                            "marvell,a70x0-pinctrl",
-                                            "marvell,a80x0-cp0-pinctrl";
+                                            "marvell,armada-7k-pinctrl",
+                                            "marvell,armada-8k-cpm-pinctrl";
                                bank-name ="cp0-110";
                                reg = <0x440000 0x20>;
                                pin-count = <63>;
@@ -89,7 +89,7 @@ Example:
                config-space {
                        cps_pinctl: pinctl@44000 {
                                compatible = "marvell,mvebu-pinctrl",
-                                            "marvell,a80x0-cp1-pinctrl";
+                                            "marvell,armada-8k-cps-pinctrl";
                                bank-name ="cp1-110";
                                reg = <0x440000 0x20>;
                                pin-count = <63>;
index c2e813f5adf73762743245a95fd833991ed5cc64..8424898dbdc6226c645a2436c10c90c8370fe455 100644 (file)
@@ -28,6 +28,8 @@ source "drivers/dfu/Kconfig"
 
 source "drivers/dma/Kconfig"
 
+source "drivers/fastboot/Kconfig"
+
 source "drivers/firmware/Kconfig"
 
 source "drivers/fpga/Kconfig"
index b3f1b600a558cef08d1f750c1b42b27a6bb9ad51..d29a6e467b6c5d121d3b73152b7d3314e2af898a 100644 (file)
@@ -71,6 +71,7 @@ obj-y += block/
 obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/
 obj-$(CONFIG_CPU) += cpu/
 obj-y += crypto/
+obj-$(CONFIG_FASTBOOT) += fastboot/
 obj-y += firmware/
 obj-$(CONFIG_FPGA) += fpga/
 obj-y += misc/
index 86ec628104b2055a82cb67a2058c9376f0986142..49a056e9416a55333004d03c6e5d27ea63261267 100644 (file)
@@ -99,4 +99,15 @@ config SATA_SIL3114
        help
          Enable this driver to support the SIL3114 SATA controllers.
 
+config AHCI_MVEBU
+       bool "Marvell EBU AHCI SATA support"
+       depends on ARCH_MVEBU
+       depends on AHCI
+       select SCSI_AHCI
+       select DM_SCSI
+       help
+         This option enables support for the Marvell EBU SoC's
+         onboard AHCI SATA.
+
+         If unsure, say N.
 endmenu
index 02f02c8e8dd5140aa4856c819785465a68545766..10bed53bb3f297a119f4d1b0a59c96971d7b6c10 100644 (file)
@@ -17,3 +17,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o
 obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o
 obj-$(CONFIG_SATA_SIL) += sata_sil.o
 obj-$(CONFIG_SANDBOX) += sata_sandbox.o
+obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o
diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
new file mode 100644 (file)
index 0000000..6e3f17e
--- /dev/null
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 Stefan Roese <sr@denx.de>
+ */
+
+#include <common.h>
+#include <ahci.h>
+#include <dm.h>
+
+/*
+ * Dummy implementation that can be overwritten by a board
+ * specific function
+ */
+__weak int board_ahci_enable(void)
+{
+       return 0;
+}
+
+static int mvebu_ahci_bind(struct udevice *dev)
+{
+       struct udevice *scsi_dev;
+       int ret;
+
+       ret = ahci_bind_scsi(dev, &scsi_dev);
+       if (ret) {
+               debug("%s: Failed to bind (err=%d\n)", __func__, ret);
+               return ret;
+       }
+
+       return 0;
+}
+
+static int mvebu_ahci_probe(struct udevice *dev)
+{
+       /*
+        * Board specific SATA / AHCI enable code, e.g. enable the
+        * AHCI power or deassert reset
+        */
+       board_ahci_enable();
+
+       ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev));
+
+       return 0;
+}
+
+static const struct udevice_id mvebu_ahci_ids[] = {
+       { .compatible = "marvell,armada-3700-ahci" },
+       { .compatible = "marvell,armada-8k-ahci" },
+       { }
+};
+
+U_BOOT_DRIVER(ahci_mvebu_drv) = {
+       .name           = "ahci_mvebu",
+       .id             = UCLASS_AHCI,
+       .of_match       = mvebu_ahci_ids,
+       .bind           = mvebu_ahci_bind,
+       .probe          = mvebu_ahci_probe,
+};
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
new file mode 100644 (file)
index 0000000..bc25ea1
--- /dev/null
@@ -0,0 +1,137 @@
+menu "Fastboot support"
+
+config FASTBOOT
+       bool
+       imply ANDROID_BOOT_IMAGE
+       imply CMD_FASTBOOT
+
+config USB_FUNCTION_FASTBOOT
+       bool "Enable USB fastboot gadget"
+       depends on USB_GADGET
+       default y if ARCH_SUNXI && USB_MUSB_GADGET
+       select FASTBOOT
+       select USB_GADGET_DOWNLOAD
+       help
+         This enables the USB part of the fastboot gadget.
+
+config UDP_FUNCTION_FASTBOOT
+       depends on NET
+       select FASTBOOT
+       bool "Enable fastboot protocol over UDP"
+       help
+         This enables the fastboot protocol over UDP.
+
+if FASTBOOT
+
+config FASTBOOT_BUF_ADDR
+       hex "Define FASTBOOT buffer address"
+       default 0x82000000 if MX6SX || MX6SL || MX6UL || MX6SLL
+       default 0x81000000 if ARCH_OMAP2PLUS
+       default 0x42000000 if ARCH_SUNXI && !MACH_SUN9I
+       default 0x22000000 if ARCH_SUNXI && MACH_SUN9I
+       default 0x60800800 if ROCKCHIP_RK3036 || ROCKCHIP_RK3188 || \
+                               ROCKCHIP_RK322X
+       default 0x800800 if ROCKCHIP_RK3288 || ROCKCHIP_RK3329 || \
+                               ROCKCHIP_RK3399
+       default 0x280000 if ROCKCHIP_RK3368
+       default 0x100000 if ARCH_ZYNQMP
+       help
+         The fastboot protocol requires a large memory buffer for
+         downloads. Define this to the starting RAM address to use for
+         downloaded images.
+
+config FASTBOOT_BUF_SIZE
+       hex "Define FASTBOOT buffer size"
+       default 0x8000000 if ARCH_ROCKCHIP
+       default 0x6000000 if ARCH_ZYNQMP
+       default 0x2000000 if ARCH_SUNXI
+       default 0x7000000
+       help
+         The fastboot protocol requires a large memory buffer for
+         downloads. This buffer should be as large as possible for a
+         platform. Define this to the size available RAM for fastboot.
+
+config FASTBOOT_USB_DEV
+       int "USB controller number"
+       depends on USB_FUNCTION_FASTBOOT
+       default 0
+       help
+         Some boards have USB OTG controller other than 0. Define this
+         option so it can be used in compiled environment (e.g. in
+         CONFIG_BOOTCOMMAND).
+
+config FASTBOOT_FLASH
+       bool "Enable FASTBOOT FLASH command"
+       default y if ARCH_SUNXI
+       depends on MMC || (NAND && CMD_MTDPARTS)
+       select IMAGE_SPARSE
+       help
+         The fastboot protocol includes a "flash" command for writing
+         the downloaded image to a non-volatile storage device. Define
+         this to enable the "fastboot flash" command.
+
+choice
+       prompt "Flash provider for FASTBOOT"
+       depends on FASTBOOT_FLASH
+
+config FASTBOOT_FLASH_MMC
+       bool "FASTBOOT on MMC"
+       depends on MMC
+
+config FASTBOOT_FLASH_NAND
+       bool "FASTBOOT on NAND"
+       depends on NAND && CMD_MTDPARTS
+
+endchoice
+
+config FASTBOOT_FLASH_MMC_DEV
+       int "Define FASTBOOT MMC FLASH default device"
+       depends on FASTBOOT_FLASH_MMC
+       default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
+       default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
+       help
+         The fastboot "flash" command requires additional information
+         regarding the non-volatile storage device. Define this to
+         the eMMC device that fastboot should use to store the image.
+
+config FASTBOOT_FLASH_NAND_TRIMFFS
+       bool "Skip empty pages when flashing NAND"
+       depends on FASTBOOT_FLASH_NAND
+       help
+         When flashing NAND enable the DROP_FFS flag to drop trailing all-0xff
+         pages.
+
+config FASTBOOT_GPT_NAME
+       string "Target name for updating GPT"
+       depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
+       default "gpt"
+       help
+         The fastboot "flash" command supports writing the downloaded
+         image to the Protective MBR and the Primary GUID Partition
+         Table. (Additionally, this downloaded image is post-processed
+         to generate and write the Backup GUID Partition Table.)
+         This occurs when the specified "partition name" on the
+         "fastboot flash" command line matches the value defined here.
+         The default target name for updating GPT is "gpt".
+
+config FASTBOOT_MBR_NAME
+       string "Target name for updating MBR"
+       depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
+       default "mbr"
+       help
+         The fastboot "flash" command allows to write the downloaded image
+         to the Master Boot Record. This occurs when the "partition name"
+         specified on the "fastboot flash" command line matches the value
+         defined here. The default target name for updating MBR is "mbr".
+
+config FASTBOOT_CMD_OEM_FORMAT
+       bool "Enable the 'oem format' command"
+       depends on FASTBOOT_FLASH_MMC && CMD_GPT
+       help
+         Add support for the "oem format" command from a client. This
+         relies on the env variable partitions to contain the list of
+         partitions as required by the gpt command.
+
+endif # FASTBOOT
+
+endmenu
diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
new file mode 100644 (file)
index 0000000..a242156
--- /dev/null
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier:      GPL-2.0+
+
+obj-y += fb_common.o
+obj-y += fb_getvar.o
+obj-y += fb_command.o
+obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fb_mmc.o
+obj-$(CONFIG_FASTBOOT_FLASH_NAND) += fb_nand.o
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
new file mode 100644 (file)
index 0000000..200f991
--- /dev/null
@@ -0,0 +1,335 @@
+// SPDX-License-Identifier: BSD-2-Clause
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ */
+
+#include <common.h>
+#include <fastboot.h>
+#include <fastboot-internal.h>
+#include <fb_mmc.h>
+#include <fb_nand.h>
+#include <part.h>
+#include <stdlib.h>
+
+/**
+ * image_size - final fastboot image size
+ */
+static u32 image_size;
+
+/**
+ * fastboot_bytes_received - number of bytes received in the current download
+ */
+static u32 fastboot_bytes_received;
+
+/**
+ * fastboot_bytes_expected - number of bytes expected in the current download
+ */
+static u32 fastboot_bytes_expected;
+
+static void okay(char *, char *);
+static void getvar(char *, char *);
+static void download(char *, char *);
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
+static void flash(char *, char *);
+static void erase(char *, char *);
+#endif
+static void reboot_bootloader(char *, char *);
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+static void oem_format(char *, char *);
+#endif
+
+static const struct {
+       const char *command;
+       void (*dispatch)(char *cmd_parameter, char *response);
+} commands[FASTBOOT_COMMAND_COUNT] = {
+       [FASTBOOT_COMMAND_GETVAR] = {
+               .command = "getvar",
+               .dispatch = getvar
+       },
+       [FASTBOOT_COMMAND_DOWNLOAD] = {
+               .command = "download",
+               .dispatch = download
+       },
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
+       [FASTBOOT_COMMAND_FLASH] =  {
+               .command = "flash",
+               .dispatch = flash
+       },
+       [FASTBOOT_COMMAND_ERASE] =  {
+               .command = "erase",
+               .dispatch = erase
+       },
+#endif
+       [FASTBOOT_COMMAND_BOOT] =  {
+               .command = "boot",
+               .dispatch = okay
+       },
+       [FASTBOOT_COMMAND_CONTINUE] =  {
+               .command = "continue",
+               .dispatch = okay
+       },
+       [FASTBOOT_COMMAND_REBOOT] =  {
+               .command = "reboot",
+               .dispatch = okay
+       },
+       [FASTBOOT_COMMAND_REBOOT_BOOTLOADER] =  {
+               .command = "reboot-bootloader",
+               .dispatch = reboot_bootloader
+       },
+       [FASTBOOT_COMMAND_SET_ACTIVE] =  {
+               .command = "set_active",
+               .dispatch = okay
+       },
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+       [FASTBOOT_COMMAND_OEM_FORMAT] = {
+               .command = "oem format",
+               .dispatch = oem_format,
+       },
+#endif
+};
+
+/**
+ * fastboot_handle_command - Handle fastboot command
+ *
+ * @cmd_string: Pointer to command string
+ * @response: Pointer to fastboot response buffer
+ *
+ * Return: Executed command, or -1 if not recognized
+ */
+int fastboot_handle_command(char *cmd_string, char *response)
+{
+       int i;
+       char *cmd_parameter;
+
+       cmd_parameter = cmd_string;
+       strsep(&cmd_parameter, ":");
+
+       for (i = 0; i < FASTBOOT_COMMAND_COUNT; i++) {
+               if (!strcmp(commands[i].command, cmd_string)) {
+                       if (commands[i].dispatch) {
+                               commands[i].dispatch(cmd_parameter,
+                                                       response);
+                               return i;
+                       } else {
+                               break;
+                       }
+               }
+       }
+
+       pr_err("command %s not recognized.\n", cmd_string);
+       fastboot_fail("unrecognized command", response);
+       return -1;
+}
+
+/**
+ * okay() - Send bare OKAY response
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ *
+ * Send a bare OKAY fastboot response. This is used where the command is
+ * valid, but all the work is done after the response has been sent (e.g.
+ * boot, reboot etc.)
+ */
+static void okay(char *cmd_parameter, char *response)
+{
+       fastboot_okay(NULL, response);
+}
+
+/**
+ * getvar() - Read a config/version variable
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ */
+static void getvar(char *cmd_parameter, char *response)
+{
+       fastboot_getvar(cmd_parameter, response);
+}
+
+/**
+ * fastboot_download() - Start a download transfer from the client
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ */
+static void download(char *cmd_parameter, char *response)
+{
+       char *tmp;
+
+       if (!cmd_parameter) {
+               fastboot_fail("Expected command parameter", response);
+               return;
+       }
+       fastboot_bytes_received = 0;
+       fastboot_bytes_expected = simple_strtoul(cmd_parameter, &tmp, 16);
+       if (fastboot_bytes_expected == 0) {
+               fastboot_fail("Expected nonzero image size", response);
+               return;
+       }
+       /*
+        * Nothing to download yet. Response is of the form:
+        * [DATA|FAIL]$cmd_parameter
+        *
+        * where cmd_parameter is an 8 digit hexadecimal number
+        */
+       if (fastboot_bytes_expected > fastboot_buf_size) {
+               fastboot_fail(cmd_parameter, response);
+       } else {
+               printf("Starting download of %d bytes\n",
+                      fastboot_bytes_expected);
+               fastboot_response("DATA", response, "%s", cmd_parameter);
+       }
+}
+
+/**
+ * fastboot_data_remaining() - return bytes remaining in current transfer
+ *
+ * Return: Number of bytes left in the current download
+ */
+u32 fastboot_data_remaining(void)
+{
+       return fastboot_bytes_expected - fastboot_bytes_received;
+}
+
+/**
+ * fastboot_data_download() - Copy image data to fastboot_buf_addr.
+ *
+ * @fastboot_data: Pointer to received fastboot data
+ * @fastboot_data_len: Length of received fastboot data
+ * @response: Pointer to fastboot response buffer
+ *
+ * Copies image data from fastboot_data to fastboot_buf_addr. Writes to
+ * response. fastboot_bytes_received is updated to indicate the number
+ * of bytes that have been transferred.
+ *
+ * On completion sets image_size and ${filesize} to the total size of the
+ * downloaded image.
+ */
+void fastboot_data_download(const void *fastboot_data,
+                           unsigned int fastboot_data_len,
+                           char *response)
+{
+#define BYTES_PER_DOT  0x20000
+       u32 pre_dot_num, now_dot_num;
+
+       if (fastboot_data_len == 0 ||
+           (fastboot_bytes_received + fastboot_data_len) >
+           fastboot_bytes_expected) {
+               fastboot_fail("Received invalid data length",
+                             response);
+               return;
+       }
+       /* Download data to fastboot_buf_addr */
+       memcpy(fastboot_buf_addr + fastboot_bytes_received,
+              fastboot_data, fastboot_data_len);
+
+       pre_dot_num = fastboot_bytes_received / BYTES_PER_DOT;
+       fastboot_bytes_received += fastboot_data_len;
+       now_dot_num = fastboot_bytes_received / BYTES_PER_DOT;
+
+       if (pre_dot_num != now_dot_num) {
+               putc('.');
+               if (!(now_dot_num % 74))
+                       putc('\n');
+       }
+       *response = '\0';
+}
+
+/**
+ * fastboot_data_complete() - Mark current transfer complete
+ *
+ * @response: Pointer to fastboot response buffer
+ *
+ * Set image_size and ${filesize} to the total size of the downloaded image.
+ */
+void fastboot_data_complete(char *response)
+{
+       /* Download complete. Respond with "OKAY" */
+       fastboot_okay(NULL, response);
+       printf("\ndownloading of %d bytes finished\n", fastboot_bytes_received);
+       image_size = fastboot_bytes_received;
+       env_set_hex("filesize", image_size);
+       fastboot_bytes_expected = 0;
+       fastboot_bytes_received = 0;
+}
+
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
+/**
+ * flash() - write the downloaded image to the indicated partition.
+ *
+ * @cmd_parameter: Pointer to partition name
+ * @response: Pointer to fastboot response buffer
+ *
+ * Writes the previously downloaded image to the partition indicated by
+ * cmd_parameter. Writes to response.
+ */
+static void flash(char *cmd_parameter, char *response)
+{
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+       fastboot_mmc_flash_write(cmd_parameter, fastboot_buf_addr, image_size,
+                                response);
+#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
+       fastboot_nand_flash_write(cmd_parameter, fastboot_buf_addr, image_size,
+                                 response);
+#endif
+}
+
+/**
+ * erase() - erase the indicated partition.
+ *
+ * @cmd_parameter: Pointer to partition name
+ * @response: Pointer to fastboot response buffer
+ *
+ * Erases the partition indicated by cmd_parameter (clear to 0x00s). Writes
+ * to response.
+ */
+static void erase(char *cmd_parameter, char *response)
+{
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+       fastboot_mmc_erase(cmd_parameter, response);
+#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
+       fastboot_nand_erase(cmd_parameter, response);
+#endif
+}
+#endif
+
+/**
+ * reboot_bootloader() - Sets reboot bootloader flag.
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ */
+static void reboot_bootloader(char *cmd_parameter, char *response)
+{
+       if (fastboot_set_reboot_flag())
+               fastboot_fail("Cannot set reboot flag", response);
+       else
+               fastboot_okay(NULL, response);
+}
+
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+/**
+ * oem_format() - Execute the OEM format command
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ */
+static void oem_format(char *cmd_parameter, char *response)
+{
+       char cmdbuf[32];
+
+       if (!env_get("partitions")) {
+               fastboot_fail("partitions not set", response);
+       } else {
+               sprintf(cmdbuf, "gpt write mmc %x $partitions",
+                       CONFIG_FASTBOOT_FLASH_MMC_DEV);
+               if (run_command(cmdbuf, 0))
+                       fastboot_fail("", response);
+               else
+                       fastboot_okay(NULL, response);
+       }
+}
+#endif
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
new file mode 100644 (file)
index 0000000..c6e06aa
--- /dev/null
@@ -0,0 +1,169 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2008 - 2009
+ * Windriver, <www.windriver.com>
+ * Tom Rix <Tom.Rix@windriver.com>
+ *
+ * Copyright 2011 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ *
+ * Copyright 2014 Linaro, Ltd.
+ * Rob Herring <robh@kernel.org>
+ */
+
+#include <common.h>
+#include <fastboot.h>
+#include <net/fastboot.h>
+
+/**
+ * fastboot_buf_addr - base address of the fastboot download buffer
+ */
+void *fastboot_buf_addr;
+
+/**
+ * fastboot_buf_size - size of the fastboot download buffer
+ */
+u32 fastboot_buf_size;
+
+/**
+ * fastboot_progress_callback - callback executed during long operations
+ */
+void (*fastboot_progress_callback)(const char *msg);
+
+/**
+ * fastboot_response() - Writes a response of the form "$tag$reason".
+ *
+ * @tag: The first part of the response
+ * @response: Pointer to fastboot response buffer
+ * @format: printf style format string
+ */
+void fastboot_response(const char *tag, char *response,
+                      const char *format, ...)
+{
+       va_list args;
+
+       strlcpy(response, tag, FASTBOOT_RESPONSE_LEN);
+       if (format) {
+               va_start(args, format);
+               vsnprintf(response + strlen(response),
+                         FASTBOOT_RESPONSE_LEN - strlen(response) - 1,
+                         format, args);
+               va_end(args);
+       }
+}
+
+/**
+ * fastboot_fail() - Write a FAIL response of the form "FAIL$reason".
+ *
+ * @reason: Pointer to returned reason string
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_fail(const char *reason, char *response)
+{
+       fastboot_response("FAIL", response, "%s", reason);
+}
+
+/**
+ * fastboot_okay() - Write an OKAY response of the form "OKAY$reason".
+ *
+ * @reason: Pointer to returned reason string, or NULL to send a bare "OKAY"
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_okay(const char *reason, char *response)
+{
+       if (reason)
+               fastboot_response("OKAY", response, "%s", reason);
+       else
+               fastboot_response("OKAY", response, NULL);
+}
+
+/**
+ * fastboot_set_reboot_flag() - Set flag to indicate reboot-bootloader
+ *
+ * Set flag which indicates that we should reboot into the bootloader
+ * following the reboot that fastboot executes after this function.
+ *
+ * This function should be overridden in your board file with one
+ * which sets whatever flag your board specific Android bootloader flow
+ * requires in order to re-enter the bootloader.
+ */
+int __weak fastboot_set_reboot_flag(void)
+{
+       return -ENOSYS;
+}
+
+/**
+ * fastboot_get_progress_callback() - Return progress callback
+ *
+ * Return: Pointer to function called during long operations
+ */
+void (*fastboot_get_progress_callback(void))(const char *)
+{
+       return fastboot_progress_callback;
+}
+
+/**
+ * fastboot_boot() - Execute fastboot boot command
+ *
+ * If ${fastboot_bootcmd} is set, run that command to execute the boot
+ * process, if that returns, then exit the fastboot server and return
+ * control to the caller.
+ *
+ * Otherwise execute "bootm <fastboot_buf_addr>", if that fails, reset
+ * the board.
+ */
+void fastboot_boot(void)
+{
+       char *s;
+
+       s = env_get("fastboot_bootcmd");
+       if (s) {
+               run_command(s, CMD_FLAG_ENV);
+       } else {
+               static char boot_addr_start[12];
+               static char *const bootm_args[] = {
+                       "bootm", boot_addr_start, NULL
+               };
+
+               snprintf(boot_addr_start, sizeof(boot_addr_start) - 1,
+                        "0x%p", fastboot_buf_addr);
+               printf("Booting kernel at %s...\n\n\n", boot_addr_start);
+
+               do_bootm(NULL, 0, 2, bootm_args);
+
+               /*
+                * This only happens if image is somehow faulty so we start
+                * over. We deliberately leave this policy to the invocation
+                * of fastbootcmd if that's what's being run
+                */
+               do_reset(NULL, 0, 0, NULL);
+       }
+}
+
+/**
+ * fastboot_set_progress_callback() - set progress callback
+ *
+ * @progress: Pointer to progress callback
+ *
+ * Set a callback which is invoked periodically during long running operations
+ * (flash and erase). This can be used (for example) by the UDP transport to
+ * send INFO responses to keep the client alive whilst those commands are
+ * executing.
+ */
+void fastboot_set_progress_callback(void (*progress)(const char *msg))
+{
+       fastboot_progress_callback = progress;
+}
+
+/*
+ * fastboot_init() - initialise new fastboot protocol session
+ *
+ * @buf_addr: Pointer to download buffer, or NULL for default
+ * @buf_size: Size of download buffer, or zero for default
+ */
+void fastboot_init(void *buf_addr, u32 buf_size)
+{
+       fastboot_buf_addr = buf_addr ? buf_addr :
+                                      (void *)CONFIG_FASTBOOT_BUF_ADDR;
+       fastboot_buf_size = buf_size ? buf_size : CONFIG_FASTBOOT_BUF_SIZE;
+       fastboot_set_progress_callback(NULL);
+}
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
new file mode 100644 (file)
index 0000000..4d264c9
--- /dev/null
@@ -0,0 +1,230 @@
+// SPDX-License-Identifier: BSD-2-Clause
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ */
+
+#include <common.h>
+#include <fastboot.h>
+#include <fastboot-internal.h>
+#include <fb_mmc.h>
+#include <fb_nand.h>
+#include <fs.h>
+#include <version.h>
+
+static void getvar_version(char *var_parameter, char *response);
+static void getvar_bootloader_version(char *var_parameter, char *response);
+static void getvar_downloadsize(char *var_parameter, char *response);
+static void getvar_serialno(char *var_parameter, char *response);
+static void getvar_version_baseband(char *var_parameter, char *response);
+static void getvar_product(char *var_parameter, char *response);
+static void getvar_current_slot(char *var_parameter, char *response);
+static void getvar_slot_suffixes(char *var_parameter, char *response);
+static void getvar_has_slot(char *var_parameter, char *response);
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+static void getvar_partition_type(char *part_name, char *response);
+#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
+static void getvar_partition_size(char *part_name, char *response);
+#endif
+
+static const struct {
+       const char *variable;
+       void (*dispatch)(char *var_parameter, char *response);
+} getvar_dispatch[] = {
+       {
+               .variable = "version",
+               .dispatch = getvar_version
+       }, {
+               .variable = "bootloader-version",
+               .dispatch = getvar_bootloader_version
+       }, {
+               .variable = "version-bootloader",
+               .dispatch = getvar_bootloader_version
+       }, {
+               .variable = "downloadsize",
+               .dispatch = getvar_downloadsize
+       }, {
+               .variable = "max-download-size",
+               .dispatch = getvar_downloadsize
+       }, {
+               .variable = "serialno",
+               .dispatch = getvar_serialno
+       }, {
+               .variable = "version-baseband",
+               .dispatch = getvar_version_baseband
+       }, {
+               .variable = "product",
+               .dispatch = getvar_product
+       }, {
+               .variable = "current-slot",
+               .dispatch = getvar_current_slot
+       }, {
+               .variable = "slot-suffixes",
+               .dispatch = getvar_slot_suffixes
+       }, {
+               .variable = "has_slot",
+               .dispatch = getvar_has_slot
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+       }, {
+               .variable = "partition-type",
+               .dispatch = getvar_partition_type
+#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
+       }, {
+               .variable = "partition-size",
+               .dispatch = getvar_partition_size
+#endif
+       }
+};
+
+static void getvar_version(char *var_parameter, char *response)
+{
+       fastboot_okay(FASTBOOT_VERSION, response);
+}
+
+static void getvar_bootloader_version(char *var_parameter, char *response)
+{
+       fastboot_okay(U_BOOT_VERSION, response);
+}
+
+static void getvar_downloadsize(char *var_parameter, char *response)
+{
+       fastboot_response("OKAY", response, "0x%08x", fastboot_buf_size);
+}
+
+static void getvar_serialno(char *var_parameter, char *response)
+{
+       const char *tmp = env_get("serial#");
+
+       if (tmp)
+               fastboot_okay(tmp, response);
+       else
+               fastboot_fail("Value not set", response);
+}
+
+static void getvar_version_baseband(char *var_parameter, char *response)
+{
+       fastboot_okay("N/A", response);
+}
+
+static void getvar_product(char *var_parameter, char *response)
+{
+       const char *board = env_get("board");
+
+       if (board)
+               fastboot_okay(board, response);
+       else
+               fastboot_fail("Board not set", response);
+}
+
+static void getvar_current_slot(char *var_parameter, char *response)
+{
+       /* A/B not implemented, for now always return _a */
+       fastboot_okay("_a", response);
+}
+
+static void getvar_slot_suffixes(char *var_parameter, char *response)
+{
+       fastboot_okay("_a,_b", response);
+}
+
+static void getvar_has_slot(char *part_name, char *response)
+{
+       if (part_name && (!strcmp(part_name, "boot") ||
+                         !strcmp(part_name, "system")))
+               fastboot_okay("yes", response);
+       else
+               fastboot_okay("no", response);
+}
+
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+static void getvar_partition_type(char *part_name, char *response)
+{
+       int r;
+       struct blk_desc *dev_desc;
+       disk_partition_t part_info;
+
+       r = fastboot_mmc_get_part_info(part_name, &dev_desc, &part_info,
+                                      response);
+       if (r >= 0) {
+               r = fs_set_blk_dev_with_part(dev_desc, r);
+               if (r < 0)
+                       fastboot_fail("failed to set partition", response);
+               else
+                       fastboot_okay(fs_get_type_name(), response);
+       }
+}
+#endif
+
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
+static void getvar_partition_size(char *part_name, char *response)
+{
+       int r;
+       size_t size;
+
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+       struct blk_desc *dev_desc;
+       disk_partition_t part_info;
+
+       r = fastboot_mmc_get_part_info(part_name, &dev_desc, &part_info,
+                                      response);
+       if (r >= 0)
+               size = part_info.size;
+#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
+       struct part_info *part_info;
+
+       r = fastboot_nand_get_part_info(part_name, &part_info, response);
+       if (r >= 0)
+               size = part_info->size;
+#endif
+       if (r >= 0)
+               fastboot_response("OKAY", response, "0x%016zx", size);
+}
+#endif
+
+/**
+ * fastboot_getvar() - Writes variable indicated by cmd_parameter to response.
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ *
+ * Look up cmd_parameter first as an environment variable of the form
+ * fastboot.<cmd_parameter>, if that exists return use its value to set
+ * response.
+ *
+ * Otherwise lookup the name of variable and execute the appropriate
+ * function to return the requested value.
+ */
+void fastboot_getvar(char *cmd_parameter, char *response)
+{
+       if (!cmd_parameter) {
+               fastboot_fail("missing var", response);
+       } else {
+#define FASTBOOT_ENV_PREFIX    "fastboot."
+               int i;
+               char *var_parameter = cmd_parameter;
+               char envstr[FASTBOOT_RESPONSE_LEN];
+               const char *s;
+
+               snprintf(envstr, sizeof(envstr) - 1,
+                        FASTBOOT_ENV_PREFIX "%s", cmd_parameter);
+               s = env_get(envstr);
+               if (s) {
+                       fastboot_response("OKAY", response, "%s", s);
+                       return;
+               }
+
+               strsep(&var_parameter, ":");
+               for (i = 0; i < ARRAY_SIZE(getvar_dispatch); ++i) {
+                       if (!strcmp(getvar_dispatch[i].variable,
+                                   cmd_parameter)) {
+                               getvar_dispatch[i].dispatch(var_parameter,
+                                                           response);
+                               return;
+                       }
+               }
+               pr_warn("WARNING: unknown variable: %s\n", cmd_parameter);
+               fastboot_fail("Variable not implemented", response);
+       }
+}
diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
new file mode 100644 (file)
index 0000000..4c1c7fd
--- /dev/null
@@ -0,0 +1,488 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2014 Broadcom Corporation.
+ */
+
+#include <config.h>
+#include <common.h>
+#include <blk.h>
+#include <fastboot.h>
+#include <fastboot-internal.h>
+#include <fb_mmc.h>
+#include <image-sparse.h>
+#include <part.h>
+#include <mmc.h>
+#include <div64.h>
+#include <linux/compat.h>
+#include <android_image.h>
+
+#define FASTBOOT_MAX_BLK_WRITE 16384
+
+#define BOOT_PARTITION_NAME "boot"
+
+struct fb_mmc_sparse {
+       struct blk_desc *dev_desc;
+};
+
+static int part_get_info_by_name_or_alias(struct blk_desc *dev_desc,
+               const char *name, disk_partition_t *info)
+{
+       int ret;
+
+       ret = part_get_info_by_name(dev_desc, name, info);
+       if (ret < 0) {
+               /* strlen("fastboot_partition_alias_") + 32(part_name) + 1 */
+               char env_alias_name[25 + 32 + 1];
+               char *aliased_part_name;
+
+               /* check for alias */
+               strcpy(env_alias_name, "fastboot_partition_alias_");
+               strncat(env_alias_name, name, 32);
+               aliased_part_name = env_get(env_alias_name);
+               if (aliased_part_name != NULL)
+                       ret = part_get_info_by_name(dev_desc,
+                                       aliased_part_name, info);
+       }
+       return ret;
+}
+
+/**
+ * fb_mmc_blk_write() - Write/erase MMC in chunks of FASTBOOT_MAX_BLK_WRITE
+ *
+ * @block_dev: Pointer to block device
+ * @start: First block to write/erase
+ * @blkcnt: Count of blocks
+ * @buffer: Pointer to data buffer for write or NULL for erase
+ */
+static lbaint_t fb_mmc_blk_write(struct blk_desc *block_dev, lbaint_t start,
+                                lbaint_t blkcnt, const void *buffer)
+{
+       lbaint_t blk = start;
+       lbaint_t blks_written;
+       lbaint_t cur_blkcnt;
+       lbaint_t blks = 0;
+       int i;
+
+       for (i = 0; i < blkcnt; i += FASTBOOT_MAX_BLK_WRITE) {
+               cur_blkcnt = min((int)blkcnt - i, FASTBOOT_MAX_BLK_WRITE);
+               if (buffer) {
+                       if (fastboot_progress_callback)
+                               fastboot_progress_callback("writing");
+                       blks_written = blk_dwrite(block_dev, blk, cur_blkcnt,
+                                                 buffer + (i * block_dev->blksz));
+               } else {
+                       if (fastboot_progress_callback)
+                               fastboot_progress_callback("erasing");
+                       blks_written = blk_derase(block_dev, blk, cur_blkcnt);
+               }
+               blk += blks_written;
+               blks += blks_written;
+       }
+       return blks;
+}
+
+static lbaint_t fb_mmc_sparse_write(struct sparse_storage *info,
+               lbaint_t blk, lbaint_t blkcnt, const void *buffer)
+{
+       struct fb_mmc_sparse *sparse = info->priv;
+       struct blk_desc *dev_desc = sparse->dev_desc;
+
+       return fb_mmc_blk_write(dev_desc, blk, blkcnt, buffer);
+}
+
+static lbaint_t fb_mmc_sparse_reserve(struct sparse_storage *info,
+               lbaint_t blk, lbaint_t blkcnt)
+{
+       return blkcnt;
+}
+
+static void write_raw_image(struct blk_desc *dev_desc, disk_partition_t *info,
+               const char *part_name, void *buffer,
+               u32 download_bytes, char *response)
+{
+       lbaint_t blkcnt;
+       lbaint_t blks;
+
+       /* determine number of blocks to write */
+       blkcnt = ((download_bytes + (info->blksz - 1)) & ~(info->blksz - 1));
+       blkcnt = lldiv(blkcnt, info->blksz);
+
+       if (blkcnt > info->size) {
+               pr_err("too large for partition: '%s'\n", part_name);
+               fastboot_fail("too large for partition", response);
+               return;
+       }
+
+       puts("Flashing Raw Image\n");
+
+       blks = fb_mmc_blk_write(dev_desc, info->start, blkcnt, buffer);
+
+       if (blks != blkcnt) {
+               pr_err("failed writing to device %d\n", dev_desc->devnum);
+               fastboot_fail("failed writing to device", response);
+               return;
+       }
+
+       printf("........ wrote " LBAFU " bytes to '%s'\n", blkcnt * info->blksz,
+              part_name);
+       fastboot_okay(NULL, response);
+}
+
+#ifdef CONFIG_ANDROID_BOOT_IMAGE
+/**
+ * Read Android boot image header from boot partition.
+ *
+ * @param[in] dev_desc MMC device descriptor
+ * @param[in] info Boot partition info
+ * @param[out] hdr Where to store read boot image header
+ *
+ * @return Boot image header sectors count or 0 on error
+ */
+static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
+                                      disk_partition_t *info,
+                                      struct andr_img_hdr *hdr,
+                                      char *response)
+{
+       ulong sector_size;              /* boot partition sector size */
+       lbaint_t hdr_sectors;           /* boot image header sectors count */
+       int res;
+
+       /* Calculate boot image sectors count */
+       sector_size = info->blksz;
+       hdr_sectors = DIV_ROUND_UP(sizeof(struct andr_img_hdr), sector_size);
+       if (hdr_sectors == 0) {
+               pr_err("invalid number of boot sectors: 0\n");
+               fastboot_fail("invalid number of boot sectors: 0", response);
+               return 0;
+       }
+
+       /* Read the boot image header */
+       res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr);
+       if (res != hdr_sectors) {
+               pr_err("cannot read header from boot partition\n");
+               fastboot_fail("cannot read header from boot partition",
+                             response);
+               return 0;
+       }
+
+       /* Check boot header magic string */
+       res = android_image_check_header(hdr);
+       if (res != 0) {
+               pr_err("bad boot image magic\n");
+               fastboot_fail("boot partition not initialized", response);
+               return 0;
+       }
+
+       return hdr_sectors;
+}
+
+/**
+ * Write downloaded zImage to boot partition and repack it properly.
+ *
+ * @param dev_desc MMC device descriptor
+ * @param download_buffer Address to fastboot buffer with zImage in it
+ * @param download_bytes Size of fastboot buffer, in bytes
+ *
+ * @return 0 on success or -1 on error
+ */
+static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
+                               void *download_buffer,
+                               u32 download_bytes,
+                               char *response)
+{
+       uintptr_t hdr_addr;                     /* boot image header address */
+       struct andr_img_hdr *hdr;               /* boot image header */
+       lbaint_t hdr_sectors;                   /* boot image header sectors */
+       u8 *ramdisk_buffer;
+       u32 ramdisk_sector_start;
+       u32 ramdisk_sectors;
+       u32 kernel_sector_start;
+       u32 kernel_sectors;
+       u32 sectors_per_page;
+       disk_partition_t info;
+       int res;
+
+       puts("Flashing zImage\n");
+
+       /* Get boot partition info */
+       res = part_get_info_by_name(dev_desc, BOOT_PARTITION_NAME, &info);
+       if (res < 0) {
+               pr_err("cannot find boot partition\n");
+               fastboot_fail("cannot find boot partition", response);
+               return -1;
+       }
+
+       /* Put boot image header in fastboot buffer after downloaded zImage */
+       hdr_addr = (uintptr_t)download_buffer + ALIGN(download_bytes, PAGE_SIZE);
+       hdr = (struct andr_img_hdr *)hdr_addr;
+
+       /* Read boot image header */
+       hdr_sectors = fb_mmc_get_boot_header(dev_desc, &info, hdr, response);
+       if (hdr_sectors == 0) {
+               pr_err("unable to read boot image header\n");
+               fastboot_fail("unable to read boot image header", response);
+               return -1;
+       }
+
+       /* Check if boot image has second stage in it (we don't support it) */
+       if (hdr->second_size > 0) {
+               pr_err("moving second stage is not supported yet\n");
+               fastboot_fail("moving second stage is not supported yet",
+                             response);
+               return -1;
+       }
+
+       /* Extract ramdisk location */
+       sectors_per_page = hdr->page_size / info.blksz;
+       ramdisk_sector_start = info.start + sectors_per_page;
+       ramdisk_sector_start += DIV_ROUND_UP(hdr->kernel_size, hdr->page_size) *
+                                            sectors_per_page;
+       ramdisk_sectors = DIV_ROUND_UP(hdr->ramdisk_size, hdr->page_size) *
+                                      sectors_per_page;
+
+       /* Read ramdisk and put it in fastboot buffer after boot image header */
+       ramdisk_buffer = (u8 *)hdr + (hdr_sectors * info.blksz);
+       res = blk_dread(dev_desc, ramdisk_sector_start, ramdisk_sectors,
+                       ramdisk_buffer);
+       if (res != ramdisk_sectors) {
+               pr_err("cannot read ramdisk from boot partition\n");
+               fastboot_fail("cannot read ramdisk from boot partition",
+                             response);
+               return -1;
+       }
+
+       /* Write new kernel size to boot image header */
+       hdr->kernel_size = download_bytes;
+       res = blk_dwrite(dev_desc, info.start, hdr_sectors, (void *)hdr);
+       if (res == 0) {
+               pr_err("cannot writeback boot image header\n");
+               fastboot_fail("cannot write back boot image header", response);
+               return -1;
+       }
+
+       /* Write the new downloaded kernel */
+       kernel_sector_start = info.start + sectors_per_page;
+       kernel_sectors = DIV_ROUND_UP(hdr->kernel_size, hdr->page_size) *
+                                     sectors_per_page;
+       res = blk_dwrite(dev_desc, kernel_sector_start, kernel_sectors,
+                        download_buffer);
+       if (res == 0) {
+               pr_err("cannot write new kernel\n");
+               fastboot_fail("cannot write new kernel", response);
+               return -1;
+       }
+
+       /* Write the saved ramdisk back */
+       ramdisk_sector_start = info.start + sectors_per_page;
+       ramdisk_sector_start += DIV_ROUND_UP(hdr->kernel_size, hdr->page_size) *
+                                            sectors_per_page;
+       res = blk_dwrite(dev_desc, ramdisk_sector_start, ramdisk_sectors,
+                        ramdisk_buffer);
+       if (res == 0) {
+               pr_err("cannot write back original ramdisk\n");
+               fastboot_fail("cannot write back original ramdisk", response);
+               return -1;
+       }
+
+       puts("........ zImage was updated in boot partition\n");
+       fastboot_okay(NULL, response);
+       return 0;
+}
+#endif
+
+/**
+ * fastboot_mmc_get_part_info() - Lookup eMMC partion by name
+ *
+ * @part_name: Named partition to lookup
+ * @dev_desc: Pointer to returned blk_desc pointer
+ * @part_info: Pointer to returned disk_partition_t
+ * @response: Pointer to fastboot response buffer
+ */
+int fastboot_mmc_get_part_info(char *part_name, struct blk_desc **dev_desc,
+                              disk_partition_t *part_info, char *response)
+{
+       int r;
+
+       *dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+       if (!*dev_desc) {
+               fastboot_fail("block device not found", response);
+               return -ENOENT;
+       }
+       if (!part_name) {
+               fastboot_fail("partition not found", response);
+               return -ENOENT;
+       }
+
+       r = part_get_info_by_name_or_alias(*dev_desc, part_name, part_info);
+       if (r < 0) {
+               fastboot_fail("partition not found", response);
+               return r;
+       }
+
+       return r;
+}
+
+/**
+ * fastboot_mmc_flash_write() - Write image to eMMC for fastboot
+ *
+ * @cmd: Named partition to write image to
+ * @download_buffer: Pointer to image data
+ * @download_bytes: Size of image data
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
+                             u32 download_bytes, char *response)
+{
+       struct blk_desc *dev_desc;
+       disk_partition_t info;
+
+       dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+       if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
+               pr_err("invalid mmc device\n");
+               fastboot_fail("invalid mmc device", response);
+               return;
+       }
+
+#if CONFIG_IS_ENABLED(EFI_PARTITION)
+       if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
+               printf("%s: updating MBR, Primary and Backup GPT(s)\n",
+                      __func__);
+               if (is_valid_gpt_buf(dev_desc, download_buffer)) {
+                       printf("%s: invalid GPT - refusing to write to flash\n",
+                              __func__);
+                       fastboot_fail("invalid GPT partition", response);
+                       return;
+               }
+               if (write_mbr_and_gpt_partitions(dev_desc, download_buffer)) {
+                       printf("%s: writing GPT partitions failed\n", __func__);
+                       fastboot_fail("writing GPT partitions failed",
+                                     response);
+                       return;
+               }
+               printf("........ success\n");
+               fastboot_okay(NULL, response);
+               return;
+       }
+#endif
+
+#if CONFIG_IS_ENABLED(DOS_PARTITION)
+       if (strcmp(cmd, CONFIG_FASTBOOT_MBR_NAME) == 0) {
+               printf("%s: updating MBR\n", __func__);
+               if (is_valid_dos_buf(download_buffer)) {
+                       printf("%s: invalid MBR - refusing to write to flash\n",
+                              __func__);
+                       fastboot_fail("invalid MBR partition", response);
+                       return;
+               }
+               if (write_mbr_partition(dev_desc, download_buffer)) {
+                       printf("%s: writing MBR partition failed\n", __func__);
+                       fastboot_fail("writing MBR partition failed",
+                                     response);
+                       return;
+               }
+               printf("........ success\n");
+               fastboot_okay(NULL, response);
+               return;
+       }
+#endif
+
+#ifdef CONFIG_ANDROID_BOOT_IMAGE
+       if (strncasecmp(cmd, "zimage", 6) == 0) {
+               fb_mmc_update_zimage(dev_desc, download_buffer,
+                                    download_bytes, response);
+               return;
+       }
+#endif
+
+       if (part_get_info_by_name_or_alias(dev_desc, cmd, &info) < 0) {
+               pr_err("cannot find partition: '%s'\n", cmd);
+               fastboot_fail("cannot find partition", response);
+               return;
+       }
+
+       if (is_sparse_image(download_buffer)) {
+               struct fb_mmc_sparse sparse_priv;
+               struct sparse_storage sparse;
+               int err;
+
+               sparse_priv.dev_desc = dev_desc;
+
+               sparse.blksz = info.blksz;
+               sparse.start = info.start;
+               sparse.size = info.size;
+               sparse.write = fb_mmc_sparse_write;
+               sparse.reserve = fb_mmc_sparse_reserve;
+               sparse.mssg = fastboot_fail;
+
+               printf("Flashing sparse image at offset " LBAFU "\n",
+                      sparse.start);
+
+               sparse.priv = &sparse_priv;
+               err = write_sparse_image(&sparse, cmd, download_buffer,
+                                        response);
+               if (!err)
+                       fastboot_okay(NULL, response);
+       } else {
+               write_raw_image(dev_desc, &info, cmd, download_buffer,
+                               download_bytes, response);
+       }
+}
+
+/**
+ * fastboot_mmc_flash_erase() - Erase eMMC for fastboot
+ *
+ * @cmd: Named partition to erase
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_mmc_erase(const char *cmd, char *response)
+{
+       int ret;
+       struct blk_desc *dev_desc;
+       disk_partition_t info;
+       lbaint_t blks, blks_start, blks_size, grp_size;
+       struct mmc *mmc = find_mmc_device(CONFIG_FASTBOOT_FLASH_MMC_DEV);
+
+       if (mmc == NULL) {
+               pr_err("invalid mmc device\n");
+               fastboot_fail("invalid mmc device", response);
+               return;
+       }
+
+       dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+       if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
+               pr_err("invalid mmc device\n");
+               fastboot_fail("invalid mmc device", response);
+               return;
+       }
+
+       ret = part_get_info_by_name_or_alias(dev_desc, cmd, &info);
+       if (ret < 0) {
+               pr_err("cannot find partition: '%s'\n", cmd);
+               fastboot_fail("cannot find partition", response);
+               return;
+       }
+
+       /* Align blocks to erase group size to avoid erasing other partitions */
+       grp_size = mmc->erase_grp_size;
+       blks_start = (info.start + grp_size - 1) & ~(grp_size - 1);
+       if (info.size >= grp_size)
+               blks_size = (info.size - (blks_start - info.start)) &
+                               (~(grp_size - 1));
+       else
+               blks_size = 0;
+
+       printf("Erasing blocks " LBAFU " to " LBAFU " due to alignment\n",
+              blks_start, blks_start + blks_size);
+
+       blks = fb_mmc_blk_write(dev_desc, blks_start, blks_size, NULL);
+
+       if (blks != blks_size) {
+               pr_err("failed erasing from device %d\n", dev_desc->devnum);
+               fastboot_fail("failed erasing from device", response);
+               return;
+       }
+
+       printf("........ erased " LBAFU " bytes from '%s'\n",
+              blks_size * info.blksz, cmd);
+       fastboot_okay(NULL, response);
+}
diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
new file mode 100644 (file)
index 0000000..526bc12
--- /dev/null
@@ -0,0 +1,261 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2014 Broadcom Corporation.
+ * Copyright 2015 Free Electrons.
+ */
+
+#include <config.h>
+#include <common.h>
+
+#include <fastboot.h>
+#include <image-sparse.h>
+
+#include <linux/mtd/mtd.h>
+#include <jffs2/jffs2.h>
+#include <nand.h>
+
+struct fb_nand_sparse {
+       struct mtd_info         *mtd;
+       struct part_info        *part;
+};
+
+__weak int board_fastboot_erase_partition_setup(char *name)
+{
+       return 0;
+}
+
+__weak int board_fastboot_write_partition_setup(char *name)
+{
+       return 0;
+}
+
+static int fb_nand_lookup(const char *partname,
+                         struct mtd_info **mtd,
+                         struct part_info **part,
+                         char *response)
+{
+       struct mtd_device *dev;
+       int ret;
+       u8 pnum;
+
+       ret = mtdparts_init();
+       if (ret) {
+               pr_err("Cannot initialize MTD partitions\n");
+               fastboot_fail("cannot init mtdparts", response);
+               return ret;
+       }
+
+       ret = find_dev_and_part(partname, &dev, &pnum, part);
+       if (ret) {
+               pr_err("cannot find partition: '%s'", partname);
+               fastboot_fail("cannot find partition", response);
+               return ret;
+       }
+
+       if (dev->id->type != MTD_DEV_TYPE_NAND) {
+               pr_err("partition '%s' is not stored on a NAND device",
+                     partname);
+               fastboot_fail("not a NAND device", response);
+               return -EINVAL;
+       }
+
+       *mtd = get_nand_dev_by_index(dev->id->num);
+
+       return 0;
+}
+
+static int _fb_nand_erase(struct mtd_info *mtd, struct part_info *part)
+{
+       nand_erase_options_t opts;
+       int ret;
+
+       memset(&opts, 0, sizeof(opts));
+       opts.offset = part->offset;
+       opts.length = part->size;
+       opts.quiet = 1;
+
+       printf("Erasing blocks 0x%llx to 0x%llx\n",
+              part->offset, part->offset + part->size);
+
+       ret = nand_erase_opts(mtd, &opts);
+       if (ret)
+               return ret;
+
+       printf("........ erased 0x%llx bytes from '%s'\n",
+              part->size, part->name);
+
+       return 0;
+}
+
+static int _fb_nand_write(struct mtd_info *mtd, struct part_info *part,
+                         void *buffer, u32 offset,
+                         size_t length, size_t *written)
+{
+       int flags = WITH_WR_VERIFY;
+
+#ifdef CONFIG_FASTBOOT_FLASH_NAND_TRIMFFS
+       flags |= WITH_DROP_FFS;
+#endif
+
+       return nand_write_skip_bad(mtd, offset, &length, written,
+                                  part->size - (offset - part->offset),
+                                  buffer, flags);
+}
+
+static lbaint_t fb_nand_sparse_write(struct sparse_storage *info,
+               lbaint_t blk, lbaint_t blkcnt, const void *buffer)
+{
+       struct fb_nand_sparse *sparse = info->priv;
+       size_t written;
+       int ret;
+
+       ret = _fb_nand_write(sparse->mtd, sparse->part, (void *)buffer,
+                            blk * info->blksz,
+                            blkcnt * info->blksz, &written);
+       if (ret < 0) {
+               printf("Failed to write sparse chunk\n");
+               return ret;
+       }
+
+/* TODO - verify that the value "written" includes the "bad-blocks" ... */
+
+       /*
+        * the return value must be 'blkcnt' ("good-blocks") plus the
+        * number of "bad-blocks" encountered within this space...
+        */
+       return written / info->blksz;
+}
+
+static lbaint_t fb_nand_sparse_reserve(struct sparse_storage *info,
+               lbaint_t blk, lbaint_t blkcnt)
+{
+       int bad_blocks = 0;
+
+/*
+ * TODO - implement a function to determine the total number
+ * of blocks which must be used in order to reserve the specified
+ * number ("blkcnt") of "good-blocks", starting at "blk"...
+ * ( possibly something like the "check_skip_len()" function )
+ */
+
+       /*
+        * the return value must be 'blkcnt' ("good-blocks") plus the
+        * number of "bad-blocks" encountered within this space...
+        */
+       return blkcnt + bad_blocks;
+}
+
+/**
+ * fastboot_nand_get_part_info() - Lookup NAND partion by name
+ *
+ * @part_name: Named device to lookup
+ * @part_info: Pointer to returned part_info pointer
+ * @response: Pointer to fastboot response buffer
+ */
+int fastboot_nand_get_part_info(char *part_name, struct part_info **part_info,
+                               char *response)
+{
+       struct mtd_info *mtd = NULL;
+
+       return fb_nand_lookup(part_name, &mtd, part_info, response);
+}
+
+/**
+ * fastboot_nand_flash_write() - Write image to NAND for fastboot
+ *
+ * @cmd: Named device to write image to
+ * @download_buffer: Pointer to image data
+ * @download_bytes: Size of image data
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
+                              u32 download_bytes, char *response)
+{
+       struct part_info *part;
+       struct mtd_info *mtd = NULL;
+       int ret;
+
+       ret = fb_nand_lookup(cmd, &mtd, &part, response);
+       if (ret) {
+               pr_err("invalid NAND device");
+               fastboot_fail("invalid NAND device", response);
+               return;
+       }
+
+       ret = board_fastboot_write_partition_setup(part->name);
+       if (ret)
+               return;
+
+       if (is_sparse_image(download_buffer)) {
+               struct fb_nand_sparse sparse_priv;
+               struct sparse_storage sparse;
+
+               sparse_priv.mtd = mtd;
+               sparse_priv.part = part;
+
+               sparse.blksz = mtd->writesize;
+               sparse.start = part->offset / sparse.blksz;
+               sparse.size = part->size / sparse.blksz;
+               sparse.write = fb_nand_sparse_write;
+               sparse.reserve = fb_nand_sparse_reserve;
+               sparse.mssg = fastboot_fail;
+
+               printf("Flashing sparse image at offset " LBAFU "\n",
+                      sparse.start);
+
+               sparse.priv = &sparse_priv;
+               ret = write_sparse_image(&sparse, cmd, download_buffer,
+                                        response);
+               if (!ret)
+                       fastboot_okay(NULL, response);
+       } else {
+               printf("Flashing raw image at offset 0x%llx\n",
+                      part->offset);
+
+               ret = _fb_nand_write(mtd, part, download_buffer, part->offset,
+                                    download_bytes, NULL);
+
+               printf("........ wrote %u bytes to '%s'\n",
+                      download_bytes, part->name);
+       }
+
+       if (ret) {
+               fastboot_fail("error writing the image", response);
+               return;
+       }
+
+       fastboot_okay(NULL, response);
+}
+
+/**
+ * fastboot_nand_flash_erase() - Erase NAND for fastboot
+ *
+ * @cmd: Named device to erase
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_nand_erase(const char *cmd, char *response)
+{
+       struct part_info *part;
+       struct mtd_info *mtd = NULL;
+       int ret;
+
+       ret = fb_nand_lookup(cmd, &mtd, &part, response);
+       if (ret) {
+               pr_err("invalid NAND device");
+               fastboot_fail("invalid NAND device", response);
+               return;
+       }
+
+       ret = board_fastboot_erase_partition_setup(part->name);
+       if (ret)
+               return;
+
+       ret = _fb_nand_erase(mtd, part);
+       if (ret) {
+               pr_err("failed erasing from device %s", mtd->name);
+               fastboot_fail("failed erasing from device", response);
+               return;
+       }
+
+       fastboot_okay(NULL, response);
+}
index 55bdf9e7cf290e4cd405cdc2ece0c3c59d291177..7e8bd7eae881d23c641eb1869b099db19c82f652 100644 (file)
@@ -217,6 +217,35 @@ int fpga_fsload(int devnum, const void *buf, size_t size,
 }
 #endif
 
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+int fpga_loads(int devnum, const void *buf, size_t size,
+              struct fpga_secure_info *fpga_sec_info)
+{
+       int ret_val = FPGA_FAIL;
+
+       const fpga_desc *desc = fpga_validate(devnum, buf, size,
+                                             (char *)__func__);
+
+       if (desc) {
+               switch (desc->devtype) {
+               case fpga_xilinx:
+#if defined(CONFIG_FPGA_XILINX)
+                       ret_val = xilinx_loads(desc->devdesc, buf, size,
+                                              fpga_sec_info);
+#else
+                       fpga_no_sup((char *)__func__, "Xilinx devices");
+#endif
+                       break;
+               default:
+                       printf("%s: Invalid or unsupported device type %d\n",
+                              __func__, desc->devtype);
+               }
+       }
+
+       return ret_val;
+}
+#endif
+
 /*
  * Generic multiplexing code
  */
index 724304a5451d359eaa8b4c8f8c0ca311fc0766ad..f5135504eeb60748d0e073e678710644fb437489 100644 (file)
@@ -171,6 +171,24 @@ int xilinx_loadfs(xilinx_desc *desc, const void *buf, size_t bsize,
 }
 #endif
 
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+int xilinx_loads(xilinx_desc *desc, const void *buf, size_t bsize,
+                struct fpga_secure_info *fpga_sec_info)
+{
+       if (!xilinx_validate(desc, (char *)__func__)) {
+               printf("%s: Invalid device descriptor\n", __func__);
+               return FPGA_FAIL;
+       }
+
+       if (!desc->operations || !desc->operations->loads) {
+               printf("%s: Missing loads operation\n", __func__);
+               return FPGA_FAIL;
+       }
+
+       return desc->operations->loads(desc, buf, bsize, fpga_sec_info);
+}
+#endif
+
 int xilinx_dump(xilinx_desc *desc, const void *buf, size_t bsize)
 {
        if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
index b57623b6a7567044b513a6e9a53955c0f4ceecbb..03ffa8c11f2c7d11887199b904c4174772960aef 100644 (file)
@@ -223,6 +223,51 @@ static int zynqmp_load(xilinx_desc *desc, const void *buf, size_t bsize,
        return ret;
 }
 
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE) && !defined(CONFIG_SPL_BUILD)
+static int zynqmp_loads(xilinx_desc *desc, const void *buf, size_t bsize,
+                       struct fpga_secure_info *fpga_sec_info)
+{
+       int ret;
+       u32 buf_lo, buf_hi;
+       u32 ret_payload[PAYLOAD_ARG_CNT];
+       u8 flag = 0;
+
+       flush_dcache_range((ulong)buf, (ulong)buf +
+                          ALIGN(bsize, CONFIG_SYS_CACHELINE_SIZE));
+
+       if (!fpga_sec_info->encflag)
+               flag |= BIT(ZYNQMP_FPGA_BIT_ENC_DEV_KEY);
+
+       if (fpga_sec_info->userkey_addr &&
+           fpga_sec_info->encflag == FPGA_ENC_USR_KEY) {
+               flush_dcache_range((ulong)fpga_sec_info->userkey_addr,
+                                  (ulong)fpga_sec_info->userkey_addr +
+                                  ALIGN(KEY_PTR_LEN,
+                                        CONFIG_SYS_CACHELINE_SIZE));
+               flag |= BIT(ZYNQMP_FPGA_BIT_ENC_USR_KEY);
+       }
+
+       if (!fpga_sec_info->authflag)
+               flag |= BIT(ZYNQMP_FPGA_BIT_AUTH_OCM);
+
+       if (fpga_sec_info->authflag == ZYNQMP_FPGA_AUTH_DDR)
+               flag |= BIT(ZYNQMP_FPGA_BIT_AUTH_DDR);
+
+       buf_lo = lower_32_bits((ulong)buf);
+       buf_hi = upper_32_bits((ulong)buf);
+
+       ret = invoke_smc(ZYNQMP_SIP_SVC_PM_FPGA_LOAD, buf_lo, buf_hi,
+                        (u32)(uintptr_t)fpga_sec_info->userkey_addr,
+                        flag, ret_payload);
+       if (ret)
+               puts("PL FPGA LOAD fail\n");
+       else
+               puts("Bitstream successfully loaded\n");
+
+       return ret;
+}
+#endif
+
 static int zynqmp_pcap_info(xilinx_desc *desc)
 {
        int ret;
@@ -238,5 +283,8 @@ static int zynqmp_pcap_info(xilinx_desc *desc)
 
 struct xilinx_fpga_op zynqmp_op = {
        .load = zynqmp_load,
+#if defined CONFIG_CMD_FPGA_LOAD_SECURE
+       .loads = zynqmp_loads,
+#endif
        .info = zynqmp_pcap_info,
 };
index 00209e33889d401b7b96a5adde6e03c70c962747..9c15eb36d6462801456bcc00af60427970262079 100644 (file)
@@ -463,7 +463,7 @@ int ftsdc010_mmc_bind(struct udevice *dev)
 }
 
 static const struct udevice_id ftsdc010_mmc_ids[] = {
-       { .compatible = "andestech,atsdc010" },
+       { .compatible = "andestech,atfsdc010" },
        { }
 };
 
index 400f87e134dc26a52554c71a77c5619531167004..40e28abda67f4c0130c6cd85716a55061d0046b1 100644 (file)
@@ -161,7 +161,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
        /* We shouldn't wait for data inihibit for stop commands, even
           though they might use busy signaling */
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION ||
-           cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK)
+           cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
+           cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200)
                mask &= ~SDHCI_DATA_INHIBIT;
 
        while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) {
@@ -183,7 +184,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
        sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_STATUS);
 
        mask = SDHCI_INT_RESPONSE;
-       if (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK)
+       if (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
+           cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200)
                mask = SDHCI_INT_DATA_AVAIL;
 
        if (!(cmd->resp_type & MMC_RSP_PRESENT))
@@ -201,7 +203,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
                flags |= SDHCI_CMD_CRC;
        if (cmd->resp_type & MMC_RSP_OPCODE)
                flags |= SDHCI_CMD_INDEX;
-       if (data || cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK)
+       if (data || cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK ||
+           cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200)
                flags |= SDHCI_CMD_DATA;
 
        /* Set Transfer mode regarding to data flag */
index f99731fb1ffeb0b29cf4dd329c97ad942f62f6d8..5b6d5256084c8dfad68e680bc6b6548c9dbe62f5 100644 (file)
@@ -32,12 +32,21 @@ struct arasan_sdhci_priv {
 };
 
 #if defined(CONFIG_ARCH_ZYNQMP)
+#define MMC_HS200_BUS_SPEED    5
+
 static const u8 mode2timing[] = {
-            [UHS_SDR12] = UHS_SDR12_BUS_SPEED,
-            [UHS_SDR25] = UHS_SDR25_BUS_SPEED,
-            [UHS_SDR50] = UHS_SDR50_BUS_SPEED,
-            [UHS_SDR104] = UHS_SDR104_BUS_SPEED,
-            [UHS_DDR50] = UHS_DDR50_BUS_SPEED,
+       [MMC_LEGACY] = UHS_SDR12_BUS_SPEED,
+       [SD_LEGACY] = UHS_SDR12_BUS_SPEED,
+       [MMC_HS] = HIGH_SPEED_BUS_SPEED,
+       [SD_HS] = HIGH_SPEED_BUS_SPEED,
+       [MMC_HS_52] = HIGH_SPEED_BUS_SPEED,
+       [MMC_DDR_52] = HIGH_SPEED_BUS_SPEED,
+       [UHS_SDR12] = UHS_SDR12_BUS_SPEED,
+       [UHS_SDR25] = UHS_SDR25_BUS_SPEED,
+       [UHS_SDR50] = UHS_SDR50_BUS_SPEED,
+       [UHS_DDR50] = UHS_DDR50_BUS_SPEED,
+       [UHS_SDR104] = UHS_SDR104_BUS_SPEED,
+       [MMC_HS_200] = MMC_HS200_BUS_SPEED,
 };
 
 #define SDHCI_HOST_CTRL2       0x3E
@@ -160,9 +169,6 @@ static void arasan_sdhci_set_tapdelay(struct sdhci_host *host)
        struct mmc *mmc = (struct mmc *)host->mmc;
        u8 uhsmode;
 
-       if (!IS_SD(mmc))
-               return;
-
        uhsmode = mode2timing[mmc->selected_mode];
 
        if (uhsmode >= UHS_SDR25_BUS_SPEED)
@@ -175,6 +181,9 @@ static void arasan_sdhci_set_control_reg(struct sdhci_host *host)
        struct mmc *mmc = (struct mmc *)host->mmc;
        u32 reg;
 
+       if (!IS_SD(mmc))
+               return;
+
        if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
                reg = sdhci_readw(host, SDHCI_HOST_CTRL2);
                reg |= SDHCI_18V_SIGNAL;
@@ -283,25 +292,21 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
                return -1;
 
        priv->host->name = dev->name;
-       priv->host->ioaddr = (void *)devfdt_get_addr(dev);
-
-       priv->deviceid = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-                                       "xlnx,device_id", -1);
-       priv->bank = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-                                   "xlnx,mio_bank", -1);
-       if (fdt_get_property(gd->fdt_blob, dev_of_offset(dev),
-                            "no-1-8-v", NULL))
-               priv->no_1p8 = 1;
-       else
-               priv->no_1p8 = 0;
 
 #if defined(CONFIG_DM_MMC) && defined(CONFIG_ARCH_ZYNQMP)
        priv->host->ops = &arasan_ops;
 #endif
 
-       plat->f_max = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-                               "max-frequency", CONFIG_ZYNQ_SDHCI_MAX_FREQ);
+       priv->host->ioaddr = (void *)dev_read_addr(dev);
+       if (IS_ERR(priv->host->ioaddr))
+               return PTR_ERR(priv->host->ioaddr);
+
+       priv->deviceid = dev_read_u32_default(dev, "xlnx,device_id", -1);
+       priv->bank = dev_read_u32_default(dev, "xlnx,mio_bank", -1);
+       priv->no_1p8 = dev_read_bool(dev, "no-1-8-v");
 
+       plat->f_max = dev_read_u32_default(dev, "max-frequency",
+                                          CONFIG_ZYNQ_SDHCI_MAX_FREQ);
        return 0;
 }
 
index eb593c90d757319a50e2c2ea8b0e46425948c374..9cec06510c3eb47330fc75b14866b2e9415f5074 100644 (file)
@@ -12,7 +12,6 @@ obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
 obj-$(CONFIG_ALTERA_QSPI) += altera_qspi.o
 obj-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
 obj-$(CONFIG_FLASH_CFI_MTD) += cfi_mtd.o
-obj-$(CONFIG_FTSMC020) += ftsmc020.o
 obj-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
 obj-$(CONFIG_MW_EEPROM) += mw_eeprom.o
 obj-$(CONFIG_FLASH_PIC32) += pic32_flash.o
diff --git a/drivers/mtd/ftsmc020.c b/drivers/mtd/ftsmc020.c
deleted file mode 100644 (file)
index 41cdd0e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2009 Faraday Technology
- * Po-Yu Chuang <ratbert@faraday-tech.com>
- */
-
-#include <config.h>
-#include <common.h>
-#include <asm/io.h>
-#include <faraday/ftsmc020.h>
-
-struct ftsmc020_config {
-       unsigned int    config;
-       unsigned int    timing;
-};
-
-static void ftsmc020_setup_bank(unsigned int bank, struct ftsmc020_config *cfg)
-{
-       struct ftsmc020 *smc = (struct ftsmc020 *)CONFIG_FTSMC020_BASE;
-
-       if (bank > 3) {
-               printf("bank # %u invalid\n", bank);
-               return;
-       }
-
-       writel(cfg->config, &smc->bank[bank].cr);
-       writel(cfg->timing, &smc->bank[bank].tpr);
-}
-
-void ftsmc020_init(void)
-{
-       struct ftsmc020_config config[] = CONFIG_SYS_FTSMC020_CONFIGS;
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(config); i++)
-               ftsmc020_setup_bank(i, &config[i]);
-}
index 2911729b289ed077996cf2cf0c1745fe187204f1..0ed2317554783e8f0e2b828ca177b2f4f4d3e5ba 100644 (file)
@@ -1202,14 +1202,15 @@ int spi_flash_scan(struct spi_flash *flash)
        flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
        flash->page_size = info->page_size;
        /*
-        * The Spansion S25FL032P and S25FL064P have 256b pages, yet use the
-        * 0x4d00 Extended JEDEC code. The rest of the Spansion flashes with
-        * the 0x4d00 Extended JEDEC code have 512b pages. All of the others
-        * have 256b pages.
+        * The Spansion S25FS512S, S25FL032P and S25FL064P have 256b pages,
+        * yet use the 0x4d00 Extended JEDEC code. The rest of the Spansion
+        * flashes with the 0x4d00 Extended JEDEC code have 512b pages.
+        * All of the others have 256b pages.
         */
        if (JEDEC_EXT(info) == 0x4d00) {
                if ((JEDEC_ID(info) != 0x0215) &&
-                   (JEDEC_ID(info) != 0x0216))
+                   (JEDEC_ID(info) != 0x0216) &&
+                   (JEDEC_ID(info) != 0x0220))
                        flash->page_size = 512;
        }
        flash->page_size <<= flash->shift;
index 41879d662a8d5dce6f76142428df23c89cd677d2..5d146e36c64593f0751b229b98d552121fb7abdf 100644 (file)
@@ -71,6 +71,9 @@ const struct spi_flash_info spi_flash_ids[] = {
        {"is25lp064",      INFO(0x9d6017, 0x0, 64 * 1024,   128, 0) },
        {"is25lp128",      INFO(0x9d6018, 0x0, 64 * 1024,   256, 0) },
        {"is25lp256",      INFO(0x9d6019, 0x0, 64 * 1024,   512, 0) },
+       {"is25wp032",      INFO(0x9d7016, 0x0, 64 * 1024,    64, RD_FULL | SECT_4K) },
+       {"is25wp064",      INFO(0x9d7017, 0x0, 64 * 1024,   128, RD_FULL | SECT_4K) },
+       {"is25wp128",      INFO(0x9d7018, 0x0, 64 * 1024,   256, RD_FULL | SECT_4K) },
 #endif
 #ifdef CONFIG_SPI_FLASH_MACRONIX       /* MACRONIX */
        {"mx25l2006e",     INFO(0xc22012, 0x0, 64 * 1024,     4, 0) },
@@ -85,6 +88,7 @@ const struct spi_flash_info spi_flash_ids[] = {
        {"mx25u6435f",     INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | WR_QPP) },
        {"mx25l12855e",    INFO(0xc22618, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
        {"mx25u1635e",     INFO(0xc22535, 0x0, 64 * 1024,  32, SECT_4K) },
+       {"mx25u25635f",    INFO(0xc22539, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP) },
        {"mx66u51235f",    INFO(0xc2253a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
        {"mx66l1g45g",     INFO(0xc2201b, 0x0, 64 * 1024,  2048, RD_FULL | WR_QPP) },
 #endif
@@ -174,6 +178,7 @@ const struct spi_flash_info spi_flash_ids[] = {
        {"w25q32dw",       INFO(0xef6016, 0x0,  64 * 1024,    64, RD_FULL | WR_QPP | SECT_4K) },
        {"w25q64dw",       INFO(0xef6017, 0x0,  64 * 1024,   128, RD_FULL | WR_QPP | SECT_4K) },
        {"w25q128fw",      INFO(0xef6018, 0x0,  64 * 1024,   256, RD_FULL | WR_QPP | SECT_4K) },
+       {"w25q256fw",      INFO(0xef6019, 0x0,  64 * 1024,   512, RD_FULL | WR_QPP | SECT_4K) },
 #endif
        {},     /* Empty entry to terminate the list */
        /*
@@ -188,5 +193,6 @@ const struct spi_flash_info spi_flash_ids[] = {
         * (w25q32dw, w25q32fv_qpi)
         * (w25q64dw, w25q64fv_qpi)
         * (w25q128fw, w25q128fv_qpi)
+        * (w25q256fw, w25q256fv_qpi)
         */
 };
index 675e487ae8c8f9feed11f1ae03cce30b39ef31f9..4cb1377c4257c507330c5a0dc0d8a1362e3abed0 100644 (file)
@@ -169,6 +169,30 @@ void ubi_refill_pools(struct ubi_device *ubi)
        spin_unlock(&ubi->wl_lock);
 }
 
+/**
+ * produce_free_peb - produce a free physical eraseblock.
+ * @ubi: UBI device description object
+ *
+ * This function tries to make a free PEB by means of synchronous execution of
+ * pending works. This may be needed if, for example the background thread is
+ * disabled. Returns zero in case of success and a negative error code in case
+ * of failure.
+ */
+static int produce_free_peb(struct ubi_device *ubi)
+{
+       int err;
+
+       while (!ubi->free.rb_node && ubi->works_count) {
+               dbg_wl("do one work synchronously");
+               err = do_work(ubi);
+
+               if (err)
+                       return err;
+       }
+
+       return 0;
+}
+
 /**
  * ubi_wl_get_peb - get a physical eraseblock.
  * @ubi: UBI device description object
@@ -211,6 +235,11 @@ again:
                }
                retried = 1;
                up_read(&ubi->fm_eba_sem);
+               ret = produce_free_peb(ubi);
+               if (ret < 0) {
+                       down_read(&ubi->fm_eba_sem);
+                       goto out;
+               }
                goto again;
        }
 
index 6c8474893d24756133ef2cd54edae071c2bd4c4e..c08889c4b1114a02321ffcb6ea5c05d8089ac4f0 100644 (file)
@@ -104,18 +104,18 @@ static int _ftmac100_init(struct ftmac100_data *priv, unsigned char enetaddr[6])
 
        for (i = 0; i < PKTBUFSRX; i++) {
                /* RXBUF_BADR */
-               rxdes[i].rxdes2 = (unsigned int)net_rx_packets[i];
+               rxdes[i].rxdes2 = (unsigned int)(unsigned long)net_rx_packets[i];
                rxdes[i].rxdes1 |= FTMAC100_RXDES1_RXBUF_SIZE (PKTSIZE_ALIGN);
                rxdes[i].rxdes0 = FTMAC100_RXDES0_RXDMA_OWN;
        }
 
        /* transmit ring */
 
-       writel ((unsigned int)txdes, &ftmac100->txr_badr);
+       writel ((unsigned long)txdes, &ftmac100->txr_badr);
 
        /* receive ring */
 
-       writel ((unsigned int)rxdes, &ftmac100->rxr_badr);
+       writel ((unsigned long)rxdes, &ftmac100->rxr_badr);
 
        /* poll receive descriptor automatically */
 
@@ -192,14 +192,14 @@ static int _ftmac100_send(struct ftmac100_data *priv, void *packet, int length)
                return -1;
        }
 
-       debug ("%s(%x, %x)\n", __func__, (int)packet, length);
+       debug ("%s(%lx, %x)\n", __func__, (unsigned long)packet, length);
 
        length = (length < ETH_ZLEN) ? ETH_ZLEN : length;
 
        /* initiate a transmit sequence */
 
-       flush_dcache_range((u32)packet,(u32)packet+length);
-       curr_des->txdes2 = (unsigned int)packet;        /* TXBUF_BADR */
+       flush_dcache_range((unsigned long)packet,(unsigned long)packet+length);
+       curr_des->txdes2 = (unsigned int)(unsigned long)packet; /* TXBUF_BADR */
 
        curr_des->txdes1 &= FTMAC100_TXDES1_EDOTR;
        curr_des->txdes1 |= FTMAC100_TXDES1_FTS |
@@ -343,7 +343,7 @@ static int ftmac100_recv(struct udevice *dev, int flags, uchar **packetp)
        int len;
        len = __ftmac100_recv(priv);
        if (len)
-               *packetp = (void *)curr_des->rxdes2;
+               *packetp = (uchar *)(unsigned long)curr_des->rxdes2;
 
        return len ? len : -EAGAIN;
 }
index d4f2970a6924c95db5a94103647ef9fecf42e64b..0b9c9e1d6a90ce6a95f43f8da748900cd00e7a67 100644 (file)
 #include <asm/arch-armada8k/soc-info.h>
 #include "pinctrl-mvebu.h"
 
+#define AP_EMMC_PHY_CTRL_REG           0x100
+#define CP_EMMC_PHY_CTRL_REG           0x424
+#define EMMC_PHY_CTRL_SDPHY_EN         BIT(0)
+
+#define AP806_EMMC_CLK_PIN_ID          0
+#define AP806_EMMC_CLK_FUNC            0x1
+#define CP110_EMMC_CLK_PIN_ID          56
+#define CP110_EMMC_CLK_FUNC            0xe
+
 DECLARE_GLOBAL_DATA_PTR;
 
+/* mvebu_pinctl_emmc_set_mux: configure sd/mmc PHY mux
+ * To enable SDIO/eMMC in Armada-APN806/CP110, need to configure PHY mux.
+ * eMMC/SD PHY register responsible for muxing between MPPs and SD/eMMC
+ * controller:
+ * - Bit0 enabled SDIO/eMMC PHY is used as a MPP muxltiplexer,
+ * - Bit0 disabled SDIO/eMMC PHY is connected to SDIO/eMMC controller
+ * If pin function is set to eMMC/SD, then configure the eMMC/SD PHY
+ * muxltiplexer register to be on SDIO/eMMC controller
+ */
+void mvebu_pinctl_emmc_set_mux(struct udevice *dev, u32 pin, u32 func)
+{
+       const void *blob = gd->fdt_blob;
+       int node = dev_of_offset(dev);
+       struct mvebu_pinctrl_priv *priv = dev_get_priv(dev);
+
+       if (!fdt_node_check_compatible(blob, node, "marvell,ap806-pinctrl")) {
+               if ((pin == AP806_EMMC_CLK_PIN_ID) &&
+                   (func == AP806_EMMC_CLK_FUNC)) {
+                       clrbits_le32(priv->base_reg + AP_EMMC_PHY_CTRL_REG,
+                                    EMMC_PHY_CTRL_SDPHY_EN);
+               }
+       } else if (!fdt_node_check_compatible(blob, node,
+                                       "marvell,armada-8k-cpm-pinctrl")) {
+               if ((pin == CP110_EMMC_CLK_PIN_ID) &&
+                   (func == CP110_EMMC_CLK_FUNC)) {
+                       clrbits_le32(priv->base_reg + CP_EMMC_PHY_CTRL_REG,
+                                    EMMC_PHY_CTRL_SDPHY_EN);
+               }
+       }
+}
+
 /*
  * mvebu_pinctrl_set_state: configure pin functions.
  * @dev: the pinctrl device to be configured.
@@ -47,9 +87,16 @@ int mvebu_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 
        function = fdtdec_get_int(blob, node, "marvell,function", 0xff);
 
+       /*
+        * Check if setup of PHY mux is needed for this pins group.
+        * Only the first pin id in array is tested, all the rest use the same
+        * pin function.
+        */
+       mvebu_pinctl_emmc_set_mux(dev, pin_arr[0], function);
+
        for (i = 0; i < pin_count; i++) {
-       int reg_offset;
-       int field_offset;
+               int reg_offset;
+               int field_offset;
                int pin = pin_arr[i];
 
                if (function > priv->max_func) {
@@ -96,6 +143,14 @@ static int mvebu_pinctrl_set_state_all(struct udevice *dev,
                return -EINVAL;
        }
 
+       /* Check if setup of PHY mux is needed for this pins group. */
+       if (priv->pin_cnt < CP110_EMMC_CLK_PIN_ID)
+               mvebu_pinctl_emmc_set_mux(dev, AP806_EMMC_CLK_PIN_ID,
+                                         func_arr[AP806_EMMC_CLK_PIN_ID]);
+       else
+               mvebu_pinctl_emmc_set_mux(dev, CP110_EMMC_CLK_PIN_ID,
+                                         func_arr[CP110_EMMC_CLK_PIN_ID]);
+
        for (pin = 0; pin < priv->pin_cnt; pin++) {
                int reg_offset;
                int field_offset;
@@ -161,10 +216,10 @@ static struct pinctrl_ops mvebu_pinctrl_ops = {
 
 static const struct udevice_id mvebu_pinctrl_ids[] = {
        { .compatible = "marvell,mvebu-pinctrl" },
-       { .compatible = "marvell,armada-ap806-pinctrl" },
-       { .compatible = "marvell,a70x0-pinctrl" },
-       { .compatible = "marvell,a80x0-cp0-pinctrl" },
-       { .compatible = "marvell,a80x0-cp1-pinctrl" },
+       { .compatible = "marvell,ap806-pinctrl" },
+       { .compatible = "marvell,armada-7k-pinctrl" },
+       { .compatible = "marvell,armada-8k-cpm-pinctrl" },
+       { .compatible = "marvell,armada-8k-cps-pinctrl" },
        { }
 };
 
index 06f0a48e670939d4197105878659eef554bae843..3650af21573122e48d82685ec12622af8f9cc143 100644 (file)
@@ -175,7 +175,9 @@ static int zynq_serial_ofdata_to_platdata(struct udevice *dev)
 {
        struct zynq_uart_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct uart_zynq *)devfdt_get_addr(dev);
+       priv->regs = (struct uart_zynq *)dev_read_addr(dev);
+       if (IS_ERR(priv->regs))
+               return PTR_ERR(priv->regs);
 
        return 0;
 }
index 2c1d36ee6737477796ac3bdba78fac3bba43700f..af96c6d21e5c5e04220c2936e8586f5b192b4691 100644 (file)
@@ -197,7 +197,7 @@ static int __atcspi200_spi_xfer(struct nds_spi_slave *ns,
                int num_bytes;
                u8 *cmd_buf = ns->cmd_buf;
                size_t cmd_len = ns->cmd_len;
-               size_t data_len = bitlen / 8;
+               unsigned long data_len = bitlen / 8;
                int rf_cnt;
                int ret = 0;
 
@@ -229,13 +229,15 @@ static int __atcspi200_spi_xfer(struct nds_spi_slave *ns,
                        __atcspi200_spi_start(ns);
                        break;
                }
-               debug("spi_xfer: data_out %08X(%p) data_in %08X(%p) data_len %u\n",
-                     *(uint *)data_out, data_out, *(uint *)data_in, data_in, data_len);
+               if (data_out)
+                       debug("spi_xfer: data_out %08X(%p) data_in %08X(%p) data_len %lu\n",
+                             *(uint *)data_out, data_out, *(uint *)data_in,
+                             data_in, data_len);
                num_chunks = DIV_ROUND_UP(data_len, max_tran_len);
                din = data_in;
                dout = data_out;
                while (num_chunks--) {
-                       tran_len = min(data_len, (size_t)max_tran_len);
+                       tran_len = min((size_t)data_len, (size_t)max_tran_len);
                        ns->tran_len = tran_len;
                        num_blks = DIV_ROUND_UP(tran_len , CHUNK_SIZE);
                        num_bytes = (tran_len) % CHUNK_SIZE;
index 368424948478e0691dafbe3e5faa123c7b411537..197f41f9db093b8123c6b04e47ea24c445426461 100644 (file)
@@ -407,7 +407,7 @@ static inline void qspi_ahb_read(struct fsl_qspi_priv *priv, u8 *rxbuf, int len)
 {
        struct fsl_qspi_regs *regs = priv->regs;
        u32 mcr_reg;
-       void *rx_addr = NULL;
+       void *rx_addr;
 
        mcr_reg = qspi_read32(priv->flags, &regs->mcr);
 
index e6c876da07b41f78f2f43804f72df230c9e98a49..ce12eee65715890429258b81aaef45cbf16521fe 100644 (file)
@@ -129,7 +129,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
                int status = readl(&lslave->regs->sr);
                if ((idx_out < bytelen) && (status & SSP_SR_TNF))
                        writel(((u8 *)dout)[idx_out++], &lslave->regs->data);
-               if ((idx_in < bytelen) && (status & status & SSP_SR_RNE))
+               if ((idx_in < bytelen) && (status & SSP_SR_RNE))
                        ((u8 *)din)[idx_in++] = readl(&lslave->regs->data);
                if (get_timer(start_time) >= CONFIG_LPC32XX_SSP_TIMEOUT)
                        return -1;
index 7d1801280773937c6e31f713755560bc10436017..f6cc35336320ce1ec0e5cba4e9f0879e1d34b39d 100644 (file)
@@ -8,16 +8,16 @@
  */
 
 #include <common.h>
+#include <clk.h>
+#include <dm.h>
+#include <errno.h>
 #include <malloc.h>
+#include <reset.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <asm/io.h>
-#include <dm.h>
-#include <errno.h>
 #include <asm/arch/stm32.h>
-#include <clk.h>
-
-DECLARE_GLOBAL_DATA_PTR;
+#include <linux/ioport.h>
 
 struct stm32_qspi_regs {
        u32 cr;         /* 0x00 */
@@ -155,6 +155,8 @@ enum STM32_QSPI_CCR_FMODE {
 /* default SCK frequency, unit: HZ */
 #define STM32_QSPI_DEFAULT_SCK_FREQ 108000000
 
+#define STM32_MAX_NORCHIP 2
+
 struct stm32_qspi_platdata {
        u32 base;
        u32 memory_map;
@@ -206,11 +208,18 @@ static void _stm32_qspi_wait_for_ftf(struct stm32_qspi_priv *priv)
 static void _stm32_qspi_set_flash_size(struct stm32_qspi_priv *priv, u32 size)
 {
        u32 fsize = fls(size) - 1;
+
        clrsetbits_le32(&priv->regs->dcr,
                        STM32_QSPI_DCR_FSIZE_MASK << STM32_QSPI_DCR_FSIZE_SHIFT,
                        fsize << STM32_QSPI_DCR_FSIZE_SHIFT);
 }
 
+static void _stm32_qspi_set_cs(struct stm32_qspi_priv *priv, unsigned int cs)
+{
+       clrsetbits_le32(&priv->regs->cr, STM32_QSPI_CR_FSEL,
+                       cs ? STM32_QSPI_CR_FSEL : 0);
+}
+
 static unsigned int _stm32_qspi_gen_ccr(struct stm32_qspi_priv *priv)
 {
        unsigned int ccr_reg = 0;
@@ -255,13 +264,15 @@ static unsigned int _stm32_qspi_gen_ccr(struct stm32_qspi_priv *priv)
 }
 
 static void _stm32_qspi_enable_mmap(struct stm32_qspi_priv *priv,
-               struct spi_flash *flash)
+                                   struct spi_flash *flash)
 {
+       unsigned int ccr_reg;
+
        priv->command = flash->read_cmd | CMD_HAS_ADR | CMD_HAS_DATA
                        | CMD_HAS_DUMMY;
        priv->dummycycles = flash->dummy_byte * 8;
 
-       unsigned int ccr_reg = _stm32_qspi_gen_ccr(priv);
+       ccr_reg = _stm32_qspi_gen_ccr(priv);
        ccr_reg |= (STM32_QSPI_CCR_MEM_MAP << STM32_QSPI_CCR_FMODE_SHIFT);
 
        _stm32_qspi_wait_for_not_busy(priv);
@@ -291,10 +302,12 @@ static void _stm32_qspi_start_xfer(struct stm32_qspi_priv *priv, u32 cr_reg)
 }
 
 static int _stm32_qspi_xfer(struct stm32_qspi_priv *priv,
-               struct spi_flash *flash, unsigned int bitlen,
-               const u8 *dout, u8 *din, unsigned long flags)
+                           struct spi_flash *flash, unsigned int bitlen,
+                           const u8 *dout, u8 *din, unsigned long flags)
 {
        unsigned int words = bitlen / 8;
+       u32 ccr_reg;
+       int i;
 
        if (flags & SPI_XFER_MMAP) {
                _stm32_qspi_enable_mmap(priv, flash);
@@ -346,7 +359,7 @@ static int _stm32_qspi_xfer(struct stm32_qspi_priv *priv,
                }
 
                if (flags & SPI_XFER_END) {
-                       u32 ccr_reg = _stm32_qspi_gen_ccr(priv);
+                       ccr_reg = _stm32_qspi_gen_ccr(priv);
                        ccr_reg |= STM32_QSPI_CCR_IND_WRITE
                                        << STM32_QSPI_CCR_FMODE_SHIFT;
 
@@ -365,7 +378,7 @@ static int _stm32_qspi_xfer(struct stm32_qspi_priv *priv,
 
                                debug("%s: words:%d data:", __func__, words);
 
-                               int i = 0;
+                               i = 0;
                                while (words > i) {
                                        writeb(dout[i], &priv->regs->dr);
                                        debug("%02x ", dout[i]);
@@ -379,7 +392,7 @@ static int _stm32_qspi_xfer(struct stm32_qspi_priv *priv,
                        }
                }
        } else if (din) {
-               u32 ccr_reg = _stm32_qspi_gen_ccr(priv);
+               ccr_reg = _stm32_qspi_gen_ccr(priv);
                ccr_reg |= STM32_QSPI_CCR_IND_READ
                                << STM32_QSPI_CCR_FMODE_SHIFT;
 
@@ -394,7 +407,7 @@ static int _stm32_qspi_xfer(struct stm32_qspi_priv *priv,
 
                debug("%s: data:", __func__);
 
-               int i = 0;
+               i = 0;
                while (words > i) {
                        din[i] = readb(&priv->regs->dr);
                        debug("%02x ", din[i]);
@@ -408,27 +421,23 @@ static int _stm32_qspi_xfer(struct stm32_qspi_priv *priv,
 
 static int stm32_qspi_ofdata_to_platdata(struct udevice *bus)
 {
-       struct fdt_resource res_regs, res_mem;
+       struct resource res_regs, res_mem;
        struct stm32_qspi_platdata *plat = bus->platdata;
-       const void *blob = gd->fdt_blob;
-       int node = dev_of_offset(bus);
        int ret;
 
-       ret = fdt_get_named_resource(blob, node, "reg", "reg-names",
-                                    "QuadSPI", &res_regs);
+       ret = dev_read_resource_byname(bus, "qspi", &res_regs);
        if (ret) {
                debug("Error: can't get regs base addresses(ret = %d)!\n", ret);
                return -ENOMEM;
        }
-       ret = fdt_get_named_resource(blob, node, "reg", "reg-names",
-                                    "QuadSPI-memory", &res_mem);
+       ret = dev_read_resource_byname(bus, "qspi_mm", &res_mem);
        if (ret) {
                debug("Error: can't get mmap base address(ret = %d)!\n", ret);
                return -ENOMEM;
        }
 
-       plat->max_hz = fdtdec_get_int(blob, node, "spi-max-frequency",
-                                       STM32_QSPI_DEFAULT_SCK_FREQ);
+       plat->max_hz = dev_read_u32_default(bus, "spi-max-frequency",
+                                           STM32_QSPI_DEFAULT_SCK_FREQ);
 
        plat->base = res_regs.start;
        plat->memory_map = res_mem.start;
@@ -448,6 +457,9 @@ static int stm32_qspi_probe(struct udevice *bus)
        struct stm32_qspi_platdata *plat = dev_get_platdata(bus);
        struct stm32_qspi_priv *priv = dev_get_priv(bus);
        struct dm_spi_bus *dm_spi_bus;
+       struct clk clk;
+       struct reset_ctl reset_ctl;
+       int ret;
 
        dm_spi_bus = bus->uclass_priv;
 
@@ -457,9 +469,6 @@ static int stm32_qspi_probe(struct udevice *bus)
 
        priv->max_hz = plat->max_hz;
 
-#ifdef CONFIG_CLK
-       int ret;
-       struct clk clk;
        ret = clk_get_by_index(bus, 0, &clk);
        if (ret < 0)
                return ret;
@@ -477,7 +486,19 @@ static int stm32_qspi_probe(struct udevice *bus)
                return priv->clock_rate;
        }
 
-#endif
+       ret = reset_get_by_index(bus, 0, &reset_ctl);
+       if (ret) {
+               if (ret != -ENOENT) {
+                       dev_err(bus, "failed to get reset\n");
+                       clk_disable(&clk);
+                       return ret;
+               }
+       } else {
+               /* Reset QSPI controller */
+               reset_assert(&reset_ctl);
+               udelay(2);
+               reset_deassert(&reset_ctl);
+       }
 
        setbits_le32(&priv->regs->cr, STM32_QSPI_CR_SSHIFT);
 
@@ -494,10 +515,17 @@ static int stm32_qspi_claim_bus(struct udevice *dev)
        struct stm32_qspi_priv *priv;
        struct udevice *bus;
        struct spi_flash *flash;
+       struct dm_spi_slave_platdata *slave_plat;
 
        bus = dev->parent;
        priv = dev_get_priv(bus);
        flash = dev_get_uclass_priv(dev);
+       slave_plat = dev_get_parent_platdata(dev);
+
+       if (slave_plat->cs >= STM32_MAX_NORCHIP)
+               return -ENODEV;
+
+       _stm32_qspi_set_cs(priv, slave_plat->cs);
 
        _stm32_qspi_set_flash_size(priv, flash->size);
 
@@ -520,7 +548,7 @@ static int stm32_qspi_release_bus(struct udevice *dev)
 }
 
 static int stm32_qspi_xfer(struct udevice *dev, unsigned int bitlen,
-               const void *dout, void *din, unsigned long flags)
+                          const void *dout, void *din, unsigned long flags)
 {
        struct stm32_qspi_priv *priv;
        struct udevice *bus;
@@ -538,12 +566,13 @@ static int stm32_qspi_set_speed(struct udevice *bus, uint speed)
 {
        struct stm32_qspi_platdata *plat = bus->platdata;
        struct stm32_qspi_priv *priv = dev_get_priv(bus);
+       u32 qspi_clk = priv->clock_rate;
+       u32 prescaler = 255;
+       u32 csht;
 
        if (speed > plat->max_hz)
                speed = plat->max_hz;
 
-       u32 qspi_clk = priv->clock_rate;
-       u32 prescaler = 255;
        if (speed > 0) {
                prescaler = DIV_ROUND_UP(qspi_clk, speed) - 1;
                if (prescaler > 255)
@@ -552,7 +581,7 @@ static int stm32_qspi_set_speed(struct udevice *bus, uint speed)
                        prescaler = 0;
        }
 
-       u32 csht = DIV_ROUND_UP((5 * qspi_clk) / (prescaler + 1), 100000000);
+       csht = DIV_ROUND_UP((5 * qspi_clk) / (prescaler + 1), 100000000);
        csht = (csht - 1) & STM32_QSPI_DCR_CSHT_MASK;
 
        _stm32_qspi_wait_for_not_busy(priv);
@@ -562,7 +591,6 @@ static int stm32_qspi_set_speed(struct udevice *bus, uint speed)
                        STM32_QSPI_CR_PRESCALER_SHIFT,
                        prescaler << STM32_QSPI_CR_PRESCALER_SHIFT);
 
-
        clrsetbits_le32(&priv->regs->dcr,
                        STM32_QSPI_DCR_CSHT_MASK << STM32_QSPI_DCR_CSHT_SHIFT,
                        csht << STM32_QSPI_DCR_CSHT_SHIFT);
@@ -632,6 +660,7 @@ static const struct dm_spi_ops stm32_qspi_ops = {
 
 static const struct udevice_id stm32_qspi_ids[] = {
        { .compatible = "st,stm32-qspi" },
+       { .compatible = "st,stm32f469-qspi" },
        { }
 };
 
index 5b91c8a90b345aff94580c7b309bfc17fb6c450a..3541e5c841278fa308697ef94876406ebd7f9634 100644 (file)
@@ -64,8 +64,10 @@ static int cadence_ttc_ofdata_to_platdata(struct udevice *dev)
 {
        struct cadence_ttc_priv *priv = dev_get_priv(dev);
 
-       priv->regs = map_physmem(devfdt_get_addr(dev),
+       priv->regs = map_physmem(dev_read_addr(dev),
                                 sizeof(struct cadence_ttc_regs), MAP_NOCACHE);
+       if (IS_ERR(priv->regs))
+               return PTR_ERR(priv->regs);
 
        return 0;
 }
index 3acadae8b170b80ef157e12b40ef0671f2244500..3ad4346f2d099b77a243dc88394b24f409408473 100644 (file)
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 #include <linux/compiler.h>
-#include <version.h>
 #include <g_dnl.h>
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-#include <fb_mmc.h>
-#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
-#include <fb_nand.h>
-#endif
-
-#define FASTBOOT_VERSION               "0.4"
 
 #define FASTBOOT_INTERFACE_CLASS       0xff
 #define FASTBOOT_INTERFACE_SUB_CLASS   0x42
@@ -58,8 +49,6 @@ static inline struct f_fastboot *func_to_fastboot(struct usb_function *f)
 }
 
 static struct f_fastboot *fastboot_func;
-static unsigned int download_size;
-static unsigned int download_bytes;
 
 static struct usb_endpoint_descriptor fs_ep_in = {
        .bLength            = USB_DT_ENDPOINT_SIZE,
@@ -147,22 +136,6 @@ static struct usb_gadget_strings *fastboot_strings[] = {
 };
 
 static void rx_handler_command(struct usb_ep *ep, struct usb_request *req);
-static int strcmp_l1(const char *s1, const char *s2);
-
-
-static char *fb_response_str;
-
-void fastboot_fail(const char *reason)
-{
-       strncpy(fb_response_str, "FAIL\0", 5);
-       strncat(fb_response_str, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
-}
-
-void fastboot_okay(const char *reason)
-{
-       strncpy(fb_response_str, "OKAY\0", 5);
-       strncat(fb_response_str, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
-}
 
 static void fastboot_complete(struct usb_ep *ep, struct usb_request *req)
 {
@@ -372,90 +345,9 @@ static void compl_do_reset(struct usb_ep *ep, struct usb_request *req)
        do_reset(NULL, 0, 0, NULL);
 }
 
-int __weak fb_set_reboot_flag(void)
-{
-       return -ENOSYS;
-}
-
-static void cb_reboot(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-       if (!strcmp_l1("reboot-bootloader", cmd)) {
-               if (fb_set_reboot_flag()) {
-                       fastboot_tx_write_str("FAILCannot set reboot flag");
-                       return;
-               }
-       }
-       fastboot_func->in_req->complete = compl_do_reset;
-       fastboot_tx_write_str("OKAY");
-}
-
-static int strcmp_l1(const char *s1, const char *s2)
-{
-       if (!s1 || !s2)
-               return -1;
-       return strncmp(s1, s2, strlen(s1));
-}
-
-static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-       char response[FASTBOOT_RESPONSE_LEN];
-       const char *s;
-       size_t chars_left;
-
-       strcpy(response, "OKAY");
-       chars_left = sizeof(response) - strlen(response) - 1;
-
-       strsep(&cmd, ":");
-       if (!cmd) {
-               pr_err("missing variable");
-               fastboot_tx_write_str("FAILmissing var");
-               return;
-       }
-
-       if (!strcmp_l1("version", cmd)) {
-               strncat(response, FASTBOOT_VERSION, chars_left);
-       } else if (!strcmp_l1("bootloader-version", cmd)) {
-               strncat(response, U_BOOT_VERSION, chars_left);
-       } else if (!strcmp_l1("downloadsize", cmd) ||
-               !strcmp_l1("max-download-size", cmd)) {
-               char str_num[12];
-
-               sprintf(str_num, "0x%08x", CONFIG_FASTBOOT_BUF_SIZE);
-               strncat(response, str_num, chars_left);
-       } else if (!strcmp_l1("serialno", cmd)) {
-               s = env_get("serial#");
-               if (s)
-                       strncat(response, s, chars_left);
-               else
-                       strcpy(response, "FAILValue not set");
-       } else {
-               char *envstr;
-
-               envstr = malloc(strlen("fastboot.") + strlen(cmd) + 1);
-               if (!envstr) {
-                       fastboot_tx_write_str("FAILmalloc error");
-                       return;
-               }
-
-               sprintf(envstr, "fastboot.%s", cmd);
-               s = env_get(envstr);
-               if (s) {
-                       strncat(response, s, chars_left);
-               } else {
-                       printf("WARNING: unknown variable: %s\n", cmd);
-                       strcpy(response, "FAILVariable not implemented");
-               }
-
-               free(envstr);
-       }
-       fastboot_tx_write_str(response);
-}
-
 static unsigned int rx_bytes_expected(struct usb_ep *ep)
 {
-       int rx_remain = download_size - download_bytes;
+       int rx_remain = fastboot_data_remaining();
        unsigned int rem;
        unsigned int maxpacket = ep->maxpacket;
 
@@ -477,14 +369,12 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep)
        return rx_remain;
 }
 
-#define BYTES_PER_DOT  0x20000
 static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
 {
-       char response[FASTBOOT_RESPONSE_LEN];
-       unsigned int transfer_size = download_size - download_bytes;
+       char response[FASTBOOT_RESPONSE_LEN] = {0};
+       unsigned int transfer_size = fastboot_data_remaining();
        const unsigned char *buffer = req->buf;
        unsigned int buffer_size = req->actual;
-       unsigned int pre_dot_num, now_dot_num;
 
        if (req->status != 0) {
                printf("Bad status: %d\n", req->status);
@@ -494,33 +384,19 @@ static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
        if (buffer_size < transfer_size)
                transfer_size = buffer_size;
 
-       memcpy((void *)CONFIG_FASTBOOT_BUF_ADDR + download_bytes,
-              buffer, transfer_size);
-
-       pre_dot_num = download_bytes / BYTES_PER_DOT;
-       download_bytes += transfer_size;
-       now_dot_num = download_bytes / BYTES_PER_DOT;
-
-       if (pre_dot_num != now_dot_num) {
-               putc('.');
-               if (!(now_dot_num % 74))
-                       putc('\n');
-       }
+       fastboot_data_download(buffer, transfer_size, response);
+       if (response[0]) {
+               fastboot_tx_write_str(response);
+       } else if (!fastboot_data_remaining()) {
+               fastboot_data_complete(response);
 
-       /* Check if transfer is done */
-       if (download_bytes >= download_size) {
                /*
-                * Reset global transfer variable, keep download_bytes because
-                * it will be used in the next possible flashing command
+                * Reset global transfer variable
                 */
-               download_size = 0;
                req->complete = rx_handler_command;
                req->length = EP_BUFFER_SIZE;
 
-               strcpy(response, "OKAY");
                fastboot_tx_write_str(response);
-
-               printf("\ndownloading of %d bytes finished\n", download_bytes);
        } else {
                req->length = rx_bytes_expected(ep);
        }
@@ -529,204 +405,55 @@ static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
        usb_ep_queue(ep, req, 0);
 }
 
-static void cb_download(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-       char response[FASTBOOT_RESPONSE_LEN];
-
-       strsep(&cmd, ":");
-       download_size = simple_strtoul(cmd, NULL, 16);
-       download_bytes = 0;
-
-       printf("Starting download of %d bytes\n", download_size);
-
-       if (0 == download_size) {
-               strcpy(response, "FAILdata invalid size");
-       } else if (download_size > CONFIG_FASTBOOT_BUF_SIZE) {
-               download_size = 0;
-               strcpy(response, "FAILdata too large");
-       } else {
-               sprintf(response, "DATA%08x", download_size);
-               req->complete = rx_handler_dl_image;
-               req->length = rx_bytes_expected(ep);
-       }
-       fastboot_tx_write_str(response);
-}
-
-static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req)
-{
-       char boot_addr_start[12];
-       char *bootm_args[] = { "bootm", boot_addr_start, NULL };
-
-       puts("Booting kernel..\n");
-
-       sprintf(boot_addr_start, "0x%lx", (long)CONFIG_FASTBOOT_BUF_ADDR);
-       do_bootm(NULL, 0, 2, bootm_args);
-
-       /* This only happens if image is somehow faulty so we start over */
-       do_reset(NULL, 0, 0, NULL);
-}
-
-static void cb_boot(struct usb_ep *ep, struct usb_request *req)
-{
-       fastboot_func->in_req->complete = do_bootm_on_complete;
-       fastboot_tx_write_str("OKAY");
-}
-
 static void do_exit_on_complete(struct usb_ep *ep, struct usb_request *req)
 {
        g_dnl_trigger_detach();
 }
 
-static void cb_continue(struct usb_ep *ep, struct usb_request *req)
+static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req)
 {
-       fastboot_func->in_req->complete = do_exit_on_complete;
-       fastboot_tx_write_str("OKAY");
+       fastboot_boot();
+       do_exit_on_complete(ep, req);
 }
 
-#ifdef CONFIG_FASTBOOT_FLASH
-static void cb_flash(struct usb_ep *ep, struct usb_request *req)
+static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
 {
-       char *cmd = req->buf;
-       char response[FASTBOOT_RESPONSE_LEN];
+       char *cmdbuf = req->buf;
+       char response[FASTBOOT_RESPONSE_LEN] = {0};
+       int cmd = -1;
 
-       strsep(&cmd, ":");
-       if (!cmd) {
-               pr_err("missing partition name");
-               fastboot_tx_write_str("FAILmissing partition name");
+       if (req->status != 0 || req->length == 0)
                return;
-       }
-
-       /* initialize the response buffer */
-       fb_response_str = response;
-
-       fastboot_fail("no flash device defined");
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-       fb_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
-                          download_bytes);
-#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
-       fb_nand_flash_write(cmd,
-                           (void *)CONFIG_FASTBOOT_BUF_ADDR,
-                           download_bytes);
-#endif
-       fastboot_tx_write_str(response);
-}
-#endif
 
-static void cb_oem(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-       if (strncmp("format", cmd + 4, 6) == 0) {
-               char cmdbuf[32];
-                sprintf(cmdbuf, "gpt write mmc %x $partitions",
-                       CONFIG_FASTBOOT_FLASH_MMC_DEV);
-                if (run_command(cmdbuf, 0))
-                       fastboot_tx_write_str("FAIL");
-                else
-                       fastboot_tx_write_str("OKAY");
-       } else
-#endif
-       if (strncmp("unlock", cmd + 4, 8) == 0) {
-               fastboot_tx_write_str("FAILnot implemented");
-       }
-       else {
-               fastboot_tx_write_str("FAILunknown oem command");
+       if (req->actual < req->length) {
+               cmdbuf[req->actual] = '\0';
+               cmd = fastboot_handle_command(cmdbuf, response);
+       } else {
+               pr_err("buffer overflow");
+               fastboot_fail("buffer overflow", response);
        }
-}
-
-#ifdef CONFIG_FASTBOOT_FLASH
-static void cb_erase(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-       char response[FASTBOOT_RESPONSE_LEN];
 
-       strsep(&cmd, ":");
-       if (!cmd) {
-               pr_err("missing partition name");
-               fastboot_tx_write_str("FAILmissing partition name");
-               return;
+       if (!strncmp("DATA", response, 4)) {
+               req->complete = rx_handler_dl_image;
+               req->length = rx_bytes_expected(ep);
        }
 
-       /* initialize the response buffer */
-       fb_response_str = response;
-
-       fastboot_fail("no flash device defined");
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-       fb_mmc_erase(cmd);
-#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
-       fb_nand_erase(cmd);
-#endif
        fastboot_tx_write_str(response);
-}
-#endif
-
-struct cmd_dispatch_info {
-       char *cmd;
-       void (*cb)(struct usb_ep *ep, struct usb_request *req);
-};
-
-static const struct cmd_dispatch_info cmd_dispatch_info[] = {
-       {
-               .cmd = "reboot",
-               .cb = cb_reboot,
-       }, {
-               .cmd = "getvar:",
-               .cb = cb_getvar,
-       }, {
-               .cmd = "download:",
-               .cb = cb_download,
-       }, {
-               .cmd = "boot",
-               .cb = cb_boot,
-       }, {
-               .cmd = "continue",
-               .cb = cb_continue,
-       },
-#ifdef CONFIG_FASTBOOT_FLASH
-       {
-               .cmd = "flash",
-               .cb = cb_flash,
-       }, {
-               .cmd = "erase",
-               .cb = cb_erase,
-       },
-#endif
-       {
-               .cmd = "oem",
-               .cb = cb_oem,
-       },
-};
-
-static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmdbuf = req->buf;
-       void (*func_cb)(struct usb_ep *ep, struct usb_request *req) = NULL;
-       int i;
 
-       if (req->status != 0 || req->length == 0)
-               return;
+       if (!strncmp("OKAY", response, 4)) {
+               switch (cmd) {
+               case FASTBOOT_COMMAND_BOOT:
+                       fastboot_func->in_req->complete = do_bootm_on_complete;
+                       break;
 
-       for (i = 0; i < ARRAY_SIZE(cmd_dispatch_info); i++) {
-               if (!strcmp_l1(cmd_dispatch_info[i].cmd, cmdbuf)) {
-                       func_cb = cmd_dispatch_info[i].cb;
+               case FASTBOOT_COMMAND_CONTINUE:
+                       fastboot_func->in_req->complete = do_exit_on_complete;
                        break;
-               }
-       }
 
-       if (!func_cb) {
-               pr_err("unknown command: %.*s", req->actual, cmdbuf);
-               fastboot_tx_write_str("FAILunknown command");
-       } else {
-               if (req->actual < req->length) {
-                       u8 *buf = (u8 *)req->buf;
-                       buf[req->actual] = 0;
-                       func_cb(ep, req);
-               } else {
-                       pr_err("buffer overflow");
-                       fastboot_tx_write_str("FAILbuffer overflow");
+               case FASTBOOT_COMMAND_REBOOT:
+               case FASTBOOT_COMMAND_REBOOT_BOOTLOADER:
+                       fastboot_func->in_req->complete = compl_do_reset;
+                       break;
                }
        }
 
index c8eda058329cec84e4f3cafc040f70de9f1d09b1..1aa6be44bb4d0894604dca8ad1f90e83bd0c225c 100644 (file)
@@ -620,22 +620,6 @@ static void thor_rx_tx_complete(struct usb_ep *ep, struct usb_request *req)
              status, req->actual, req->length);
 }
 
-static struct usb_request *thor_start_ep(struct usb_ep *ep)
-{
-       struct usb_request *req;
-
-       req = alloc_ep_req(ep, THOR_PACKET_SIZE);
-       debug("%s: ep:%p req:%p\n", __func__, ep, req);
-
-       if (!req)
-               return NULL;
-
-       memset(req->buf, 0, req->length);
-       req->complete = thor_rx_tx_complete;
-
-       return req;
-}
-
 static void thor_setup_complete(struct usb_ep *ep, struct usb_request *req)
 {
        if (req->status || req->actual != req->length)
@@ -752,6 +736,13 @@ int thor_handle(void)
        return 0;
 }
 
+static void free_ep_req(struct usb_ep *ep, struct usb_request *req)
+{
+       if (req->buf)
+               free(req->buf);
+       usb_ep_free_request(ep, req);
+}
+
 static int thor_func_bind(struct usb_configuration *c, struct usb_function *f)
 {
        struct usb_gadget *gadget = c->cdev->gadget;
@@ -860,21 +851,18 @@ static int thor_func_bind(struct usb_configuration *c, struct usb_function *f)
        return 0;
 
  fail:
+       if (dev->req)
+               free_ep_req(gadget->ep0, dev->req);
        free(dev);
        return status;
 }
 
-static void free_ep_req(struct usb_ep *ep, struct usb_request *req)
-{
-       free(req->buf);
-       usb_ep_free_request(ep, req);
-}
-
 static void thor_unbind(struct usb_configuration *c, struct usb_function *f)
 {
        struct f_thor *f_thor = func_to_thor(f);
        struct thor_dev *dev = f_thor->dev;
 
+       free_ep_req(dev->gadget->ep0, dev->req);
        free(dev);
        memset(thor_func, 0, sizeof(*thor_func));
        thor_func = NULL;
@@ -895,8 +883,6 @@ static void thor_func_disable(struct usb_function *f)
        }
 
        if (dev->out_ep->driver_data) {
-               free(dev->out_req->buf);
-               dev->out_req->buf = NULL;
                usb_ep_free_request(dev->out_ep, dev->out_req);
                usb_ep_disable(dev->out_ep);
                dev->out_ep->driver_data = NULL;
@@ -924,16 +910,17 @@ static int thor_eps_setup(struct usb_function *f)
 
        result = usb_ep_enable(ep, d);
        if (result)
-               goto exit;
+               goto err;
 
        ep->driver_data = cdev; /* claim */
-       req = thor_start_ep(ep);
+       req = alloc_ep_req(ep, THOR_PACKET_SIZE);
        if (!req) {
-               usb_ep_disable(ep);
                result = -EIO;
-               goto exit;
+               goto err_disable_in_ep;
        }
 
+       memset(req->buf, 0, req->length);
+       req->complete = thor_rx_tx_complete;
        dev->in_req = req;
        ep = dev->out_ep;
        d = ep_desc(gadget, &hs_out_desc, &fs_out_desc);
@@ -941,22 +928,34 @@ static int thor_eps_setup(struct usb_function *f)
 
        result = usb_ep_enable(ep, d);
        if (result)
-               goto exit;
+               goto err_free_in_req;
 
        ep->driver_data = cdev; /* claim */
-       req = thor_start_ep(ep);
+       req = usb_ep_alloc_request(ep, 0);
        if (!req) {
-               usb_ep_disable(ep);
                result = -EIO;
-               goto exit;
+               goto err_disable_out_ep;
        }
 
+       req->complete = thor_rx_tx_complete;
        dev->out_req = req;
        /* ACM control EP */
        ep = dev->int_ep;
        ep->driver_data = cdev; /* claim */
 
- exit:
+       return 0;
+
+ err_disable_out_ep:
+       usb_ep_disable(dev->out_ep);
+
+ err_free_in_req:
+       free_ep_req(dev->in_ep, dev->in_req);
+       dev->in_req = NULL;
+
+ err_disable_in_ep:
+       usb_ep_disable(dev->in_ep);
+
+ err:
        return result;
 }
 
index a837afc483bf3c5e2fbca18f74713c32aad98ce1..f2e91ef0feb71bec72f80ebb69b3b07fecd5597d 100644 (file)
@@ -117,12 +117,15 @@ err_clk:
 
 static int xhci_rcar_deregister(struct udevice *dev)
 {
+       int ret;
        struct rcar_xhci_platdata *plat = dev_get_platdata(dev);
 
+       ret = xhci_deregister(dev);
+
        clk_disable(&plat->clk);
        clk_free(&plat->clk);
 
-       return xhci_deregister(dev);
+       return ret;
 }
 
 static int xhci_rcar_ofdata_to_platdata(struct udevice *dev)
index 060a6c43092f441f37322c220ba1d6ae45b4b55f..f19bea3a91b736d1ad2e9434aa6192c78494b77a 100644 (file)
@@ -17,7 +17,6 @@
 
 struct rockchip_xhci_platdata {
        fdt_addr_t hcd_base;
-       fdt_addr_t phy_base;
        struct udevice *vbus_supply;
 };
 
@@ -35,7 +34,6 @@ struct rockchip_xhci {
 static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
 {
        struct rockchip_xhci_platdata *plat = dev_get_platdata(dev);
-       struct udevice *child;
        int ret = 0;
 
        /*
@@ -47,20 +45,6 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
                return -ENXIO;
        }
 
-       /* Get the base address for usbphy from the device node */
-       for (device_find_first_child(dev, &child); child;
-            device_find_next_child(&child)) {
-               if (!device_is_compatible(child, "rockchip,rk3399-usb3-phy"))
-                       continue;
-               plat->phy_base = devfdt_get_addr(child);
-               break;
-       }
-
-       if (plat->phy_base == FDT_ADDR_T_NONE) {
-               pr_err("Can't get the usbphy register address\n");
-               return -ENXIO;
-       }
-
        /* Vbus regulator */
        ret = device_get_supply_regulator(dev, "vbus-supply",
                                          &plat->vbus_supply);
index 7fe54281c3c4548bf50341ef90d084e7468ab7ea..e44e1ae1d915b790e3a1c7df3d4a6c0507941d77 100644 (file)
@@ -13,7 +13,7 @@
 #include <dm.h>
 #include <usb.h>
 #include <linux/errno.h>
-#include <asm/arch-zynqmp/hardware.h>
+#include <asm/arch/hardware.h>
 #include <linux/compat.h>
 #include <linux/usb/dwc3.h>
 #include "xhci.h"
index 3adb0028f2ae3501b84b0cab8d4fc1e6e432d2d6..9ded14cc3cb7a6703da755d4ded51e91338ecd91 100644 (file)
@@ -536,7 +536,7 @@ static int xhci_set_configuration(struct usb_device *udev)
        /* slot context */
        xhci_slot_copy(ctrl, in_ctx, out_ctx);
        slot_ctx = xhci_get_slot_ctx(ctrl, in_ctx);
-       slot_ctx->dev_info &= ~(LAST_CTX_MASK);
+       slot_ctx->dev_info &= ~(cpu_to_le32(LAST_CTX_MASK));
        slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(max_ep_flag + 1) | 0);
 
        xhci_endpoint_copy(ctrl, in_ctx, out_ctx, 0);
@@ -1424,7 +1424,7 @@ static int xhci_update_hub_device(struct udevice *dev, struct usb_device *udev)
 
        ctrl_ctx = xhci_get_input_control_ctx(in_ctx);
        /* Initialize the input context control */
-       ctrl_ctx->add_flags |= cpu_to_le32(SLOT_FLAG);
+       ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG);
        ctrl_ctx->drop_flags = 0;
 
        xhci_inval_cache((uintptr_t)out_ctx->bytes, out_ctx->size);
@@ -1435,8 +1435,15 @@ static int xhci_update_hub_device(struct udevice *dev, struct usb_device *udev)
 
        /* Update hub related fields */
        slot_ctx->dev_info |= cpu_to_le32(DEV_HUB);
-       if (hub->tt.multi && udev->speed == USB_SPEED_HIGH)
+       /*
+        * refer to section 6.2.2: MTT should be 0 for full speed hub,
+        * but it may be already set to 1 when setup an xHCI virtual
+        * device, so clear it anyway.
+        */
+       if (hub->tt.multi)
                slot_ctx->dev_info |= cpu_to_le32(DEV_MTT);
+       else if (udev->speed == USB_SPEED_FULL)
+               slot_ctx->dev_info &= cpu_to_le32(~DEV_MTT);
        slot_ctx->dev_info2 |= cpu_to_le32(XHCI_MAX_PORTS(udev->maxchild));
        /*
         * Set TT think time - convert from ns to FS bit times.
@@ -1452,6 +1459,7 @@ static int xhci_update_hub_device(struct udevice *dev, struct usb_device *udev)
                think_time = (think_time / 666) - 1;
        if (udev->speed == USB_SPEED_HIGH)
                slot_ctx->tt_info |= cpu_to_le32(TT_THINK_TIME(think_time));
+       slot_ctx->dev_state = 0;
 
        return xhci_configure_endpoints(udev, false);
 }
index 9a07fa10fd9b7d644224345fcb2bb4c0bbc2a541..f7618f86da15fe037859139b0948ceaf4fe505b2 100644 (file)
@@ -231,17 +231,16 @@ static int cdns_wdt_probe(struct udevice *dev)
 
 static int cdns_wdt_ofdata_to_platdata(struct udevice *dev)
 {
-       int node = dev_of_offset(dev);
        struct cdns_wdt_priv *priv = dev_get_priv(dev);
 
-       priv->regs = devfdt_get_addr_ptr(dev);
+       priv->regs = (struct cdns_regs *)dev_read_addr(dev);
        if (IS_ERR(priv->regs))
                return PTR_ERR(priv->regs);
 
-       priv->timeout = fdtdec_get_int(gd->fdt_blob, node, "timeout-sec",
-                                      CDNS_WDT_DEFAULT_TIMEOUT);
+       priv->timeout = dev_read_u32_default(dev, "timeout-sec",
+                                            CDNS_WDT_DEFAULT_TIMEOUT);
 
-       priv->rst = fdtdec_get_bool(gd->fdt_blob, node, "reset-on-timeout");
+       priv->rst = dev_read_bool(dev, "reset-on-timeout");
 
        debug("%s: timeout %d, reset %d\n", __func__, priv->timeout, priv->rst);
 
diff --git a/fs/fs.c b/fs/fs.c
index 94cdc37debfb39c0e813129bea976e81ed15d8e6..33808d549e0a5cd5e0a005dc5b00a3337aa4f0f8 100644 (file)
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -265,6 +265,19 @@ static struct fstype_info *fs_get_info(int fstype)
        return info;
 }
 
+/**
+ * fs_get_type_name() - Get type of current filesystem
+ *
+ * Return: Pointer to filesystem name
+ *
+ * Returns a string describing the current filesystem, or the sentinel
+ * "unsupported" for any unrecognised filesystem.
+ */
+const char *fs_get_type_name(void)
+{
+       return fs_get_info(fs_type)->name;
+}
+
 int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 {
        struct fstype_info *info;
index 8d5feb3ac774d81307a5d39f7f732713ddde7a97..d672e8ebe65c9e6a974058328aa1bf0d2dbe88e3 100644 (file)
 #define BOOTEFI_NAME "bootia32.efi"
 #elif defined(CONFIG_X86_RUN_64BIT)
 #define BOOTEFI_NAME "bootx64.efi"
+#elif defined(CONFIG_CPU_RISCV_32)
+#define BOOTEFI_NAME "bootriscv32.efi"
+#elif defined(CONFIG_CPU_RISCV_64)
+#define BOOTEFI_NAME "bootriscv64.efi"
 #endif
 #endif
 
 
 #if defined(CONFIG_CMD_DHCP)
 #if defined(CONFIG_EFI_LOADER)
+/* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */
 #if defined(CONFIG_ARM64)
 #define BOOTENV_EFI_PXE_ARCH "0xb"
 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00011:UNDI:003000"
 /* Always assume we're running 64bit */
 #define BOOTENV_EFI_PXE_ARCH "0x7"
 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00007:UNDI:003000"
+#elif defined(CONFIG_CPU_RISCV_32)
+#define BOOTENV_EFI_PXE_ARCH "0x19"
+#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00025:UNDI:003000"
+#elif defined(CONFIG_CPU_RISCV_64)
+#define BOOTENV_EFI_PXE_ARCH "0x1b"
+#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00027:UNDI:003000"
 #else
 #error Please specify an EFI client identifier
 #endif
diff --git a/include/configs/ax25-ae350.h b/include/configs/ax25-ae350.h
new file mode 100644 (file)
index 0000000..b1ca5ac
--- /dev/null
@@ -0,0 +1,162 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2017 Andes Technology Corporation
+ * Rick Chen, Andes Technology Corporation <rick@andestech.com>
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * CPU and Board Configuration Options
+ */
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_BOOTP_SERVERIP
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_CBSIZE      1024    /* Console I/O Buffer Size */
+
+/*
+ * Print Buffer Size
+ */
+#define CONFIG_SYS_PBSIZE      \
+       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+
+/*
+ * max number of command args
+ */
+#define CONFIG_SYS_MAXARGS     16
+
+/*
+ * Boot Argument Buffer Size
+ */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+
+/*
+ * Size of malloc() pool
+ * 512kB is suggested, (CONFIG_ENV_SIZE + 128 * 1024) was not enough
+ */
+#define CONFIG_SYS_MALLOC_LEN   (512 << 10)
+
+/* DT blob (fdt) address */
+#define CONFIG_SYS_FDT_BASE            0x000f0000
+
+/*
+ * Physical Memory Map
+ */
+#define CONFIG_NR_DRAM_BANKS   2
+#define PHYS_SDRAM_0   0x00000000              /* SDRAM Bank #1 */
+#define PHYS_SDRAM_1   \
+       (PHYS_SDRAM_0 + PHYS_SDRAM_0_SIZE)      /* SDRAM Bank #2 */
+#define PHYS_SDRAM_0_SIZE      0x20000000      /* 512 MB */
+#define PHYS_SDRAM_1_SIZE      0x20000000      /* 512 MB */
+#define CONFIG_SYS_SDRAM_BASE  PHYS_SDRAM_0
+
+/*
+ * Serial console configuration
+ */
+#define CONFIG_SYS_NS16550_SERIAL
+#ifndef CONFIG_DM_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE    -4
+#endif
+#define CONFIG_SYS_NS16550_CLK         19660800
+
+/* Init Stack Pointer */
+#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 0x1000000 - \
+                                       GENERATED_GBL_DATA_SIZE)
+
+/*
+ * Load address and memory test area should agree with
+ * arch/riscv/config.mk. Be careful not to overwrite U-Boot itself.
+ */
+#define CONFIG_SYS_LOAD_ADDR           0x100000        /* SDRAM */
+
+/*
+ * memtest works on 512 MB in DRAM
+ */
+#define CONFIG_SYS_MEMTEST_START       PHYS_SDRAM_0
+#define CONFIG_SYS_MEMTEST_END         (PHYS_SDRAM_0 + PHYS_SDRAM_0_SIZE)
+
+/*
+ * FLASH and environment organization
+ */
+
+/* use CFI framework */
+#define CONFIG_SYS_FLASH_CFI
+#define CONFIG_FLASH_CFI_DRIVER
+
+#define CONFIG_SYS_FLASH_CFI_WIDTH     FLASH_CFI_16BIT
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
+#define CONFIG_SYS_CFI_FLASH_STATUS_POLL
+
+/* support JEDEC */
+#ifdef CONFIG_CFI_FLASH
+#define CONFIG_SYS_MAX_FLASH_BANKS_DETECT      1
+#endif/* Do not use CONFIG_FLASH_CFI_LEGACY to detect on board flash */
+#define PHYS_FLASH_1                   0x88000000      /* BANK 0 */
+#define CONFIG_SYS_FLASH_BASE          PHYS_FLASH_1
+#define CONFIG_SYS_FLASH_BANKS_LIST    { PHYS_FLASH_1, }
+#define CONFIG_SYS_MONITOR_BASE                PHYS_FLASH_1
+
+#define CONFIG_SYS_FLASH_ERASE_TOUT    120000  /* TO for Flash Erase (ms) */
+#define CONFIG_SYS_FLASH_WRITE_TOUT    500     /* TO for Flash Write (ms) */
+
+/* max number of memory banks */
+/*
+ * There are 4 banks supported for this Controller,
+ * but we have only 1 bank connected to flash on board
+*/
+#ifndef CONFIG_SYS_MAX_FLASH_BANKS_DETECT
+#define CONFIG_SYS_MAX_FLASH_BANKS     1
+#endif
+#define CONFIG_SYS_FLASH_BANKS_SIZES {0x4000000}
+
+/* max number of sectors on one chip */
+#define CONFIG_FLASH_SECTOR_SIZE       (0x10000*2)
+#define CONFIG_SYS_MAX_FLASH_SECT      512
+
+/* environments */
+#define CONFIG_ENV_SPI_BUS             0
+#define CONFIG_ENV_SPI_CS              0
+#define CONFIG_ENV_SPI_MAX_HZ          50000000
+#define CONFIG_ENV_SPI_MODE            0
+#define CONFIG_ENV_SECT_SIZE           0x1000
+#define CONFIG_ENV_OVERWRITE
+
+/* SPI FLASH */
+#define CONFIG_SF_DEFAULT_BUS          0
+#define CONFIG_SF_DEFAULT_CS           0
+#define CONFIG_SF_DEFAULT_SPEED                1000000
+#define CONFIG_SF_DEFAULT_MODE         0
+
+/*
+ * For booting Linux, the board info and command line data
+ * have to be in the first 16 MB of memory, since this is
+ * the maximum mapped by the Linux kernel during initialization.
+ */
+
+/* Initial Memory map for Linux*/
+#define CONFIG_SYS_BOOTMAPSZ   (64 << 20)
+/* Increase max gunzip size */
+#define CONFIG_SYS_BOOTM_LEN   (64 << 20)
+
+/* When we use RAM as ENV */
+#define CONFIG_ENV_SIZE 0x2000
+
+/* Enable distro boot */
+#define BOOT_TARGET_DEVICES(func) \
+       func(MMC, mmc, 0) \
+       func(DHCP, dhcp, na)
+#include <config_distro_bootcmd.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS      \
+                               "kernel_addr_r=0x00080000\0" \
+                               "pxefile_addr_r=0x01f00000\0" \
+                               "scriptaddr=0x01f00000\0" \
+                               "fdt_addr_r=0x02000000\0" \
+                               "ramdisk_addr_r=0x02800000\0" \
+                               BOOTENV
+
+#endif /* __CONFIG_H */
diff --git a/include/configs/bitmain_antminer_s9.h b/include/configs/bitmain_antminer_s9.h
new file mode 100644 (file)
index 0000000..2267502
--- /dev/null
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * (C) Copyright 2018 Michal Simek <monstr@monstr.eu>
+ */
+
+#ifndef __CONFIG_BITMAIN_ANTMINER_S9_H
+#define __CONFIG_BITMAIN_ANTMINER_S9_H
+
+#define CONFIG_SYS_SDRAM_BASE  0x00000000
+#define CONFIG_SYS_SDRAM_SIZE  0x40000000
+
+#define CONFIG_ENV_SIZE                0x20000
+#define CONFIG_ENV_OFFSET      0x300000
+
+#define CONFIG_BOOTP_SERVERIP
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       "autoload=no\0" \
+       "pxefile_addr_r=0x2000000\0" \
+       "scriptaddr=0x3000000\0" \
+       "kernel_addr_r=0x2000000\0" \
+       "fdt_high=0xefff000\0" \
+       "initrd_high=0xefff000\0" \
+       "devnum=0\0" \
+       "wdstop=mw f8005000 ABC000\0" \
+       BOOTENV
+
+#include <configs/zynq-common.h>
+
+#endif /* __CONFIG_BITMAIN_ANTMINER_S9_H */
index 5b78785ee255ce0161f2cc016838def363571658..dec71038bf219ee932dd677a9bbe65d0af3f155a 100644 (file)
@@ -27,7 +27,8 @@
 /*
  * Commands configuration
  */
-#define CONFIG_SYS_MVFS
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 #define CONFIG_NR_DRAM_BANKS           1
 
index 5b444542f4e9d12b0fbc9c1ce9e0b42fcb192f6f..27308c92ffb99a55cde2ed7629d2db68453abcd3 100644 (file)
@@ -61,7 +61,8 @@
 #endif
 
 /* why is this only defined in mv-common.h if CONFIG_DM is undefined? */
-#define CONFIG_SYS_MVFS
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 /*
  * mv-common.h should be defined after CMD configs since it used them
diff --git a/include/configs/emdk.h b/include/configs/emdk.h
new file mode 100644 (file)
index 0000000..dca13e2
--- /dev/null
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018 Synopsys, Inc. All rights reserved.
+ */
+
+#ifndef _CONFIG_EMDK_H_
+#define _CONFIG_EMDK_H_
+
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_MONITOR_BASE                CONFIG_SYS_TEXT_BASE
+
+#define CONFIG_SYS_SDRAM_BASE          0x10000000
+#define CONFIG_SYS_SDRAM_SIZE          SZ_8M
+
+#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + SZ_1M)
+
+#define CONFIG_SYS_MALLOC_LEN          SZ_64K
+#define CONFIG_SYS_LOAD_ADDR           CONFIG_SYS_SDRAM_BASE
+
+/* Required by DW MMC driver */
+#define CONFIG_BOUNCE_BUFFER
+
+/*
+ * Environment
+ */
+#define CONFIG_ENV_SIZE                        SZ_4K
+#define CONFIG_BOOTFILE                        "app.bin"
+#define CONFIG_LOADADDR                        CONFIG_SYS_LOAD_ADDR
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       "upgrade_image=u-boot.bin\0" \
+       "upgrade=emdk rom unlock && " \
+               "fatload mmc 0 ${loadaddr} ${upgrade_image} && " \
+               "cp.b ${loadaddr} 0 ${filesize} && " \
+               "dcache flush && " \
+               "emdk rom lock\0"
+
+#endif /* _CONFIG_EMDK_H_ */
+
index 1d9fe29f9ed4b3846793392d4296b050843bd2d8..8b05e0a53d7143f48e170d7068cffc3d7eab5dab 100644 (file)
@@ -41,7 +41,8 @@
  * Commands configuration
  */
 
-#define CONFIG_SYS_MVFS         /* Picks up Filesystem from mv-common.h */
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 /*
  * mv-common.h should be defined after CMD configs since it used them
index d59cddb002e55646dea21a3c283d529812238d7d..9e7ca60f112f2b4b24110c8c6ebb703a24d082ae 100644 (file)
@@ -17,7 +17,9 @@
 /*
  * Standard filesystems
  */
-#define CONFIG_SYS_MVFS
+#define CONFIG_BZIP2
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 /*
  * mv-plug-common.h should be defined after CMD configs since it used them
index 5f071d02b7397712edba1ea2aa3ef4f26c6b9d8b..a7643166f417c77cbb4cb184aaf5613437ca02b5 100644 (file)
@@ -26,7 +26,8 @@
 /*
  * Commands configuration
  */
-#define CONFIG_SYS_MVFS
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 /*
  * mv-common.h should be defined after CMD configs since it used them
index 66131cca622b0b406b85b18a22fbb001837d3726..1fe4618da5e5f11058f215b8f94fa661c507b312 100644 (file)
@@ -28,7 +28,8 @@
 /*
  * Commands configuration
  */
-#define CONFIG_SYS_MVFS
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 /*
  * mv-common.h should be defined after CMD configs since it used them
index fa9b5bcf3a516f204a7d86f2046feca733a3c4c1..79d61c599e54e4e2c30d776a61557d75c986b038 100644 (file)
 /* additions for new ARM relocation support */
 #define CONFIG_SYS_SDRAM_BASE  0x00000000
 
-/*
- * CLKs configurations
- */
-
 /*
  * NS16550 Configuration
  */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
 #endif
 
-/*
- * Common SPI Flash configuration
- */
-#ifdef CONFIG_CMD_SF
-#endif
-
-/*
- * File system
- */
-#ifdef CONFIG_SYS_MVFS
-#define CONFIG_MTD_DEVICE               /* needed for mtdparts commands */
-#define CONFIG_MTD_PARTITIONS
-#endif
-
 #endif /* _MV_COMMON_H */
index df686dbe4f6c5d43e1808787efc91773126ef141..81c07a889a36b600b6b47cdde0cb27590637906b 100644 (file)
 /* Add target to build it automatically upon "make" */
 #define CONFIG_BUILD_TARGET     "u-boot.kwb"
 
-/*
- * Compression configuration
- */
-#ifdef CONFIG_SYS_MVFS
-#define CONFIG_BZIP2
-#endif /* CONFIG_SYS_MVFS */
-
-/*
- * Commands configuration
- */
-
-/*
- * Extra file system
- */
-
 /*
  * mv-common.h should be defined after CMD configs since it used them
  * to enable certain macros
index 4c320522d2f77d49341ada28a621ba2ec15d99c5..2f90439383418422751d17f5333e536ee5a1e03d 100644 (file)
@@ -22,7 +22,8 @@
 #define CONFIG_BZIP2
 
 /* commands configuration */
-#define CONFIG_SYS_MVFS
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 /*
  * mv-common.h should be defined after CMD configs since it used them
diff --git a/include/configs/nx25-ae250.h b/include/configs/nx25-ae250.h
deleted file mode 100644 (file)
index 930cdbd..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2017 Andes Technology Corporation
- * Rick Chen, Andes Technology Corporation <rick@andestech.com>
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-/*
- * CPU and Board Configuration Options
- */
-#define CONFIG_BOOTP_SEND_HOSTNAME
-#define CONFIG_BOOTP_SERVERIP
-
-/*
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_CBSIZE      1024    /* Console I/O Buffer Size */
-
-/*
- * Print Buffer Size
- */
-#define CONFIG_SYS_PBSIZE      \
-       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
-
-/*
- * max number of command args
- */
-#define CONFIG_SYS_MAXARGS     16
-
-/*
- * Boot Argument Buffer Size
- */
-#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
-
-/*
- * Size of malloc() pool
- * 512kB is suggested, (CONFIG_ENV_SIZE + 128 * 1024) was not enough
- */
-#define CONFIG_SYS_MALLOC_LEN   (512 << 10)
-
-/* DT blob (fdt) address */
-#define CONFIG_SYS_FDT_BASE            0x000f0000
-
-/*
- * Physical Memory Map
- */
-#define CONFIG_NR_DRAM_BANKS   2
-#define PHYS_SDRAM_0   0x00000000              /* SDRAM Bank #1 */
-#define PHYS_SDRAM_1   \
-       (PHYS_SDRAM_0 + PHYS_SDRAM_0_SIZE)      /* SDRAM Bank #2 */
-#define PHYS_SDRAM_0_SIZE      0x20000000      /* 512 MB */
-#define PHYS_SDRAM_1_SIZE      0x20000000      /* 512 MB */
-#define CONFIG_SYS_SDRAM_BASE  PHYS_SDRAM_0
-
-/*
- * Serial console configuration
- */
-#define CONFIG_SYS_NS16550_SERIAL
-#ifndef CONFIG_DM_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE    -4
-#endif
-#define CONFIG_SYS_NS16550_CLK         19660800
-
-/* Init Stack Pointer */
-#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 0x1000000 - \
-                                       GENERATED_GBL_DATA_SIZE)
-
-/*
- * Load address and memory test area should agree with
- * arch/riscv/config.mk. Be careful not to overwrite U-Boot itself.
- */
-#define CONFIG_SYS_LOAD_ADDR           0x100000        /* SDRAM */
-
-/*
- * memtest works on 512 MB in DRAM
- */
-#define CONFIG_SYS_MEMTEST_START       PHYS_SDRAM_0
-#define CONFIG_SYS_MEMTEST_END         (PHYS_SDRAM_0 + PHYS_SDRAM_0_SIZE)
-
-/* environments */
-#define CONFIG_ENV_SPI_BUS             0
-#define CONFIG_ENV_SPI_CS              0
-#define CONFIG_ENV_SPI_MAX_HZ          50000000
-#define CONFIG_ENV_SPI_MODE            0
-#define CONFIG_ENV_SECT_SIZE           0x1000
-#define CONFIG_ENV_OVERWRITE
-
-/* SPI FLASH */
-#define CONFIG_SF_DEFAULT_BUS          0
-#define CONFIG_SF_DEFAULT_CS           0
-#define CONFIG_SF_DEFAULT_SPEED                1000000
-#define CONFIG_SF_DEFAULT_MODE         0
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 16 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-
-/* Initial Memory map for Linux*/
-#define CONFIG_SYS_BOOTMAPSZ   (64 << 20)
-/* Increase max gunzip size */
-#define CONFIG_SYS_BOOTM_LEN   (64 << 20)
-
-#endif /* __CONFIG_H */
index dfdad56dcc927fea69cc661384e1224918d5d04e..aa5425af02ea0666e42b18276107fcbd7e726785 100644 (file)
@@ -23,7 +23,8 @@
 /*
  * Commands configuration
  */
-#define CONFIG_SYS_MVFS
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 /*
  * mv-common.h should be defined after CMD configs since it used them
index 0416baef452ab5a2cedeceb2db86f64f4a0f5818..a654df6d6f856e4884e4e676d2b0c4103641f67d 100644 (file)
@@ -27,7 +27,8 @@
 /*
  * Commands configuration
  */
-#define CONFIG_SYS_MVFS
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 /*
  * mv-common.h should be defined after CMD configs since it used them
index 656db45adf19e3b422ab219b94e19fd10ff25041..23dd5ceb7cb97600e61e752a865a3d853d1353dc 100644 (file)
@@ -21,7 +21,9 @@
 /*
  * Standard filesystems
  */
-#define CONFIG_SYS_MVFS
+#define CONFIG_BZIP2
+#define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
 
 /*
  * mv-plug-common.h should be defined after CMD configs since it used them
index 947d3083dae493977b8606ca8917e6c940fe162a..96ff6c9f021593d250c433797978ea56a0a5c708 100644 (file)
@@ -32,7 +32,6 @@
 /* BOOTP options */
 #undef CONFIG_BOOTP_BOOTFILESIZE
 #undef CONFIG_BOOTP_MAY_FAIL
-#undef CONFIG_CMD_UNZIP
 
 #undef CONFIG_NR_DRAM_BANKS
 
diff --git a/include/configs/xilinx_zynqmp_zc1751_xm016_dc2.h b/include/configs/xilinx_zynqmp_zc1751_xm016_dc2.h
deleted file mode 100644 (file)
index bfebbb3..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Configuration for Xilinx ZynqMP zc1751 XM016 DC2
- *
- * (C) Copyright 2015 Xilinx, Inc.
- * Michal Simek <michal.simek@xilinx.com>
- */
-
-#ifndef __CONFIG_ZYNQMP_ZC1751_XM016_DC2_H
-#define __CONFIG_ZYNQMP_ZC1751_XM016_DC2_H
-
-#include <configs/xilinx_zynqmp.h>
-
-#endif /* __CONFIG_ZYNQMP_ZC1751_XM016_DC2_H */
diff --git a/include/dt-bindings/leds/leds-netxbig.h b/include/dt-bindings/leds/leds-netxbig.h
new file mode 100644 (file)
index 0000000..92658b0
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * This header provides constants for netxbig LED bindings.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef _DT_BINDINGS_LEDS_NETXBIG_H
+#define _DT_BINDINGS_LEDS_NETXBIG_H
+
+#define NETXBIG_LED_OFF                0
+#define NETXBIG_LED_ON         1
+#define NETXBIG_LED_SATA       2
+#define NETXBIG_LED_TIMER1     3
+#define NETXBIG_LED_TIMER2     4
+
+#endif /* _DT_BINDINGS_LEDS_NETXBIG_H */
diff --git a/include/dt-bindings/leds/leds-ns2.h b/include/dt-bindings/leds/leds-ns2.h
new file mode 100644 (file)
index 0000000..fd61574
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _DT_BINDINGS_LEDS_NS2_H
+#define _DT_BINDINGS_LEDS_NS2_H
+
+#define NS_V2_LED_OFF  0
+#define NS_V2_LED_ON   1
+#define NS_V2_LED_SATA 2
+
+#endif
diff --git a/include/dt_table.h b/include/dt_table.h
new file mode 100644 (file)
index 0000000..7fb16e9
--- /dev/null
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * This is from the Android Project,
+ * Repository: https://android.googlesource.com/platform/system/libufdt
+ * File: utils/src/dt_table.h
+ * Commit: 2626d8b9e4d8e8c6cc67ceb1dc4e05a47779785c
+ * Copyright (C) 2017 The Android Open Source Project
+ */
+
+#ifndef DT_TABLE_H
+#define DT_TABLE_H
+
+#include <linux/types.h>
+
+#define DT_TABLE_MAGIC                 0xd7b7ab1e
+#define DT_TABLE_DEFAULT_PAGE_SIZE     2048
+#define DT_TABLE_DEFAULT_VERSION       0
+
+struct dt_table_header {
+       u32 magic;              /* DT_TABLE_MAGIC */
+       u32 total_size;         /* includes dt_table_header + all dt_table_entry
+                                * and all dtb/dtbo
+                                */
+       u32 header_size;        /* sizeof(dt_table_header) */
+
+       u32 dt_entry_size;      /* sizeof(dt_table_entry) */
+       u32 dt_entry_count;     /* number of dt_table_entry */
+       u32 dt_entries_offset;  /* offset to the first dt_table_entry
+                                * from head of dt_table_header.
+                                * The value will be equal to header_size if
+                                * no padding is appended
+                                */
+       u32 page_size;          /* flash page size we assume */
+       u32 version;            /* DTBO image version, the current version is 0.
+                                * The version will be incremented when the
+                                * dt_table_header struct is updated.
+                                */
+};
+
+struct dt_table_entry {
+       u32 dt_size;
+       u32 dt_offset;          /* offset from head of dt_table_header */
+
+       u32 id;                 /* optional, must be zero if unused */
+       u32 rev;                /* optional, must be zero if unused */
+       u32 custom[4];          /* optional, must be zero if unused */
+};
+
+#endif
index 2868ca25abb493d3ec5e867591eb65e9811c0ad4..ec000658f6de4220af3edfcbe9000e3a507faafb 100644 (file)
@@ -75,6 +75,13 @@ const char *__efi_nesting_dec(void);
                ##__VA_ARGS__); \
        })
 
+#ifdef CONFIG_SYS_CACHELINE_SIZE
+#define EFI_CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZE
+#else
+/* Just use the greatest cache flush alignment requirement I'm aware of */
+#define EFI_CACHELINE_SIZE 128
+#endif
+
 extern struct efi_runtime_services efi_runtime_services;
 extern struct efi_system_table systab;
 
diff --git a/include/fastboot-internal.h b/include/fastboot-internal.h
new file mode 100644 (file)
index 0000000..bf2f2b3
--- /dev/null
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef _FASTBOOT_INTERNAL_H_
+#define _FASTBOOT_INTERNAL_H_
+
+/**
+ * fastboot_buf_addr - base address of the fastboot download buffer
+ */
+extern void *fastboot_buf_addr;
+
+/**
+ * fastboot_buf_size - size of the fastboot download buffer
+ */
+extern u32 fastboot_buf_size;
+
+/**
+ * fastboot_progress_callback - callback executed during long operations
+ */
+extern void (*fastboot_progress_callback)(const char *msg);
+
+/**
+ * fastboot_getvar() - Writes variable indicated by cmd_parameter to response.
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ *
+ * Look up cmd_parameter first as an environment variable of the form
+ * fastboot.<cmd_parameter>, if that exists return use its value to set
+ * response.
+ *
+ * Otherwise lookup the name of variable and execute the appropriate
+ * function to return the requested value.
+ */
+void fastboot_getvar(char *cmd_parameter, char *response);
+
+#endif
index 009f1a72e10fb287fa721cac91028b4db065371c..1933b1d98e3bb9a03832f37b5efb616cb6ec952b 100644 (file)
 #ifndef _FASTBOOT_H_
 #define _FASTBOOT_H_
 
+#define FASTBOOT_VERSION       "0.4"
+
 /* The 64 defined bytes plus \0 */
+#define FASTBOOT_COMMAND_LEN   (64 + 1)
 #define FASTBOOT_RESPONSE_LEN  (64 + 1)
 
-void fastboot_fail(const char *reason);
-void fastboot_okay(const char *reason);
+/**
+ * All known commands to fastboot
+ */
+enum {
+       FASTBOOT_COMMAND_GETVAR = 0,
+       FASTBOOT_COMMAND_DOWNLOAD,
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
+       FASTBOOT_COMMAND_FLASH,
+       FASTBOOT_COMMAND_ERASE,
+#endif
+       FASTBOOT_COMMAND_BOOT,
+       FASTBOOT_COMMAND_CONTINUE,
+       FASTBOOT_COMMAND_REBOOT,
+       FASTBOOT_COMMAND_REBOOT_BOOTLOADER,
+       FASTBOOT_COMMAND_SET_ACTIVE,
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+       FASTBOOT_COMMAND_OEM_FORMAT,
+#endif
+
+       FASTBOOT_COMMAND_COUNT
+};
+
+/**
+ * fastboot_response() - Writes a response of the form "$tag$reason".
+ *
+ * @tag: The first part of the response
+ * @response: Pointer to fastboot response buffer
+ * @format: printf style format string
+ */
+void fastboot_response(const char *tag, char *response,
+                      const char *format, ...)
+       __attribute__ ((format (__printf__, 3, 4)));
+
+/**
+ * fastboot_fail() - Write a FAIL response of the form "FAIL$reason".
+ *
+ * @reason: Pointer to returned reason string
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_fail(const char *reason, char *response);
+
+/**
+ * fastboot_okay() - Write an OKAY response of the form "OKAY$reason".
+ *
+ * @reason: Pointer to returned reason string, or NULL to send a bare "OKAY"
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_okay(const char *reason, char *response);
+
+/**
+ * fastboot_set_reboot_flag() - Set flag to indicate reboot-bootloader
+ *
+ * Set flag which indicates that we should reboot into the bootloader
+ * following the reboot that fastboot executes after this function.
+ *
+ * This function should be overridden in your board file with one
+ * which sets whatever flag your board specific Android bootloader flow
+ * requires in order to re-enter the bootloader.
+ */
+int fastboot_set_reboot_flag(void);
+
+/**
+ * fastboot_set_progress_callback() - set progress callback
+ *
+ * @progress: Pointer to progress callback
+ *
+ * Set a callback which is invoked periodically during long running operations
+ * (flash and erase). This can be used (for example) by the UDP transport to
+ * send INFO responses to keep the client alive whilst those commands are
+ * executing.
+ */
+void fastboot_set_progress_callback(void (*progress)(const char *msg));
+
+/*
+ * fastboot_init() - initialise new fastboot protocol session
+ *
+ * @buf_addr: Pointer to download buffer, or NULL for default
+ * @buf_size: Size of download buffer, or zero for default
+ */
+void fastboot_init(void *buf_addr, u32 buf_size);
+
+/**
+ * fastboot_boot() - Execute fastboot boot command
+ *
+ * If ${fastboot_bootcmd} is set, run that command to execute the boot
+ * process, if that returns, then exit the fastboot server and return
+ * control to the caller.
+ *
+ * Otherwise execute "bootm <fastboot_buf_addr>", if that fails, reset
+ * the board.
+ */
+void fastboot_boot(void);
+
+/**
+ * fastboot_handle_command() - Handle fastboot command
+ *
+ * @cmd_string: Pointer to command string
+ * @response: Pointer to fastboot response buffer
+ *
+ * Return: Executed command, or -1 if not recognized
+ */
+int fastboot_handle_command(char *cmd_string, char *response);
+
+/**
+ * fastboot_data_remaining() - return bytes remaining in current transfer
+ *
+ * Return: Number of bytes left in the current download
+ */
+u32 fastboot_data_remaining(void);
+
+/**
+ * fastboot_data_download() - Copy image data to fastboot_buf_addr.
+ *
+ * @fastboot_data: Pointer to received fastboot data
+ * @fastboot_data_len: Length of received fastboot data
+ * @response: Pointer to fastboot response buffer
+ *
+ * Copies image data from fastboot_data to fastboot_buf_addr. Writes to
+ * response. fastboot_bytes_received is updated to indicate the number
+ * of bytes that have been transferred.
+ */
+void fastboot_data_download(const void *fastboot_data,
+                           unsigned int fastboot_data_len, char *response);
+
+/**
+ * fastboot_data_complete() - Mark current transfer complete
+ *
+ * @response: Pointer to fastboot response buffer
+ *
+ * Set image_size and ${filesize} to the total size of the downloaded image.
+ */
+void fastboot_data_complete(char *response);
 
 #endif /* _FASTBOOT_H_ */
index a2d7c4895fa1b5f9449b43619f27c71a3aea9b7d..fd5db9eac8753b8e526036a65bb610d162ea4780 100644 (file)
@@ -3,6 +3,35 @@
  * Copyright 2014 Broadcom Corporation.
  */
 
-void fb_mmc_flash_write(const char *cmd, void *download_buffer,
-                       unsigned int download_bytes);
-void fb_mmc_erase(const char *cmd);
+#ifndef _FB_MMC_H_
+#define _FB_MMC_H_
+
+/**
+ * fastboot_mmc_get_part_info() - Lookup eMMC partion by name
+ *
+ * @part_name: Named partition to lookup
+ * @dev_desc: Pointer to returned blk_desc pointer
+ * @part_info: Pointer to returned disk_partition_t
+ * @response: Pointer to fastboot response buffer
+ */
+int fastboot_mmc_get_part_info(char *part_name, struct blk_desc **dev_desc,
+                              disk_partition_t *part_info, char *response);
+
+/**
+ * fastboot_mmc_flash_write() - Write image to eMMC for fastboot
+ *
+ * @cmd: Named partition to write image to
+ * @download_buffer: Pointer to image data
+ * @download_bytes: Size of image data
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
+                             u32 download_bytes, char *response);
+/**
+ * fastboot_mmc_flash_erase() - Erase eMMC for fastboot
+ *
+ * @cmd: Named partition to erase
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_mmc_erase(const char *cmd, char *response);
+#endif
index 3daae8c4ca450ade1dad49600cd183eb833882ac..08ab0e28a6545ed1df6d1eaca87a3534a0a57356 100644 (file)
@@ -4,6 +4,37 @@
  * Copyright 2015 Free Electrons.
  */
 
-void fb_nand_flash_write(const char *cmd, void *download_buffer,
-                        unsigned int download_bytes);
-void fb_nand_erase(const char *cmd);
+#ifndef _FB_NAND_H_
+#define _FB_NAND_H_
+
+#include <jffs2/load_kernel.h>
+
+/**
+ * fastboot_nand_get_part_info() - Lookup NAND partion by name
+ *
+ * @part_name: Named device to lookup
+ * @part_info: Pointer to returned part_info pointer
+ * @response: Pointer to fastboot response buffer
+ */
+int fastboot_nand_get_part_info(char *part_name, struct part_info **part_info,
+                               char *response);
+
+/**
+ * fastboot_nand_flash_write() - Write image to NAND for fastboot
+ *
+ * @cmd: Named device to write image to
+ * @download_buffer: Pointer to image data
+ * @download_bytes: Size of image data
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
+                              u32 download_bytes, char *response);
+
+/**
+ * fastboot_nand_flash_erase() - Erase NAND for fastboot
+ *
+ * @cmd: Named device to erase
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_nand_erase(const char *cmd, char *response);
+#endif
index f4440933531f41a5ac9a339119200a71bc968f20..195f0bdd57a98b1c3404b7d33b31bc53f986969a 100644 (file)
@@ -20,6 +20,9 @@
 /* device numbers must be non-negative */
 #define FPGA_INVALID_DEVICE    -1
 
+#define FPGA_ENC_USR_KEY       1
+#define FPGA_NO_ENC_OR_NO_AUTH 2
+
 /* root data type defintions */
 typedef enum {                 /* typedef fpga_type */
        fpga_min_type,          /* range check value */
@@ -42,6 +45,12 @@ typedef struct {                /* typedef fpga_desc */
        int fstype;
 } fpga_fs_info;
 
+struct fpga_secure_info {
+       u8 *userkey_addr;
+       u8 authflag;
+       u8 encflag;
+};
+
 typedef enum {
        BIT_FULL = 0,
        BIT_PARTIAL,
@@ -58,6 +67,8 @@ int fpga_load(int devnum, const void *buf, size_t bsize,
              bitstream_type bstype);
 int fpga_fsload(int devnum, const void *buf, size_t size,
                fpga_fs_info *fpga_fsinfo);
+int fpga_loads(int devnum, const void *buf, size_t size,
+              struct fpga_secure_info *fpga_sec_info);
 int fpga_loadbitstream(int devnum, char *fpgadata, size_t size,
                       bitstream_type bstype);
 int fpga_dump(int devnum, const void *buf, size_t bsize);
index d703ed5027edef072830ac09cd9f18c475ffe8ec..163da103b472bd65fae7c7ef71ea50815385bcae 100644 (file)
@@ -37,6 +37,16 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype);
  */
 int fs_set_blk_dev_with_part(struct blk_desc *desc, int part);
 
+/**
+ * fs_get_type_name() - Get type of current filesystem
+ *
+ * Return: Pointer to filesystem name
+ *
+ * Returns a string describing the current filesystem, or the sentinel
+ * "unsupported" for any unrecognised filesystem.
+ */
+const char *fs_get_type_name(void);
+
 /*
  * Print the list of files on the partition previously set by fs_set_blk_dev(),
  * in directory "dirname".
index f39dc16617f32d987882fae7d134ff93f04cd07a..234c237b845fe592077d4be51e98ffe7cfb8ef3b 100644 (file)
@@ -23,7 +23,7 @@ struct sparse_storage {
                                 lbaint_t blk,
                                 lbaint_t blkcnt);
 
-       void            (*mssg)(const char *str);
+       void            (*mssg)(const char *str, char *response);
 };
 
 static inline int is_sparse_image(void *buf)
@@ -38,4 +38,4 @@ static inline int is_sparse_image(void *buf)
 }
 
 int write_sparse_image(struct sparse_storage *info, const char *part_name,
-                      void *data);
+                      void *data, char *response);
index 0d209a64928664f4c30ff2f6fd26aa475fb82550..e2bf79c7ee8d63bf6bc29d6239b85a0487f5353a 100644 (file)
@@ -6,8 +6,8 @@
  * Using the same guard name as that of scripts/dtc/libfdt/libfdt_env.h
  * prevents it from being included.
  */
-#ifndef _LIBFDT_ENV_H
-#define _LIBFDT_ENV_H
+#ifndef LIBFDT_ENV_H
+#define LIBFDT_ENV_H
 
 #include <linux/string.h>
 
@@ -27,5 +27,5 @@ typedef __be64 fdt64_t;
 
 #define strtoul(cp, endp, base)        simple_strtoul(cp, endp, base)
 
-#endif /* _LIBFDT_ENV_H */
+#endif /* LIBFDT_ENV_H */
 #endif
index 65f51d77a555d3e7dce91ef769bf4ba7bbe564c2..57606855564f002f5b0d4e38c1df926a998e0a43 100644 (file)
@@ -535,7 +535,7 @@ extern int          net_restart_wrap;       /* Tried all network devices */
 
 enum proto_t {
        BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
-       TFTPSRV, TFTPPUT, LINKLOCAL
+       TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT
 };
 
 extern char    net_boot_file_name[1024];/* Boot File name */
diff --git a/include/net/fastboot.h b/include/net/fastboot.h
new file mode 100644 (file)
index 0000000..6860209
--- /dev/null
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2016 The Android Open Source Project
+ */
+
+#ifndef __NET_FASTBOOT_H__
+#define __NET_FASTBOOT_H__
+
+/**********************************************************************/
+/*
+ *     Global functions and variables.
+ */
+
+/**
+ * Wait for incoming fastboot comands.
+ */
+void fastboot_start_server(void);
+
+/**********************************************************************/
+
+#endif /* __NET_FASTBOOT_H__ */
index 9429f51b48aeeb82606012b3b36ca34fc93ffb3e..af40befa52de5999c40913847abb556a42382c82 100644 (file)
@@ -48,6 +48,8 @@ typedef struct {              /* typedef xilinx_desc */
 struct xilinx_fpga_op {
        int (*load)(xilinx_desc *, const void *, size_t, bitstream_type);
        int (*loadfs)(xilinx_desc *, const void *, size_t, fpga_fs_info *);
+       int (*loads)(xilinx_desc *desc, const void *buf, size_t bsize,
+                    struct fpga_secure_info *fpga_sec_info);
        int (*dump)(xilinx_desc *, const void *, size_t);
        int (*info)(xilinx_desc *);
 };
@@ -60,6 +62,8 @@ int xilinx_dump(xilinx_desc *desc, const void *buf, size_t bsize);
 int xilinx_info(xilinx_desc *desc);
 int xilinx_loadfs(xilinx_desc *desc, const void *buf, size_t bsize,
                  fpga_fs_info *fpga_fsinfo);
+int xilinx_loads(xilinx_desc *desc, const void *buf, size_t bsize,
+                struct fpga_secure_info *fpga_sec_info);
 
 /* Board specific implementation specific function types
  *********************************************************************/
index a0f4e68a0c193e361726e465ad983d2356deb648..5214db99fba769b2ae8dbeba111cefacc7f2cced 100644 (file)
@@ -16,6 +16,9 @@
 #define ZYNQMP_FPGA_OP_LOAD                    (1 << 1)
 #define ZYNQMP_FPGA_OP_DONE                    (1 << 2)
 
+#define ZYNQMP_FPGA_FLAG_AUTHENTICATED         BIT(2)
+#define ZYNQMP_FPGA_FLAG_ENCRYPTED             BIT(3)
+
 #define ZYNQMP_CSU_IDCODE_DEVICE_CODE_SHIFT    15
 #define ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK     (0xf << \
                                        ZYNQMP_CSU_IDCODE_DEVICE_CODE_SHIFT)
index 1590f7afa40250cf3df678fccd57aecaa5e1e940..15c6a52d4a1b57273c1d84ce822191209004fa9f 100644 (file)
@@ -61,6 +61,17 @@ config SPL_STRTO
 config TPL_STRTO
        bool
 
+config IMAGE_SPARSE
+       bool
+
+config IMAGE_SPARSE_FILLBUF_SIZE
+       hex "Android sparse image CHUNK_TYPE_FILL buffer size"
+       default 0x80000
+       depends on IMAGE_SPARSE
+       help
+         Set the size of the fill buffer used when processing CHUNK_TYPE_FILL
+         chunks.
+
 config USE_PRIVATE_LIBGCC
        bool "Use private libgcc"
        depends on HAVE_PRIVATE_LIBGCC
index e6cb4afc232650ac31072fcd553fb5be7c732cc6..c0511cbff84450b28926ed543c050a610766ec74 100644 (file)
@@ -29,6 +29,7 @@ obj-$(CONFIG_FIT) += fdtdec_common.o
 obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
 obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
 obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
+obj-$(CONFIG_IMAGE_SPARSE) += image-sparse.o
 obj-y += initcall.o
 obj-$(CONFIG_LMB) += lmb.o
 obj-y += ldiv.o
index d38780b604e504d0af2fa0ed784db96c2cdad447..2909e7696080d8ffb711e0f96ba28e5ead6848c1 100644 (file)
@@ -1,6 +1,6 @@
 config EFI_LOADER
        bool "Support running EFI Applications in U-Boot"
-       depends on (ARM || X86) && OF_LIBFDT
+       depends on (ARM || X86 || RISCV) && OF_LIBFDT
        # We do not support bootefi booting ARMv7 in non-secure mode
        depends on !ARMV7_NONSEC
        # We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB
index e832cde9016dae0c2cff1514a558d82603c81bc3..b45f09591a5730231629fb441df00b54a40792c7 100644 (file)
@@ -287,7 +287,7 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info)
 
        /* Flush cache */
        flush_cache((ulong)efi_reloc,
-                   ALIGN(virt_size, CONFIG_SYS_CACHELINE_SIZE));
+                   ALIGN(virt_size, EFI_CACHELINE_SIZE));
        invalidate_icache_all();
 
        /* Populate the loaded image interface bits */
index 52f1301d75b67ceb71dbccfd5e0e7cf449bcd5fb..241090f6b4842639b2911032b1e0a731df27de97 100644 (file)
@@ -29,13 +29,6 @@ static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void);
 static efi_status_t __efi_runtime EFIAPI efi_device_error(void);
 static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void);
 
-#ifdef CONFIG_SYS_CACHELINE_SIZE
-#define EFI_CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZE
-#else
-/* Just use the greatest cache flush alignment requirement I'm aware of */
-#define EFI_CACHELINE_SIZE 128
-#endif
-
 #if defined(CONFIG_ARM64)
 #define R_RELATIVE     1027
 #define R_MASK         0xffffffffULL
@@ -47,6 +40,25 @@ static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void);
 #include <asm/elf.h>
 #define R_RELATIVE     R_386_RELATIVE
 #define R_MASK         0xffULL
+#elif defined(CONFIG_RISCV)
+#include <elf.h>
+#define R_RELATIVE     R_RISCV_RELATIVE
+#define R_MASK         0xffULL
+#define IS_RELA                1
+
+struct dyn_sym {
+       ulong foo1;
+       ulong addr;
+       u32 foo2;
+       u32 foo3;
+};
+#ifdef CONFIG_CPU_RISCV_32
+#define R_ABSOLUTE     R_RISCV_32
+#define SYM_INDEX      8
+#else
+#define R_ABSOLUTE     R_RISCV_64
+#define SYM_INDEX      32
+#endif
 #else
 #error Need to add relocation awareness
 #endif
@@ -253,15 +265,27 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map)
 
                p = (void*)((ulong)rel->offset - base) + gd->relocaddr;
 
-               if ((rel->info & R_MASK) != R_RELATIVE) {
-                       continue;
-               }
+               debug("%s: rel->info=%#lx *p=%#lx rel->offset=%p\n", __func__, rel->info, *p, rel->offset);
 
+               switch (rel->info & R_MASK) {
+               case R_RELATIVE:
 #ifdef IS_RELA
                newaddr = rel->addend + offset - CONFIG_SYS_TEXT_BASE;
 #else
                newaddr = *p - lastoff + offset;
 #endif
+                       break;
+#ifdef R_ABSOLUTE
+               case R_ABSOLUTE: {
+                       ulong symidx = rel->info >> SYM_INDEX;
+                       extern struct dyn_sym __dyn_sym_start[];
+                       newaddr = __dyn_sym_start[symidx].addr + offset;
+                       break;
+               }
+#endif
+               default:
+                       continue;
+               }
 
                /* Check if the relocation is inside bounds */
                if (map && ((newaddr < map->virtual_start) ||
diff --git a/lib/image-sparse.c b/lib/image-sparse.c
new file mode 100644 (file)
index 0000000..0360621
--- /dev/null
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2009, Google Inc.
+ * All rights reserved.
+ *
+ * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
+ * Portions Copyright 2014 Broadcom Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of The Linux Foundation nor
+ *       the names of its contributors may be used to endorse or promote
+ *       products derived from this software without specific prior written
+ *       permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * NOTE:
+ *   Although it is very similar, this license text is not identical
+ *   to the "BSD-3-Clause", therefore, DO NOT MODIFY THIS LICENSE TEXT!
+ */
+
+#include <config.h>
+#include <common.h>
+#include <image-sparse.h>
+#include <div64.h>
+#include <malloc.h>
+#include <part.h>
+#include <sparse_format.h>
+
+#include <linux/math64.h>
+
+static void default_log(const char *ignored, char *response) {}
+
+int write_sparse_image(struct sparse_storage *info,
+                      const char *part_name, void *data, char *response)
+{
+       lbaint_t blk;
+       lbaint_t blkcnt;
+       lbaint_t blks;
+       uint32_t bytes_written = 0;
+       unsigned int chunk;
+       unsigned int offset;
+       unsigned int chunk_data_sz;
+       uint32_t *fill_buf = NULL;
+       uint32_t fill_val;
+       sparse_header_t *sparse_header;
+       chunk_header_t *chunk_header;
+       uint32_t total_blocks = 0;
+       int fill_buf_num_blks;
+       int i;
+       int j;
+
+       fill_buf_num_blks = CONFIG_IMAGE_SPARSE_FILLBUF_SIZE / info->blksz;
+
+       /* Read and skip over sparse image header */
+       sparse_header = (sparse_header_t *)data;
+
+       data += sparse_header->file_hdr_sz;
+       if (sparse_header->file_hdr_sz > sizeof(sparse_header_t)) {
+               /*
+                * Skip the remaining bytes in a header that is longer than
+                * we expected.
+                */
+               data += (sparse_header->file_hdr_sz - sizeof(sparse_header_t));
+       }
+
+       if (!info->mssg)
+               info->mssg = default_log;
+
+       debug("=== Sparse Image Header ===\n");
+       debug("magic: 0x%x\n", sparse_header->magic);
+       debug("major_version: 0x%x\n", sparse_header->major_version);
+       debug("minor_version: 0x%x\n", sparse_header->minor_version);
+       debug("file_hdr_sz: %d\n", sparse_header->file_hdr_sz);
+       debug("chunk_hdr_sz: %d\n", sparse_header->chunk_hdr_sz);
+       debug("blk_sz: %d\n", sparse_header->blk_sz);
+       debug("total_blks: %d\n", sparse_header->total_blks);
+       debug("total_chunks: %d\n", sparse_header->total_chunks);
+
+       /*
+        * Verify that the sparse block size is a multiple of our
+        * storage backend block size
+        */
+       div_u64_rem(sparse_header->blk_sz, info->blksz, &offset);
+       if (offset) {
+               printf("%s: Sparse image block size issue [%u]\n",
+                      __func__, sparse_header->blk_sz);
+               info->mssg("sparse image block size issue", response);
+               return -1;
+       }
+
+       puts("Flashing Sparse Image\n");
+
+       /* Start processing chunks */
+       blk = info->start;
+       for (chunk = 0; chunk < sparse_header->total_chunks; chunk++) {
+               /* Read and skip over chunk header */
+               chunk_header = (chunk_header_t *)data;
+               data += sizeof(chunk_header_t);
+
+               if (chunk_header->chunk_type != CHUNK_TYPE_RAW) {
+                       debug("=== Chunk Header ===\n");
+                       debug("chunk_type: 0x%x\n", chunk_header->chunk_type);
+                       debug("chunk_data_sz: 0x%x\n", chunk_header->chunk_sz);
+                       debug("total_size: 0x%x\n", chunk_header->total_sz);
+               }
+
+               if (sparse_header->chunk_hdr_sz > sizeof(chunk_header_t)) {
+                       /*
+                        * Skip the remaining bytes in a header that is longer
+                        * than we expected.
+                        */
+                       data += (sparse_header->chunk_hdr_sz -
+                                sizeof(chunk_header_t));
+               }
+
+               chunk_data_sz = sparse_header->blk_sz * chunk_header->chunk_sz;
+               blkcnt = chunk_data_sz / info->blksz;
+               switch (chunk_header->chunk_type) {
+               case CHUNK_TYPE_RAW:
+                       if (chunk_header->total_sz !=
+                           (sparse_header->chunk_hdr_sz + chunk_data_sz)) {
+                               info->mssg("Bogus chunk size for chunk type Raw",
+                                          response);
+                               return -1;
+                       }
+
+                       if (blk + blkcnt > info->start + info->size) {
+                               printf(
+                                   "%s: Request would exceed partition size!\n",
+                                   __func__);
+                               info->mssg("Request would exceed partition size!",
+                                          response);
+                               return -1;
+                       }
+
+                       blks = info->write(info, blk, blkcnt, data);
+                       /* blks might be > blkcnt (eg. NAND bad-blocks) */
+                       if (blks < blkcnt) {
+                               printf("%s: %s" LBAFU " [" LBAFU "]\n",
+                                      __func__, "Write failed, block #",
+                                      blk, blks);
+                               info->mssg("flash write failure", response);
+                               return -1;
+                       }
+                       blk += blks;
+                       bytes_written += blkcnt * info->blksz;
+                       total_blocks += chunk_header->chunk_sz;
+                       data += chunk_data_sz;
+                       break;
+
+               case CHUNK_TYPE_FILL:
+                       if (chunk_header->total_sz !=
+                           (sparse_header->chunk_hdr_sz + sizeof(uint32_t))) {
+                               info->mssg("Bogus chunk size for chunk type FILL", response);
+                               return -1;
+                       }
+
+                       fill_buf = (uint32_t *)
+                                  memalign(ARCH_DMA_MINALIGN,
+                                           ROUNDUP(
+                                               info->blksz * fill_buf_num_blks,
+                                               ARCH_DMA_MINALIGN));
+                       if (!fill_buf) {
+                               info->mssg("Malloc failed for: CHUNK_TYPE_FILL",
+                                          response);
+                               return -1;
+                       }
+
+                       fill_val = *(uint32_t *)data;
+                       data = (char *)data + sizeof(uint32_t);
+
+                       for (i = 0;
+                            i < (info->blksz * fill_buf_num_blks /
+                                 sizeof(fill_val));
+                            i++)
+                               fill_buf[i] = fill_val;
+
+                       if (blk + blkcnt > info->start + info->size) {
+                               printf(
+                                   "%s: Request would exceed partition size!\n",
+                                   __func__);
+                               info->mssg("Request would exceed partition size!",
+                                          response);
+                               return -1;
+                       }
+
+                       for (i = 0; i < blkcnt;) {
+                               j = blkcnt - i;
+                               if (j > fill_buf_num_blks)
+                                       j = fill_buf_num_blks;
+                               blks = info->write(info, blk, j, fill_buf);
+                               /* blks might be > j (eg. NAND bad-blocks) */
+                               if (blks < j) {
+                                       printf("%s: %s " LBAFU " [%d]\n",
+                                              __func__,
+                                              "Write failed, block #",
+                                              blk, j);
+                                       info->mssg("flash write failure",
+                                                  response);
+                                       free(fill_buf);
+                                       return -1;
+                               }
+                               blk += blks;
+                               i += j;
+                       }
+                       bytes_written += blkcnt * info->blksz;
+                       total_blocks += chunk_data_sz / sparse_header->blk_sz;
+                       free(fill_buf);
+                       break;
+
+               case CHUNK_TYPE_DONT_CARE:
+                       blk += info->reserve(info, blk, blkcnt);
+                       total_blocks += chunk_header->chunk_sz;
+                       break;
+
+               case CHUNK_TYPE_CRC32:
+                       if (chunk_header->total_sz !=
+                           sparse_header->chunk_hdr_sz) {
+                               info->mssg("Bogus chunk size for chunk type Dont Care",
+                                          response);
+                               return -1;
+                       }
+                       total_blocks += chunk_header->chunk_sz;
+                       data += chunk_data_sz;
+                       break;
+
+               default:
+                       printf("%s: Unknown chunk type: %x\n", __func__,
+                              chunk_header->chunk_type);
+                       info->mssg("Unknown chunk type", response);
+                       return -1;
+               }
+       }
+
+       debug("Wrote %d blocks, expected to write %d blocks\n",
+             total_blocks, sparse_header->total_blks);
+       printf("........ wrote %u bytes to '%s'\n", bytes_written, part_name);
+
+       if (total_blocks != sparse_header->total_blks) {
+               info->mssg("sparse image write failure", response);
+               return -1;
+       }
+
+       return 0;
+}
index 4b7008d88fe964a42820a6a102e537f2cdf3957f..b6ca4e0b0c308fb9f5ebb9dfe5639aaa90769f8c 100644 (file)
@@ -76,8 +76,8 @@ uint32_t fdt_get_max_phandle(const void *fdt)
 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
 {
        FDT_CHECK_HEADER(fdt);
-       *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address);
-       *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size);
+       *address = fdt64_to_cpu(fdt_mem_rsv_(fdt, n)->address);
+       *size = fdt64_to_cpu(fdt_mem_rsv_(fdt, n)->size);
        return 0;
 }
 
@@ -85,7 +85,7 @@ int fdt_num_mem_rsv(const void *fdt)
 {
        int i = 0;
 
-       while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0)
+       while (fdt64_to_cpu(fdt_mem_rsv_(fdt, i)->size) != 0)
                i++;
        return i;
 }
@@ -211,11 +211,11 @@ int fdt_path_offset(const void *fdt, const char *path)
 
 const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
 {
-       const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset);
+       const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset);
        int err;
 
        if (((err = fdt_check_header(fdt)) != 0)
-           || ((err = _fdt_check_node_offset(fdt, nodeoffset)) < 0))
+           || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0))
                        goto fail;
 
        if (len)
@@ -233,7 +233,7 @@ int fdt_first_property_offset(const void *fdt, int nodeoffset)
 {
        int offset;
 
-       if ((offset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
+       if ((offset = fdt_check_node_offset_(fdt, nodeoffset)) < 0)
                return offset;
 
        return _nextprop(fdt, offset);
@@ -241,7 +241,7 @@ int fdt_first_property_offset(const void *fdt, int nodeoffset)
 
 int fdt_next_property_offset(const void *fdt, int offset)
 {
-       if ((offset = _fdt_check_prop_offset(fdt, offset)) < 0)
+       if ((offset = fdt_check_prop_offset_(fdt, offset)) < 0)
                return offset;
 
        return _nextprop(fdt, offset);
@@ -254,13 +254,13 @@ const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
        int err;
        const struct fdt_property *prop;
 
-       if ((err = _fdt_check_prop_offset(fdt, offset)) < 0) {
+       if ((err = fdt_check_prop_offset_(fdt, offset)) < 0) {
                if (lenp)
                        *lenp = err;
                return NULL;
        }
 
-       prop = _fdt_offset_ptr(fdt, offset);
+       prop = fdt_offset_ptr_(fdt, offset);
 
        if (lenp)
                *lenp = fdt32_to_cpu(prop->len);
index d1e8e01f62fbfc9f114898d6c84e3a41bf5bac1c..07466879f501f77aea77853b9f2ba609f7ad64a7 100644 (file)
@@ -23,6 +23,7 @@ obj-$(CONFIG_CMD_PING) += ping.o
 obj-$(CONFIG_CMD_RARP) += rarp.o
 obj-$(CONFIG_CMD_SNTP) += sntp.o
 obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o
+obj-$(CONFIG_UDP_FUNCTION_FASTBOOT)  += fastboot.o
 
 # Disable this warning as it is triggered by:
 # sprintf(buf, index ? "foo%d" : "foo", index)
diff --git a/net/fastboot.c b/net/fastboot.c
new file mode 100644 (file)
index 0000000..a9f7c07
--- /dev/null
@@ -0,0 +1,317 @@
+// SPDX-License-Identifier: BSD-2-Clause
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ */
+
+#include <common.h>
+#include <fastboot.h>
+#include <net.h>
+#include <net/fastboot.h>
+
+/* Fastboot port # defined in spec */
+#define WELL_KNOWN_PORT 5554
+
+enum {
+       FASTBOOT_ERROR = 0,
+       FASTBOOT_QUERY = 1,
+       FASTBOOT_INIT = 2,
+       FASTBOOT_FASTBOOT = 3,
+};
+
+struct __packed fastboot_header {
+       uchar id;
+       uchar flags;
+       unsigned short seq;
+};
+
+#define PACKET_SIZE 1024
+#define DATA_SIZE (PACKET_SIZE - sizeof(struct fastboot_header))
+
+/* Sequence number sent for every packet */
+static unsigned short sequence_number = 1;
+static const unsigned short packet_size = PACKET_SIZE;
+static const unsigned short udp_version = 1;
+
+/* Keep track of last packet for resubmission */
+static uchar last_packet[PACKET_SIZE];
+static unsigned int last_packet_len;
+
+static struct in_addr fastboot_remote_ip;
+/* The UDP port at their end */
+static int fastboot_remote_port;
+/* The UDP port at our end */
+static int fastboot_our_port;
+
+static void boot_downloaded_image(void);
+
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
+/**
+ * fastboot_udp_send_info() - Send an INFO packet during long commands.
+ *
+ * @msg: String describing the reason for waiting
+ */
+static void fastboot_udp_send_info(const char *msg)
+{
+       uchar *packet;
+       uchar *packet_base;
+       int len = 0;
+       char response[FASTBOOT_RESPONSE_LEN] = {0};
+
+       struct fastboot_header response_header = {
+               .id = FASTBOOT_FASTBOOT,
+               .flags = 0,
+               .seq = htons(sequence_number)
+       };
+       ++sequence_number;
+       packet = net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE;
+       packet_base = packet;
+
+       /* Write headers */
+       memcpy(packet, &response_header, sizeof(response_header));
+       packet += sizeof(response_header);
+       /* Write response */
+       fastboot_response("INFO", response, "%s", msg);
+       memcpy(packet, response, strlen(response));
+       packet += strlen(response);
+
+       len = packet - packet_base;
+
+       /* Save packet for retransmitting */
+       last_packet_len = len;
+       memcpy(last_packet, packet_base, last_packet_len);
+
+       net_send_udp_packet(net_server_ethaddr, fastboot_remote_ip,
+                           fastboot_remote_port, fastboot_our_port, len);
+}
+
+/**
+ * fastboot_timed_send_info() - Send INFO packet every 30 seconds
+ *
+ * @msg: String describing the reason for waiting
+ *
+ * Send an INFO packet during long commands based on timer. An INFO packet
+ * is sent if the time is 30 seconds after start. Else, noop.
+ */
+static void fastboot_timed_send_info(const char *msg)
+{
+       static ulong start;
+
+       /* Initialize timer */
+       if (start == 0)
+               start = get_timer(0);
+       ulong time = get_timer(start);
+       /* Send INFO packet to host every 30 seconds */
+       if (time >= 30000) {
+               start = get_timer(0);
+               fastboot_udp_send_info(msg);
+       }
+}
+#endif
+
+/**
+ * fastboot_send() - Sends a packet in response to received fastboot packet
+ *
+ * @header: Header for response packet
+ * @fastboot_data: Pointer to received fastboot data
+ * @fastboot_data_len: Length of received fastboot data
+ * @retransmit: Nonzero if sending last sent packet
+ */
+static void fastboot_send(struct fastboot_header header, char *fastboot_data,
+                         unsigned int fastboot_data_len, uchar retransmit)
+{
+       uchar *packet;
+       uchar *packet_base;
+       int len = 0;
+       const char *error_msg = "An error occurred.";
+       short tmp;
+       struct fastboot_header response_header = header;
+       static char command[FASTBOOT_COMMAND_LEN];
+       static int cmd = -1;
+       static bool pending_command;
+       char response[FASTBOOT_RESPONSE_LEN] = {0};
+
+       /*
+        * We will always be sending some sort of packet, so
+        * cobble together the packet headers now.
+        */
+       packet = net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE;
+       packet_base = packet;
+
+       /* Resend last packet */
+       if (retransmit) {
+               memcpy(packet, last_packet, last_packet_len);
+               net_send_udp_packet(net_server_ethaddr, fastboot_remote_ip,
+                                   fastboot_remote_port, fastboot_our_port,
+                                   last_packet_len);
+               return;
+       }
+
+       response_header.seq = htons(response_header.seq);
+       memcpy(packet, &response_header, sizeof(response_header));
+       packet += sizeof(response_header);
+
+       switch (header.id) {
+       case FASTBOOT_QUERY:
+               tmp = htons(sequence_number);
+               memcpy(packet, &tmp, sizeof(tmp));
+               packet += sizeof(tmp);
+               break;
+       case FASTBOOT_INIT:
+               tmp = htons(udp_version);
+               memcpy(packet, &tmp, sizeof(tmp));
+               packet += sizeof(tmp);
+               tmp = htons(packet_size);
+               memcpy(packet, &tmp, sizeof(tmp));
+               packet += sizeof(tmp);
+               break;
+       case FASTBOOT_ERROR:
+               memcpy(packet, error_msg, strlen(error_msg));
+               packet += strlen(error_msg);
+               break;
+       case FASTBOOT_FASTBOOT:
+               if (cmd == FASTBOOT_COMMAND_DOWNLOAD) {
+                       if (!fastboot_data_len && !fastboot_data_remaining()) {
+                               fastboot_data_complete(response);
+                       } else {
+                               fastboot_data_download(fastboot_data,
+                                                      fastboot_data_len,
+                                                      response);
+                       }
+               } else if (!pending_command) {
+                       strlcpy(command, fastboot_data,
+                               min((size_t)fastboot_data_len + 1,
+                                   sizeof(command)));
+                       pending_command = true;
+               } else {
+                       cmd = fastboot_handle_command(command, response);
+                       pending_command = false;
+               }
+               /*
+                * Sent some INFO packets, need to update sequence number in
+                * header
+                */
+               if (header.seq != sequence_number) {
+                       response_header.seq = htons(sequence_number);
+                       memcpy(packet_base, &response_header,
+                              sizeof(response_header));
+               }
+               /* Write response to packet */
+               memcpy(packet, response, strlen(response));
+               packet += strlen(response);
+               break;
+       default:
+               pr_err("ID %d not implemented.\n", header.id);
+               return;
+       }
+
+       len = packet - packet_base;
+
+       /* Save packet for retransmitting */
+       last_packet_len = len;
+       memcpy(last_packet, packet_base, last_packet_len);
+
+       net_send_udp_packet(net_server_ethaddr, fastboot_remote_ip,
+                           fastboot_remote_port, fastboot_our_port, len);
+
+       /* Continue boot process after sending response */
+       if (!strncmp("OKAY", response, 4)) {
+               switch (cmd) {
+               case FASTBOOT_COMMAND_BOOT:
+                       boot_downloaded_image();
+                       break;
+
+               case FASTBOOT_COMMAND_CONTINUE:
+                       net_set_state(NETLOOP_SUCCESS);
+                       break;
+
+               case FASTBOOT_COMMAND_REBOOT:
+               case FASTBOOT_COMMAND_REBOOT_BOOTLOADER:
+                       do_reset(NULL, 0, 0, NULL);
+                       break;
+               }
+       }
+
+       if (!strncmp("OKAY", response, 4) || !strncmp("FAIL", response, 4))
+               cmd = -1;
+}
+
+/**
+ * boot_downloaded_image() - Boots into downloaded image.
+ */
+static void boot_downloaded_image(void)
+{
+       fastboot_boot();
+       net_set_state(NETLOOP_SUCCESS);
+}
+
+/**
+ * fastboot_handler() - Incoming UDP packet handler.
+ *
+ * @packet: Pointer to incoming UDP packet
+ * @dport: Destination UDP port
+ * @sip: Source IP address
+ * @sport: Source UDP port
+ * @len: Packet length
+ */
+static void fastboot_handler(uchar *packet, unsigned int dport,
+                            struct in_addr sip, unsigned int sport,
+                            unsigned int len)
+{
+       struct fastboot_header header;
+       char fastboot_data[DATA_SIZE] = {0};
+       unsigned int fastboot_data_len = 0;
+
+       if (dport != fastboot_our_port)
+               return;
+
+       fastboot_remote_ip = sip;
+       fastboot_remote_port = sport;
+
+       if (len < sizeof(struct fastboot_header) || len > PACKET_SIZE)
+               return;
+       memcpy(&header, packet, sizeof(header));
+       header.flags = 0;
+       header.seq = ntohs(header.seq);
+       packet += sizeof(header);
+       len -= sizeof(header);
+
+       switch (header.id) {
+       case FASTBOOT_QUERY:
+               fastboot_send(header, fastboot_data, 0, 0);
+               break;
+       case FASTBOOT_INIT:
+       case FASTBOOT_FASTBOOT:
+               fastboot_data_len = len;
+               if (len > 0)
+                       memcpy(fastboot_data, packet, len);
+               if (header.seq == sequence_number) {
+                       fastboot_send(header, fastboot_data,
+                                     fastboot_data_len, 0);
+                       sequence_number++;
+               } else if (header.seq == sequence_number - 1) {
+                       /* Retransmit last sent packet */
+                       fastboot_send(header, fastboot_data,
+                                     fastboot_data_len, 1);
+               }
+               break;
+       default:
+               pr_err("ID %d not implemented.\n", header.id);
+               header.id = FASTBOOT_ERROR;
+               fastboot_send(header, fastboot_data, 0, 0);
+               break;
+       }
+}
+
+void fastboot_start_server(void)
+{
+       printf("Using %s device\n", eth_get_name());
+       printf("Listening for fastboot command on %pI4\n", &net_ip);
+
+       fastboot_our_port = WELL_KNOWN_PORT;
+
+       fastboot_set_progress_callback(fastboot_timed_send_info);
+       net_set_udp_handler(fastboot_handler);
+
+       /* zero out server ether in case the server ip has changed */
+       memset(net_server_ethaddr, 0, 6);
+}
index 7f852114427e56cfea1d5a0da150684e3a27bbe1..a4932f46d905f51d0466983b2032a35b134e4e73 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -87,6 +87,7 @@
 #include <environment.h>
 #include <errno.h>
 #include <net.h>
+#include <net/fastboot.h>
 #include <net/tftp.h>
 #if defined(CONFIG_LED_STATUS)
 #include <miiphy.h>
@@ -451,6 +452,11 @@ restart:
                        tftp_start_server();
                        break;
 #endif
+#ifdef CONFIG_UDP_FUNCTION_FASTBOOT
+               case FASTBOOT:
+                       fastboot_start_server();
+                       break;
+#endif
 #if defined(CONFIG_CMD_DHCP)
                case DHCP:
                        bootp_reset();
@@ -1322,6 +1328,7 @@ common:
                /* Fall through */
 
        case NETCONS:
+       case FASTBOOT:
        case TFTPSRV:
                if (net_ip.s_addr == 0) {
                        puts("*** ERROR: `ipaddr' not set\n");
index 4a6ed345928eb8ec3b55bca49fe91ae8ab26c8a0..482ed0c8d80482c8bbf81e7a46adbfd2c96c9e9a 100644 (file)
@@ -415,6 +415,17 @@ $(call multi_depend, $(multi-used-m), .o, -objs -y)
 targets += $(multi-used-y) $(multi-used-m)
 
 
+# Add intermediate targets:
+# When building objects with specific suffix patterns, add intermediate
+# targets that the final targets are derived from.
+intermediate_targets = $(foreach sfx, $(2), \
+                               $(patsubst %$(strip $(1)),%$(sfx), \
+                                       $(filter %$(strip $(1)), $(targets))))
+# %.lex.o <- %.lex.c <- %.l
+# %.tab.o <- %.tab.[ch] <- %.y
+targets += $(call intermediate_targets, .lex.o, .lex.c) \
+          $(call intermediate_targets, .tab.o, .tab.c .tab.h)
+
 # Descending
 # ---------------------------------------------------------------------------
 
index f9809ce7cef51e6676cba46cd6affbda7a3d5884..ef7604c4638166d7151b92337fd168c1678a4592 100644 (file)
@@ -209,47 +209,30 @@ $(foreach m, $(notdir $1), \
        $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
 endef
 
-ifdef REGENERATE_PARSERS
-
-# GPERF
-# ---------------------------------------------------------------------------
-quiet_cmd_gperf = GPERF $@
-      cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $<
-
-.PRECIOUS: $(src)/%.hash.c_shipped
-$(src)/%.hash.c_shipped: $(src)/%.gperf
-       $(call cmd,gperf)
-
 # LEX
 # ---------------------------------------------------------------------------
-LEX_PREFIX = $(if $(LEX_PREFIX_${baseprereq}),$(LEX_PREFIX_${baseprereq}),yy)
-
 quiet_cmd_flex = LEX     $@
-      cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $<
+      cmd_flex = $(LEX) -o$@ -L $<
 
-.PRECIOUS: $(src)/%.lex.c_shipped
-$(src)/%.lex.c_shipped: $(src)/%.l
-       $(call cmd,flex)
+.PRECIOUS: $(obj)/%.lex.c
+$(obj)/%.lex.c: $(src)/%.l FORCE
+       $(call if_changed,flex)
 
 # YACC
 # ---------------------------------------------------------------------------
-YACC_PREFIX = $(if $(YACC_PREFIX_${baseprereq}),$(YACC_PREFIX_${baseprereq}),yy)
-
 quiet_cmd_bison = YACC    $@
-      cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $<
+      cmd_bison = $(YACC) -o$@ -t -l $<
 
-.PRECIOUS: $(src)/%.tab.c_shipped
-$(src)/%.tab.c_shipped: $(src)/%.y
-       $(call cmd,bison)
+.PRECIOUS: $(obj)/%.tab.c
+$(obj)/%.tab.c: $(src)/%.y FORCE
+       $(call if_changed,bison)
 
 quiet_cmd_bison_h = YACC    $@
-      cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $<
+      cmd_bison_h = $(YACC) -o/dev/null --defines=$@ -t -l $<
 
-.PRECIOUS: $(src)/%.tab.h_shipped
-$(src)/%.tab.h_shipped: $(src)/%.y
-       $(call cmd,bison_h)
-
-endif
+.PRECIOUS: $(obj)/%.tab.h
+$(obj)/%.tab.h: $(src)/%.y FORCE
+       $(call if_changed,bison_h)
 
 # Shipped files
 # ===========================================================================
index 705ed89a659f7bbe414fe1f961ce54dd9c8c7f2f..d6819370269dfe3956092da564642e9dd9b80f13 100644 (file)
@@ -589,8 +589,6 @@ CONFIG_EXYNOS_RELOCATE_CODE_BASE
 CONFIG_EXYNOS_SPL
 CONFIG_EXYNOS_TMU
 CONFIG_FACTORYSET
-CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE
-CONFIG_FASTBOOT_FLASH_NAND_TRIMFFS
 CONFIG_FAST_FLASH_BIT
 CONFIG_FB_ADDR
 CONFIG_FB_BACKLIGHT
@@ -3578,7 +3576,6 @@ CONFIG_SYS_MSC0_VAL
 CONFIG_SYS_MSC1_VAL
 CONFIG_SYS_MSC2_VAL
 CONFIG_SYS_MTDPARTS_RUNTIME
-CONFIG_SYS_MVFS
 CONFIG_SYS_MX5_CLK32
 CONFIG_SYS_MX5_HCLK
 CONFIG_SYS_MX6_CLK32
index d807c081a250ab8c064dc87ea7af301a6adf0a87..689b9be0f935a36a4baf358ecbb96e4f54e02efc 100644 (file)
@@ -1,4 +1 @@
 /dtc
-/dtc-lexer.lex.c
-/dtc-parser.tab.c
-/dtc-parser.tab.h
index 90ef2db85c5f39b04847095adc61dc945a0f13a0..e999be939831bde794f2aafb7b336c9ed36f4544 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
 # scripts/dtc makefile
 
 hostprogs-y    := dtc
@@ -27,8 +28,5 @@ HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
 # dependencies on generated files need to be listed explicitly
 $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
 
-# generated files need to be cleaned explicitly
-clean-files    := dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h
-
 # Added for U-Boot
 subdir-$(CONFIG_PYLIBFDT) += pylibfdt
index 08a3a29edae348f4b2189375ed327626c9352330..c07ba4da9e36119bfb5c8732f5b2178a46b09997 100644 (file)
@@ -53,26 +53,28 @@ struct check {
        struct check **prereq;
 };
 
-#define CHECK_ENTRY(_nm, _fn, _d, _w, _e, ...)        \
-       static struct check *_nm##_prereqs[] = { __VA_ARGS__ }; \
-       static struct check _nm = { \
-               .name = #_nm, \
-               .fn = (_fn), \
-               .data = (_d), \
-               .warn = (_w), \
-               .error = (_e), \
+#define CHECK_ENTRY(nm_, fn_, d_, w_, e_, ...)        \
+       static struct check *nm_##_prereqs[] = { __VA_ARGS__ }; \
+       static struct check nm_ = { \
+               .name = #nm_, \
+               .fn = (fn_), \
+               .data = (d_), \
+               .warn = (w_), \
+               .error = (e_), \
                .status = UNCHECKED, \
-               .num_prereqs = ARRAY_SIZE(_nm##_prereqs), \
-               .prereq = _nm##_prereqs, \
+               .num_prereqs = ARRAY_SIZE(nm_##_prereqs), \
+               .prereq = nm_##_prereqs, \
        };
-#define WARNING(_nm, _fn, _d, ...) \
-       CHECK_ENTRY(_nm, _fn, _d, true, false, __VA_ARGS__)
-#define ERROR(_nm, _fn, _d, ...) \
-       CHECK_ENTRY(_nm, _fn, _d, false, true, __VA_ARGS__)
-#define CHECK(_nm, _fn, _d, ...) \
-       CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__)
-
-static inline void  PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti,
+#define WARNING(nm_, fn_, d_, ...) \
+       CHECK_ENTRY(nm_, fn_, d_, true, false, __VA_ARGS__)
+#define ERROR(nm_, fn_, d_, ...) \
+       CHECK_ENTRY(nm_, fn_, d_, false, true, __VA_ARGS__)
+#define CHECK(nm_, fn_, d_, ...) \
+       CHECK_ENTRY(nm_, fn_, d_, false, false, __VA_ARGS__)
+
+static inline void  PRINTF(5, 6) check_msg(struct check *c, struct dt_info *dti,
+                                          struct node *node,
+                                          struct property *prop,
                                           const char *fmt, ...)
 {
        va_list ap;
@@ -83,19 +85,33 @@ static inline void  PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti,
                fprintf(stderr, "%s: %s (%s): ",
                        strcmp(dti->outname, "-") ? dti->outname : "<stdout>",
                        (c->error) ? "ERROR" : "Warning", c->name);
+               if (node) {
+                       fprintf(stderr, "%s", node->fullpath);
+                       if (prop)
+                               fprintf(stderr, ":%s", prop->name);
+                       fputs(": ", stderr);
+               }
                vfprintf(stderr, fmt, ap);
                fprintf(stderr, "\n");
        }
        va_end(ap);
 }
 
-#define FAIL(c, dti, ...)                                              \
+#define FAIL(c, dti, node, ...)                                                \
+       do {                                                            \
+               TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__);  \
+               (c)->status = FAILED;                                   \
+               check_msg((c), dti, node, NULL, __VA_ARGS__);           \
+       } while (0)
+
+#define FAIL_PROP(c, dti, node, prop, ...)                             \
        do {                                                            \
                TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__);  \
                (c)->status = FAILED;                                   \
-               check_msg((c), dti, __VA_ARGS__);                       \
+               check_msg((c), dti, node, prop, __VA_ARGS__);           \
        } while (0)
 
+
 static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node)
 {
        struct node *child;
@@ -126,7 +142,7 @@ static bool run_check(struct check *c, struct dt_info *dti)
                error = error || run_check(prq, dti);
                if (prq->status != PASSED) {
                        c->status = PREREQ;
-                       check_msg(c, dti, "Failed prerequisite '%s'",
+                       check_msg(c, dti, NULL, NULL, "Failed prerequisite '%s'",
                                  c->prereq[i]->name);
                }
        }
@@ -156,7 +172,7 @@ out:
 static inline void check_always_fail(struct check *c, struct dt_info *dti,
                                     struct node *node)
 {
-       FAIL(c, dti, "always_fail check");
+       FAIL(c, dti, node, "always_fail check");
 }
 CHECK(always_fail, check_always_fail, NULL);
 
@@ -171,14 +187,42 @@ static void check_is_string(struct check *c, struct dt_info *dti,
                return; /* Not present, assumed ok */
 
        if (!data_is_one_string(prop->val))
-               FAIL(c, dti, "\"%s\" property in %s is not a string",
-                    propname, node->fullpath);
+               FAIL_PROP(c, dti, node, prop, "property is not a string");
 }
 #define WARNING_IF_NOT_STRING(nm, propname) \
        WARNING(nm, check_is_string, (propname))
 #define ERROR_IF_NOT_STRING(nm, propname) \
        ERROR(nm, check_is_string, (propname))
 
+static void check_is_string_list(struct check *c, struct dt_info *dti,
+                                struct node *node)
+{
+       int rem, l;
+       struct property *prop;
+       char *propname = c->data;
+       char *str;
+
+       prop = get_property(node, propname);
+       if (!prop)
+               return; /* Not present, assumed ok */
+
+       str = prop->val.val;
+       rem = prop->val.len;
+       while (rem > 0) {
+               l = strnlen(str, rem);
+               if (l == rem) {
+                       FAIL_PROP(c, dti, node, prop, "property is not a string list");
+                       break;
+               }
+               rem -= l + 1;
+               str += l + 1;
+       }
+}
+#define WARNING_IF_NOT_STRING_LIST(nm, propname) \
+       WARNING(nm, check_is_string_list, (propname))
+#define ERROR_IF_NOT_STRING_LIST(nm, propname) \
+       ERROR(nm, check_is_string_list, (propname))
+
 static void check_is_cell(struct check *c, struct dt_info *dti,
                          struct node *node)
 {
@@ -190,8 +234,7 @@ static void check_is_cell(struct check *c, struct dt_info *dti,
                return; /* Not present, assumed ok */
 
        if (prop->val.len != sizeof(cell_t))
-               FAIL(c, dti, "\"%s\" property in %s is not a single cell",
-                    propname, node->fullpath);
+               FAIL_PROP(c, dti, node, prop, "property is not a single cell");
 }
 #define WARNING_IF_NOT_CELL(nm, propname) \
        WARNING(nm, check_is_cell, (propname))
@@ -212,8 +255,7 @@ static void check_duplicate_node_names(struct check *c, struct dt_info *dti,
                     child2;
                     child2 = child2->next_sibling)
                        if (streq(child->name, child2->name))
-                               FAIL(c, dti, "Duplicate node name %s",
-                                    child->fullpath);
+                               FAIL(c, dti, node, "Duplicate node name");
 }
 ERROR(duplicate_node_names, check_duplicate_node_names, NULL);
 
@@ -227,8 +269,7 @@ static void check_duplicate_property_names(struct check *c, struct dt_info *dti,
                        if (prop2->deleted)
                                continue;
                        if (streq(prop->name, prop2->name))
-                               FAIL(c, dti, "Duplicate property name %s in %s",
-                                    prop->name, node->fullpath);
+                               FAIL_PROP(c, dti, node, prop, "Duplicate property name");
                }
        }
 }
@@ -246,8 +287,8 @@ static void check_node_name_chars(struct check *c, struct dt_info *dti,
        int n = strspn(node->name, c->data);
 
        if (n < strlen(node->name))
-               FAIL(c, dti, "Bad character '%c' in node %s",
-                    node->name[n], node->fullpath);
+               FAIL(c, dti, node, "Bad character '%c' in node name",
+                    node->name[n]);
 }
 ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@");
 
@@ -257,8 +298,8 @@ static void check_node_name_chars_strict(struct check *c, struct dt_info *dti,
        int n = strspn(node->name, c->data);
 
        if (n < node->basenamelen)
-               FAIL(c, dti, "Character '%c' not recommended in node %s",
-                    node->name[n], node->fullpath);
+               FAIL(c, dti, node, "Character '%c' not recommended in node name",
+                    node->name[n]);
 }
 CHECK(node_name_chars_strict, check_node_name_chars_strict, PROPNODECHARSSTRICT);
 
@@ -266,8 +307,7 @@ static void check_node_name_format(struct check *c, struct dt_info *dti,
                                   struct node *node)
 {
        if (strchr(get_unitname(node), '@'))
-               FAIL(c, dti, "Node %s has multiple '@' characters in name",
-                    node->fullpath);
+               FAIL(c, dti, node, "multiple '@' characters in node name");
 }
 ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars);
 
@@ -285,12 +325,10 @@ static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti,
 
        if (prop) {
                if (!unitname[0])
-                       FAIL(c, dti, "Node %s has a reg or ranges property, but no unit name",
-                           node->fullpath);
+                       FAIL(c, dti, node, "node has a reg or ranges property, but no unit name");
        } else {
                if (unitname[0])
-                       FAIL(c, dti, "Node %s has a unit name, but no reg property",
-                           node->fullpath);
+                       FAIL(c, dti, node, "node has a unit name, but no reg property");
        }
 }
 WARNING(unit_address_vs_reg, check_unit_address_vs_reg, NULL);
@@ -304,8 +342,8 @@ static void check_property_name_chars(struct check *c, struct dt_info *dti,
                int n = strspn(prop->name, c->data);
 
                if (n < strlen(prop->name))
-                       FAIL(c, dti, "Bad character '%c' in property name \"%s\", node %s",
-                            prop->name[n], prop->name, node->fullpath);
+                       FAIL_PROP(c, dti, node, prop, "Bad character '%c' in property name",
+                                 prop->name[n]);
        }
 }
 ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS);
@@ -336,8 +374,8 @@ static void check_property_name_chars_strict(struct check *c,
                        n = strspn(name, c->data);
                }
                if (n < strlen(name))
-                       FAIL(c, dti, "Character '%c' not recommended in property name \"%s\", node %s",
-                            name[n], prop->name, node->fullpath);
+                       FAIL_PROP(c, dti, node, prop, "Character '%c' not recommended in property name",
+                                 name[n]);
        }
 }
 CHECK(property_name_chars_strict, check_property_name_chars_strict, PROPNODECHARSSTRICT);
@@ -370,7 +408,7 @@ static void check_duplicate_label(struct check *c, struct dt_info *dti,
                return;
 
        if ((othernode != node) || (otherprop != prop) || (othermark != mark))
-               FAIL(c, dti, "Duplicate label '%s' on " DESCLABEL_FMT
+               FAIL(c, dti, node, "Duplicate label '%s' on " DESCLABEL_FMT
                     " and " DESCLABEL_FMT,
                     label, DESCLABEL_ARGS(node, prop, mark),
                     DESCLABEL_ARGS(othernode, otherprop, othermark));
@@ -410,8 +448,8 @@ static cell_t check_phandle_prop(struct check *c, struct dt_info *dti,
                return 0;
 
        if (prop->val.len != sizeof(cell_t)) {
-               FAIL(c, dti, "%s has bad length (%d) %s property",
-                    node->fullpath, prop->val.len, prop->name);
+               FAIL_PROP(c, dti, node, prop, "bad length (%d) %s property",
+                         prop->val.len, prop->name);
                return 0;
        }
 
@@ -422,8 +460,8 @@ static cell_t check_phandle_prop(struct check *c, struct dt_info *dti,
                        /* "Set this node's phandle equal to some
                         * other node's phandle".  That's nonsensical
                         * by construction. */ {
-                       FAIL(c, dti, "%s in %s is a reference to another node",
-                            prop->name, node->fullpath);
+                       FAIL(c, dti, node, "%s is a reference to another node",
+                            prop->name);
                }
                /* But setting this node's phandle equal to its own
                 * phandle is allowed - that means allocate a unique
@@ -436,8 +474,8 @@ static cell_t check_phandle_prop(struct check *c, struct dt_info *dti,
        phandle = propval_cell(prop);
 
        if ((phandle == 0) || (phandle == -1)) {
-               FAIL(c, dti, "%s has bad value (0x%x) in %s property",
-                    node->fullpath, phandle, prop->name);
+               FAIL_PROP(c, dti, node, prop, "bad value (0x%x) in %s property",
+                    phandle, prop->name);
                return 0;
        }
 
@@ -463,16 +501,16 @@ static void check_explicit_phandles(struct check *c, struct dt_info *dti,
                return;
 
        if (linux_phandle && phandle && (phandle != linux_phandle))
-               FAIL(c, dti, "%s has mismatching 'phandle' and 'linux,phandle'"
-                    " properties", node->fullpath);
+               FAIL(c, dti, node, "mismatching 'phandle' and 'linux,phandle'"
+                    " properties");
 
        if (linux_phandle && !phandle)
                phandle = linux_phandle;
 
        other = get_node_by_phandle(root, phandle);
        if (other && (other != node)) {
-               FAIL(c, dti, "%s has duplicated phandle 0x%x (seen before at %s)",
-                    node->fullpath, phandle, other->fullpath);
+               FAIL(c, dti, node, "duplicated phandle 0x%x (seen before at %s)",
+                    phandle, other->fullpath);
                return;
        }
 
@@ -496,8 +534,8 @@ static void check_name_properties(struct check *c, struct dt_info *dti,
 
        if ((prop->val.len != node->basenamelen+1)
            || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) {
-               FAIL(c, dti, "\"name\" property in %s is incorrect (\"%s\" instead"
-                    " of base node name)", node->fullpath, prop->val.val);
+               FAIL(c, dti, node, "\"name\" property is incorrect (\"%s\" instead"
+                    " of base node name)", prop->val.val);
        } else {
                /* The name property is correct, and therefore redundant.
                 * Delete it */
@@ -531,7 +569,7 @@ static void fixup_phandle_references(struct check *c, struct dt_info *dti,
                        refnode = get_node_by_ref(dt, m->ref);
                        if (! refnode) {
                                if (!(dti->dtsflags & DTSF_PLUGIN))
-                                       FAIL(c, dti, "Reference to non-existent node or "
+                                       FAIL(c, dti, node, "Reference to non-existent node or "
                                                        "label \"%s\"\n", m->ref);
                                else /* mark the entry as unresolved */
                                        *((fdt32_t *)(prop->val.val + m->offset)) =
@@ -563,7 +601,7 @@ static void fixup_path_references(struct check *c, struct dt_info *dti,
 
                        refnode = get_node_by_ref(dt, m->ref);
                        if (!refnode) {
-                               FAIL(c, dti, "Reference to non-existent node or label \"%s\"\n",
+                               FAIL(c, dti, node, "Reference to non-existent node or label \"%s\"\n",
                                     m->ref);
                                continue;
                        }
@@ -586,6 +624,45 @@ WARNING_IF_NOT_CELL(interrupt_cells_is_cell, "#interrupt-cells");
 WARNING_IF_NOT_STRING(device_type_is_string, "device_type");
 WARNING_IF_NOT_STRING(model_is_string, "model");
 WARNING_IF_NOT_STRING(status_is_string, "status");
+WARNING_IF_NOT_STRING(label_is_string, "label");
+
+WARNING_IF_NOT_STRING_LIST(compatible_is_string_list, "compatible");
+
+static void check_names_is_string_list(struct check *c, struct dt_info *dti,
+                                      struct node *node)
+{
+       struct property *prop;
+
+       for_each_property(node, prop) {
+               const char *s = strrchr(prop->name, '-');
+               if (!s || !streq(s, "-names"))
+                       continue;
+
+               c->data = prop->name;
+               check_is_string_list(c, dti, node);
+       }
+}
+WARNING(names_is_string_list, check_names_is_string_list, NULL);
+
+static void check_alias_paths(struct check *c, struct dt_info *dti,
+                                   struct node *node)
+{
+       struct property *prop;
+
+       if (!streq(node->name, "aliases"))
+               return;
+
+       for_each_property(node, prop) {
+               if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) {
+                       FAIL_PROP(c, dti, node, prop, "aliases property is not a valid node (%s)",
+                                 prop->val.val);
+                       continue;
+               }
+               if (strspn(prop->name, LOWERCASE DIGITS "-") != strlen(prop->name))
+                       FAIL(c, dti, node, "aliases property name must include only lowercase and '-'");
+       }
+}
+WARNING(alias_paths, check_alias_paths, NULL);
 
 static void fixup_addr_size_cells(struct check *c, struct dt_info *dti,
                                  struct node *node)
@@ -622,21 +699,21 @@ static void check_reg_format(struct check *c, struct dt_info *dti,
                return; /* No "reg", that's fine */
 
        if (!node->parent) {
-               FAIL(c, dti, "Root node has a \"reg\" property");
+               FAIL(c, dti, node, "Root node has a \"reg\" property");
                return;
        }
 
        if (prop->val.len == 0)
-               FAIL(c, dti, "\"reg\" property in %s is empty", node->fullpath);
+               FAIL_PROP(c, dti, node, prop, "property is empty");
 
        addr_cells = node_addr_cells(node->parent);
        size_cells = node_size_cells(node->parent);
        entrylen = (addr_cells + size_cells) * sizeof(cell_t);
 
        if (!entrylen || (prop->val.len % entrylen) != 0)
-               FAIL(c, dti, "\"reg\" property in %s has invalid length (%d bytes) "
-                    "(#address-cells == %d, #size-cells == %d)",
-                    node->fullpath, prop->val.len, addr_cells, size_cells);
+               FAIL_PROP(c, dti, node, prop, "property has invalid length (%d bytes) "
+                         "(#address-cells == %d, #size-cells == %d)",
+                         prop->val.len, addr_cells, size_cells);
 }
 WARNING(reg_format, check_reg_format, NULL, &addr_size_cells);
 
@@ -651,7 +728,7 @@ static void check_ranges_format(struct check *c, struct dt_info *dti,
                return;
 
        if (!node->parent) {
-               FAIL(c, dti, "Root node has a \"ranges\" property");
+               FAIL_PROP(c, dti, node, prop, "Root node has a \"ranges\" property");
                return;
        }
 
@@ -663,20 +740,20 @@ static void check_ranges_format(struct check *c, struct dt_info *dti,
 
        if (prop->val.len == 0) {
                if (p_addr_cells != c_addr_cells)
-                       FAIL(c, dti, "%s has empty \"ranges\" property but its "
-                            "#address-cells (%d) differs from %s (%d)",
-                            node->fullpath, c_addr_cells, node->parent->fullpath,
-                            p_addr_cells);
+                       FAIL_PROP(c, dti, node, prop, "empty \"ranges\" property but its "
+                                 "#address-cells (%d) differs from %s (%d)",
+                                 c_addr_cells, node->parent->fullpath,
+                                 p_addr_cells);
                if (p_size_cells != c_size_cells)
-                       FAIL(c, dti, "%s has empty \"ranges\" property but its "
-                            "#size-cells (%d) differs from %s (%d)",
-                            node->fullpath, c_size_cells, node->parent->fullpath,
-                            p_size_cells);
+                       FAIL_PROP(c, dti, node, prop, "empty \"ranges\" property but its "
+                                 "#size-cells (%d) differs from %s (%d)",
+                                 c_size_cells, node->parent->fullpath,
+                                 p_size_cells);
        } else if ((prop->val.len % entrylen) != 0) {
-               FAIL(c, dti, "\"ranges\" property in %s has invalid length (%d bytes) "
-                    "(parent #address-cells == %d, child #address-cells == %d, "
-                    "#size-cells == %d)", node->fullpath, prop->val.len,
-                    p_addr_cells, c_addr_cells, c_size_cells);
+               FAIL_PROP(c, dti, node, prop, "\"ranges\" property has invalid length (%d bytes) "
+                         "(parent #address-cells == %d, child #address-cells == %d, "
+                         "#size-cells == %d)", prop->val.len,
+                         p_addr_cells, c_addr_cells, c_size_cells);
        }
 }
 WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells);
@@ -696,41 +773,33 @@ static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *
 
        node->bus = &pci_bus;
 
-       if (!strneq(node->name, "pci", node->basenamelen) &&
-           !strneq(node->name, "pcie", node->basenamelen))
-               FAIL(c, dti, "Node %s node name is not \"pci\" or \"pcie\"",
-                            node->fullpath);
+       if (!strprefixeq(node->name, node->basenamelen, "pci") &&
+           !strprefixeq(node->name, node->basenamelen, "pcie"))
+               FAIL(c, dti, node, "node name is not \"pci\" or \"pcie\"");
 
        prop = get_property(node, "ranges");
        if (!prop)
-               FAIL(c, dti, "Node %s missing ranges for PCI bridge (or not a bridge)",
-                            node->fullpath);
+               FAIL(c, dti, node, "missing ranges for PCI bridge (or not a bridge)");
 
        if (node_addr_cells(node) != 3)
-               FAIL(c, dti, "Node %s incorrect #address-cells for PCI bridge",
-                            node->fullpath);
+               FAIL(c, dti, node, "incorrect #address-cells for PCI bridge");
        if (node_size_cells(node) != 2)
-               FAIL(c, dti, "Node %s incorrect #size-cells for PCI bridge",
-                            node->fullpath);
+               FAIL(c, dti, node, "incorrect #size-cells for PCI bridge");
 
        prop = get_property(node, "bus-range");
        if (!prop) {
-               FAIL(c, dti, "Node %s missing bus-range for PCI bridge",
-                            node->fullpath);
+               FAIL(c, dti, node, "missing bus-range for PCI bridge");
                return;
        }
        if (prop->val.len != (sizeof(cell_t) * 2)) {
-               FAIL(c, dti, "Node %s bus-range must be 2 cells",
-                            node->fullpath);
+               FAIL_PROP(c, dti, node, prop, "value must be 2 cells");
                return;
        }
        cells = (cell_t *)prop->val.val;
        if (fdt32_to_cpu(cells[0]) > fdt32_to_cpu(cells[1]))
-               FAIL(c, dti, "Node %s bus-range 1st cell must be less than or equal to 2nd cell",
-                            node->fullpath);
+               FAIL_PROP(c, dti, node, prop, "1st cell must be less than or equal to 2nd cell");
        if (fdt32_to_cpu(cells[1]) > 0xff)
-               FAIL(c, dti, "Node %s bus-range maximum bus number must be less than 256",
-                            node->fullpath);
+               FAIL_PROP(c, dti, node, prop, "maximum bus number must be less than 256");
 }
 WARNING(pci_bridge, check_pci_bridge, NULL,
        &device_type_is_string, &addr_size_cells);
@@ -760,8 +829,8 @@ static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struc
                max_bus = fdt32_to_cpu(cells[0]);
        }
        if ((bus_num < min_bus) || (bus_num > max_bus))
-               FAIL(c, dti, "Node %s PCI bus number %d out of range, expected (%d - %d)",
-                    node->fullpath, bus_num, min_bus, max_bus);
+               FAIL_PROP(c, dti, node, prop, "PCI bus number %d out of range, expected (%d - %d)",
+                         bus_num, min_bus, max_bus);
 }
 WARNING(pci_device_bus_num, check_pci_device_bus_num, NULL, &reg_format, &pci_bridge);
 
@@ -778,25 +847,22 @@ static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct no
 
        prop = get_property(node, "reg");
        if (!prop) {
-               FAIL(c, dti, "Node %s missing PCI reg property", node->fullpath);
+               FAIL(c, dti, node, "missing PCI reg property");
                return;
        }
 
        cells = (cell_t *)prop->val.val;
        if (cells[1] || cells[2])
-               FAIL(c, dti, "Node %s PCI reg config space address cells 2 and 3 must be 0",
-                            node->fullpath);
+               FAIL_PROP(c, dti, node, prop, "PCI reg config space address cells 2 and 3 must be 0");
 
        reg = fdt32_to_cpu(cells[0]);
        dev = (reg & 0xf800) >> 11;
        func = (reg & 0x700) >> 8;
 
        if (reg & 0xff000000)
-               FAIL(c, dti, "Node %s PCI reg address is not configuration space",
-                            node->fullpath);
+               FAIL_PROP(c, dti, node, prop, "PCI reg address is not configuration space");
        if (reg & 0x000000ff)
-               FAIL(c, dti, "Node %s PCI reg config space address register number must be 0",
-                            node->fullpath);
+               FAIL_PROP(c, dti, node, prop, "PCI reg config space address register number must be 0");
 
        if (func == 0) {
                snprintf(unit_addr, sizeof(unit_addr), "%x", dev);
@@ -808,8 +874,8 @@ static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct no
        if (streq(unitname, unit_addr))
                return;
 
-       FAIL(c, dti, "Node %s PCI unit address format error, expected \"%s\"",
-            node->fullpath, unit_addr);
+       FAIL(c, dti, node, "PCI unit address format error, expected \"%s\"",
+            unit_addr);
 }
 WARNING(pci_device_reg, check_pci_device_reg, NULL, &reg_format, &pci_bridge);
 
@@ -828,7 +894,7 @@ static bool node_is_compatible(struct node *node, const char *compat)
 
        for (str = prop->val.val, end = str + prop->val.len; str < end;
             str += strnlen(str, end - str) + 1) {
-               if (strneq(str, compat, end - str))
+               if (strprefixeq(str, end - str, compat))
                        return true;
        }
        return false;
@@ -865,7 +931,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no
 
        if (!cells) {
                if (node->parent->parent && !(node->bus == &simple_bus))
-                       FAIL(c, dti, "Node %s missing or empty reg/ranges property", node->fullpath);
+                       FAIL(c, dti, node, "missing or empty reg/ranges property");
                return;
        }
 
@@ -875,8 +941,8 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no
 
        snprintf(unit_addr, sizeof(unit_addr), "%"PRIx64, reg);
        if (!streq(unitname, unit_addr))
-               FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
-                    node->fullpath, unit_addr);
+               FAIL(c, dti, node, "simple-bus unit address format error, expected \"%s\"",
+                    unit_addr);
 }
 WARNING(simple_bus_reg, check_simple_bus_reg, NULL, &reg_format, &simple_bus_bridge);
 
@@ -892,14 +958,12 @@ static void check_unit_address_format(struct check *c, struct dt_info *dti,
                return;
 
        if (!strncmp(unitname, "0x", 2)) {
-               FAIL(c, dti, "Node %s unit name should not have leading \"0x\"",
-                   node->fullpath);
+               FAIL(c, dti, node, "unit name should not have leading \"0x\"");
                /* skip over 0x for next test */
                unitname += 2;
        }
        if (unitname[0] == '0' && isxdigit(unitname[1]))
-               FAIL(c, dti, "Node %s unit name should not have leading 0s",
-                   node->fullpath);
+               FAIL(c, dti, node, "unit name should not have leading 0s");
 }
 WARNING(unit_address_format, check_unit_address_format, NULL,
        &node_name_format, &pci_bridge, &simple_bus_bridge);
@@ -922,16 +986,38 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti,
                return;
 
        if (node->parent->addr_cells == -1)
-               FAIL(c, dti, "Relying on default #address-cells value for %s",
-                    node->fullpath);
+               FAIL(c, dti, node, "Relying on default #address-cells value");
 
        if (node->parent->size_cells == -1)
-               FAIL(c, dti, "Relying on default #size-cells value for %s",
-                    node->fullpath);
+               FAIL(c, dti, node, "Relying on default #size-cells value");
 }
 WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL,
        &addr_size_cells);
 
+static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *dti,
+                                             struct node *node)
+{
+       struct property *prop;
+       struct node *child;
+       bool has_reg = false;
+
+       if (!node->parent || node->addr_cells < 0 || node->size_cells < 0)
+               return;
+
+       if (get_property(node, "ranges") || !node->children)
+               return;
+
+       for_each_child(node, child) {
+               prop = get_property(child, "reg");
+               if (prop)
+                       has_reg = true;
+       }
+
+       if (!has_reg)
+               FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property");
+}
+WARNING(avoid_unnecessary_addr_size, check_avoid_unnecessary_addr_size, NULL, &avoid_default_addr_size);
+
 static void check_obsolete_chosen_interrupt_controller(struct check *c,
                                                       struct dt_info *dti,
                                                       struct node *node)
@@ -950,12 +1036,61 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c,
 
        prop = get_property(chosen, "interrupt-controller");
        if (prop)
-               FAIL(c, dti, "/chosen has obsolete \"interrupt-controller\" "
-                    "property");
+               FAIL_PROP(c, dti, node, prop,
+                         "/chosen has obsolete \"interrupt-controller\" property");
 }
 WARNING(obsolete_chosen_interrupt_controller,
        check_obsolete_chosen_interrupt_controller, NULL);
 
+static void check_chosen_node_is_root(struct check *c, struct dt_info *dti,
+                                     struct node *node)
+{
+       if (!streq(node->name, "chosen"))
+               return;
+
+       if (node->parent != dti->dt)
+               FAIL(c, dti, node, "chosen node must be at root node");
+}
+WARNING(chosen_node_is_root, check_chosen_node_is_root, NULL);
+
+static void check_chosen_node_bootargs(struct check *c, struct dt_info *dti,
+                                      struct node *node)
+{
+       struct property *prop;
+
+       if (!streq(node->name, "chosen"))
+               return;
+
+       prop = get_property(node, "bootargs");
+       if (!prop)
+               return;
+
+       c->data = prop->name;
+       check_is_string(c, dti, node);
+}
+WARNING(chosen_node_bootargs, check_chosen_node_bootargs, NULL);
+
+static void check_chosen_node_stdout_path(struct check *c, struct dt_info *dti,
+                                         struct node *node)
+{
+       struct property *prop;
+
+       if (!streq(node->name, "chosen"))
+               return;
+
+       prop = get_property(node, "stdout-path");
+       if (!prop) {
+               prop = get_property(node, "linux,stdout-path");
+               if (!prop)
+                       return;
+               FAIL_PROP(c, dti, node, prop, "Use 'stdout-path' instead");
+       }
+
+       c->data = prop->name;
+       check_is_string(c, dti, node);
+}
+WARNING(chosen_node_stdout_path, check_chosen_node_stdout_path, NULL);
+
 struct provider {
        const char *prop_name;
        const char *cell_name;
@@ -972,8 +1107,9 @@ static void check_property_phandle_args(struct check *c,
        int cell, cellsize = 0;
 
        if (prop->val.len % sizeof(cell_t)) {
-               FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s",
-                    prop->name, prop->val.len, sizeof(cell_t), node->fullpath);
+               FAIL_PROP(c, dti, node, prop,
+                         "property size (%d) is invalid, expected multiple of %zu",
+                         prop->val.len, sizeof(cell_t));
                return;
        }
 
@@ -988,6 +1124,10 @@ static void check_property_phandle_args(struct check *c,
                 * entries when each index position has a specific definition.
                 */
                if (phandle == 0 || phandle == -1) {
+                       /* Give up if this is an overlay with external references */
+                       if (dti->dtsflags & DTSF_PLUGIN)
+                               break;
+
                        cellsize = 0;
                        continue;
                }
@@ -1000,14 +1140,16 @@ static void check_property_phandle_args(struct check *c,
                                        break;
                        }
                        if (!m)
-                               FAIL(c, dti, "Property '%s', cell %d is not a phandle reference in %s",
-                                    prop->name, cell, node->fullpath);
+                               FAIL_PROP(c, dti, node, prop,
+                                         "cell %d is not a phandle reference",
+                                         cell);
                }
 
                provider_node = get_node_by_phandle(root, phandle);
                if (!provider_node) {
-                       FAIL(c, dti, "Could not get phandle node for %s:%s(cell %d)",
-                            node->fullpath, prop->name, cell);
+                       FAIL_PROP(c, dti, node, prop,
+                                 "Could not get phandle node for (cell %d)",
+                                 cell);
                        break;
                }
 
@@ -1017,16 +1159,17 @@ static void check_property_phandle_args(struct check *c,
                } else if (provider->optional) {
                        cellsize = 0;
                } else {
-                       FAIL(c, dti, "Missing property '%s' in node %s or bad phandle (referred from %s:%s[%d])",
+                       FAIL(c, dti, node, "Missing property '%s' in node %s or bad phandle (referred from %s[%d])",
                             provider->cell_name,
                             provider_node->fullpath,
-                            node->fullpath, prop->name, cell);
+                            prop->name, cell);
                        break;
                }
 
                if (prop->val.len < ((cell + cellsize + 1) * sizeof(cell_t))) {
-                       FAIL(c, dti, "%s property size (%d) too small for cell size %d in %s",
-                            prop->name, prop->val.len, cellsize, node->fullpath);
+                       FAIL_PROP(c, dti, node, prop,
+                                 "property size (%d) too small for cell size %d",
+                                 prop->val.len, cellsize);
                }
        }
 }
@@ -1062,7 +1205,7 @@ WARNING_PROPERTY_PHANDLE_CELLS(phys, "phys", "#phy-cells");
 WARNING_PROPERTY_PHANDLE_CELLS(power_domains, "power-domains", "#power-domain-cells");
 WARNING_PROPERTY_PHANDLE_CELLS(pwms, "pwms", "#pwm-cells");
 WARNING_PROPERTY_PHANDLE_CELLS(resets, "resets", "#reset-cells");
-WARNING_PROPERTY_PHANDLE_CELLS(sound_dais, "sound-dais", "#sound-dai-cells");
+WARNING_PROPERTY_PHANDLE_CELLS(sound_dai, "sound-dai", "#sound-dai-cells");
 WARNING_PROPERTY_PHANDLE_CELLS(thermal_sensors, "thermal-sensors", "#thermal-sensor-cells");
 
 static bool prop_is_gpio(struct property *prop)
@@ -1128,8 +1271,8 @@ static void check_deprecated_gpio_property(struct check *c,
                if (!streq(str, "gpio"))
                        continue;
 
-               FAIL(c, dti, "'[*-]gpio' is deprecated, use '[*-]gpios' instead for %s:%s",
-                    node->fullpath, prop->name);
+               FAIL_PROP(c, dti, node, prop,
+                         "'[*-]gpio' is deprecated, use '[*-]gpios' instead");
        }
 
 }
@@ -1163,9 +1306,8 @@ static void check_interrupts_property(struct check *c,
                return;
 
        if (irq_prop->val.len % sizeof(cell_t))
-               FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s",
-                    irq_prop->name, irq_prop->val.len, sizeof(cell_t),
-                    node->fullpath);
+               FAIL_PROP(c, dti, node, irq_prop, "size (%d) is invalid, expected multiple of %zu",
+                    irq_prop->val.len, sizeof(cell_t));
 
        while (parent && !prop) {
                if (parent != node && node_is_interrupt_provider(parent)) {
@@ -1176,16 +1318,19 @@ static void check_interrupts_property(struct check *c,
                prop = get_property(parent, "interrupt-parent");
                if (prop) {
                        phandle = propval_cell(prop);
+                       /* Give up if this is an overlay with external references */
+                       if ((phandle == 0 || phandle == -1) &&
+                           (dti->dtsflags & DTSF_PLUGIN))
+                                       return;
+
                        irq_node = get_node_by_phandle(root, phandle);
                        if (!irq_node) {
-                               FAIL(c, dti, "Bad interrupt-parent phandle for %s",
-                                    node->fullpath);
+                               FAIL_PROP(c, dti, parent, prop, "Bad phandle");
                                return;
                        }
                        if (!node_is_interrupt_provider(irq_node))
-                               FAIL(c, dti,
-                                    "Missing interrupt-controller or interrupt-map property in %s",
-                                    irq_node->fullpath);
+                               FAIL(c, dti, irq_node,
+                                    "Missing interrupt-controller or interrupt-map property");
 
                        break;
                }
@@ -1194,23 +1339,21 @@ static void check_interrupts_property(struct check *c,
        }
 
        if (!irq_node) {
-               FAIL(c, dti, "Missing interrupt-parent for %s", node->fullpath);
+               FAIL(c, dti, node, "Missing interrupt-parent");
                return;
        }
 
        prop = get_property(irq_node, "#interrupt-cells");
        if (!prop) {
-               FAIL(c, dti, "Missing #interrupt-cells in interrupt-parent %s",
-                    irq_node->fullpath);
+               FAIL(c, dti, irq_node, "Missing #interrupt-cells in interrupt-parent");
                return;
        }
 
        irq_cells = propval_cell(prop);
        if (irq_prop->val.len % (irq_cells * sizeof(cell_t))) {
-               FAIL(c, dti,
-                    "interrupts size is (%d), expected multiple of %d in %s",
-                    irq_prop->val.len, (int)(irq_cells * sizeof(cell_t)),
-                    node->fullpath);
+               FAIL_PROP(c, dti, node, prop,
+                         "size is (%d), expected multiple of %d",
+                         irq_prop->val.len, (int)(irq_cells * sizeof(cell_t)));
        }
 }
 WARNING(interrupts_property, check_interrupts_property, &phandle_references);
@@ -1227,6 +1370,9 @@ static struct check *check_table[] = {
 
        &address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell,
        &device_type_is_string, &model_is_string, &status_is_string,
+       &label_is_string,
+
+       &compatible_is_string_list, &names_is_string_list,
 
        &property_name_chars_strict,
        &node_name_chars_strict,
@@ -1244,7 +1390,9 @@ static struct check *check_table[] = {
        &simple_bus_reg,
 
        &avoid_default_addr_size,
+       &avoid_unnecessary_addr_size,
        &obsolete_chosen_interrupt_controller,
+       &chosen_node_is_root, &chosen_node_bootargs, &chosen_node_stdout_path,
 
        &clocks_property,
        &cooling_device_property,
@@ -1260,13 +1408,15 @@ static struct check *check_table[] = {
        &power_domains_property,
        &pwms_property,
        &resets_property,
-       &sound_dais_property,
+       &sound_dai_property,
        &thermal_sensors_property,
 
        &deprecated_gpio_property,
        &gpios_property,
        &interrupts_property,
 
+       &alias_paths,
+
        &always_fail,
 };
 
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
deleted file mode 100644 (file)
index 011bb96..0000000
+++ /dev/null
@@ -1,2259 +0,0 @@
-#line 2 "dtc-lexer.lex.c"
-
-#line 4 "dtc-lexer.lex.c"
-
-#define  YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 1
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with  platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types. 
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN               (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN              (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN              (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX               (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX              (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX              (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX              (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX             (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX             (4294967295U)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-/* TODO: this is always defined, so inline it */
-#define yyconst const
-
-#if defined(__GNUC__) && __GNUC__ >= 3
-#define yynoreturn __attribute__((__noreturn__))
-#else
-#define yynoreturn
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index.  If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition.  This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN (yy_start) = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state.  The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START (((yy_start) - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart(yyin  )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-extern int yyleng;
-
-extern FILE *yyin, *yyout;
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-    #define YY_LESS_LINENO(n)
-    #define YY_LINENO_REWIND_TO(ptr)
-    
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
-       do \
-               { \
-               /* Undo effects of setting up yytext. */ \
-        int yyless_macro_arg = (n); \
-        YY_LESS_LINENO(yyless_macro_arg);\
-               *yy_cp = (yy_hold_char); \
-               YY_RESTORE_YY_MORE_OFFSET \
-               (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
-               YY_DO_BEFORE_ACTION; /* set up yytext again */ \
-               } \
-       while ( 0 )
-
-#define unput(c) yyunput( c, (yytext_ptr)  )
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
-       {
-       FILE *yy_input_file;
-
-       char *yy_ch_buf;                /* input buffer */
-       char *yy_buf_pos;               /* current position in input buffer */
-
-       /* Size of input buffer in bytes, not including room for EOB
-        * characters.
-        */
-       int yy_buf_size;
-
-       /* Number of characters read into yy_ch_buf, not including EOB
-        * characters.
-        */
-       int yy_n_chars;
-
-       /* Whether we "own" the buffer - i.e., we know we created it,
-        * and can realloc() it to grow it, and should free() it to
-        * delete it.
-        */
-       int yy_is_our_buffer;
-
-       /* Whether this is an "interactive" input source; if so, and
-        * if we're using stdio for input, then we want to use getc()
-        * instead of fread(), to make sure we stop fetching input after
-        * each newline.
-        */
-       int yy_is_interactive;
-
-       /* Whether we're considered to be at the beginning of a line.
-        * If so, '^' rules will be active on the next match, otherwise
-        * not.
-        */
-       int yy_at_bol;
-
-    int yy_bs_lineno; /**< The line count. */
-    int yy_bs_column; /**< The column count. */
-
-       /* Whether to try to fill the input buffer when we reach the
-        * end of it.
-        */
-       int yy_fill_buffer;
-
-       int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
-       /* When an EOF's been seen but there's still some text to process
-        * then we mark the buffer as YY_EOF_PENDING, to indicate that we
-        * shouldn't try reading from the input source any more.  We might
-        * still have a bunch of tokens to match, though, because of
-        * possible backing-up.
-        *
-        * When we actually see the EOF, we change the status to "new"
-        * (via yyrestart()), so that the user can continue scanning by
-        * just pointing yyin at a new input file.
-        */
-#define YY_BUFFER_EOF_PENDING 2
-
-       };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* Stack of input buffers. */
-static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
-static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
-                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
-                          : NULL)
-
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
-
-/* yy_hold_char holds the character lost when yytext is formed. */
-static char yy_hold_char;
-static int yy_n_chars;         /* number of characters read into yy_ch_buf */
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = NULL;
-static int yy_init = 0;                /* whether we need to initialize */
-static int yy_start = 0;       /* start state number */
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin.  A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void yyrestart (FILE *input_file  );
-void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
-YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
-void yy_delete_buffer (YY_BUFFER_STATE b  );
-void yy_flush_buffer (YY_BUFFER_STATE b  );
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
-void yypop_buffer_state (void );
-
-static void yyensure_buffer_stack (void );
-static void yy_load_buffer_state (void );
-static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
-
-#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
-
-YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
-YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
-
-void *yyalloc (yy_size_t  );
-void *yyrealloc (void *,yy_size_t  );
-void yyfree (void *  );
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
-       { \
-       if ( ! YY_CURRENT_BUFFER ){ \
-        yyensure_buffer_stack (); \
-               YY_CURRENT_BUFFER_LVALUE =    \
-            yy_create_buffer(yyin,YY_BUF_SIZE ); \
-       } \
-       YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
-       }
-
-#define yy_set_bol(at_bol) \
-       { \
-       if ( ! YY_CURRENT_BUFFER ){\
-        yyensure_buffer_stack (); \
-               YY_CURRENT_BUFFER_LVALUE =    \
-            yy_create_buffer(yyin,YY_BUF_SIZE ); \
-       } \
-       YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
-       }
-
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
-
-#define yywrap() (/*CONSTCOND*/1)
-#define YY_SKIP_YYWRAP
-
-typedef unsigned char YY_CHAR;
-
-FILE *yyin = NULL, *yyout = NULL;
-
-typedef int yy_state_type;
-
-extern int yylineno;
-
-int yylineno = 1;
-
-extern char *yytext;
-#ifdef yytext_ptr
-#undef yytext_ptr
-#endif
-#define yytext_ptr yytext
-
-static yy_state_type yy_get_previous_state (void );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
-static int yy_get_next_buffer (void );
-static void yynoreturn yy_fatal_error (yyconst char* msg  );
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
-       (yytext_ptr) = yy_bp; \
-       yyleng = (int) (yy_cp - yy_bp); \
-       (yy_hold_char) = *yy_cp; \
-       *yy_cp = '\0'; \
-       (yy_c_buf_p) = yy_cp;
-
-#define YY_NUM_RULES 31
-#define YY_END_OF_BUFFER 32
-/* This struct is not used in this scanner,
-   but its presence is necessary. */
-struct yy_trans_info
-       {
-       flex_int32_t yy_verify;
-       flex_int32_t yy_nxt;
-       };
-static yyconst flex_int16_t yy_accept[166] =
-    {   0,
-        0,    0,    0,    0,    0,    0,    0,    0,   32,   30,
-       19,   19,   30,   30,   30,   30,   30,   30,   30,   30,
-       30,   30,   30,   30,   30,   30,   16,   17,   17,   30,
-       17,   11,   11,   19,   27,    0,    3,    0,   28,   13,
-        0,    0,   12,    0,    0,    0,    0,    0,    0,    0,
-        0,   22,   24,   26,   25,   23,    0,   10,   29,    0,
-        0,    0,   15,   15,   17,   17,   17,   11,   11,   11,
-        0,   13,    0,   12,    0,    0,    0,   21,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,   17,   11,   11,
-       11,    0,   14,   20,    0,    0,    0,    0,    0,    0,
-
-        0,    0,    0,    0,   17,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,   17,    7,    0,    0,    0,
-        0,    0,    0,    0,    2,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    4,   18,    0,    0,    5,    2,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    1,    0,    0,    0,    0,    6,    9,    0,
-        0,    0,    0,    8,    0
-    } ;
-
-static yyconst YY_CHAR yy_ec[256] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
-        4,    4,    4,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    5,    6,    7,    1,    1,    8,    9,    1,
-        1,   10,   11,   11,   12,   11,   13,   14,   15,   16,
-       16,   16,   16,   16,   16,   16,   16,   17,    1,   18,
-       19,   20,   11,   11,   21,   21,   21,   21,   21,   21,
-       22,   22,   22,   22,   22,   23,   22,   22,   22,   22,
-       22,   22,   22,   22,   24,   22,   22,   25,   22,   22,
-        1,   26,   27,    1,   22,    1,   21,   28,   29,   30,
-
-       31,   21,   32,   22,   33,   22,   22,   34,   35,   36,
-       37,   38,   22,   39,   40,   41,   42,   43,   22,   25,
-       44,   22,   45,   46,   47,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
-
-static yyconst YY_CHAR yy_meta[48] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    2,    3,    1,    2,
-        2,    2,    4,    5,    5,    5,    6,    1,    1,    1,
-        7,    8,    8,    8,    8,    1,    1,    7,    7,    7,
-        7,    8,    8,    8,    8,    8,    8,    8,    8,    8,
-        8,    8,    8,    8,    3,    1,    4
-    } ;
-
-static yyconst flex_uint16_t yy_base[180] =
-    {   0,
-        0,  393,   35,  392,   66,  391,   38,  107,  397,  401,
-       55,  113,  377,  112,  111,  111,  114,   42,  376,  106,
-      377,  347,  126,  120,    0,  147,  401,    0,  124,    0,
-      137,  158,  170,  163,  401,  153,  401,  389,  401,    0,
-      378,  120,  401,  131,  380,  386,  355,  139,  351,  355,
-      351,  401,  401,  401,  401,  401,  367,  401,  401,  185,
-      350,  346,  401,  364,    0,  185,  347,  189,  356,  355,
-        0,    0,  330,  180,  366,  141,  372,  361,  332,  338,
-      331,  341,  334,  326,  205,  331,  337,  329,  401,  341,
-      167,  316,  401,  349,  348,  320,  328,  346,  180,  318,
-
-      324,  209,  324,  320,  322,  342,  338,  309,  306,  315,
-      305,  315,  312,  192,  342,  341,  401,  293,  306,  282,
-      268,  252,  255,  203,  285,  282,  272,  268,  252,  233,
-      232,  239,  208,  107,  401,  401,  238,  211,  401,  211,
-      212,  208,  228,  203,  215,  207,  233,  222,  212,  211,
-      203,  227,  401,  237,  225,  204,  185,  401,  401,  149,
-      128,   88,   42,  401,  401,  253,  259,  267,  271,  275,
-      281,  288,  292,  300,  308,  312,  318,  326,  334
-    } ;
-
-static yyconst flex_int16_t yy_def[180] =
-    {   0,
-      165,    1,    1,    3,  165,    5,    1,    1,  165,  165,
-      165,  165,  165,  166,  167,  168,  165,  165,  165,  165,
-      169,  165,  165,  165,  170,  169,  165,  171,  172,  171,
-      171,  165,  165,  165,  165,  166,  165,  166,  165,  173,
-      165,  168,  165,  168,  174,  175,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  169,  165,  165,  165,
-      165,  165,  165,  169,  171,  172,  171,  165,  165,  165,
-      176,  173,  177,  168,  174,  174,  175,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  171,  165,  165,
-      176,  177,  165,  165,  165,  165,  165,  165,  165,  165,
-
-      165,  165,  165,  165,  171,  165,  165,  165,  165,  165,
-      165,  165,  165,  178,  165,  171,  165,  165,  165,  165,
-      165,  165,  165,  178,  165,  178,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  179,  165,  165,
-      165,  179,  165,  179,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,    0,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165,  165
-    } ;
-
-static yyconst flex_uint16_t yy_nxt[449] =
-    {   0,
-       10,   11,   12,   11,   13,   14,   10,   15,   16,   10,
-       10,   10,   17,   10,   10,   10,   10,   18,   19,   20,
-       21,   21,   21,   21,   21,   10,   10,   21,   21,   21,
-       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   21,   21,   21,   10,   22,   10,   24,   25,   25,
-       25,   32,   33,   33,  164,   26,   34,   34,   34,   52,
-       53,   27,   26,   26,   26,   26,   10,   11,   12,   11,
-       13,   14,   28,   15,   16,   28,   28,   28,   24,   28,
-       28,   28,   10,   18,   19,   20,   29,   29,   29,   29,
-       29,   30,   10,   29,   29,   29,   29,   29,   29,   29,
-
-       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
-       10,   22,   10,   23,   34,   34,   34,   37,   39,   43,
-       32,   33,   33,   45,   55,   56,   46,   60,   43,   45,
-       65,  163,   46,   65,   65,   65,   44,   38,   60,   74,
-       58,   47,  141,   48,  142,   44,   49,   47,   50,   48,
-       76,   51,   62,   94,   50,   41,   44,   51,   37,   61,
-       64,   64,   64,   58,   34,   34,   34,   64,  162,   80,
-       67,   68,   68,   68,   64,   64,   64,   64,   38,   81,
-       69,   70,   71,   68,   68,   68,   60,  161,   43,   69,
-       70,   65,   69,   70,   65,   65,   65,  125,   85,   85,
-
-       85,   58,   68,   68,   68,   44,  102,  110,  125,  133,
-      102,   69,   70,  111,  114,  160,  159,  126,   85,   85,
-       85,  140,  140,  140,  140,  140,  140,  153,  126,  147,
-      147,  147,  153,  148,  147,  147,  147,  158,  148,  165,
-      157,  156,  155,  151,  150,  149,  146,  154,  145,  144,
-      143,  139,  154,   36,   36,   36,   36,   36,   36,   36,
-       36,   40,  138,  137,  136,   40,   40,   42,   42,   42,
-       42,   42,   42,   42,   42,   57,   57,   57,   57,   63,
-      135,   63,   65,  134,  165,   65,  133,   65,   65,   66,
-      132,  131,   66,   66,   66,   66,   72,  130,   72,   72,
-
-       75,   75,   75,   75,   75,   75,   75,   75,   77,   77,
-       77,   77,   77,   77,   77,   77,   91,  129,   91,   92,
-      128,   92,   92,  127,   92,   92,  124,  124,  124,  124,
-      124,  124,  124,  124,  152,  152,  152,  152,  152,  152,
-      152,  152,   60,   60,  123,  122,  121,  120,  119,  118,
-      117,   45,  116,  111,  115,  113,  112,  109,  108,  107,
-       46,  106,   93,   89,  105,  104,  103,  101,  100,   99,
-       98,   97,   96,   95,   78,   76,   93,   90,   89,   88,
-       58,   87,   86,   58,   84,   83,   82,   79,   78,   76,
-       73,  165,   59,   58,   54,   35,  165,   31,   23,   23,
-
-        9,  165,  165,  165,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165
-    } ;
-
-static yyconst flex_int16_t yy_chk[449] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    3,    3,    3,
-        3,    7,    7,    7,  163,    3,   11,   11,   11,   18,
-       18,    3,    3,    3,    3,    3,    5,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-
-        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    8,   12,   12,   12,   14,   15,   16,
-        8,    8,    8,   17,   20,   20,   17,   23,   42,   24,
-       29,  162,   24,   29,   29,   29,   16,   14,   31,   44,
-       29,   17,  134,   17,  134,   42,   17,   24,   17,   24,
-       76,   17,   24,   76,   24,   15,   44,   24,   36,   23,
-       26,   26,   26,   26,   34,   34,   34,   26,  161,   48,
-       31,   32,   32,   32,   26,   26,   26,   26,   36,   48,
-       32,   32,   32,   33,   33,   33,   60,  160,   74,   91,
-       91,   66,   33,   33,   66,   66,   66,  114,   60,   60,
-
-       60,   66,   68,   68,   68,   74,   85,   99,  124,  133,
-      102,   68,   68,   99,  102,  157,  156,  114,   85,   85,
-       85,  133,  133,  133,  140,  140,  140,  148,  124,  143,
-      143,  143,  152,  143,  147,  147,  147,  155,  147,  154,
-      151,  150,  149,  146,  145,  144,  142,  148,  141,  138,
-      137,  132,  152,  166,  166,  166,  166,  166,  166,  166,
-      166,  167,  131,  130,  129,  167,  167,  168,  168,  168,
-      168,  168,  168,  168,  168,  169,  169,  169,  169,  170,
-      128,  170,  171,  127,  126,  171,  125,  171,  171,  172,
-      123,  122,  172,  172,  172,  172,  173,  121,  173,  173,
-
-      174,  174,  174,  174,  174,  174,  174,  174,  175,  175,
-      175,  175,  175,  175,  175,  175,  176,  120,  176,  177,
-      119,  177,  177,  118,  177,  177,  178,  178,  178,  178,
-      178,  178,  178,  178,  179,  179,  179,  179,  179,  179,
-      179,  179,  116,  115,  113,  112,  111,  110,  109,  108,
-      107,  106,  105,  104,  103,  101,  100,   98,   97,   96,
-       95,   94,   92,   90,   88,   87,   86,   84,   83,   82,
-       81,   80,   79,   78,   77,   75,   73,   70,   69,   67,
-       64,   62,   61,   57,   51,   50,   49,   47,   46,   45,
-       41,   38,   22,   21,   19,   13,    9,    6,    4,    2,
-
-      165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
-      165,  165,  165,  165,  165,  165,  165,  165
-    } ;
-
-static yy_state_type yy_last_accepting_state;
-static char *yy_last_accepting_cpos;
-
-extern int yy_flex_debug;
-int yy_flex_debug = 0;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-char *yytext;
-#line 1 "dtc-lexer.l"
-/*
- * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation.  2005.
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
- *                                                                   USA
- */
-#define YY_NO_INPUT 1
-
-
-
-#line 37 "dtc-lexer.l"
-#include "dtc.h"
-#include "srcpos.h"
-#include "dtc-parser.tab.h"
-
-YYLTYPE yylloc;
-extern bool treesource_error;
-
-/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
-#define        YY_USER_ACTION \
-       { \
-               srcpos_update(&yylloc, yytext, yyleng); \
-       }
-
-/*#define LEXDEBUG     1*/
-
-#ifdef LEXDEBUG
-#define DPRINT(fmt, ...)       fprintf(stderr, fmt, ##__VA_ARGS__)
-#else
-#define DPRINT(fmt, ...)       do { } while (0)
-#endif
-
-static int dts_version = 1;
-
-#define BEGIN_DEFAULT()                DPRINT("<V1>\n"); \
-                               BEGIN(V1); \
-
-static void push_input_file(const char *filename);
-static bool pop_input_file(void);
-static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
-
-#line 661 "dtc-lexer.lex.c"
-
-#define INITIAL 0
-#define BYTESTRING 1
-#define PROPNODENAME 2
-#define V1 3
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-static int yy_init_globals (void );
-
-/* Accessor methods to globals.
-   These are made visible to non-reentrant scanners for convenience. */
-
-int yylex_destroy (void );
-
-int yyget_debug (void );
-
-void yyset_debug (int debug_flag  );
-
-YY_EXTRA_TYPE yyget_extra (void );
-
-void yyset_extra (YY_EXTRA_TYPE user_defined  );
-
-FILE *yyget_in (void );
-
-void yyset_in  (FILE * _in_str  );
-
-FILE *yyget_out (void );
-
-void yyset_out  (FILE * _out_str  );
-
-                       int yyget_leng (void );
-
-char *yyget_text (void );
-
-int yyget_lineno (void );
-
-void yyset_lineno (int _line_number  );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap (void );
-#else
-extern int yywrap (void );
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-    
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
-#endif
-
-#ifndef YY_NO_INPUT
-
-#ifdef __cplusplus
-static int yyinput (void );
-#else
-static int input (void );
-#endif
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
-#endif
-
-/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
-               { \
-               int c = '*'; \
-               size_t n; \
-               for ( n = 0; n < max_size && \
-                            (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
-                       buf[n] = (char) c; \
-               if ( c == '\n' ) \
-                       buf[n++] = (char) c; \
-               if ( c == EOF && ferror( yyin ) ) \
-                       YY_FATAL_ERROR( "input in flex scanner failed" ); \
-               result = n; \
-               } \
-       else \
-               { \
-               errno=0; \
-               while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
-                       { \
-                       if( errno != EINTR) \
-                               { \
-                               YY_FATAL_ERROR( "input in flex scanner failed" ); \
-                               break; \
-                               } \
-                       errno=0; \
-                       clearerr(yyin); \
-                       } \
-               }\
-\
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* end tables serialization structures and prototypes */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int yylex (void);
-
-#define YY_DECL int yylex (void)
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK /*LINTED*/break;
-#endif
-
-#define YY_RULE_SETUP \
-       if ( yyleng > 0 ) \
-               YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
-                               (yytext[yyleng - 1] == '\n'); \
-       YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
-       yy_state_type yy_current_state;
-       char *yy_cp, *yy_bp;
-       int yy_act;
-    
-       if ( !(yy_init) )
-               {
-               (yy_init) = 1;
-
-#ifdef YY_USER_INIT
-               YY_USER_INIT;
-#endif
-
-               if ( ! (yy_start) )
-                       (yy_start) = 1; /* first start state */
-
-               if ( ! yyin )
-                       yyin = stdin;
-
-               if ( ! yyout )
-                       yyout = stdout;
-
-               if ( ! YY_CURRENT_BUFFER ) {
-                       yyensure_buffer_stack ();
-                       YY_CURRENT_BUFFER_LVALUE =
-                               yy_create_buffer(yyin,YY_BUF_SIZE );
-               }
-
-               yy_load_buffer_state( );
-               }
-
-       {
-#line 69 "dtc-lexer.l"
-
-#line 885 "dtc-lexer.lex.c"
-
-       while ( /*CONSTCOND*/1 )                /* loops until end-of-file is reached */
-               {
-               yy_cp = (yy_c_buf_p);
-
-               /* Support of yytext. */
-               *yy_cp = (yy_hold_char);
-
-               /* yy_bp points to the position in yy_ch_buf of the start of
-                * the current run.
-                */
-               yy_bp = yy_cp;
-
-               yy_current_state = (yy_start);
-               yy_current_state += YY_AT_BOL();
-yy_match:
-               do
-                       {
-                       YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
-                       if ( yy_accept[yy_current_state] )
-                               {
-                               (yy_last_accepting_state) = yy_current_state;
-                               (yy_last_accepting_cpos) = yy_cp;
-                               }
-                       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                               {
-                               yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 166 )
-                                       yy_c = yy_meta[(unsigned int) yy_c];
-                               }
-                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
-                       ++yy_cp;
-                       }
-               while ( yy_current_state != 165 );
-               yy_cp = (yy_last_accepting_cpos);
-               yy_current_state = (yy_last_accepting_state);
-
-yy_find_action:
-               yy_act = yy_accept[yy_current_state];
-
-               YY_DO_BEFORE_ACTION;
-
-do_action:     /* This label is used only to access EOF actions. */
-
-               switch ( yy_act )
-       { /* beginning of action switch */
-                       case 0: /* must back up */
-                       /* undo the effects of YY_DO_BEFORE_ACTION */
-                       *yy_cp = (yy_hold_char);
-                       yy_cp = (yy_last_accepting_cpos);
-                       yy_current_state = (yy_last_accepting_state);
-                       goto yy_find_action;
-
-case 1:
-/* rule 1 can match eol */
-YY_RULE_SETUP
-#line 70 "dtc-lexer.l"
-{
-                       char *name = strchr(yytext, '\"') + 1;
-                       yytext[yyleng-1] = '\0';
-                       push_input_file(name);
-               }
-       YY_BREAK
-case 2:
-/* rule 2 can match eol */
-YY_RULE_SETUP
-#line 76 "dtc-lexer.l"
-{
-                       char *line, *fnstart, *fnend;
-                       struct data fn;
-                       /* skip text before line # */
-                       line = yytext;
-                       while (!isdigit((unsigned char)*line))
-                               line++;
-
-                       /* regexp ensures that first and list "
-                        * in the whole yytext are those at
-                        * beginning and end of the filename string */
-                       fnstart = memchr(yytext, '"', yyleng);
-                       for (fnend = yytext + yyleng - 1;
-                            *fnend != '"'; fnend--)
-                               ;
-                       assert(fnstart && fnend && (fnend > fnstart));
-
-                       fn = data_copy_escape_string(fnstart + 1,
-                                                    fnend - fnstart - 1);
-
-                       /* Don't allow nuls in filenames */
-                       if (memchr(fn.val, '\0', fn.len - 1))
-                               lexical_error("nul in line number directive");
-
-                       /* -1 since #line is the number of the next line */
-                       srcpos_set_line(xstrdup(fn.val), atoi(line) - 1);
-                       data_free(fn);
-               }
-       YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(BYTESTRING):
-case YY_STATE_EOF(PROPNODENAME):
-case YY_STATE_EOF(V1):
-#line 105 "dtc-lexer.l"
-{
-                       if (!pop_input_file()) {
-                               yyterminate();
-                       }
-               }
-       YY_BREAK
-case 3:
-/* rule 3 can match eol */
-YY_RULE_SETUP
-#line 111 "dtc-lexer.l"
-{
-                       DPRINT("String: %s\n", yytext);
-                       yylval.data = data_copy_escape_string(yytext+1,
-                                       yyleng-2);
-                       return DT_STRING;
-               }
-       YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 118 "dtc-lexer.l"
-{
-                       DPRINT("Keyword: /dts-v1/\n");
-                       dts_version = 1;
-                       BEGIN_DEFAULT();
-                       return DT_V1;
-               }
-       YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 125 "dtc-lexer.l"
-{
-                       DPRINT("Keyword: /plugin/\n");
-                       return DT_PLUGIN;
-               }
-       YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 130 "dtc-lexer.l"
-{
-                       DPRINT("Keyword: /memreserve/\n");
-                       BEGIN_DEFAULT();
-                       return DT_MEMRESERVE;
-               }
-       YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 136 "dtc-lexer.l"
-{
-                       DPRINT("Keyword: /bits/\n");
-                       BEGIN_DEFAULT();
-                       return DT_BITS;
-               }
-       YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 142 "dtc-lexer.l"
-{
-                       DPRINT("Keyword: /delete-property/\n");
-                       DPRINT("<PROPNODENAME>\n");
-                       BEGIN(PROPNODENAME);
-                       return DT_DEL_PROP;
-               }
-       YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 149 "dtc-lexer.l"
-{
-                       DPRINT("Keyword: /delete-node/\n");
-                       DPRINT("<PROPNODENAME>\n");
-                       BEGIN(PROPNODENAME);
-                       return DT_DEL_NODE;
-               }
-       YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 156 "dtc-lexer.l"
-{
-                       DPRINT("Label: %s\n", yytext);
-                       yylval.labelref = xstrdup(yytext);
-                       yylval.labelref[yyleng-1] = '\0';
-                       return DT_LABEL;
-               }
-       YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 163 "dtc-lexer.l"
-{
-                       char *e;
-                       DPRINT("Integer Literal: '%s'\n", yytext);
-
-                       errno = 0;
-                       yylval.integer = strtoull(yytext, &e, 0);
-
-                       if (*e && e[strspn(e, "UL")]) {
-                               lexical_error("Bad integer literal '%s'",
-                                             yytext);
-                       }
-
-                       if (errno == ERANGE)
-                               lexical_error("Integer literal '%s' out of range",
-                                             yytext);
-                       else
-                               /* ERANGE is the only strtoull error triggerable
-                                *  by strings matching the pattern */
-                               assert(errno == 0);
-                       return DT_LITERAL;
-               }
-       YY_BREAK
-case 12:
-/* rule 12 can match eol */
-YY_RULE_SETUP
-#line 185 "dtc-lexer.l"
-{
-                       struct data d;
-                       DPRINT("Character literal: %s\n", yytext);
-
-                       d = data_copy_escape_string(yytext+1, yyleng-2);
-                       if (d.len == 1) {
-                               lexical_error("Empty character literal");
-                               yylval.integer = 0;
-                       } else {
-                               yylval.integer = (unsigned char)d.val[0];
-
-                               if (d.len > 2)
-                                       lexical_error("Character literal has %d"
-                                                     " characters instead of 1",
-                                                     d.len - 1);
-                       }
-
-                       data_free(d);
-                       return DT_CHAR_LITERAL;
-               }
-       YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 206 "dtc-lexer.l"
-{      /* label reference */
-                       DPRINT("Ref: %s\n", yytext+1);
-                       yylval.labelref = xstrdup(yytext+1);
-                       return DT_REF;
-               }
-       YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 212 "dtc-lexer.l"
-{      /* new-style path reference */
-                       yytext[yyleng-1] = '\0';
-                       DPRINT("Ref: %s\n", yytext+2);
-                       yylval.labelref = xstrdup(yytext+2);
-                       return DT_REF;
-               }
-       YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 219 "dtc-lexer.l"
-{
-                       yylval.byte = strtol(yytext, NULL, 16);
-                       DPRINT("Byte: %02x\n", (int)yylval.byte);
-                       return DT_BYTE;
-               }
-       YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 225 "dtc-lexer.l"
-{
-                       DPRINT("/BYTESTRING\n");
-                       BEGIN_DEFAULT();
-                       return ']';
-               }
-       YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 231 "dtc-lexer.l"
-{
-                       DPRINT("PropNodeName: %s\n", yytext);
-                       yylval.propnodename = xstrdup((yytext[0] == '\\') ?
-                                                       yytext + 1 : yytext);
-                       BEGIN_DEFAULT();
-                       return DT_PROPNODENAME;
-               }
-       YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 239 "dtc-lexer.l"
-{
-                       DPRINT("Binary Include\n");
-                       return DT_INCBIN;
-               }
-       YY_BREAK
-case 19:
-/* rule 19 can match eol */
-YY_RULE_SETUP
-#line 244 "dtc-lexer.l"
-/* eat whitespace */
-       YY_BREAK
-case 20:
-/* rule 20 can match eol */
-YY_RULE_SETUP
-#line 245 "dtc-lexer.l"
-/* eat C-style comments */
-       YY_BREAK
-case 21:
-/* rule 21 can match eol */
-YY_RULE_SETUP
-#line 246 "dtc-lexer.l"
-/* eat C++-style comments */
-       YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 248 "dtc-lexer.l"
-{ return DT_LSHIFT; };
-       YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 249 "dtc-lexer.l"
-{ return DT_RSHIFT; };
-       YY_BREAK
-case 24:
-YY_RULE_SETUP
-#line 250 "dtc-lexer.l"
-{ return DT_LE; };
-       YY_BREAK
-case 25:
-YY_RULE_SETUP
-#line 251 "dtc-lexer.l"
-{ return DT_GE; };
-       YY_BREAK
-case 26:
-YY_RULE_SETUP
-#line 252 "dtc-lexer.l"
-{ return DT_EQ; };
-       YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 253 "dtc-lexer.l"
-{ return DT_NE; };
-       YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 254 "dtc-lexer.l"
-{ return DT_AND; };
-       YY_BREAK
-case 29:
-YY_RULE_SETUP
-#line 255 "dtc-lexer.l"
-{ return DT_OR; };
-       YY_BREAK
-case 30:
-YY_RULE_SETUP
-#line 257 "dtc-lexer.l"
-{
-                       DPRINT("Char: %c (\\x%02x)\n", yytext[0],
-                               (unsigned)yytext[0]);
-                       if (yytext[0] == '[') {
-                               DPRINT("<BYTESTRING>\n");
-                               BEGIN(BYTESTRING);
-                       }
-                       if ((yytext[0] == '{')
-                           || (yytext[0] == ';')) {
-                               DPRINT("<PROPNODENAME>\n");
-                               BEGIN(PROPNODENAME);
-                       }
-                       return yytext[0];
-               }
-       YY_BREAK
-case 31:
-YY_RULE_SETUP
-#line 272 "dtc-lexer.l"
-ECHO;
-       YY_BREAK
-#line 1257 "dtc-lexer.lex.c"
-
-       case YY_END_OF_BUFFER:
-               {
-               /* Amount of text matched not including the EOB char. */
-               int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
-
-               /* Undo the effects of YY_DO_BEFORE_ACTION. */
-               *yy_cp = (yy_hold_char);
-               YY_RESTORE_YY_MORE_OFFSET
-
-               if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
-                       {
-                       /* We're scanning a new file or input source.  It's
-                        * possible that this happened because the user
-                        * just pointed yyin at a new source and called
-                        * yylex().  If so, then we have to assure
-                        * consistency between YY_CURRENT_BUFFER and our
-                        * globals.  Here is the right place to do so, because
-                        * this is the first action (other than possibly a
-                        * back-up) that will match for the new input source.
-                        */
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-                       YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
-                       }
-
-               /* Note that here we test for yy_c_buf_p "<=" to the position
-                * of the first EOB in the buffer, since yy_c_buf_p will
-                * already have been incremented past the NUL character
-                * (since all states make transitions on EOB to the
-                * end-of-buffer state).  Contrast this with the test
-                * in input().
-                */
-               if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       { /* This was really a NUL. */
-                       yy_state_type yy_next_state;
-
-                       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
-
-                       yy_current_state = yy_get_previous_state(  );
-
-                       /* Okay, we're now positioned to make the NUL
-                        * transition.  We couldn't have
-                        * yy_get_previous_state() go ahead and do it
-                        * for us because it doesn't know how to deal
-                        * with the possibility of jamming (and we don't
-                        * want to build jamming into it because then it
-                        * will run more slowly).
-                        */
-
-                       yy_next_state = yy_try_NUL_trans( yy_current_state );
-
-                       yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-
-                       if ( yy_next_state )
-                               {
-                               /* Consume the NUL. */
-                               yy_cp = ++(yy_c_buf_p);
-                               yy_current_state = yy_next_state;
-                               goto yy_match;
-                               }
-
-                       else
-                               {
-                               yy_cp = (yy_last_accepting_cpos);
-                               yy_current_state = (yy_last_accepting_state);
-                               goto yy_find_action;
-                               }
-                       }
-
-               else switch ( yy_get_next_buffer(  ) )
-                       {
-                       case EOB_ACT_END_OF_FILE:
-                               {
-                               (yy_did_buffer_switch_on_eof) = 0;
-
-                               if ( yywrap( ) )
-                                       {
-                                       /* Note: because we've taken care in
-                                        * yy_get_next_buffer() to have set up
-                                        * yytext, we can now set up
-                                        * yy_c_buf_p so that if some total
-                                        * hoser (like flex itself) wants to
-                                        * call the scanner after we return the
-                                        * YY_NULL, it'll still work - another
-                                        * YY_NULL will get returned.
-                                        */
-                                       (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
-
-                                       yy_act = YY_STATE_EOF(YY_START);
-                                       goto do_action;
-                                       }
-
-                               else
-                                       {
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
-                                       }
-                               break;
-                               }
-
-                       case EOB_ACT_CONTINUE_SCAN:
-                               (yy_c_buf_p) =
-                                       (yytext_ptr) + yy_amount_of_matched_text;
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_match;
-
-                       case EOB_ACT_LAST_MATCH:
-                               (yy_c_buf_p) =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_find_action;
-                       }
-               break;
-               }
-
-       default:
-               YY_FATAL_ERROR(
-                       "fatal flex scanner internal error--no action found" );
-       } /* end of action switch */
-               } /* end of scanning one token */
-       } /* end of user's declarations */
-} /* end of yylex */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- *     EOB_ACT_LAST_MATCH -
- *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- *     EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (void)
-{
-       char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-       char *source = (yytext_ptr);
-       int number_to_move, i;
-       int ret_val;
-
-       if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
-               YY_FATAL_ERROR(
-               "fatal flex scanner internal error--end of buffer missed" );
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
-               { /* Don't try to fill the buffer, so this is an EOF. */
-               if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
-                       {
-                       /* We matched a single character, the EOB, so
-                        * treat this as a final EOF.
-                        */
-                       return EOB_ACT_END_OF_FILE;
-                       }
-
-               else
-                       {
-                       /* We matched some text prior to the EOB, first
-                        * process it.
-                        */
-                       return EOB_ACT_LAST_MATCH;
-                       }
-               }
-
-       /* Try to read more data. */
-
-       /* First move last chars to start of buffer. */
-       number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
-
-       for ( i = 0; i < number_to_move; ++i )
-               *(dest++) = *(source++);
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
-               /* don't do the read, it's not guaranteed to return an EOF,
-                * just force an EOF
-                */
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
-
-       else
-               {
-                       int num_to_read =
-                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
-               while ( num_to_read <= 0 )
-                       { /* Not enough room in the buffer - grow it. */
-
-                       /* just a shorter name for the current buffer */
-                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
-
-                       int yy_c_buf_p_offset =
-                               (int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-                       if ( b->yy_is_our_buffer )
-                               {
-                               int new_size = b->yy_buf_size * 2;
-
-                               if ( new_size <= 0 )
-                                       b->yy_buf_size += b->yy_buf_size / 8;
-                               else
-                                       b->yy_buf_size *= 2;
-
-                               b->yy_ch_buf = (char *)
-                                       /* Include room in for 2 EOB chars. */
-                                       yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
-                               }
-                       else
-                               /* Can't grow it, we don't own it. */
-                               b->yy_ch_buf = NULL;
-
-                       if ( ! b->yy_ch_buf )
-                               YY_FATAL_ERROR(
-                               "fatal error - scanner input buffer overflow" );
-
-                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
-
-                       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
-                                               number_to_move - 1;
-
-                       }
-
-               if ( num_to_read > YY_READ_BUF_SIZE )
-                       num_to_read = YY_READ_BUF_SIZE;
-
-               /* Read in more data. */
-               YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       (yy_n_chars), num_to_read );
-
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       if ( (yy_n_chars) == 0 )
-               {
-               if ( number_to_move == YY_MORE_ADJ )
-                       {
-                       ret_val = EOB_ACT_END_OF_FILE;
-                       yyrestart(yyin  );
-                       }
-
-               else
-                       {
-                       ret_val = EOB_ACT_LAST_MATCH;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
-                               YY_BUFFER_EOF_PENDING;
-                       }
-               }
-
-       else
-               ret_val = EOB_ACT_CONTINUE_SCAN;
-
-       if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-               /* Extend the array by 50%, plus the number we really need. */
-               int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
-               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
-               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-       }
-
-       (yy_n_chars) += number_to_move;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
-
-       (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
-       return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-    static yy_state_type yy_get_previous_state (void)
-{
-       yy_state_type yy_current_state;
-       char *yy_cp;
-    
-       yy_current_state = (yy_start);
-       yy_current_state += YY_AT_BOL();
-
-       for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-               {
-               YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
-               if ( yy_accept[yy_current_state] )
-                       {
-                       (yy_last_accepting_state) = yy_current_state;
-                       (yy_last_accepting_cpos) = yy_cp;
-                       }
-               while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                       {
-                       yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 166 )
-                               yy_c = yy_meta[(unsigned int) yy_c];
-                       }
-               yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
-               }
-
-       return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- *     next_state = yy_try_NUL_trans( current_state );
- */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
-{
-       int yy_is_jam;
-       char *yy_cp = (yy_c_buf_p);
-
-       YY_CHAR yy_c = 1;
-       if ( yy_accept[yy_current_state] )
-               {
-               (yy_last_accepting_state) = yy_current_state;
-               (yy_last_accepting_cpos) = yy_cp;
-               }
-       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-               {
-               yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 166 )
-                       yy_c = yy_meta[(unsigned int) yy_c];
-               }
-       yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
-       yy_is_jam = (yy_current_state == 165);
-
-               return yy_is_jam ? 0 : yy_current_state;
-}
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-    static int yyinput (void)
-#else
-    static int input  (void)
-#endif
-
-{
-       int c;
-    
-       *(yy_c_buf_p) = (yy_hold_char);
-
-       if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
-               {
-               /* yy_c_buf_p now points to the character we want to return.
-                * If this occurs *before* the EOB characters, then it's a
-                * valid NUL; if not, then we've hit the end of the buffer.
-                */
-               if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       /* This was really a NUL. */
-                       *(yy_c_buf_p) = '\0';
-
-               else
-                       { /* need more input */
-                       int offset = (yy_c_buf_p) - (yytext_ptr);
-                       ++(yy_c_buf_p);
-
-                       switch ( yy_get_next_buffer(  ) )
-                               {
-                               case EOB_ACT_LAST_MATCH:
-                                       /* This happens because yy_g_n_b()
-                                        * sees that we've accumulated a
-                                        * token and flags that we need to
-                                        * try matching the token before
-                                        * proceeding.  But for input(),
-                                        * there's no matching to consider.
-                                        * So convert the EOB_ACT_LAST_MATCH
-                                        * to EOB_ACT_END_OF_FILE.
-                                        */
-
-                                       /* Reset buffer status. */
-                                       yyrestart(yyin );
-
-                                       /*FALLTHROUGH*/
-
-                               case EOB_ACT_END_OF_FILE:
-                                       {
-                                       if ( yywrap( ) )
-                                               return 0;
-
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
-#ifdef __cplusplus
-                                       return yyinput();
-#else
-                                       return input();
-#endif
-                                       }
-
-                               case EOB_ACT_CONTINUE_SCAN:
-                                       (yy_c_buf_p) = (yytext_ptr) + offset;
-                                       break;
-                               }
-                       }
-               }
-
-       c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
-       *(yy_c_buf_p) = '\0';   /* preserve yytext */
-       (yy_hold_char) = *++(yy_c_buf_p);
-
-       YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
-
-       return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * 
- * @note This function does not reset the start condition to @c INITIAL .
- */
-    void yyrestart  (FILE * input_file )
-{
-    
-       if ( ! YY_CURRENT_BUFFER ){
-        yyensure_buffer_stack ();
-               YY_CURRENT_BUFFER_LVALUE =
-            yy_create_buffer(yyin,YY_BUF_SIZE );
-       }
-
-       yy_init_buffer(YY_CURRENT_BUFFER,input_file );
-       yy_load_buffer_state( );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * 
- */
-    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
-{
-    
-       /* TODO. We should be able to replace this entire function body
-        * with
-        *              yypop_buffer_state();
-        *              yypush_buffer_state(new_buffer);
-     */
-       yyensure_buffer_stack ();
-       if ( YY_CURRENT_BUFFER == new_buffer )
-               return;
-
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-       yy_load_buffer_state( );
-
-       /* We don't actually know whether we did this switch during
-        * EOF (yywrap()) processing, but the only time this flag
-        * is looked at is after yywrap() is called, so it's safe
-        * to go ahead and always set it.
-        */
-       (yy_did_buffer_switch_on_eof) = 1;
-}
-
-static void yy_load_buffer_state  (void)
-{
-       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-       (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
-       yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
-       (yy_hold_char) = *(yy_c_buf_p);
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * 
- * @return the allocated buffer state.
- */
-    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
-{
-       YY_BUFFER_STATE b;
-    
-       b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
-       b->yy_buf_size = (yy_size_t)size;
-
-       /* yy_ch_buf has to be 2 characters longer than the size given because
-        * we need to put in 2 end-of-buffer characters.
-        */
-       b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
-       if ( ! b->yy_ch_buf )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
-       b->yy_is_our_buffer = 1;
-
-       yy_init_buffer(b,file );
-
-       return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with yy_create_buffer()
- * 
- */
-    void yy_delete_buffer (YY_BUFFER_STATE  b )
-{
-    
-       if ( ! b )
-               return;
-
-       if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
-               YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
-       if ( b->yy_is_our_buffer )
-               yyfree((void *) b->yy_ch_buf  );
-
-       yyfree((void *) b  );
-}
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a yyrestart() or at EOF.
- */
-    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
-
-{
-       int oerrno = errno;
-    
-       yy_flush_buffer(b );
-
-       b->yy_input_file = file;
-       b->yy_fill_buffer = 1;
-
-    /* If b is the current buffer, then yy_init_buffer was _probably_
-     * called from yyrestart() or through yy_get_next_buffer.
-     * In that case, we don't want to reset the lineno or column.
-     */
-    if (b != YY_CURRENT_BUFFER){
-        b->yy_bs_lineno = 1;
-        b->yy_bs_column = 0;
-    }
-
-        b->yy_is_interactive = 0;
-    
-       errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * 
- */
-    void yy_flush_buffer (YY_BUFFER_STATE  b )
-{
-       if ( ! b )
-               return;
-
-       b->yy_n_chars = 0;
-
-       /* We always need two end-of-buffer characters.  The first causes
-        * a transition to the end-of-buffer state.  The second causes
-        * a jam in that state.
-        */
-       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
-       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
-       b->yy_buf_pos = &b->yy_ch_buf[0];
-
-       b->yy_at_bol = 1;
-       b->yy_buffer_status = YY_BUFFER_NEW;
-
-       if ( b == YY_CURRENT_BUFFER )
-               yy_load_buffer_state( );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- *  the current state. This function will allocate the stack
- *  if necessary.
- *  @param new_buffer The new state.
- *  
- */
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
-{
-       if (new_buffer == NULL)
-               return;
-
-       yyensure_buffer_stack();
-
-       /* This block is copied from yy_switch_to_buffer. */
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       /* Only push if top exists. Otherwise, replace top. */
-       if (YY_CURRENT_BUFFER)
-               (yy_buffer_stack_top)++;
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
-       /* copied from yy_switch_to_buffer. */
-       yy_load_buffer_state( );
-       (yy_did_buffer_switch_on_eof) = 1;
-}
-
-/** Removes and deletes the top of the stack, if present.
- *  The next element becomes the new top.
- *  
- */
-void yypop_buffer_state (void)
-{
-       if (!YY_CURRENT_BUFFER)
-               return;
-
-       yy_delete_buffer(YY_CURRENT_BUFFER );
-       YY_CURRENT_BUFFER_LVALUE = NULL;
-       if ((yy_buffer_stack_top) > 0)
-               --(yy_buffer_stack_top);
-
-       if (YY_CURRENT_BUFFER) {
-               yy_load_buffer_state( );
-               (yy_did_buffer_switch_on_eof) = 1;
-       }
-}
-
-/* Allocates the stack if it does not exist.
- *  Guarantees space for at least one push.
- */
-static void yyensure_buffer_stack (void)
-{
-       int num_to_alloc;
-    
-       if (!(yy_buffer_stack)) {
-
-               /* First allocation is just for 2 elements, since we don't know if this
-                * scanner will even need a stack. We use 2 instead of 1 to avoid an
-                * immediate realloc on the next call.
-         */
-      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
-               (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
-                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
-               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
-               (yy_buffer_stack_max) = num_to_alloc;
-               (yy_buffer_stack_top) = 0;
-               return;
-       }
-
-       if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
-
-               /* Increase the buffer to prepare for a possible push. */
-               yy_size_t grow_size = 8 /* arbitrary grow size */;
-
-               num_to_alloc = (yy_buffer_stack_max) + grow_size;
-               (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
-                                                               ((yy_buffer_stack),
-                                                               num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
-               /* zero only the new slots.*/
-               memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
-               (yy_buffer_stack_max) = num_to_alloc;
-       }
-}
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * 
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
-{
-       YY_BUFFER_STATE b;
-    
-       if ( size < 2 ||
-            base[size-2] != YY_END_OF_BUFFER_CHAR ||
-            base[size-1] != YY_END_OF_BUFFER_CHAR )
-               /* They forgot to leave room for the EOB's. */
-               return NULL;
-
-       b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
-       b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
-       b->yy_buf_pos = b->yy_ch_buf = base;
-       b->yy_is_our_buffer = 0;
-       b->yy_input_file = NULL;
-       b->yy_n_chars = b->yy_buf_size;
-       b->yy_is_interactive = 0;
-       b->yy_at_bol = 1;
-       b->yy_fill_buffer = 0;
-       b->yy_buffer_status = YY_BUFFER_NEW;
-
-       yy_switch_to_buffer(b  );
-
-       return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to yylex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * 
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- *       yy_scan_bytes() instead.
- */
-YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
-{
-    
-       return yy_scan_bytes(yystr,(int) strlen(yystr) );
-}
-
-/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
- * scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- * 
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
-{
-       YY_BUFFER_STATE b;
-       char *buf;
-       yy_size_t n;
-       int i;
-    
-       /* Get memory for full buffer, including space for trailing EOB's. */
-       n = (yy_size_t) (_yybytes_len + 2);
-       buf = (char *) yyalloc(n  );
-       if ( ! buf )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
-       for ( i = 0; i < _yybytes_len; ++i )
-               buf[i] = yybytes[i];
-
-       buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
-       b = yy_scan_buffer(buf,n );
-       if ( ! b )
-               YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
-       /* It's okay to grow etc. this buffer, and we should throw it
-        * away when we're done.
-        */
-       b->yy_is_our_buffer = 1;
-
-       return b;
-}
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yynoreturn yy_fatal_error (yyconst char* msg )
-{
-                       (void) fprintf( stderr, "%s\n", msg );
-       exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
-       do \
-               { \
-               /* Undo effects of setting up yytext. */ \
-        int yyless_macro_arg = (n); \
-        YY_LESS_LINENO(yyless_macro_arg);\
-               yytext[yyleng] = (yy_hold_char); \
-               (yy_c_buf_p) = yytext + yyless_macro_arg; \
-               (yy_hold_char) = *(yy_c_buf_p); \
-               *(yy_c_buf_p) = '\0'; \
-               yyleng = yyless_macro_arg; \
-               } \
-       while ( 0 )
-
-/* Accessor  methods (get/set functions) to struct members. */
-
-/** Get the current line number.
- * 
- */
-int yyget_lineno  (void)
-{
-    
-    return yylineno;
-}
-
-/** Get the input stream.
- * 
- */
-FILE *yyget_in  (void)
-{
-        return yyin;
-}
-
-/** Get the output stream.
- * 
- */
-FILE *yyget_out  (void)
-{
-        return yyout;
-}
-
-/** Get the length of the current token.
- * 
- */
-int yyget_leng  (void)
-{
-        return yyleng;
-}
-
-/** Get the current token.
- * 
- */
-
-char *yyget_text  (void)
-{
-        return yytext;
-}
-
-/** Set the current line number.
- * @param _line_number line number
- * 
- */
-void yyset_lineno (int  _line_number )
-{
-    
-    yylineno = _line_number;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param _in_str A readable stream.
- * 
- * @see yy_switch_to_buffer
- */
-void yyset_in (FILE *  _in_str )
-{
-        yyin = _in_str ;
-}
-
-void yyset_out (FILE *  _out_str )
-{
-        yyout = _out_str ;
-}
-
-int yyget_debug  (void)
-{
-        return yy_flex_debug;
-}
-
-void yyset_debug (int  _bdebug )
-{
-        yy_flex_debug = _bdebug ;
-}
-
-static int yy_init_globals (void)
-{
-        /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from yylex_destroy(), so don't allocate here.
-     */
-
-    (yy_buffer_stack) = NULL;
-    (yy_buffer_stack_top) = 0;
-    (yy_buffer_stack_max) = 0;
-    (yy_c_buf_p) = NULL;
-    (yy_init) = 0;
-    (yy_start) = 0;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
-    yyin = stdin;
-    yyout = stdout;
-#else
-    yyin = NULL;
-    yyout = NULL;
-#endif
-
-    /* For future reference: Set errno on error, since we are called by
-     * yylex_init()
-     */
-    return 0;
-}
-
-/* yylex_destroy is for both reentrant and non-reentrant scanners. */
-int yylex_destroy  (void)
-{
-    
-    /* Pop the buffer stack, destroying each element. */
-       while(YY_CURRENT_BUFFER){
-               yy_delete_buffer(YY_CURRENT_BUFFER  );
-               YY_CURRENT_BUFFER_LVALUE = NULL;
-               yypop_buffer_state();
-       }
-
-       /* Destroy the stack itself. */
-       yyfree((yy_buffer_stack) );
-       (yy_buffer_stack) = NULL;
-
-    /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * yylex() is called, initialization will occur. */
-    yy_init_globals( );
-
-    return 0;
-}
-
-/*
- * Internal utility routines.
- */
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
-{
-               
-       int i;
-       for ( i = 0; i < n; ++i )
-               s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s )
-{
-       int n;
-       for ( n = 0; s[n]; ++n )
-               ;
-
-       return n;
-}
-#endif
-
-void *yyalloc (yy_size_t  size )
-{
-                       return malloc(size);
-}
-
-void *yyrealloc  (void * ptr, yy_size_t  size )
-{
-               
-       /* The cast to (char *) in the following accommodates both
-        * implementations that use char* generic pointers, and those
-        * that use void* generic pointers.  It works with the latter
-        * because both ANSI C and C++ allow castless assignment from
-        * any pointer type to void*, and deal with argument conversions
-        * as though doing an assignment.
-        */
-       return realloc(ptr, size);
-}
-
-void yyfree (void * ptr )
-{
-                       free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-#line 272 "dtc-lexer.l"
-
-
-
-static void push_input_file(const char *filename)
-{
-       assert(filename);
-
-       srcfile_push(filename);
-
-       yyin = current_srcfile->f;
-
-       yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
-}
-
-
-static bool pop_input_file(void)
-{
-       if (srcfile_pop() == 0)
-               return false;
-
-       yypop_buffer_state();
-       yyin = current_srcfile->f;
-
-       return true;
-}
-
-static void lexical_error(const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       srcpos_verror(&yylloc, "Lexical error", fmt, ap);
-       va_end(ap);
-
-       treesource_error = true;
-}
-
diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped
deleted file mode 100644 (file)
index aea514f..0000000
+++ /dev/null
@@ -1,2321 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
-
-/* Bison implementation for Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
-   simplifying the original so-called "semantic" parser.  */
-
-/* All symbols defined below should begin with yy or YY, to avoid
-   infringing on user name space.  This should be done even for local
-   variables, as they might otherwise be expanded by user macros.
-   There are some unavoidable exceptions within include files to
-   define necessary library symbols; they are noted "INFRINGES ON
-   USER NAME SPACE" below.  */
-
-/* Identify Bison output.  */
-#define YYBISON 1
-
-/* Bison version.  */
-#define YYBISON_VERSION "3.0.4"
-
-/* Skeleton name.  */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers.  */
-#define YYPURE 0
-
-/* Push parsers.  */
-#define YYPUSH 0
-
-/* Pull parsers.  */
-#define YYPULL 1
-
-
-
-
-/* Copy the first part of user declarations.  */
-#line 20 "dtc-parser.y" /* yacc.c:339  */
-
-#include <stdio.h>
-#include <inttypes.h>
-
-#include "dtc.h"
-#include "srcpos.h"
-
-extern int yylex(void);
-extern void yyerror(char const *s);
-#define ERROR(loc, ...) \
-       do { \
-               srcpos_error((loc), "Error", __VA_ARGS__); \
-               treesource_error = true; \
-       } while (0)
-
-extern struct dt_info *parser_output;
-extern bool treesource_error;
-
-#line 85 "dtc-parser.tab.c" /* yacc.c:339  */
-
-# ifndef YY_NULLPTR
-#  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
-#  else
-#   define YY_NULLPTR 0
-#  endif
-# endif
-
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* In a future release of Bison, this section will be replaced
-   by #include "dtc-parser.tab.h".  */
-#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
-# define YY_YY_DTC_PARSER_TAB_H_INCLUDED
-/* Debug traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int yydebug;
-#endif
-
-/* Token type.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-  enum yytokentype
-  {
-    DT_V1 = 258,
-    DT_PLUGIN = 259,
-    DT_MEMRESERVE = 260,
-    DT_LSHIFT = 261,
-    DT_RSHIFT = 262,
-    DT_LE = 263,
-    DT_GE = 264,
-    DT_EQ = 265,
-    DT_NE = 266,
-    DT_AND = 267,
-    DT_OR = 268,
-    DT_BITS = 269,
-    DT_DEL_PROP = 270,
-    DT_DEL_NODE = 271,
-    DT_PROPNODENAME = 272,
-    DT_LITERAL = 273,
-    DT_CHAR_LITERAL = 274,
-    DT_BYTE = 275,
-    DT_STRING = 276,
-    DT_LABEL = 277,
-    DT_REF = 278,
-    DT_INCBIN = 279
-  };
-#endif
-
-/* Value type.  */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
-union YYSTYPE
-{
-#line 39 "dtc-parser.y" /* yacc.c:355  */
-
-       char *propnodename;
-       char *labelref;
-       uint8_t byte;
-       struct data data;
-
-       struct {
-               struct data     data;
-               int             bits;
-       } array;
-
-       struct property *prop;
-       struct property *proplist;
-       struct node *node;
-       struct node *nodelist;
-       struct reserve_info *re;
-       uint64_t integer;
-       unsigned int flags;
-
-#line 170 "dtc-parser.tab.c" /* yacc.c:355  */
-};
-
-typedef union YYSTYPE YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-/* Location type.  */
-#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE YYLTYPE;
-struct YYLTYPE
-{
-  int first_line;
-  int first_column;
-  int last_line;
-  int last_column;
-};
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-
-extern YYSTYPE yylval;
-extern YYLTYPE yylloc;
-int yyparse (void);
-
-#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED  */
-
-/* Copy the second part of user declarations.  */
-
-#line 201 "dtc-parser.tab.c" /* yacc.c:358  */
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#else
-typedef signed char yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-#  define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-#  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYSIZE_T size_t
-# else
-#  define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-#  if ENABLE_NLS
-#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-#  endif
-# endif
-# ifndef YY_
-#  define YY_(Msgid) Msgid
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__                                               \
-      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
-     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-#  define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E.  */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
-#else
-# define YYUSE(E) /* empty */
-#endif
-
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
-    _Pragma ("GCC diagnostic push") \
-    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
-    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
-    _Pragma ("GCC diagnostic pop")
-#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols.  */
-
-# ifdef YYSTACK_USE_ALLOCA
-#  if YYSTACK_USE_ALLOCA
-#   ifdef __GNUC__
-#    define YYSTACK_ALLOC __builtin_alloca
-#   elif defined __BUILTIN_VA_ARG_INCR
-#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-#   elif defined _AIX
-#    define YYSTACK_ALLOC __alloca
-#   elif defined _MSC_VER
-#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-#    define alloca _alloca
-#   else
-#    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
-#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
-#     ifndef EXIT_SUCCESS
-#      define EXIT_SUCCESS 0
-#     endif
-#    endif
-#   endif
-#  endif
-# endif
-
-# ifdef YYSTACK_ALLOC
-   /* Pacify GCC's 'empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-    /* The OS might guarantee only one guard page at the bottom of the stack,
-       and a page size can be as small as 4096 bytes.  So we cannot safely
-       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
-       to allow for a few compiler-allocated temporary stack slots.  */
-#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-#  endif
-# else
-#  define YYSTACK_ALLOC YYMALLOC
-#  define YYSTACK_FREE YYFREE
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-#  endif
-#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
-       && ! ((defined YYMALLOC || defined malloc) \
-             && (defined YYFREE || defined free)))
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef EXIT_SUCCESS
-#    define EXIT_SUCCESS 0
-#   endif
-#  endif
-#  ifndef YYMALLOC
-#   define YYMALLOC malloc
-#   if ! defined malloc && ! defined EXIT_SUCCESS
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-#  ifndef YYFREE
-#   define YYFREE free
-#   if ! defined free && ! defined EXIT_SUCCESS
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
-     && (! defined __cplusplus \
-         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
-             && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member.  */
-union yyalloc
-{
-  yytype_int16 yyss_alloc;
-  YYSTYPE yyvs_alloc;
-  YYLTYPE yyls_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
-   N elements.  */
-# define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
-      + 2 * YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one.  The
-   local variables YYSIZE and YYSTACKSIZE give the old and new number of
-   elements in the stack, and YYPTR gives the new location of the
-   stack.  Advance YYPTR to a properly aligned location for the next
-   stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
-    do                                                                  \
-      {                                                                 \
-        YYSIZE_T yynewbytes;                                            \
-        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
-        Stack = &yyptr->Stack_alloc;                                    \
-        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-        yyptr += yynewbytes / sizeof (*yyptr);                          \
-      }                                                                 \
-    while (0)
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(Dst, Src, Count) \
-      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
-#  else
-#   define YYCOPY(Dst, Src, Count)              \
-      do                                        \
-        {                                       \
-          YYSIZE_T yyi;                         \
-          for (yyi = 0; yyi < (Count); yyi++)   \
-            (Dst)[yyi] = (Src)[yyi];            \
-        }                                       \
-      while (0)
-#  endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  6
-/* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   138
-
-/* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  48
-/* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  30
-/* YYNRULES -- Number of rules.  */
-#define YYNRULES  85
-/* YYNSTATES -- Number of states.  */
-#define YYNSTATES  149
-
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
-   by yylex, with out-of-bounds checking.  */
-#define YYUNDEFTOK  2
-#define YYMAXUTOK   279
-
-#define YYTRANSLATE(YYX)                                                \
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex, without out-of-bounds checking.  */
-static const yytype_uint8 yytranslate[] =
-{
-       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,    47,     2,     2,     2,    45,    41,     2,
-      33,    35,    44,    42,    34,    43,     2,    26,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,    38,    25,
-      36,    29,    30,    37,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,    31,     2,    32,    40,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,    27,    39,    28,    46,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24
-};
-
-#if YYDEBUG
-  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
-static const yytype_uint16 yyrline[] =
-{
-       0,   109,   109,   117,   121,   128,   129,   139,   142,   149,
-     153,   161,   165,   170,   181,   200,   213,   220,   228,   231,
-     238,   242,   246,   250,   258,   262,   266,   270,   274,   290,
-     300,   308,   311,   315,   322,   338,   343,   362,   376,   383,
-     384,   385,   392,   396,   397,   401,   402,   406,   407,   411,
-     412,   416,   417,   421,   422,   426,   427,   428,   432,   433,
-     434,   435,   436,   440,   441,   442,   446,   447,   448,   452,
-     453,   462,   471,   475,   476,   477,   478,   483,   486,   490,
-     498,   501,   505,   513,   517,   521
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || 0
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
-   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
-static const char *const yytname[] =
-{
-  "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE",
-  "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND",
-  "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME",
-  "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL",
-  "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
-  "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
-  "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
-  "header", "headers", "memreserves", "memreserve", "devicetree",
-  "nodedef", "proplist", "propdef", "propdata", "propdataprefix",
-  "arrayprefix", "integer_prim", "integer_expr", "integer_trinary",
-  "integer_or", "integer_and", "integer_bitor", "integer_bitxor",
-  "integer_bitand", "integer_eq", "integer_rela", "integer_shift",
-  "integer_add", "integer_mul", "integer_unary", "bytestring", "subnodes",
-  "subnode", YY_NULLPTR
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
-   (internal) symbol number NUM (which must be that of a token).  */
-static const yytype_uint16 yytoknum[] =
-{
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,   276,   277,   278,   279,    59,    47,   123,   125,    61,
-      62,    91,    93,    40,    44,    41,    60,    63,    58,   124,
-      94,    38,    43,    45,    42,    37,   126,    33
-};
-# endif
-
-#define YYPACT_NINF -44
-
-#define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-44)))
-
-#define YYTABLE_NINF -1
-
-#define yytable_value_is_error(Yytable_value) \
-  0
-
-  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-     STATE-NUM.  */
-static const yytype_int8 yypact[] =
-{
-      14,    27,    61,    14,     8,    18,   -44,   -44,    37,     8,
-      40,     8,    64,   -44,   -44,   -12,    37,   -44,    50,    52,
-     -44,   -44,   -12,   -12,   -12,   -44,    51,   -44,    -4,    78,
-      53,    54,    55,    17,     2,    30,    38,    -3,   -44,    66,
-     -44,   -44,    70,    72,    50,    50,   -44,   -44,   -44,   -44,
-     -12,   -12,   -12,   -12,   -12,   -12,   -12,   -12,   -12,   -12,
-     -12,   -12,   -12,   -12,   -12,   -12,   -12,   -12,   -12,   -44,
-       3,    73,    50,   -44,   -44,    78,    59,    53,    54,    55,
-      17,     2,     2,    30,    30,    30,    30,    38,    38,    -3,
-      -3,   -44,   -44,   -44,    82,    83,    44,     3,   -44,    74,
-       3,   -44,   -44,   -12,    76,    79,   -44,   -44,   -44,   -44,
-     -44,    80,   -44,   -44,   -44,   -44,   -44,   -10,    36,   -44,
-     -44,   -44,   -44,    85,   -44,   -44,   -44,    75,   -44,   -44,
-      21,    71,    88,    -6,   -44,   -44,   -44,   -44,   -44,    11,
-     -44,   -44,   -44,    37,   -44,    77,    37,    81,   -44
-};
-
-  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-     Performed when YYTABLE does not specify something else to do.  Zero
-     means the default is an error.  */
-static const yytype_uint8 yydefact[] =
-{
-       0,     0,     0,     5,     7,     3,     1,     6,     0,     0,
-      16,     7,     0,    39,    40,     0,     0,    10,     0,     2,
-       8,     4,     0,     0,     0,    73,     0,    42,    43,    45,
-      47,    49,    51,    53,    55,    58,    65,    68,    72,     0,
-      18,    11,     0,     0,     0,     0,    74,    75,    76,    41,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     9,
-      80,     0,     0,    14,    12,    46,     0,    48,    50,    52,
-      54,    56,    57,    61,    62,    60,    59,    63,    64,    66,
-      67,    70,    69,    71,     0,     0,     0,     0,    19,     0,
-      80,    15,    13,     0,     0,     0,    21,    31,    83,    23,
-      85,     0,    82,    81,    44,    22,    84,     0,     0,    17,
-      30,    20,    32,     0,    24,    33,    27,     0,    77,    35,
-       0,     0,     0,     0,    38,    37,    25,    36,    34,     0,
-      78,    79,    26,     0,    29,     0,     0,     0,    28
-};
-
-  /* YYPGOTO[NTERM-NUM].  */
-static const yytype_int8 yypgoto[] =
-{
-     -44,   -44,   -44,   103,    99,   104,   -44,   -43,   -44,   -21,
-     -44,   -44,   -44,    -8,    63,     9,   -44,    65,    67,    68,
-      69,    62,    26,     4,    22,    23,   -19,   -44,    20,    28
-};
-
-  /* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int16 yydefgoto[] =
-{
-      -1,     2,     3,     4,    10,    11,    19,    41,    70,    98,
-     117,   118,   130,    25,    26,    27,    28,    29,    30,    31,
-      32,    33,    34,    35,    36,    37,    38,   133,    99,   100
-};
-
-  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-     positive, shift that token.  If negative, reduce the rule whose
-     number is the opposite.  If YYTABLE_NINF, syntax error.  */
-static const yytype_uint8 yytable[] =
-{
-      16,    73,    74,    46,    47,    48,    13,    14,    39,    50,
-      58,    59,   120,     8,   140,   121,   141,     1,    94,    95,
-      96,    15,    12,    66,   122,    97,   142,    56,    57,   102,
-       9,    22,    60,    51,    23,    24,    62,    63,    61,    13,
-      14,    67,    68,   134,   135,   143,   144,    91,    92,    93,
-     123,   136,     5,   108,    15,    13,    14,   124,   125,   126,
-     127,     6,    83,    84,    85,    86,    18,   128,    42,   106,
-      15,    40,   129,   107,    43,    44,   109,    40,    45,   112,
-      64,    65,    81,    82,    87,    88,    49,    89,    90,    21,
-      52,    69,    53,    71,    54,    72,    55,   103,   101,   104,
-     105,   115,   111,   131,   116,   119,     7,   138,   132,   139,
-      20,   146,   114,    17,    76,    75,   148,    80,     0,    77,
-     113,    78,   137,    79,     0,   110,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,   145,     0,     0,   147
-};
-
-static const yytype_int16 yycheck[] =
-{
-       8,    44,    45,    22,    23,    24,    18,    19,    16,    13,
-       8,     9,    22,     5,    20,    25,    22,     3,    15,    16,
-      17,    33,     4,    26,    34,    22,    32,    10,    11,    72,
-      22,    43,    30,    37,    46,    47,     6,     7,    36,    18,
-      19,    44,    45,    22,    23,    34,    35,    66,    67,    68,
-      14,    30,    25,    96,    33,    18,    19,    21,    22,    23,
-      24,     0,    58,    59,    60,    61,    26,    31,    16,    25,
-      33,    27,    36,    29,    22,    23,    97,    27,    26,   100,
-      42,    43,    56,    57,    62,    63,    35,    64,    65,    25,
-      12,    25,    39,    23,    40,    23,    41,    38,    25,    17,
-      17,    25,    28,    18,    25,    25,     3,    36,    33,    21,
-      11,    34,   103,     9,    51,    50,    35,    55,    -1,    52,
-     100,    53,   130,    54,    -1,    97,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   143,    -1,    -1,   146
-};
-
-  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.  */
-static const yytype_uint8 yystos[] =
-{
-       0,     3,    49,    50,    51,    25,     0,    51,     5,    22,
-      52,    53,     4,    18,    19,    33,    61,    53,    26,    54,
-      52,    25,    43,    46,    47,    61,    62,    63,    64,    65,
-      66,    67,    68,    69,    70,    71,    72,    73,    74,    61,
-      27,    55,    16,    22,    23,    26,    74,    74,    74,    35,
-      13,    37,    12,    39,    40,    41,    10,    11,     8,     9,
-      30,    36,     6,     7,    42,    43,    26,    44,    45,    25,
-      56,    23,    23,    55,    55,    65,    62,    66,    67,    68,
-      69,    70,    70,    71,    71,    71,    71,    72,    72,    73,
-      73,    74,    74,    74,    15,    16,    17,    22,    57,    76,
-      77,    25,    55,    38,    17,    17,    25,    29,    55,    57,
-      77,    28,    57,    76,    63,    25,    25,    58,    59,    25,
-      22,    25,    34,    14,    21,    22,    23,    24,    31,    36,
-      60,    18,    33,    75,    22,    23,    30,    61,    36,    21,
-      20,    22,    32,    34,    35,    61,    34,    61,    35
-};
-
-  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,    48,    49,    50,    50,    51,    51,    52,    52,    53,
-      53,    54,    54,    54,    54,    54,    54,    55,    56,    56,
-      57,    57,    57,    57,    58,    58,    58,    58,    58,    58,
-      58,    59,    59,    59,    60,    60,    60,    60,    60,    61,
-      61,    61,    62,    63,    63,    64,    64,    65,    65,    66,
-      66,    67,    67,    68,    68,    69,    69,    69,    70,    70,
-      70,    70,    70,    71,    71,    71,    72,    72,    72,    73,
-      73,    73,    73,    74,    74,    74,    74,    75,    75,    75,
-      76,    76,    76,    77,    77,    77
-};
-
-  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     3,     2,     4,     1,     2,     0,     2,     4,
-       2,     2,     3,     4,     3,     4,     0,     5,     0,     2,
-       4,     2,     3,     2,     2,     3,     4,     2,     9,     5,
-       2,     0,     2,     2,     3,     1,     2,     2,     2,     1,
-       1,     3,     1,     1,     5,     1,     3,     1,     3,     1,
-       3,     1,     3,     1,     3,     1,     3,     3,     1,     3,
-       3,     3,     3,     3,     3,     1,     3,     3,     1,     3,
-       3,     3,     1,     1,     2,     2,     2,     0,     2,     2,
-       0,     2,     2,     2,     3,     2
-};
-
-
-#define yyerrok         (yyerrstatus = 0)
-#define yyclearin       (yychar = YYEMPTY)
-#define YYEMPTY         (-2)
-#define YYEOF           0
-
-#define YYACCEPT        goto yyacceptlab
-#define YYABORT         goto yyabortlab
-#define YYERROR         goto yyerrorlab
-
-
-#define YYRECOVERING()  (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value)                                  \
-do                                                              \
-  if (yychar == YYEMPTY)                                        \
-    {                                                           \
-      yychar = (Token);                                         \
-      yylval = (Value);                                         \
-      YYPOPSTACK (yylen);                                       \
-      yystate = *yyssp;                                         \
-      goto yybackup;                                            \
-    }                                                           \
-  else                                                          \
-    {                                                           \
-      yyerror (YY_("syntax error: cannot back up")); \
-      YYERROR;                                                  \
-    }                                                           \
-while (0)
-
-/* Error token number */
-#define YYTERROR        1
-#define YYERRCODE       256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
-   If N is 0, then set CURRENT to the empty location which ends
-   the previous symbol: RHS[0] (always defined).  */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
-    do                                                                  \
-      if (N)                                                            \
-        {                                                               \
-          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
-          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
-          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
-          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
-        }                                                               \
-      else                                                              \
-        {                                                               \
-          (Current).first_line   = (Current).last_line   =              \
-            YYRHSLOC (Rhs, 0).last_line;                                \
-          (Current).first_column = (Current).last_column =              \
-            YYRHSLOC (Rhs, 0).last_column;                              \
-        }                                                               \
-    while (0)
-#endif
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-
-
-/* Enable debugging if requested.  */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args)                        \
-do {                                            \
-  if (yydebug)                                  \
-    YYFPRINTF Args;                             \
-} while (0)
-
-
-/* YY_LOCATION_PRINT -- Print the location on the stream.
-   This macro was not mandated originally: define only if we know
-   we won't break user code: when these are the locations we know.  */
-
-#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-
-/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
-
-YY_ATTRIBUTE_UNUSED
-static unsigned
-yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
-{
-  unsigned res = 0;
-  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
-  if (0 <= yylocp->first_line)
-    {
-      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
-      if (0 <= yylocp->first_column)
-        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
-    }
-  if (0 <= yylocp->last_line)
-    {
-      if (yylocp->first_line < yylocp->last_line)
-        {
-          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
-          if (0 <= end_col)
-            res += YYFPRINTF (yyo, ".%d", end_col);
-        }
-      else if (0 <= end_col && yylocp->first_column < end_col)
-        res += YYFPRINTF (yyo, "-%d", end_col);
-    }
-  return res;
- }
-
-#  define YY_LOCATION_PRINT(File, Loc)          \
-  yy_location_print_ (File, &(Loc))
-
-# else
-#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
-
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
-do {                                                                      \
-  if (yydebug)                                                            \
-    {                                                                     \
-      YYFPRINTF (stderr, "%s ", Title);                                   \
-      yy_symbol_print (stderr,                                            \
-                  Type, Value, Location); \
-      YYFPRINTF (stderr, "\n");                                           \
-    }                                                                     \
-} while (0)
-
-
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT.  |
-`----------------------------------------*/
-
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
-{
-  FILE *yyo = yyoutput;
-  YYUSE (yyo);
-  YYUSE (yylocationp);
-  if (!yyvaluep)
-    return;
-# ifdef YYPRINT
-  if (yytype < YYNTOKENS)
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
-  YYUSE (yytype);
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
-
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
-{
-  YYFPRINTF (yyoutput, "%s %s (",
-             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
-
-  YY_LOCATION_PRINT (yyoutput, *yylocationp);
-  YYFPRINTF (yyoutput, ": ");
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
-  YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included).                                                   |
-`------------------------------------------------------------------*/
-
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-{
-  YYFPRINTF (stderr, "Stack now");
-  for (; yybottom <= yytop; yybottom++)
-    {
-      int yybot = *yybottom;
-      YYFPRINTF (stderr, " %d", yybot);
-    }
-  YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top)                            \
-do {                                                            \
-  if (yydebug)                                                  \
-    yy_stack_print ((Bottom), (Top));                           \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced.  |
-`------------------------------------------------*/
-
-static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
-{
-  unsigned long int yylno = yyrline[yyrule];
-  int yynrhs = yyr2[yyrule];
-  int yyi;
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
-             yyrule - 1, yylno);
-  /* The symbols being reduced.  */
-  for (yyi = 0; yyi < yynrhs; yyi++)
-    {
-      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr,
-                       yystos[yyssp[yyi + 1 - yynrhs]],
-                       &(yyvsp[(yyi + 1) - (yynrhs)])
-                       , &(yylsp[(yyi + 1) - (yynrhs)])                       );
-      YYFPRINTF (stderr, "\n");
-    }
-}
-
-# define YY_REDUCE_PRINT(Rule)          \
-do {                                    \
-  if (yydebug)                          \
-    yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
-} while (0)
-
-/* Nonzero means print parse trace.  It is left uninitialized so that
-   multiple parsers can coexist.  */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
-   if the built-in stack extension method is used).
-
-   Do not make this value too large; the results are undefined if
-   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
-   evaluated with infinite-precision integer arithmetic.  */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-#  if defined __GLIBC__ && defined _STRING_H
-#   define yystrlen strlen
-#  else
-/* Return the length of YYSTR.  */
-static YYSIZE_T
-yystrlen (const char *yystr)
-{
-  YYSIZE_T yylen;
-  for (yylen = 0; yystr[yylen]; yylen++)
-    continue;
-  return yylen;
-}
-#  endif
-# endif
-
-# ifndef yystpcpy
-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-#   define yystpcpy stpcpy
-#  else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-   YYDEST.  */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
-  char *yyd = yydest;
-  const char *yys = yysrc;
-
-  while ((*yyd++ = *yys++) != '\0')
-    continue;
-
-  return yyd - 1;
-}
-#  endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
-   quotes and backslashes, so that it's suitable for yyerror.  The
-   heuristic is that double-quoting is unnecessary unless the string
-   contains an apostrophe, a comma, or backslash (other than
-   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
-   null, do not copy; instead, return the length of what the result
-   would have been.  */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
-  if (*yystr == '"')
-    {
-      YYSIZE_T yyn = 0;
-      char const *yyp = yystr;
-
-      for (;;)
-        switch (*++yyp)
-          {
-          case '\'':
-          case ',':
-            goto do_not_strip_quotes;
-
-          case '\\':
-            if (*++yyp != '\\')
-              goto do_not_strip_quotes;
-            /* Fall through.  */
-          default:
-            if (yyres)
-              yyres[yyn] = *yyp;
-            yyn++;
-            break;
-
-          case '"':
-            if (yyres)
-              yyres[yyn] = '\0';
-            return yyn;
-          }
-    do_not_strip_quotes: ;
-    }
-
-  if (! yyres)
-    return yystrlen (yystr);
-
-  return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
-   about the unexpected token YYTOKEN for the state stack whose top is
-   YYSSP.
-
-   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
-   not large enough to hold the message.  In that case, also set
-   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
-   required number of bytes is too large to store.  */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
-                yytype_int16 *yyssp, int yytoken)
-{
-  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
-  YYSIZE_T yysize = yysize0;
-  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-  /* Internationalized format string. */
-  const char *yyformat = YY_NULLPTR;
-  /* Arguments of yyformat. */
-  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-  /* Number of reported tokens (one for the "unexpected", one per
-     "expected"). */
-  int yycount = 0;
-
-  /* There are many possibilities here to consider:
-     - If this state is a consistent state with a default action, then
-       the only way this function was invoked is if the default action
-       is an error action.  In that case, don't check for expected
-       tokens because there are none.
-     - The only way there can be no lookahead present (in yychar) is if
-       this state is a consistent state with a default action.  Thus,
-       detecting the absence of a lookahead is sufficient to determine
-       that there is no unexpected or expected token to report.  In that
-       case, just report a simple "syntax error".
-     - Don't assume there isn't a lookahead just because this state is a
-       consistent state with a default action.  There might have been a
-       previous inconsistent state, consistent state with a non-default
-       action, or user semantic action that manipulated yychar.
-     - Of course, the expected token list depends on states to have
-       correct lookahead information, and it depends on the parser not
-       to perform extra reductions after fetching a lookahead from the
-       scanner and before detecting a syntax error.  Thus, state merging
-       (from LALR or IELR) and default reductions corrupt the expected
-       token list.  However, the list is correct for canonical LR with
-       one exception: it will still contain any token that will not be
-       accepted due to an error action in a later state.
-  */
-  if (yytoken != YYEMPTY)
-    {
-      int yyn = yypact[*yyssp];
-      yyarg[yycount++] = yytname[yytoken];
-      if (!yypact_value_is_default (yyn))
-        {
-          /* Start YYX at -YYN if negative to avoid negative indexes in
-             YYCHECK.  In other words, skip the first -YYN actions for
-             this state because they are default actions.  */
-          int yyxbegin = yyn < 0 ? -yyn : 0;
-          /* Stay within bounds of both yycheck and yytname.  */
-          int yychecklim = YYLAST - yyn + 1;
-          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-          int yyx;
-
-          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
-                && !yytable_value_is_error (yytable[yyx + yyn]))
-              {
-                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-                  {
-                    yycount = 1;
-                    yysize = yysize0;
-                    break;
-                  }
-                yyarg[yycount++] = yytname[yyx];
-                {
-                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
-                  if (! (yysize <= yysize1
-                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-                    return 2;
-                  yysize = yysize1;
-                }
-              }
-        }
-    }
-
-  switch (yycount)
-    {
-# define YYCASE_(N, S)                      \
-      case N:                               \
-        yyformat = S;                       \
-      break
-      YYCASE_(0, YY_("syntax error"));
-      YYCASE_(1, YY_("syntax error, unexpected %s"));
-      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
-      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
-      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
-      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
-    }
-
-  {
-    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
-    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-      return 2;
-    yysize = yysize1;
-  }
-
-  if (*yymsg_alloc < yysize)
-    {
-      *yymsg_alloc = 2 * yysize;
-      if (! (yysize <= *yymsg_alloc
-             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
-        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
-      return 1;
-    }
-
-  /* Avoid sprintf, as that infringes on the user's name space.
-     Don't have undefined behavior even if the translation
-     produced a string with the wrong number of "%s"s.  */
-  {
-    char *yyp = *yymsg;
-    int yyi = 0;
-    while ((*yyp = *yyformat) != '\0')
-      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
-        {
-          yyp += yytnamerr (yyp, yyarg[yyi++]);
-          yyformat += 2;
-        }
-      else
-        {
-          yyp++;
-          yyformat++;
-        }
-  }
-  return 0;
-}
-#endif /* YYERROR_VERBOSE */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol.  |
-`-----------------------------------------------*/
-
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
-{
-  YYUSE (yyvaluep);
-  YYUSE (yylocationp);
-  if (!yymsg)
-    yymsg = "Deleting";
-  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  YYUSE (yytype);
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
-}
-
-
-
-
-/* The lookahead symbol.  */
-int yychar;
-
-/* The semantic value of the lookahead symbol.  */
-YYSTYPE yylval;
-/* Location data for the lookahead symbol.  */
-YYLTYPE yylloc
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-  = { 1, 1, 1, 1 }
-# endif
-;
-/* Number of syntax errors so far.  */
-int yynerrs;
-
-
-/*----------.
-| yyparse.  |
-`----------*/
-
-int
-yyparse (void)
-{
-    int yystate;
-    /* Number of tokens to shift before error messages enabled.  */
-    int yyerrstatus;
-
-    /* The stacks and their tools:
-       'yyss': related to states.
-       'yyvs': related to semantic values.
-       'yyls': related to locations.
-
-       Refer to the stacks through separate pointers, to allow yyoverflow
-       to reallocate them elsewhere.  */
-
-    /* The state stack.  */
-    yytype_int16 yyssa[YYINITDEPTH];
-    yytype_int16 *yyss;
-    yytype_int16 *yyssp;
-
-    /* The semantic value stack.  */
-    YYSTYPE yyvsa[YYINITDEPTH];
-    YYSTYPE *yyvs;
-    YYSTYPE *yyvsp;
-
-    /* The location stack.  */
-    YYLTYPE yylsa[YYINITDEPTH];
-    YYLTYPE *yyls;
-    YYLTYPE *yylsp;
-
-    /* The locations where the error started and ended.  */
-    YYLTYPE yyerror_range[3];
-
-    YYSIZE_T yystacksize;
-
-  int yyn;
-  int yyresult;
-  /* Lookahead token as an internal (translated) token number.  */
-  int yytoken = 0;
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
-  YYLTYPE yyloc;
-
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
-
-  /* The number of symbols on the RHS of the reduced rule.
-     Keep to zero when no symbol should be popped.  */
-  int yylen = 0;
-
-  yyssp = yyss = yyssa;
-  yyvsp = yyvs = yyvsa;
-  yylsp = yyls = yylsa;
-  yystacksize = YYINITDEPTH;
-
-  YYDPRINTF ((stderr, "Starting parse\n"));
-
-  yystate = 0;
-  yyerrstatus = 0;
-  yynerrs = 0;
-  yychar = YYEMPTY; /* Cause a token to be read.  */
-  yylsp[0] = yylloc;
-  goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
-`------------------------------------------------------------*/
- yynewstate:
-  /* In all cases, when you get here, the value and location stacks
-     have just been pushed.  So pushing a state here evens the stacks.  */
-  yyssp++;
-
- yysetstate:
-  *yyssp = yystate;
-
-  if (yyss + yystacksize - 1 <= yyssp)
-    {
-      /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
-      {
-        /* Give user a chance to reallocate the stack.  Use copies of
-           these so that the &'s don't force the real ones into
-           memory.  */
-        YYSTYPE *yyvs1 = yyvs;
-        yytype_int16 *yyss1 = yyss;
-        YYLTYPE *yyls1 = yyls;
-
-        /* Each stack pointer address is followed by the size of the
-           data in use in that stack, in bytes.  This used to be a
-           conditional around just the two extra args, but that might
-           be undefined if yyoverflow is a macro.  */
-        yyoverflow (YY_("memory exhausted"),
-                    &yyss1, yysize * sizeof (*yyssp),
-                    &yyvs1, yysize * sizeof (*yyvsp),
-                    &yyls1, yysize * sizeof (*yylsp),
-                    &yystacksize);
-
-        yyls = yyls1;
-        yyss = yyss1;
-        yyvs = yyvs1;
-      }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyexhaustedlab;
-# else
-      /* Extend the stack our own way.  */
-      if (YYMAXDEPTH <= yystacksize)
-        goto yyexhaustedlab;
-      yystacksize *= 2;
-      if (YYMAXDEPTH < yystacksize)
-        yystacksize = YYMAXDEPTH;
-
-      {
-        yytype_int16 *yyss1 = yyss;
-        union yyalloc *yyptr =
-          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-        if (! yyptr)
-          goto yyexhaustedlab;
-        YYSTACK_RELOCATE (yyss_alloc, yyss);
-        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-        YYSTACK_RELOCATE (yyls_alloc, yyls);
-#  undef YYSTACK_RELOCATE
-        if (yyss1 != yyssa)
-          YYSTACK_FREE (yyss1);
-      }
-# endif
-#endif /* no yyoverflow */
-
-      yyssp = yyss + yysize - 1;
-      yyvsp = yyvs + yysize - 1;
-      yylsp = yyls + yysize - 1;
-
-      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                  (unsigned long int) yystacksize));
-
-      if (yyss + yystacksize - 1 <= yyssp)
-        YYABORT;
-    }
-
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
-  if (yystate == YYFINAL)
-    YYACCEPT;
-
-  goto yybackup;
-
-/*-----------.
-| yybackup.  |
-`-----------*/
-yybackup:
-
-  /* Do appropriate processing given the current state.  Read a
-     lookahead token if we need one and don't already have one.  */
-
-  /* First try to decide what to do without reference to lookahead token.  */
-  yyn = yypact[yystate];
-  if (yypact_value_is_default (yyn))
-    goto yydefault;
-
-  /* Not known => get a lookahead token if don't already have one.  */
-
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
-  if (yychar == YYEMPTY)
-    {
-      YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = yylex ();
-    }
-
-  if (yychar <= YYEOF)
-    {
-      yychar = yytoken = YYEOF;
-      YYDPRINTF ((stderr, "Now at end of input.\n"));
-    }
-  else
-    {
-      yytoken = YYTRANSLATE (yychar);
-      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
-    }
-
-  /* If the proper action on seeing token YYTOKEN is to reduce or to
-     detect an error, take that action.  */
-  yyn += yytoken;
-  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
-    goto yydefault;
-  yyn = yytable[yyn];
-  if (yyn <= 0)
-    {
-      if (yytable_value_is_error (yyn))
-        goto yyerrlab;
-      yyn = -yyn;
-      goto yyreduce;
-    }
-
-  /* Count tokens shifted since error; after three, turn off error
-     status.  */
-  if (yyerrstatus)
-    yyerrstatus--;
-
-  /* Shift the lookahead token.  */
-  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
-  /* Discard the shifted token.  */
-  yychar = YYEMPTY;
-
-  yystate = yyn;
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
-  *++yylsp = yylloc;
-  goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state.  |
-`-----------------------------------------------------------*/
-yydefault:
-  yyn = yydefact[yystate];
-  if (yyn == 0)
-    goto yyerrlab;
-  goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction.  |
-`-----------------------------*/
-yyreduce:
-  /* yyn is the number of a rule to reduce with.  */
-  yylen = yyr2[yyn];
-
-  /* If YYLEN is nonzero, implement the default value of the action:
-     '$$ = $1'.
-
-     Otherwise, the following line sets YYVAL to garbage.
-     This behavior is undocumented and Bison
-     users should not rely upon it.  Assigning to YYVAL
-     unconditionally makes the parser a bit smaller, and it avoids a
-     GCC warning that YYVAL may be used uninitialized.  */
-  yyval = yyvsp[1-yylen];
-
-  /* Default location.  */
-  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
-  YY_REDUCE_PRINT (yyn);
-  switch (yyn)
-    {
-        case 2:
-#line 110 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       parser_output = build_dt_info((yyvsp[-2].flags), (yyvsp[-1].re), (yyvsp[0].node),
-                                                     guess_boot_cpuid((yyvsp[0].node)));
-               }
-#line 1478 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 3:
-#line 118 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.flags) = DTSF_V1;
-               }
-#line 1486 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 4:
-#line 122 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.flags) = DTSF_V1 | DTSF_PLUGIN;
-               }
-#line 1494 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 6:
-#line 130 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       if ((yyvsp[0].flags) != (yyvsp[-1].flags))
-                               ERROR(&(yylsp[0]), "Header flags don't match earlier ones");
-                       (yyval.flags) = (yyvsp[-1].flags);
-               }
-#line 1504 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 7:
-#line 139 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.re) = NULL;
-               }
-#line 1512 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 8:
-#line 143 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re));
-               }
-#line 1520 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 9:
-#line 150 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer));
-               }
-#line 1528 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 10:
-#line 154 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref));
-                       (yyval.re) = (yyvsp[0].re);
-               }
-#line 1537 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 11:
-#line 162 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.node) = name_node((yyvsp[0].node), "");
-               }
-#line 1545 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 12:
-#line 166 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node));
-               }
-#line 1553 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 13:
-#line 171 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
-
-                       if (target) {
-                               add_label(&target->labels, (yyvsp[-2].labelref));
-                               merge_nodes(target, (yyvsp[0].node));
-                       } else
-                               ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
-                       (yyval.node) = (yyvsp[-3].node);
-               }
-#line 1568 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 14:
-#line 182 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref));
-
-                       if (target) {
-                               merge_nodes(target, (yyvsp[0].node));
-                       } else {
-                               /*
-                                * We rely on the rule being always:
-                                *   versioninfo plugindecl memreserves devicetree
-                                * so $-1 is what we want (plugindecl)
-                                */
-                               if ((yyvsp[(-1) - (3)].flags) & DTSF_PLUGIN)
-                                       add_orphan_node((yyvsp[-2].node), (yyvsp[0].node), (yyvsp[-1].labelref));
-                               else
-                                       ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
-                       }
-                       (yyval.node) = (yyvsp[-2].node);
-               }
-#line 1591 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 15:
-#line 201 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
-
-                       if (target)
-                               delete_node(target);
-                       else
-                               ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
-
-
-                       (yyval.node) = (yyvsp[-3].node);
-               }
-#line 1607 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 16:
-#line 213 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       /* build empty node */
-                       (yyval.node) = name_node(build_node(NULL, NULL), "");
-               }
-#line 1616 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 17:
-#line 221 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist));
-               }
-#line 1624 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 18:
-#line 228 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.proplist) = NULL;
-               }
-#line 1632 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 19:
-#line 232 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist));
-               }
-#line 1640 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 20:
-#line 239 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data));
-               }
-#line 1648 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 21:
-#line 243 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data);
-               }
-#line 1656 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 22:
-#line 247 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.prop) = build_property_delete((yyvsp[-1].propnodename));
-               }
-#line 1664 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 23:
-#line 251 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref));
-                       (yyval.prop) = (yyvsp[0].prop);
-               }
-#line 1673 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 24:
-#line 259 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data));
-               }
-#line 1681 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 25:
-#line 263 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data);
-               }
-#line 1689 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 26:
-#line 267 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data));
-               }
-#line 1697 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 27:
-#line 271 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref));
-               }
-#line 1705 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 28:
-#line 275 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL);
-                       struct data d;
-
-                       if ((yyvsp[-3].integer) != 0)
-                               if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0)
-                                       die("Couldn't seek to offset %llu in \"%s\": %s",
-                                           (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val,
-                                           strerror(errno));
-
-                       d = data_copy_file(f, (yyvsp[-1].integer));
-
-                       (yyval.data) = data_merge((yyvsp[-8].data), d);
-                       fclose(f);
-               }
-#line 1725 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 29:
-#line 291 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL);
-                       struct data d = empty_data;
-
-                       d = data_copy_file(f, -1);
-
-                       (yyval.data) = data_merge((yyvsp[-4].data), d);
-                       fclose(f);
-               }
-#line 1739 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 30:
-#line 301 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
-               }
-#line 1747 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 31:
-#line 308 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = empty_data;
-               }
-#line 1755 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 32:
-#line 312 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = (yyvsp[-1].data);
-               }
-#line 1763 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 33:
-#line 316 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
-               }
-#line 1771 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 34:
-#line 323 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       unsigned long long bits;
-
-                       bits = (yyvsp[-1].integer);
-
-                       if ((bits !=  8) && (bits != 16) &&
-                           (bits != 32) && (bits != 64)) {
-                               ERROR(&(yylsp[-1]), "Array elements must be"
-                                     " 8, 16, 32 or 64-bits");
-                               bits = 32;
-                       }
-
-                       (yyval.array).data = empty_data;
-                       (yyval.array).bits = bits;
-               }
-#line 1791 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 35:
-#line 339 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.array).data = empty_data;
-                       (yyval.array).bits = 32;
-               }
-#line 1800 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 36:
-#line 344 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       if ((yyvsp[-1].array).bits < 64) {
-                               uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1;
-                               /*
-                                * Bits above mask must either be all zero
-                                * (positive within range of mask) or all one
-                                * (negative and sign-extended). The second
-                                * condition is true if when we set all bits
-                                * within the mask to one (i.e. | in the
-                                * mask), all bits are one.
-                                */
-                               if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL))
-                                       ERROR(&(yylsp[0]), "Value out of range for"
-                                             " %d-bit array element", (yyvsp[-1].array).bits);
-                       }
-
-                       (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits);
-               }
-#line 1823 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 37:
-#line 363 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits);
-
-                       if ((yyvsp[-1].array).bits == 32)
-                               (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data,
-                                                         REF_PHANDLE,
-                                                         (yyvsp[0].labelref));
-                       else
-                               ERROR(&(yylsp[0]), "References are only allowed in "
-                                           "arrays with 32-bit elements.");
-
-                       (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits);
-               }
-#line 1841 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 38:
-#line 377 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref));
-               }
-#line 1849 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 41:
-#line 386 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.integer) = (yyvsp[-1].integer);
-               }
-#line 1857 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 44:
-#line 397 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); }
-#line 1863 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 46:
-#line 402 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); }
-#line 1869 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 48:
-#line 407 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); }
-#line 1875 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 50:
-#line 412 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); }
-#line 1881 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 52:
-#line 417 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); }
-#line 1887 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 54:
-#line 422 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); }
-#line 1893 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 56:
-#line 427 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); }
-#line 1899 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 57:
-#line 428 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); }
-#line 1905 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 59:
-#line 433 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); }
-#line 1911 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 60:
-#line 434 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); }
-#line 1917 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 61:
-#line 435 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); }
-#line 1923 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 62:
-#line 436 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); }
-#line 1929 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 63:
-#line 440 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); }
-#line 1935 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 64:
-#line 441 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); }
-#line 1941 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 66:
-#line 446 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); }
-#line 1947 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 67:
-#line 447 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); }
-#line 1953 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 69:
-#line 452 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); }
-#line 1959 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 70:
-#line 454 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       if ((yyvsp[0].integer) != 0) {
-                               (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer);
-                       } else {
-                               ERROR(&(yyloc), "Division by zero");
-                               (yyval.integer) = 0;
-                       }
-               }
-#line 1972 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 71:
-#line 463 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       if ((yyvsp[0].integer) != 0) {
-                               (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer);
-                       } else {
-                               ERROR(&(yyloc), "Division by zero");
-                               (yyval.integer) = 0;
-                       }
-               }
-#line 1985 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 74:
-#line 476 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = -(yyvsp[0].integer); }
-#line 1991 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 75:
-#line 477 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = ~(yyvsp[0].integer); }
-#line 1997 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 76:
-#line 478 "dtc-parser.y" /* yacc.c:1646  */
-    { (yyval.integer) = !(yyvsp[0].integer); }
-#line 2003 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 77:
-#line 483 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = empty_data;
-               }
-#line 2011 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 78:
-#line 487 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte));
-               }
-#line 2019 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 79:
-#line 491 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
-               }
-#line 2027 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 80:
-#line 498 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.nodelist) = NULL;
-               }
-#line 2035 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 81:
-#line 502 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist));
-               }
-#line 2043 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 82:
-#line 506 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       ERROR(&(yylsp[0]), "Properties must precede subnodes");
-                       YYERROR;
-               }
-#line 2052 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 83:
-#line 514 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename));
-               }
-#line 2060 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 84:
-#line 518 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename));
-               }
-#line 2068 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-  case 85:
-#line 522 "dtc-parser.y" /* yacc.c:1646  */
-    {
-                       add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref));
-                       (yyval.node) = (yyvsp[0].node);
-               }
-#line 2077 "dtc-parser.tab.c" /* yacc.c:1646  */
-    break;
-
-
-#line 2081 "dtc-parser.tab.c" /* yacc.c:1646  */
-      default: break;
-    }
-  /* User semantic actions sometimes alter yychar, and that requires
-     that yytoken be updated with the new translation.  We take the
-     approach of translating immediately before every use of yytoken.
-     One alternative is translating here after every semantic action,
-     but that translation would be missed if the semantic action invokes
-     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
-     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
-     incorrect destructor might then be invoked immediately.  In the
-     case of YYERROR or YYBACKUP, subsequent parser actions might lead
-     to an incorrect destructor call or verbose syntax error message
-     before the lookahead is translated.  */
-  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
-  YYPOPSTACK (yylen);
-  yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
-
-  *++yyvsp = yyval;
-  *++yylsp = yyloc;
-
-  /* Now 'shift' the result of the reduction.  Determine what state
-     that goes to, based on the state we popped back to and the rule
-     number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTOKENS];
-
-  goto yynewstate;
-
-
-/*--------------------------------------.
-| yyerrlab -- here on detecting error.  |
-`--------------------------------------*/
-yyerrlab:
-  /* Make sure we have latest lookahead translation.  See comments at
-     user semantic actions for why this is necessary.  */
-  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
-  /* If not already recovering from an error, report this error.  */
-  if (!yyerrstatus)
-    {
-      ++yynerrs;
-#if ! YYERROR_VERBOSE
-      yyerror (YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
-                                        yyssp, yytoken)
-      {
-        char const *yymsgp = YY_("syntax error");
-        int yysyntax_error_status;
-        yysyntax_error_status = YYSYNTAX_ERROR;
-        if (yysyntax_error_status == 0)
-          yymsgp = yymsg;
-        else if (yysyntax_error_status == 1)
-          {
-            if (yymsg != yymsgbuf)
-              YYSTACK_FREE (yymsg);
-            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
-            if (!yymsg)
-              {
-                yymsg = yymsgbuf;
-                yymsg_alloc = sizeof yymsgbuf;
-                yysyntax_error_status = 2;
-              }
-            else
-              {
-                yysyntax_error_status = YYSYNTAX_ERROR;
-                yymsgp = yymsg;
-              }
-          }
-        yyerror (yymsgp);
-        if (yysyntax_error_status == 2)
-          goto yyexhaustedlab;
-      }
-# undef YYSYNTAX_ERROR
-#endif
-    }
-
-  yyerror_range[1] = yylloc;
-
-  if (yyerrstatus == 3)
-    {
-      /* If just tried and failed to reuse lookahead token after an
-         error, discard it.  */
-
-      if (yychar <= YYEOF)
-        {
-          /* Return failure if at end of input.  */
-          if (yychar == YYEOF)
-            YYABORT;
-        }
-      else
-        {
-          yydestruct ("Error: discarding",
-                      yytoken, &yylval, &yylloc);
-          yychar = YYEMPTY;
-        }
-    }
-
-  /* Else will try to reuse lookahead token after shifting the error
-     token.  */
-  goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR.  |
-`---------------------------------------------------*/
-yyerrorlab:
-
-  /* Pacify compilers like GCC when the user code never invokes
-     YYERROR and the label yyerrorlab therefore never appears in user
-     code.  */
-  if (/*CONSTCOND*/ 0)
-     goto yyerrorlab;
-
-  yyerror_range[1] = yylsp[1-yylen];
-  /* Do not reclaim the symbols of the rule whose action triggered
-     this YYERROR.  */
-  YYPOPSTACK (yylen);
-  yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
-  yystate = *yyssp;
-  goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR.  |
-`-------------------------------------------------------------*/
-yyerrlab1:
-  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
-
-  for (;;)
-    {
-      yyn = yypact[yystate];
-      if (!yypact_value_is_default (yyn))
-        {
-          yyn += YYTERROR;
-          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-            {
-              yyn = yytable[yyn];
-              if (0 < yyn)
-                break;
-            }
-        }
-
-      /* Pop the current state because it cannot handle the error token.  */
-      if (yyssp == yyss)
-        YYABORT;
-
-      yyerror_range[1] = *yylsp;
-      yydestruct ("Error: popping",
-                  yystos[yystate], yyvsp, yylsp);
-      YYPOPSTACK (1);
-      yystate = *yyssp;
-      YY_STACK_PRINT (yyss, yyssp);
-    }
-
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
-
-  yyerror_range[2] = yylloc;
-  /* Using YYLLOC is tempting, but would change the location of
-     the lookahead.  YYLOC is available though.  */
-  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
-  *++yylsp = yyloc;
-
-  /* Shift the error token.  */
-  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
-  yystate = yyn;
-  goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here.  |
-`-------------------------------------*/
-yyacceptlab:
-  yyresult = 0;
-  goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here.  |
-`-----------------------------------*/
-yyabortlab:
-  yyresult = 1;
-  goto yyreturn;
-
-#if !defined yyoverflow || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here.  |
-`-------------------------------------------------*/
-yyexhaustedlab:
-  yyerror (YY_("memory exhausted"));
-  yyresult = 2;
-  /* Fall through.  */
-#endif
-
-yyreturn:
-  if (yychar != YYEMPTY)
-    {
-      /* Make sure we have latest lookahead translation.  See comments at
-         user semantic actions for why this is necessary.  */
-      yytoken = YYTRANSLATE (yychar);
-      yydestruct ("Cleanup: discarding lookahead",
-                  yytoken, &yylval, &yylloc);
-    }
-  /* Do not reclaim the symbols of the rule whose action triggered
-     this YYABORT or YYACCEPT.  */
-  YYPOPSTACK (yylen);
-  YY_STACK_PRINT (yyss, yyssp);
-  while (yyssp != yyss)
-    {
-      yydestruct ("Cleanup: popping",
-                  yystos[*yyssp], yyvsp, yylsp);
-      YYPOPSTACK (1);
-    }
-#ifndef yyoverflow
-  if (yyss != yyssa)
-    YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
-  if (yymsg != yymsgbuf)
-    YYSTACK_FREE (yymsg);
-#endif
-  return yyresult;
-}
-#line 528 "dtc-parser.y" /* yacc.c:1906  */
-
-
-void yyerror(char const *s)
-{
-       ERROR(&yylloc, "%s", s);
-}
diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped
deleted file mode 100644 (file)
index 6aa512c..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
-
-/* Bison interface for Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
-# define YY_YY_DTC_PARSER_TAB_H_INCLUDED
-/* Debug traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int yydebug;
-#endif
-
-/* Token type.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-  enum yytokentype
-  {
-    DT_V1 = 258,
-    DT_PLUGIN = 259,
-    DT_MEMRESERVE = 260,
-    DT_LSHIFT = 261,
-    DT_RSHIFT = 262,
-    DT_LE = 263,
-    DT_GE = 264,
-    DT_EQ = 265,
-    DT_NE = 266,
-    DT_AND = 267,
-    DT_OR = 268,
-    DT_BITS = 269,
-    DT_DEL_PROP = 270,
-    DT_DEL_NODE = 271,
-    DT_PROPNODENAME = 272,
-    DT_LITERAL = 273,
-    DT_CHAR_LITERAL = 274,
-    DT_BYTE = 275,
-    DT_STRING = 276,
-    DT_LABEL = 277,
-    DT_REF = 278,
-    DT_INCBIN = 279
-  };
-#endif
-
-/* Value type.  */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
-union YYSTYPE
-{
-#line 39 "dtc-parser.y" /* yacc.c:1909  */
-
-       char *propnodename;
-       char *labelref;
-       uint8_t byte;
-       struct data data;
-
-       struct {
-               struct data     data;
-               int             bits;
-       } array;
-
-       struct property *prop;
-       struct property *proplist;
-       struct node *node;
-       struct node *nodelist;
-       struct reserve_info *re;
-       uint64_t integer;
-       unsigned int flags;
-
-#line 99 "dtc-parser.tab.h" /* yacc.c:1909  */
-};
-
-typedef union YYSTYPE YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-/* Location type.  */
-#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE YYLTYPE;
-struct YYLTYPE
-{
-  int first_line;
-  int first_column;
-  int last_line;
-  int last_column;
-};
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-
-extern YYSTYPE yylval;
-extern YYLTYPE yylloc;
-int yyparse (void);
-
-#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED  */
index affc81a8f9abedc2dec26bd8f713aac337e2ac6e..44af170abfeaca34a94217d0cf7519568e27b72a 100644 (file)
@@ -166,7 +166,17 @@ devicetree:
                {
                        $$ = merge_nodes($1, $3);
                }
-
+       | DT_REF nodedef
+               {
+                       /*
+                        * We rely on the rule being always:
+                        *   versioninfo plugindecl memreserves devicetree
+                        * so $-1 is what we want (plugindecl)
+                        */
+                       if (!($<flags>-1 & DTSF_PLUGIN))
+                               ERROR(&@2, "Label or path %s not found", $1);
+                       $$ = add_orphan_node(name_node(build_node(NULL, NULL), ""), $2, $1);
+               }
        | devicetree DT_LABEL DT_REF nodedef
                {
                        struct node *target = get_node_by_ref($1, $3);
@@ -209,11 +219,6 @@ devicetree:
 
                        $$ = $1;
                }
-       | /* empty */
-               {
-                       /* build empty node */
-                       $$ = name_node(build_node(NULL, NULL), "");
-               }
        ;
 
 nodedef:
index 5ed873c72ad1eb803d5ebcde83ba90ca0a6bb07a..c36994e6eac5ceb90dbddf38ea26aa2902899bf8 100644 (file)
@@ -59,8 +59,6 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
 }
 
 /* Usage related data. */
-#define FDT_VERSION(version)   _FDT_VERSION(version)
-#define _FDT_VERSION(version)  #version
 static const char usage_synopsis[] = "dtc [options] <input file>";
 static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@Ahv";
 static struct option const usage_long_opts[] = {
@@ -98,7 +96,7 @@ static const char * const usage_opts_help[] = {
         "\t\tdts - device tree source text\n"
         "\t\tdtb - device tree blob\n"
         "\t\tasm - assembler source",
-       "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
+       "\n\tBlob version to produce, defaults to "stringify(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
        "\n\tOutput dependency file",
        "\n\tMake space for <number> reserve map entries (for dtb and asm output)",
        "\n\tMake the blob at least <bytes> long (extra space)",
@@ -319,13 +317,14 @@ int main(int argc, char *argv[])
                dti->boot_cpuid_phys = cmdline_boot_cpuid;
 
        fill_fullpaths(dti->dt, "");
-       process_checks(force, dti);
 
        /* on a plugin, generate by default */
        if (dti->dtsflags & DTSF_PLUGIN) {
                generate_fixups = 1;
        }
 
+       process_checks(force, dti);
+
        if (auto_label_aliases)
                generate_label_tree(dti, "aliases", false);
 
index 35cf926cc14afa52ce2ff52905e0ea11787fbf82..3b18a42b866e73323c0335997a79322f385312ed 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _DTC_H
-#define _DTC_H
+#ifndef DTC_H
+#define DTC_H
 
 /*
  * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation.  2005.
@@ -67,7 +67,8 @@ typedef uint32_t cell_t;
 
 
 #define streq(a, b)    (strcmp((a), (b)) == 0)
-#define strneq(a, b, n)        (strncmp((a), (b), (n)) == 0)
+#define strstarts(s, prefix)   (strncmp((s), (prefix), strlen(prefix)) == 0)
+#define strprefixeq(a, n, b)   (strlen(b) == (n) && (memcmp(a, b, n) == 0))
 
 #define ALIGN(x, a)    (((x) + (a) - 1) & ~((a) - 1))
 
@@ -203,7 +204,7 @@ struct node *build_node_delete(void);
 struct node *name_node(struct node *node, char *name);
 struct node *chain_node(struct node *first, struct node *list);
 struct node *merge_nodes(struct node *old_node, struct node *new_node);
-void add_orphan_node(struct node *old_node, struct node *new_node, char *ref);
+struct node *add_orphan_node(struct node *old_node, struct node *new_node, char *ref);
 
 void add_property(struct node *node, struct property *prop);
 void delete_property_by_name(struct node *node, char *name);
@@ -289,4 +290,4 @@ struct dt_info *dt_from_source(const char *f);
 
 struct dt_info *dt_from_fs(const char *dirname);
 
-#endif /* _DTC_H */
+#endif /* DTC_H */
index fcf71541d8a7e543766f45077ebfc1184c7d6cab..8d268fb785dbdeff634e2d73341d7c8ea3beebcd 100644 (file)
@@ -731,7 +731,7 @@ static char *nodename_from_path(const char *ppath, const char *cpath)
 
        plen = strlen(ppath);
 
-       if (!strneq(ppath, cpath, plen))
+       if (!strstarts(cpath, ppath))
                die("Path \"%s\" is not valid as a child of \"%s\"\n",
                    cpath, ppath);
 
index 22286a1aaeaf8d8f973c51c66082c2b902e4e58d..7855a1787763aa3d891f8f3799519ebb4be477dd 100644 (file)
@@ -88,7 +88,7 @@ const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len)
                    || ((offset + len) > fdt_size_dt_struct(fdt)))
                        return NULL;
 
-       return _fdt_offset_ptr(fdt, offset);
+       return fdt_offset_ptr_(fdt, offset);
 }
 
 uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
@@ -123,6 +123,9 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
                /* skip-name offset, length and value */
                offset += sizeof(struct fdt_property) - FDT_TAGSIZE
                        + fdt32_to_cpu(*lenp);
+               if (fdt_version(fdt) < 0x10 && fdt32_to_cpu(*lenp) >= 8 &&
+                   ((offset - fdt32_to_cpu(*lenp)) % 8) != 0)
+                       offset += 4;
                break;
 
        case FDT_END:
@@ -141,7 +144,7 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
        return tag;
 }
 
-int _fdt_check_node_offset(const void *fdt, int offset)
+int fdt_check_node_offset_(const void *fdt, int offset)
 {
        if ((offset < 0) || (offset % FDT_TAGSIZE)
            || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE))
@@ -150,7 +153,7 @@ int _fdt_check_node_offset(const void *fdt, int offset)
        return offset;
 }
 
-int _fdt_check_prop_offset(const void *fdt, int offset)
+int fdt_check_prop_offset_(const void *fdt, int offset)
 {
        if ((offset < 0) || (offset % FDT_TAGSIZE)
            || (fdt_next_tag(fdt, offset, &offset) != FDT_PROP))
@@ -165,7 +168,7 @@ int fdt_next_node(const void *fdt, int offset, int *depth)
        uint32_t tag;
 
        if (offset >= 0)
-               if ((nextoffset = _fdt_check_node_offset(fdt, offset)) < 0)
+               if ((nextoffset = fdt_check_node_offset_(fdt, offset)) < 0)
                        return nextoffset;
 
        do {
@@ -227,7 +230,7 @@ int fdt_next_subnode(const void *fdt, int offset)
        return offset;
 }
 
-const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
+const char *fdt_find_string_(const char *strtab, int tabsize, const char *s)
 {
        int len = strlen(s) + 1;
        const char *last = strtab + tabsize - len;
index 526aedb51556b60efb35960a4a2012af170a8e78..74961f9026d160650f68a5880c1a8a4d8b43c147 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _FDT_H
-#define _FDT_H
+#ifndef FDT_H
+#define FDT_H
 /*
  * libfdt - Flat Device Tree manipulation
  * Copyright (C) 2006 David Gibson, IBM Corporation.
@@ -108,4 +108,4 @@ struct fdt_property {
 #define FDT_V16_SIZE   FDT_V3_SIZE
 #define FDT_V17_SIZE   (FDT_V16_SIZE + sizeof(fdt32_t))
 
-#endif /* _FDT_H */
+#endif /* FDT_H */
index bd81241e6658d296cfe1a36a379eaeabb8632bed..bf75388ec9a20d9e4878ddd0f9636889dcaa18c3 100644 (file)
@@ -1,3 +1,54 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2016 Free Electrons
+ * Copyright (C) 2016 NextThing Co.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
 #include "libfdt_env.h"
 
 #include <fdt.h>
index 08de2cce674d3a62967592e502d8f33297eb3489..dfb3236da3882654f5e7c393019f93da36d40bff 100644 (file)
 
 #include "libfdt_internal.h"
 
-static int _fdt_nodename_eq(const void *fdt, int offset,
+static int fdt_nodename_eq_(const void *fdt, int offset,
                            const char *s, int len)
 {
-       const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1);
+       int olen;
+       const char *p = fdt_get_name(fdt, offset, &olen);
 
-       if (!p)
+       if (!p || olen < len)
                /* short match */
                return 0;
 
@@ -80,7 +81,7 @@ const char *fdt_string(const void *fdt, int stroffset)
        return (const char *)fdt + fdt_off_dt_strings(fdt) + stroffset;
 }
 
-static int _fdt_string_eq(const void *fdt, int stroffset,
+static int fdt_string_eq_(const void *fdt, int stroffset,
                          const char *s, int len)
 {
        const char *p = fdt_string(fdt, stroffset);
@@ -117,8 +118,8 @@ uint32_t fdt_get_max_phandle(const void *fdt)
 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
 {
        FDT_CHECK_HEADER(fdt);
-       *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address);
-       *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size);
+       *address = fdt64_to_cpu(fdt_mem_rsv_(fdt, n)->address);
+       *size = fdt64_to_cpu(fdt_mem_rsv_(fdt, n)->size);
        return 0;
 }
 
@@ -126,12 +127,12 @@ int fdt_num_mem_rsv(const void *fdt)
 {
        int i = 0;
 
-       while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0)
+       while (fdt64_to_cpu(fdt_mem_rsv_(fdt, i)->size) != 0)
                i++;
        return i;
 }
 
-static int _nextprop(const void *fdt, int offset)
+static int nextprop_(const void *fdt, int offset)
 {
        uint32_t tag;
        int nextoffset;
@@ -166,7 +167,7 @@ int fdt_subnode_offset_namelen(const void *fdt, int offset,
             (offset >= 0) && (depth >= 0);
             offset = fdt_next_node(fdt, offset, &depth))
                if ((depth == 1)
-                   && _fdt_nodename_eq(fdt, offset, name, namelen))
+                   && fdt_nodename_eq_(fdt, offset, name, namelen))
                        return offset;
 
        if (depth < 0)
@@ -232,17 +233,35 @@ int fdt_path_offset(const void *fdt, const char *path)
 
 const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
 {
-       const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset);
+       const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset);
+       const char *nameptr;
        int err;
 
        if (((err = fdt_check_header(fdt)) != 0)
-           || ((err = _fdt_check_node_offset(fdt, nodeoffset)) < 0))
+           || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0))
                        goto fail;
 
+       nameptr = nh->name;
+
+       if (fdt_version(fdt) < 0x10) {
+               /*
+                * For old FDT versions, match the naming conventions of V16:
+                * give only the leaf name (after all /). The actual tree
+                * contents are loosely checked.
+                */
+               const char *leaf;
+               leaf = strrchr(nameptr, '/');
+               if (leaf == NULL) {
+                       err = -FDT_ERR_BADSTRUCTURE;
+                       goto fail;
+               }
+               nameptr = leaf+1;
+       }
+
        if (len)
-               *len = strlen(nh->name);
+               *len = strlen(nameptr);
 
-       return nh->name;
+       return nameptr;
 
  fail:
        if (len)
@@ -254,34 +273,34 @@ int fdt_first_property_offset(const void *fdt, int nodeoffset)
 {
        int offset;
 
-       if ((offset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
+       if ((offset = fdt_check_node_offset_(fdt, nodeoffset)) < 0)
                return offset;
 
-       return _nextprop(fdt, offset);
+       return nextprop_(fdt, offset);
 }
 
 int fdt_next_property_offset(const void *fdt, int offset)
 {
-       if ((offset = _fdt_check_prop_offset(fdt, offset)) < 0)
+       if ((offset = fdt_check_prop_offset_(fdt, offset)) < 0)
                return offset;
 
-       return _nextprop(fdt, offset);
+       return nextprop_(fdt, offset);
 }
 
-const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
-                                                     int offset,
-                                                     int *lenp)
+static const struct fdt_property *fdt_get_property_by_offset_(const void *fdt,
+                                                             int offset,
+                                                             int *lenp)
 {
        int err;
        const struct fdt_property *prop;
 
-       if ((err = _fdt_check_prop_offset(fdt, offset)) < 0) {
+       if ((err = fdt_check_prop_offset_(fdt, offset)) < 0) {
                if (lenp)
                        *lenp = err;
                return NULL;
        }
 
-       prop = _fdt_offset_ptr(fdt, offset);
+       prop = fdt_offset_ptr_(fdt, offset);
 
        if (lenp)
                *lenp = fdt32_to_cpu(prop->len);
@@ -289,23 +308,44 @@ const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
        return prop;
 }
 
-const struct fdt_property *fdt_get_property_namelen(const void *fdt,
-                                                   int offset,
-                                                   const char *name,
-                                                   int namelen, int *lenp)
+const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
+                                                     int offset,
+                                                     int *lenp)
+{
+       /* Prior to version 16, properties may need realignment
+        * and this API does not work. fdt_getprop_*() will, however. */
+
+       if (fdt_version(fdt) < 0x10) {
+               if (lenp)
+                       *lenp = -FDT_ERR_BADVERSION;
+               return NULL;
+       }
+
+       return fdt_get_property_by_offset_(fdt, offset, lenp);
+}
+
+static const struct fdt_property *fdt_get_property_namelen_(const void *fdt,
+                                                           int offset,
+                                                           const char *name,
+                                                           int namelen,
+                                                           int *lenp,
+                                                           int *poffset)
 {
        for (offset = fdt_first_property_offset(fdt, offset);
             (offset >= 0);
             (offset = fdt_next_property_offset(fdt, offset))) {
                const struct fdt_property *prop;
 
-               if (!(prop = fdt_get_property_by_offset(fdt, offset, lenp))) {
+               if (!(prop = fdt_get_property_by_offset_(fdt, offset, lenp))) {
                        offset = -FDT_ERR_INTERNAL;
                        break;
                }
-               if (_fdt_string_eq(fdt, fdt32_to_cpu(prop->nameoff),
-                                  name, namelen))
+               if (fdt_string_eq_(fdt, fdt32_to_cpu(prop->nameoff),
+                                  name, namelen)) {
+                       if (poffset)
+                               *poffset = offset;
                        return prop;
+               }
        }
 
        if (lenp)
@@ -313,6 +353,25 @@ const struct fdt_property *fdt_get_property_namelen(const void *fdt,
        return NULL;
 }
 
+
+const struct fdt_property *fdt_get_property_namelen(const void *fdt,
+                                                   int offset,
+                                                   const char *name,
+                                                   int namelen, int *lenp)
+{
+       /* Prior to version 16, properties may need realignment
+        * and this API does not work. fdt_getprop_*() will, however. */
+       if (fdt_version(fdt) < 0x10) {
+               if (lenp)
+                       *lenp = -FDT_ERR_BADVERSION;
+               return NULL;
+       }
+
+       return fdt_get_property_namelen_(fdt, offset, name, namelen, lenp,
+                                        NULL);
+}
+
+
 const struct fdt_property *fdt_get_property(const void *fdt,
                                            int nodeoffset,
                                            const char *name, int *lenp)
@@ -324,12 +383,18 @@ const struct fdt_property *fdt_get_property(const void *fdt,
 const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
                                const char *name, int namelen, int *lenp)
 {
+       int poffset;
        const struct fdt_property *prop;
 
-       prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp);
+       prop = fdt_get_property_namelen_(fdt, nodeoffset, name, namelen, lenp,
+                                        &poffset);
        if (!prop)
                return NULL;
 
+       /* Handle realignment */
+       if (fdt_version(fdt) < 0x10 && (poffset + sizeof(*prop)) % 8 &&
+           fdt32_to_cpu(prop->len) >= 8)
+               return prop->data + 4;
        return prop->data;
 }
 
@@ -338,11 +403,16 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset,
 {
        const struct fdt_property *prop;
 
-       prop = fdt_get_property_by_offset(fdt, offset, lenp);
+       prop = fdt_get_property_by_offset_(fdt, offset, lenp);
        if (!prop)
                return NULL;
        if (namep)
                *namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));
+
+       /* Handle realignment */
+       if (fdt_version(fdt) < 0x10 && (offset + sizeof(*prop)) % 8 &&
+           fdt32_to_cpu(prop->len) >= 8)
+               return prop->data + 4;
        return prop->data;
 }
 
index 5c3a2bb0bc6bc3d208ca1bfd30b6c076db811202..9b829051e4447015aad9972270e299cab4dc3053 100644 (file)
@@ -55,8 +55,8 @@
 
 #include "libfdt_internal.h"
 
-static int _fdt_blocks_misordered(const void *fdt,
-                             int mem_rsv_size, int struct_size)
+static int fdt_blocks_misordered_(const void *fdt,
+                                 int mem_rsv_size, int struct_size)
 {
        return (fdt_off_mem_rsvmap(fdt) < FDT_ALIGN(sizeof(struct fdt_header), 8))
                || (fdt_off_dt_struct(fdt) <
@@ -67,13 +67,13 @@ static int _fdt_blocks_misordered(const void *fdt,
                    (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt)));
 }
 
-static int _fdt_rw_check_header(void *fdt)
+static int fdt_rw_check_header_(void *fdt)
 {
        FDT_CHECK_HEADER(fdt);
 
        if (fdt_version(fdt) < 17)
                return -FDT_ERR_BADVERSION;
-       if (_fdt_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry),
+       if (fdt_blocks_misordered_(fdt, sizeof(struct fdt_reserve_entry),
                                   fdt_size_dt_struct(fdt)))
                return -FDT_ERR_BADLAYOUT;
        if (fdt_version(fdt) > 17)
@@ -84,20 +84,20 @@ static int _fdt_rw_check_header(void *fdt)
 
 #define FDT_RW_CHECK_HEADER(fdt) \
        { \
-               int __err; \
-               if ((__err = _fdt_rw_check_header(fdt)) != 0) \
-                       return __err; \
+               int err_; \
+               if ((err_ = fdt_rw_check_header_(fdt)) != 0) \
+                       return err_; \
        }
 
-static inline int _fdt_data_size(void *fdt)
+static inline int fdt_data_size_(void *fdt)
 {
        return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
 }
 
-static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen)
+static int fdt_splice_(void *fdt, void *splicepoint, int oldlen, int newlen)
 {
        char *p = splicepoint;
-       char *end = (char *)fdt + _fdt_data_size(fdt);
+       char *end = (char *)fdt + fdt_data_size_(fdt);
 
        if (((p + oldlen) < p) || ((p + oldlen) > end))
                return -FDT_ERR_BADOFFSET;
@@ -109,12 +109,12 @@ static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen)
        return 0;
 }
 
-static int _fdt_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p,
+static int fdt_splice_mem_rsv_(void *fdt, struct fdt_reserve_entry *p,
                               int oldn, int newn)
 {
        int delta = (newn - oldn) * sizeof(*p);
        int err;
-       err = _fdt_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p));
+       err = fdt_splice_(fdt, p, oldn * sizeof(*p), newn * sizeof(*p));
        if (err)
                return err;
        fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta);
@@ -122,13 +122,13 @@ static int _fdt_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p,
        return 0;
 }
 
-static int _fdt_splice_struct(void *fdt, void *p,
+static int fdt_splice_struct_(void *fdt, void *p,
                              int oldlen, int newlen)
 {
        int delta = newlen - oldlen;
        int err;
 
-       if ((err = _fdt_splice(fdt, p, oldlen, newlen)))
+       if ((err = fdt_splice_(fdt, p, oldlen, newlen)))
                return err;
 
        fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta);
@@ -136,20 +136,20 @@ static int _fdt_splice_struct(void *fdt, void *p,
        return 0;
 }
 
-static int _fdt_splice_string(void *fdt, int newlen)
+static int fdt_splice_string_(void *fdt, int newlen)
 {
        void *p = (char *)fdt
                + fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
        int err;
 
-       if ((err = _fdt_splice(fdt, p, 0, newlen)))
+       if ((err = fdt_splice_(fdt, p, 0, newlen)))
                return err;
 
        fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen);
        return 0;
 }
 
-static int _fdt_find_add_string(void *fdt, const char *s)
+static int fdt_find_add_string_(void *fdt, const char *s)
 {
        char *strtab = (char *)fdt + fdt_off_dt_strings(fdt);
        const char *p;
@@ -157,13 +157,13 @@ static int _fdt_find_add_string(void *fdt, const char *s)
        int len = strlen(s) + 1;
        int err;
 
-       p = _fdt_find_string(strtab, fdt_size_dt_strings(fdt), s);
+       p = fdt_find_string_(strtab, fdt_size_dt_strings(fdt), s);
        if (p)
                /* found it */
                return (p - strtab);
 
        new = strtab + fdt_size_dt_strings(fdt);
-       err = _fdt_splice_string(fdt, len);
+       err = fdt_splice_string_(fdt, len);
        if (err)
                return err;
 
@@ -178,8 +178,8 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)
 
        FDT_RW_CHECK_HEADER(fdt);
 
-       re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt));
-       err = _fdt_splice_mem_rsv(fdt, re, 0, 1);
+       re = fdt_mem_rsv_w_(fdt, fdt_num_mem_rsv(fdt));
+       err = fdt_splice_mem_rsv_(fdt, re, 0, 1);
        if (err)
                return err;
 
@@ -190,17 +190,17 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)
 
 int fdt_del_mem_rsv(void *fdt, int n)
 {
-       struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n);
+       struct fdt_reserve_entry *re = fdt_mem_rsv_w_(fdt, n);
 
        FDT_RW_CHECK_HEADER(fdt);
 
        if (n >= fdt_num_mem_rsv(fdt))
                return -FDT_ERR_NOTFOUND;
 
-       return _fdt_splice_mem_rsv(fdt, re, 1, 0);
+       return fdt_splice_mem_rsv_(fdt, re, 1, 0);
 }
 
-static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
+static int fdt_resize_property_(void *fdt, int nodeoffset, const char *name,
                                int len, struct fdt_property **prop)
 {
        int oldlen;
@@ -210,7 +210,7 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
        if (!*prop)
                return oldlen;
 
-       if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),
+       if ((err = fdt_splice_struct_(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),
                                      FDT_TAGALIGN(len))))
                return err;
 
@@ -218,7 +218,7 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
        return 0;
 }
 
-static int _fdt_add_property(void *fdt, int nodeoffset, const char *name,
+static int fdt_add_property_(void *fdt, int nodeoffset, const char *name,
                             int len, struct fdt_property **prop)
 {
        int proplen;
@@ -226,17 +226,17 @@ static int _fdt_add_property(void *fdt, int nodeoffset, const char *name,
        int namestroff;
        int err;
 
-       if ((nextoffset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
+       if ((nextoffset = fdt_check_node_offset_(fdt, nodeoffset)) < 0)
                return nextoffset;
 
-       namestroff = _fdt_find_add_string(fdt, name);
+       namestroff = fdt_find_add_string_(fdt, name);
        if (namestroff < 0)
                return namestroff;
 
-       *prop = _fdt_offset_ptr_w(fdt, nextoffset);
+       *prop = fdt_offset_ptr_w_(fdt, nextoffset);
        proplen = sizeof(**prop) + FDT_TAGALIGN(len);
 
-       err = _fdt_splice_struct(fdt, *prop, 0, proplen);
+       err = fdt_splice_struct_(fdt, *prop, 0, proplen);
        if (err)
                return err;
 
@@ -260,7 +260,7 @@ int fdt_set_name(void *fdt, int nodeoffset, const char *name)
 
        newlen = strlen(name);
 
-       err = _fdt_splice_struct(fdt, namep, FDT_TAGALIGN(oldlen+1),
+       err = fdt_splice_struct_(fdt, namep, FDT_TAGALIGN(oldlen+1),
                                 FDT_TAGALIGN(newlen+1));
        if (err)
                return err;
@@ -277,9 +277,9 @@ int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
 
        FDT_RW_CHECK_HEADER(fdt);
 
-       err = _fdt_resize_property(fdt, nodeoffset, name, len, &prop);
+       err = fdt_resize_property_(fdt, nodeoffset, name, len, &prop);
        if (err == -FDT_ERR_NOTFOUND)
-               err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
+               err = fdt_add_property_(fdt, nodeoffset, name, len, &prop);
        if (err)
                return err;
 
@@ -313,7 +313,7 @@ int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
        prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
        if (prop) {
                newlen = len + oldlen;
-               err = _fdt_splice_struct(fdt, prop->data,
+               err = fdt_splice_struct_(fdt, prop->data,
                                         FDT_TAGALIGN(oldlen),
                                         FDT_TAGALIGN(newlen));
                if (err)
@@ -321,7 +321,7 @@ int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
                prop->len = cpu_to_fdt32(newlen);
                memcpy(prop->data + oldlen, val, len);
        } else {
-               err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
+               err = fdt_add_property_(fdt, nodeoffset, name, len, &prop);
                if (err)
                        return err;
                memcpy(prop->data, val, len);
@@ -341,7 +341,7 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name)
                return len;
 
        proplen = sizeof(*prop) + FDT_TAGALIGN(len);
-       return _fdt_splice_struct(fdt, prop, proplen, 0);
+       return fdt_splice_struct_(fdt, prop, proplen, 0);
 }
 
 int fdt_add_subnode_namelen(void *fdt, int parentoffset,
@@ -369,10 +369,10 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
                tag = fdt_next_tag(fdt, offset, &nextoffset);
        } while ((tag == FDT_PROP) || (tag == FDT_NOP));
 
-       nh = _fdt_offset_ptr_w(fdt, offset);
+       nh = fdt_offset_ptr_w_(fdt, offset);
        nodelen = sizeof(*nh) + FDT_TAGALIGN(namelen+1) + FDT_TAGSIZE;
 
-       err = _fdt_splice_struct(fdt, nh, 0, nodelen);
+       err = fdt_splice_struct_(fdt, nh, 0, nodelen);
        if (err)
                return err;
 
@@ -396,15 +396,15 @@ int fdt_del_node(void *fdt, int nodeoffset)
 
        FDT_RW_CHECK_HEADER(fdt);
 
-       endoffset = _fdt_node_end_offset(fdt, nodeoffset);
+       endoffset = fdt_node_end_offset_(fdt, nodeoffset);
        if (endoffset < 0)
                return endoffset;
 
-       return _fdt_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset),
+       return fdt_splice_struct_(fdt, fdt_offset_ptr_w_(fdt, nodeoffset),
                                  endoffset - nodeoffset, 0);
 }
 
-static void _fdt_packblocks(const char *old, char *new,
+static void fdt_packblocks_(const char *old, char *new,
                            int mem_rsv_size, int struct_size)
 {
        int mem_rsv_off, struct_off, strings_off;
@@ -450,7 +450,7 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
                        return struct_size;
        }
 
-       if (!_fdt_blocks_misordered(fdt, mem_rsv_size, struct_size)) {
+       if (!fdt_blocks_misordered_(fdt, mem_rsv_size, struct_size)) {
                /* no further work necessary */
                err = fdt_move(fdt, buf, bufsize);
                if (err)
@@ -478,7 +478,7 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
                        return -FDT_ERR_NOSPACE;
        }
 
-       _fdt_packblocks(fdt, tmp, mem_rsv_size, struct_size);
+       fdt_packblocks_(fdt, tmp, mem_rsv_size, struct_size);
        memmove(buf, tmp, newsize);
 
        fdt_set_magic(buf, FDT_MAGIC);
@@ -498,8 +498,8 @@ int fdt_pack(void *fdt)
 
        mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
                * sizeof(struct fdt_reserve_entry);
-       _fdt_packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt));
-       fdt_set_totalsize(fdt, _fdt_data_size(fdt));
+       fdt_packblocks_(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt));
+       fdt_set_totalsize(fdt, fdt_data_size_(fdt));
 
        return 0;
 }
index 2bd15e7aef872c13992cbe6d85e2bd8bb4b08a2e..6d33cc29d0224d9fc6307607ef7563df944da2d3 100644 (file)
@@ -55,7 +55,7 @@
 
 #include "libfdt_internal.h"
 
-static int _fdt_sw_check_header(void *fdt)
+static int fdt_sw_check_header_(void *fdt)
 {
        if (fdt_magic(fdt) != FDT_SW_MAGIC)
                return -FDT_ERR_BADMAGIC;
@@ -66,11 +66,11 @@ static int _fdt_sw_check_header(void *fdt)
 #define FDT_SW_CHECK_HEADER(fdt) \
        { \
                int err; \
-               if ((err = _fdt_sw_check_header(fdt)) != 0) \
+               if ((err = fdt_sw_check_header_(fdt)) != 0) \
                        return err; \
        }
 
-static void *_fdt_grab_space(void *fdt, size_t len)
+static void *fdt_grab_space_(void *fdt, size_t len)
 {
        int offset = fdt_size_dt_struct(fdt);
        int spaceleft;
@@ -82,7 +82,7 @@ static void *_fdt_grab_space(void *fdt, size_t len)
                return NULL;
 
        fdt_set_size_dt_struct(fdt, offset + len);
-       return _fdt_offset_ptr_w(fdt, offset);
+       return fdt_offset_ptr_w_(fdt, offset);
 }
 
 int fdt_create(void *buf, int bufsize)
@@ -174,7 +174,7 @@ int fdt_begin_node(void *fdt, const char *name)
 
        FDT_SW_CHECK_HEADER(fdt);
 
-       nh = _fdt_grab_space(fdt, sizeof(*nh) + FDT_TAGALIGN(namelen));
+       nh = fdt_grab_space_(fdt, sizeof(*nh) + FDT_TAGALIGN(namelen));
        if (! nh)
                return -FDT_ERR_NOSPACE;
 
@@ -189,7 +189,7 @@ int fdt_end_node(void *fdt)
 
        FDT_SW_CHECK_HEADER(fdt);
 
-       en = _fdt_grab_space(fdt, FDT_TAGSIZE);
+       en = fdt_grab_space_(fdt, FDT_TAGSIZE);
        if (! en)
                return -FDT_ERR_NOSPACE;
 
@@ -197,7 +197,7 @@ int fdt_end_node(void *fdt)
        return 0;
 }
 
-static int _fdt_find_add_string(void *fdt, const char *s)
+static int fdt_find_add_string_(void *fdt, const char *s)
 {
        char *strtab = (char *)fdt + fdt_totalsize(fdt);
        const char *p;
@@ -205,7 +205,7 @@ static int _fdt_find_add_string(void *fdt, const char *s)
        int len = strlen(s) + 1;
        int struct_top, offset;
 
-       p = _fdt_find_string(strtab - strtabsize, strtabsize, s);
+       p = fdt_find_string_(strtab - strtabsize, strtabsize, s);
        if (p)
                return p - strtab;
 
@@ -227,11 +227,11 @@ int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp)
 
        FDT_SW_CHECK_HEADER(fdt);
 
-       nameoff = _fdt_find_add_string(fdt, name);
+       nameoff = fdt_find_add_string_(fdt, name);
        if (nameoff == 0)
                return -FDT_ERR_NOSPACE;
 
-       prop = _fdt_grab_space(fdt, sizeof(*prop) + FDT_TAGALIGN(len));
+       prop = fdt_grab_space_(fdt, sizeof(*prop) + FDT_TAGALIGN(len));
        if (! prop)
                return -FDT_ERR_NOSPACE;
 
@@ -265,7 +265,7 @@ int fdt_finish(void *fdt)
        FDT_SW_CHECK_HEADER(fdt);
 
        /* Add terminator */
-       end = _fdt_grab_space(fdt, sizeof(*end));
+       end = fdt_grab_space_(fdt, sizeof(*end));
        if (! end)
                return -FDT_ERR_NOSPACE;
        *end = cpu_to_fdt32(FDT_END);
@@ -281,7 +281,7 @@ int fdt_finish(void *fdt)
        while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) {
                if (tag == FDT_PROP) {
                        struct fdt_property *prop =
-                               _fdt_offset_ptr_w(fdt, offset);
+                               fdt_offset_ptr_w_(fdt, offset);
                        int nameoff;
 
                        nameoff = fdt32_to_cpu(prop->nameoff);
index 5e859198622bd48d60b4f6d59e954c79723e4747..534c1cbbb2f355deb7d7b69a19b7e5ac1c309989 100644 (file)
@@ -93,7 +93,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
                                                   val, len);
 }
 
-static void _fdt_nop_region(void *start, int len)
+static void fdt_nop_region_(void *start, int len)
 {
        fdt32_t *p;
 
@@ -110,12 +110,12 @@ int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
        if (!prop)
                return len;
 
-       _fdt_nop_region(prop, len + sizeof(*prop));
+       fdt_nop_region_(prop, len + sizeof(*prop));
 
        return 0;
 }
 
-int _fdt_node_end_offset(void *fdt, int offset)
+int fdt_node_end_offset_(void *fdt, int offset)
 {
        int depth = 0;
 
@@ -129,11 +129,11 @@ int fdt_nop_node(void *fdt, int nodeoffset)
 {
        int endoffset;
 
-       endoffset = _fdt_node_end_offset(fdt, nodeoffset);
+       endoffset = fdt_node_end_offset_(fdt, nodeoffset);
        if (endoffset < 0)
                return endoffset;
 
-       _fdt_nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0),
+       fdt_nop_region_(fdt_offset_ptr_w(fdt, nodeoffset, 0),
                        endoffset - nodeoffset);
        return 0;
 }
index 7f83023ee10947f366e4846bc9ddb78b408dbb36..1e27780e1185666e6586199b4974f4b49112c3af 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _LIBFDT_H
-#define _LIBFDT_H
+#ifndef LIBFDT_H
+#define LIBFDT_H
 /*
  * libfdt - Flat Device Tree manipulation
  * Copyright (C) 2006 David Gibson, IBM Corporation.
@@ -54,7 +54,7 @@
 #include "libfdt_env.h"
 #include "fdt.h"
 
-#define FDT_FIRST_SUPPORTED_VERSION    0x10
+#define FDT_FIRST_SUPPORTED_VERSION    0x02
 #define FDT_LAST_SUPPORTED_VERSION     0x11
 
 /* Error codes: informative error codes */
@@ -225,23 +225,23 @@ int fdt_next_subnode(const void *fdt, int offset);
 #define fdt_size_dt_strings(fdt)       (fdt_get_header(fdt, size_dt_strings))
 #define fdt_size_dt_struct(fdt)                (fdt_get_header(fdt, size_dt_struct))
 
-#define __fdt_set_hdr(name) \
+#define fdt_set_hdr_(name) \
        static inline void fdt_set_##name(void *fdt, uint32_t val) \
        { \
                struct fdt_header *fdth = (struct fdt_header *)fdt; \
                fdth->name = cpu_to_fdt32(val); \
        }
-__fdt_set_hdr(magic);
-__fdt_set_hdr(totalsize);
-__fdt_set_hdr(off_dt_struct);
-__fdt_set_hdr(off_dt_strings);
-__fdt_set_hdr(off_mem_rsvmap);
-__fdt_set_hdr(version);
-__fdt_set_hdr(last_comp_version);
-__fdt_set_hdr(boot_cpuid_phys);
-__fdt_set_hdr(size_dt_strings);
-__fdt_set_hdr(size_dt_struct);
-#undef __fdt_set_hdr
+fdt_set_hdr_(magic);
+fdt_set_hdr_(totalsize);
+fdt_set_hdr_(off_dt_struct);
+fdt_set_hdr_(off_dt_strings);
+fdt_set_hdr_(off_mem_rsvmap);
+fdt_set_hdr_(version);
+fdt_set_hdr_(last_comp_version);
+fdt_set_hdr_(boot_cpuid_phys);
+fdt_set_hdr_(size_dt_strings);
+fdt_set_hdr_(size_dt_struct);
+#undef fdt_set_hdr_
 
 /**
  * fdt_check_header - sanity check a device tree or possible device tree
@@ -527,6 +527,9 @@ int fdt_next_property_offset(const void *fdt, int offset);
  * offset.  If lenp is non-NULL, the length of the property value is
  * also returned, in the integer pointed to by lenp.
  *
+ * Note that this code only works on device tree versions >= 16. fdt_getprop()
+ * works on all versions.
+ *
  * returns:
  *     pointer to the structure representing the property
  *             if lenp is non-NULL, *lenp contains the length of the property
@@ -1449,7 +1452,7 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,
                const void *val, int len);
 
 /**
- * fdt_setprop _placeholder - allocate space for a property
+ * fdt_setprop_placeholder - allocate space for a property
  * @fdt: pointer to the device tree blob
  * @nodeoffset: offset of the node whose property to change
  * @name: name of the property to change
@@ -1896,4 +1899,4 @@ int fdt_overlay_apply(void *fdt, void *fdto);
 
 const char *fdt_strerror(int errval);
 
-#endif /* _LIBFDT_H */
+#endif /* LIBFDT_H */
index 952056cddf09a8f7beffec104a9507961b3d85e1..bd2474628775ff6d7439d37c09344ab4e9edc56e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _LIBFDT_ENV_H
-#define _LIBFDT_ENV_H
+#ifndef LIBFDT_ENV_H
+#define LIBFDT_ENV_H
 /*
  * libfdt - Flat Device Tree manipulation
  * Copyright (C) 2006 David Gibson, IBM Corporation.
@@ -109,4 +109,31 @@ static inline fdt64_t cpu_to_fdt64(uint64_t x)
 #undef CPU_TO_FDT16
 #undef EXTRACT_BYTE
 
-#endif /* _LIBFDT_ENV_H */
+#ifdef __APPLE__
+#include <AvailabilityMacros.h>
+
+/* strnlen() is not available on Mac OS < 10.7 */
+# if !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MAX_ALLOWED < \
+                                         MAC_OS_X_VERSION_10_7)
+
+#define strnlen fdt_strnlen
+
+/*
+ * fdt_strnlen: returns the length of a string or max_count - which ever is
+ * smallest.
+ * Input 1 string: the string whose size is to be determined
+ * Input 2 max_count: the maximum value returned by this function
+ * Output: length of the string or max_count (the smallest of the two)
+ */
+static inline size_t fdt_strnlen(const char *string, size_t max_count)
+{
+    const char *p = memchr(string, 0, max_count);
+    return p ? p - string : max_count;
+}
+
+#endif /* !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MAX_ALLOWED <
+          MAC_OS_X_VERSION_10_7) */
+
+#endif /* __APPLE__ */
+
+#endif /* LIBFDT_ENV_H */
index 02cfa6fb612db834c6baad27d96b003d78ab49b0..7681e192295b0a14cc07aa7a73ed3faca09b15d4 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _LIBFDT_INTERNAL_H
-#define _LIBFDT_INTERNAL_H
+#ifndef LIBFDT_INTERNAL_H
+#define LIBFDT_INTERNAL_H
 /*
  * libfdt - Flat Device Tree manipulation
  * Copyright (C) 2006 David Gibson, IBM Corporation.
 
 #define FDT_CHECK_HEADER(fdt) \
        { \
-               int __err; \
-               if ((__err = fdt_check_header(fdt)) != 0) \
-                       return __err; \
+               int err_; \
+               if ((err_ = fdt_check_header(fdt)) != 0) \
+                       return err_; \
        }
 
-int _fdt_check_node_offset(const void *fdt, int offset);
-int _fdt_check_prop_offset(const void *fdt, int offset);
-const char *_fdt_find_string(const char *strtab, int tabsize, const char *s);
-int _fdt_node_end_offset(void *fdt, int nodeoffset);
+int fdt_check_node_offset_(const void *fdt, int offset);
+int fdt_check_prop_offset_(const void *fdt, int offset);
+const char *fdt_find_string_(const char *strtab, int tabsize, const char *s);
+int fdt_node_end_offset_(void *fdt, int nodeoffset);
 
-static inline const void *_fdt_offset_ptr(const void *fdt, int offset)
+static inline const void *fdt_offset_ptr_(const void *fdt, int offset)
 {
        return (const char *)fdt + fdt_off_dt_struct(fdt) + offset;
 }
 
-static inline void *_fdt_offset_ptr_w(void *fdt, int offset)
+static inline void *fdt_offset_ptr_w_(void *fdt, int offset)
 {
-       return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset);
+       return (void *)(uintptr_t)fdt_offset_ptr_(fdt, offset);
 }
 
-static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n)
+static inline const struct fdt_reserve_entry *fdt_mem_rsv_(const void *fdt, int n)
 {
        const struct fdt_reserve_entry *rsv_table =
                (const struct fdt_reserve_entry *)
@@ -85,11 +85,11 @@ static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int
 
        return rsv_table + n;
 }
-static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n)
+static inline struct fdt_reserve_entry *fdt_mem_rsv_w_(void *fdt, int n)
 {
-       return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n);
+       return (void *)(uintptr_t)fdt_mem_rsv_(fdt, n);
 }
 
 #define FDT_SW_MAGIC           (~FDT_MAGIC)
 
-#endif /* _LIBFDT_INTERNAL_H */
+#endif /* LIBFDT_INTERNAL_H */
index 6846ad2fd6d2e54599c88c95647300fddac07771..57b7db2ed1534873ea8f382c958d19038ba86916 100644 (file)
@@ -216,7 +216,7 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node)
        return old_node;
 }
 
-void add_orphan_node(struct node *dt, struct node *new_node, char *ref)
+struct node * add_orphan_node(struct node *dt, struct node *new_node, char *ref)
 {
        static unsigned int next_orphan_fragment = 0;
        struct node *node;
@@ -236,6 +236,7 @@ void add_orphan_node(struct node *dt, struct node *new_node, char *ref)
        name_node(node, name);
 
        add_child(dt, node);
+       return dt;
 }
 
 struct node *chain_node(struct node *first, struct node *list)
@@ -507,7 +508,7 @@ struct node *get_node_by_path(struct node *tree, const char *path)
 
        for_each_child(tree, child) {
                if (p && (strlen(child->name) == p-path) &&
-                               strneq(path, child->name, p-path))
+                   strprefixeq(path, p - path, child->name))
                        return get_node_by_path(child, p+1);
                else if (!p && streq(path, child->name))
                        return child;
@@ -540,7 +541,10 @@ struct node *get_node_by_phandle(struct node *tree, cell_t phandle)
 {
        struct node *child, *node;
 
-       assert((phandle != 0) && (phandle != -1));
+       if ((phandle == 0) || (phandle == -1)) {
+               assert(generate_fixups);
+               return NULL;
+       }
 
        if (tree->phandle == phandle) {
                if (tree->deleted)
index 9d38459902f3c3c1fbb4ca5d3151a10e92fbf73d..cb6ed0e3e5e479e4b1cf2e754abed3a06beedd06 100644 (file)
@@ -209,8 +209,6 @@ struct srcpos srcpos_empty = {
        .file = NULL,
 };
 
-#define TAB_SIZE      8
-
 void srcpos_update(struct srcpos *pos, const char *text, int len)
 {
        int i;
@@ -224,9 +222,6 @@ void srcpos_update(struct srcpos *pos, const char *text, int len)
                if (text[i] == '\n') {
                        current_srcfile->lineno++;
                        current_srcfile->colno = 1;
-               } else if (text[i] == '\t') {
-                       current_srcfile->colno =
-                               ALIGN(current_srcfile->colno, TAB_SIZE);
                } else {
                        current_srcfile->colno++;
                }
index 7caca8257c6d192e2b35c4c2fc9b317b1e74a870..9ded12a3830a5f717ef3549071a5342fe427a970 100644 (file)
@@ -17,8 +17,8 @@
  *                                                                   USA
  */
 
-#ifndef _SRCPOS_H_
-#define _SRCPOS_H_
+#ifndef SRCPOS_H
+#define SRCPOS_H
 
 #include <stdio.h>
 #include <stdbool.h>
@@ -114,4 +114,4 @@ extern void PRINTF(3, 4) srcpos_error(struct srcpos *pos, const char *prefix,
 
 extern void srcpos_set_line(char *f, int l);
 
-#endif /* _SRCPOS_H_ */
+#endif /* SRCPOS_H */
index f3e5c596050a9a593ee8c14d94dbb1282531dc5c..1a009fd195d0fc77e1057e425ca8e81cba681c76 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
 # Simple script to update the version of DTC carried by the Linux kernel
 #
 # This script assumes that the dtc and the linux git trees are in the
 # same directory. After building dtc in the dtc directory, it copies the
-# source files and generated source files into the scripts/dtc directory
+# source files and generated source file(s) into the scripts/dtc directory
 # in the kernel and creates a git commit updating them to the new
 # version.
 #
@@ -33,7 +34,6 @@ DTC_LINUX_PATH=`pwd`/scripts/dtc
 DTC_SOURCE="checks.c data.c dtc.c dtc.h flattree.c fstree.c livetree.c srcpos.c \
                srcpos.h treesource.c util.c util.h version_gen.h Makefile.dtc \
                dtc-lexer.l dtc-parser.y"
-DTC_GENERATED="dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h"
 LIBFDT_SOURCE="Makefile.libfdt fdt.c fdt.h fdt_addresses.c fdt_empty_tree.c \
                fdt_overlay.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c \
                fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h"
@@ -58,10 +58,6 @@ for f in $DTC_SOURCE; do
        cp ${DTC_UPSTREAM_PATH}/${f} ${f}
        git add ${f}
 done
-for f in $DTC_GENERATED; do
-       cp ${DTC_UPSTREAM_PATH}/$f ${f}_shipped
-       git add ${f}_shipped
-done
 for f in $LIBFDT_SOURCE; do
        cp ${DTC_UPSTREAM_PATH}/libfdt/${f} libfdt/${f}
        git add libfdt/${f}
index ad5f41199edbb74f3bdb97bdfc908caab6145571..66fba8ea709b8b8a878f3c49cfbfe506f4beb877 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _UTIL_H
-#define _UTIL_H
+#ifndef UTIL_H
+#define UTIL_H
 
 #include <stdarg.h>
 #include <stdbool.h>
@@ -35,6 +35,9 @@
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
+#define stringify(s)   stringify_(s)
+#define stringify_(s)  #s
+
 static inline void NORETURN PRINTF(1, 2) die(const char *str, ...)
 {
        va_list ap;
@@ -260,4 +263,4 @@ void NORETURN util_usage(const char *errmsg, const char *synopsis,
        case 'V': util_version(); \
        case '?': usage("unknown option");
 
-#endif /* _UTIL_H */
+#endif /* UTIL_H */
index d88393cab14a74949e770272afe432c7abd7f3cf..ad87849e333bc6e450a1b27685fd10bfe065c241 100644 (file)
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.4.5-gb1a60033"
+#define DTC_VERSION "DTC 1.4.6-gaadd0b65"
index be603c4fef624669ea2bac84e1f41311713a8065..2da579edcbafd3ffe4f9af5a91562b06fe41c8b0 100644 (file)
@@ -1,11 +1,6 @@
 #
 # Generated files
 #
-config*
-*.lex.c
-*.tab.c
-*.tab.h
-zconf.hash.c
 *.moc
 gconf.glade.h
 *.pot
index 2542b38af36ffeeae3762ec3bfe78d07bc4ce54c..8b7b34975802f336b3bc9b09ae55a05e7bc7b1d3 100644 (file)
@@ -3,7 +3,7 @@
 # Kernel configuration targets
 # These targets are used from top-level makefile
 
-PHONY += xconfig gconfig menuconfig config silentoldconfig update-po-config \
+PHONY += xconfig gconfig menuconfig config syncconfig update-po-config \
        localmodconfig localyesconfig
 
 # Added for U-Boot
@@ -40,24 +40,24 @@ config: $(obj)/conf
 nconfig: $(obj)/nconf
        $< $(silent) $(Kconfig)
 
-silentoldconfig: $(obj)/conf
+# This has become an internal implementation detail and is now deprecated
+# for external use.
+syncconfig: $(obj)/conf
        $(Q)mkdir -p include/config include/generated
-       $(Q)test -e include/generated/autoksyms.h || \
-           touch   include/generated/autoksyms.h
        $< $(silent) --$@ $(Kconfig)
 
-localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
+localyesconfig localmodconfig: $(obj)/conf
        $(Q)mkdir -p include/config include/generated
-       $(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config
+       $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
        $(Q)if [ -f .config ]; then                                     \
                        cmp -s .tmp.config .config ||                   \
                        (mv -f .config .config.old.1;                   \
                         mv -f .tmp.config .config;                     \
-                        $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
+                        $< $(silent) --oldconfig $(Kconfig);           \
                         mv -f .config.old.1 .config.old)               \
        else                                                            \
                        mv -f .tmp.config .config;                      \
-                       $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
+                       $< $(silent) --oldconfig $(Kconfig);            \
        fi
        $(Q)rm -f .tmp.config
 
@@ -92,12 +92,21 @@ PHONY += $(simple-targets)
 $(simple-targets): $(obj)/conf
        $< $(silent) --$@ $(Kconfig)
 
-PHONY += oldnoconfig savedefconfig defconfig
+PHONY += oldnoconfig silentoldconfig savedefconfig defconfig
 
 # oldnoconfig is an alias of olddefconfig, because people already are dependent
 # on its behavior (sets new symbols to their default value but not 'n') with the
 # counter-intuitive name.
 oldnoconfig: olddefconfig
+       @echo "  WARNING: \"oldnoconfig\" target will be removed after Linux 4.19"
+       @echo "            Please use \"olddefconfig\" instead, which is an alias."
+
+# We do not expect manual invokcation of "silentoldcofig" (or "syncconfig").
+silentoldconfig: syncconfig
+       @echo "  WARNING: \"silentoldconfig\" has been renamed to \"syncconfig\""
+       @echo "            and is now an internal implementation detail."
+       @echo "            What you want is probably \"oldconfig\"."
+       @echo "            \"silentoldconfig\" will be removed after Linux 4.19"
 
 savedefconfig: $(obj)/conf
        $< $(silent) --$@=defconfig $(Kconfig)
@@ -141,6 +150,14 @@ PHONY += tinyconfig
 tinyconfig:
        $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
 
+# CHECK: -o cache_dir=<path> working?
+PHONY += testconfig
+testconfig: $(obj)/conf
+       $(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \
+       -o cache_dir=$(abspath $(obj)/tests/.cache) \
+       $(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no)
+clean-dirs += tests/.cache
+
 # Help text used by make help
 help:
        @echo  '  config          - Update current config utilising a line-oriented program'
@@ -152,7 +169,6 @@ help:
        @echo  '  oldconfig       - Update current config utilising a provided .config as base'
        @echo  '  localmodconfig  - Update current config disabling modules not loaded'
        @echo  '  localyesconfig  - Update current config converting local mods to core'
-       @echo  '  silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
        @echo  '  defconfig       - New config with default from ARCH supplied defconfig'
        @echo  '  savedefconfig   - Save current config as ./defconfig (minimal config)'
        @echo  '  allnoconfig     - New config where all options are answered with no'
@@ -161,8 +177,8 @@ help:
        @echo  '  alldefconfig    - New config with all symbols set to default'
        @echo  '  randconfig      - New config with random answer to all options'
        @echo  '  listnewconfig   - List new options'
-       @echo  '  olddefconfig    - Same as silentoldconfig but sets new symbols to their'
-       @echo  '                    default value'
+       @echo  '  olddefconfig    - Same as oldconfig but sets new symbols to their'
+       @echo  '                    default value without prompting'
 #      @echo  '  kvmconfig       - Enable additional options for kvm guest kernel support'
 #      @echo  '  xenconfig       - Enable additional options for xen dom0 and guest kernel support'
 #      @echo  '  tinyconfig      - Configure the tiniest possible kernel'
@@ -201,13 +217,14 @@ gconf-objs        := gconf.o zconf.tab.o
 
 hostprogs-y := conf nconf mconf kxgettext qconf gconf
 
+targets                += zconf.lex.c
 clean-files    := qconf.moc .tmp_qtcheck .tmp_gtkcheck
-clean-files    += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h
+clean-files    += gconf.glade.h
 clean-files     += config.pot linux.pot
 
 # Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
 PHONY += $(obj)/dochecklxdialog
-$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
+$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/dochecklxdialog
 $(obj)/dochecklxdialog:
        $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
 
@@ -215,14 +232,12 @@ always := dochecklxdialog
 
 # Add environment specific flags
 HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
+HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS))
 
 # generated files seem to need this to find local include files
 HOSTCFLAGS_zconf.lex.o := -I$(src)
 HOSTCFLAGS_zconf.tab.o := -I$(src)
 
-LEX_PREFIX_zconf       := zconf
-YACC_PREFIX_zconf      := zconf
-
 HOSTLOADLIBES_qconf    = $(KC_QT_LIBS)
 HOSTCXXFLAGS_qconf.o   = $(KC_QT_CFLAGS)
 
@@ -291,7 +306,7 @@ $(obj)/.tmp_gtkcheck:
        fi
 endif
 
-$(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c
+$(obj)/zconf.tab.o: $(obj)/zconf.lex.c
 
 $(obj)/qconf.o: $(obj)/qconf.moc
 
index 55b79ba1ba2a5e4c84cb6cc3bf5f25dbb92a3e89..97f0fee7d17377d712f7e117c590e6e75a4577a4 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
 # Needed for systems without gettext
 $* -x c -o /dev/null - > /dev/null 2>&1 << EOF
 #include <libintl.h>
index 866369f10ff84f4d2cae14eb6dfbe7e353c08adf..283eeedaa4fa57c56568de51eac4bdb0bd52b227 100644 (file)
 
 static void conf(struct menu *menu);
 static void check_conf(struct menu *menu);
-static void xfgets(char *str, int size, FILE *in);
 
 enum input_mode {
        oldaskconfig,
-       silentoldconfig,
+       syncconfig,
        oldconfig,
        allnoconfig,
        allyesconfig,
@@ -35,11 +34,11 @@ enum input_mode {
        savedefconfig,
        listnewconfig,
        olddefconfig,
-} input_mode = oldaskconfig;
+};
+static enum input_mode input_mode = oldaskconfig;
 
 static int indent = 1;
 static int tty_stdio;
-static int valid_stdin = 1;
 static int sync_kconfig;
 static int conf_cnt;
 static char line[PATH_MAX];
@@ -72,14 +71,14 @@ static void strip(char *str)
                *p-- = 0;
 }
 
-static void check_stdin(void)
+/* Helper function to facilitate fgets() by Jean Sacren. */
+static void xfgets(char *str, int size, FILE *in)
 {
-       if (!valid_stdin) {
-               printf(_("aborted!\n\n"));
-               printf(_("Console input/output is redirected. "));
-               printf(_("Run 'make oldconfig' to update configuration.\n\n"));
-               exit(1);
-       }
+       if (!fgets(str, size, in))
+               fprintf(stderr, "\nError in reading or end of file.\n");
+
+       if (!tty_stdio)
+               printf("%s", str);
 }
 
 static int conf_askvalue(struct symbol *sym, const char *def)
@@ -101,18 +100,15 @@ static int conf_askvalue(struct symbol *sym, const char *def)
 
        switch (input_mode) {
        case oldconfig:
-       case silentoldconfig:
+       case syncconfig:
                if (sym_has_value(sym)) {
                        printf("%s\n", def);
                        return 0;
                }
-               check_stdin();
                /* fall through */
        case oldaskconfig:
                fflush(stdout);
                xfgets(line, sizeof(line), stdin);
-               if (!tty_stdio)
-                       printf("\n");
                return 1;
        default:
                break;
@@ -192,9 +188,7 @@ static int conf_sym(struct menu *menu)
                        printf("/m");
                if (oldval != yes && sym_tristate_within_range(sym, yes))
                        printf("/y");
-               if (menu_has_help(menu))
-                       printf("/?");
-               printf("] ");
+               printf("/?] ");
                if (!conf_askvalue(sym, sym_get_string_value(sym)))
                        return 0;
                strip(line);
@@ -296,19 +290,15 @@ static int conf_choice(struct menu *menu)
                        printf("[1]: 1\n");
                        goto conf_childs;
                }
-               printf("[1-%d", cnt);
-               if (menu_has_help(menu))
-                       printf("?");
-               printf("]: ");
+               printf("[1-%d?]: ", cnt);
                switch (input_mode) {
                case oldconfig:
-               case silentoldconfig:
+               case syncconfig:
                        if (!is_new) {
                                cnt = def;
                                printf("%d\n", cnt);
                                break;
                        }
-                       check_stdin();
                        /* fall through */
                case oldaskconfig:
                        fflush(stdout);
@@ -368,10 +358,11 @@ static void conf(struct menu *menu)
 
                switch (prop->type) {
                case P_MENU:
-                       if ((input_mode == silentoldconfig ||
-                            input_mode == listnewconfig ||
-                            input_mode == olddefconfig) &&
-                           rootEntry != menu) {
+                       /*
+                        * Except in oldaskconfig mode, we show only menus that
+                        * contain new symbols.
+                        */
+                       if (input_mode != oldaskconfig && rootEntry != menu) {
                                check_conf(menu);
                                return;
                        }
@@ -431,10 +422,20 @@ static void check_conf(struct menu *menu)
                if (sym_is_changable(sym) ||
                    (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
                        if (input_mode == listnewconfig) {
-                               if (sym->name && !sym_is_choice_value(sym)) {
-                                       printf("%s%s\n", CONFIG_, sym->name);
+                               if (sym->name) {
+                                       const char *str;
+
+                                       if (sym->type == S_STRING) {
+                                               str = sym_get_string_value(sym);
+                                               str = sym_escape_string_value(str);
+                                               printf("%s%s=%s\n", CONFIG_, sym->name, str);
+                                               free((void *)str);
+                                       } else {
+                                               str = sym_get_string_value(sym);
+                                               printf("%s%s=%s\n", CONFIG_, sym->name, str);
+                                       }
                                }
-                       } else if (input_mode != olddefconfig) {
+                       } else {
                                if (!conf_cnt++)
                                        printf(_("*\n* Restart config...\n*\n"));
                                rootEntry = menu_get_parent_menu(menu);
@@ -450,7 +451,7 @@ static void check_conf(struct menu *menu)
 static struct option long_opts[] = {
        {"oldaskconfig",    no_argument,       NULL, oldaskconfig},
        {"oldconfig",       no_argument,       NULL, oldconfig},
-       {"silentoldconfig", no_argument,       NULL, silentoldconfig},
+       {"syncconfig",      no_argument,       NULL, syncconfig},
        {"defconfig",       optional_argument, NULL, defconfig},
        {"savedefconfig",   required_argument, NULL, savedefconfig},
        {"allnoconfig",     no_argument,       NULL, allnoconfig},
@@ -477,8 +478,9 @@ static void conf_usage(const char *progname)
        printf("  --listnewconfig         List new options\n");
        printf("  --oldaskconfig          Start a new configuration using a line-oriented program\n");
        printf("  --oldconfig             Update a configuration using a provided .config as base\n");
-       printf("  --silentoldconfig       Same as oldconfig, but quietly, additionally update deps\n");
-       printf("  --olddefconfig          Same as silentoldconfig but sets new symbols to their default value\n");
+       printf("  --syncconfig            Similar to oldconfig but generates configuration in\n"
+              "                          include/{generated/,config/}\n");
+       printf("  --olddefconfig          Same as oldconfig but sets new symbols to their default value\n");
        printf("  --oldnoconfig           An alias of olddefconfig\n");
        printf("  --defconfig <file>      New config with default defined in <file>\n");
        printf("  --savedefconfig <file>  Save the minimal current configuration to <file>\n");
@@ -500,7 +502,7 @@ int main(int ac, char **av)
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
 
-       tty_stdio = isatty(0) && isatty(1) && isatty(2);
+       tty_stdio = isatty(0) && isatty(1);
 
        while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) {
                if (opt == 's') {
@@ -509,7 +511,7 @@ int main(int ac, char **av)
                }
                input_mode = (enum input_mode)opt;
                switch (opt) {
-               case silentoldconfig:
+               case syncconfig:
                        sync_kconfig = 1;
                        break;
                case defconfig:
@@ -557,7 +559,7 @@ int main(int ac, char **av)
                }
        }
        if (ac == optind) {
-               printf(_("%s: Kconfig file missing\n"), av[0]);
+               fprintf(stderr, _("%s: Kconfig file missing\n"), av[0]);
                conf_usage(progname);
                exit(1);
        }
@@ -582,14 +584,16 @@ int main(int ac, char **av)
                if (!defconfig_file)
                        defconfig_file = conf_get_default_confname();
                if (conf_read(defconfig_file)) {
-                       printf(_("***\n"
-                               "*** Can't find default configuration \"%s\"!\n"
-                               "***\n"), defconfig_file);
+                       fprintf(stderr,
+                               _("***\n"
+                                 "*** Can't find default configuration \"%s\"!\n"
+                                 "***\n"),
+                               defconfig_file);
                        exit(1);
                }
                break;
        case savedefconfig:
-       case silentoldconfig:
+       case syncconfig:
        case oldaskconfig:
        case oldconfig:
        case listnewconfig:
@@ -642,7 +646,6 @@ int main(int ac, char **av)
                                return 1;
                        }
                }
-               valid_stdin = tty_stdio;
        }
 
        switch (input_mode) {
@@ -670,24 +673,24 @@ int main(int ac, char **av)
        case oldaskconfig:
                rootEntry = &rootmenu;
                conf(&rootmenu);
-               input_mode = silentoldconfig;
+               input_mode = oldconfig;
                /* fall through */
        case oldconfig:
        case listnewconfig:
-       case olddefconfig:
-       case silentoldconfig:
+       case syncconfig:
                /* Update until a loop caused no more changes */
                do {
                        conf_cnt = 0;
                        check_conf(&rootmenu);
-               } while (conf_cnt &&
-                        (input_mode != listnewconfig &&
-                         input_mode != olddefconfig));
+               } while (conf_cnt);
+               break;
+       case olddefconfig:
+       default:
                break;
        }
 
        if (sync_kconfig) {
-               /* silentoldconfig is used during the build so we shall update autoconf.
+               /* syncconfig is used during the build so we shall update autoconf.
                 * All other commands are only used to generate a config.
                 */
                if (conf_get_changed() && conf_write(NULL)) {
@@ -712,12 +715,3 @@ int main(int ac, char **av)
        }
        return 0;
 }
-
-/*
- * Helper function to facilitate fgets() by Jean Sacren.
- */
-void xfgets(char *str, int size, FILE *in)
-{
-       if (fgets(str, size, in) == NULL)
-               fprintf(stderr, "\nError in reading or end of file.\n");
-}
index 745cb93050ef42aeb2a62e9da53b302b2c192220..e4cbb87d760bfffb2935a95a4fc4da0b2495cb8c 100644 (file)
@@ -28,7 +28,7 @@ static void conf_message(const char *fmt, ...)
        __attribute__ ((format (printf, 1, 2)));
 
 static const char *conf_filename;
-static int conf_lineno, conf_warnings, conf_unsaved;
+static int conf_lineno, conf_warnings;
 
 const char conf_defname[] = "arch/$ARCH/defconfig";
 
@@ -174,7 +174,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
        case S_HEX:
        done:
                if (sym_string_valid(sym, p)) {
-                       sym->def[def].val = strdup(p);
+                       sym->def[def].val = xstrdup(p);
                        sym->flags |= def_flags;
                } else {
                        if (def != S_DEF_AUTO)
@@ -197,7 +197,7 @@ static int add_byte(int c, char **lineptr, size_t slen, size_t *n)
        if (new_size > *n) {
                new_size += LINE_GROWTH - 1;
                new_size *= 2;
-               nline = realloc(*lineptr, new_size);
+               nline = xrealloc(*lineptr, new_size);
                if (!nline)
                        return -1;
 
@@ -286,7 +286,6 @@ load:
        conf_filename = name;
        conf_lineno = 0;
        conf_warnings = 0;
-       conf_unsaved = 0;
 
        def_flags = SYMBOL_DEF << def;
        for_all_symbols(i, sym) {
@@ -405,6 +404,7 @@ setsym:
 int conf_read(const char *name)
 {
        struct symbol *sym;
+       int conf_unsaved = 0;
        int i;
 
        sym_set_change_count(0);
@@ -1121,7 +1121,7 @@ void set_all_choice_values(struct symbol *csym)
 bool conf_set_all_new_symbols(enum conf_def_mode mode)
 {
        struct symbol *sym, *csym;
-       int i, cnt, pby, pty, ptm;      /* pby: probability of boolean  = y
+       int i, cnt, pby, pty, ptm;      /* pby: probability of bool     = y
                                         * pty: probability of tristate = y
                                         * ptm: probability of tristate = m
                                         */
index cbf4996dd9c1045ecc7ffa66a9ec79edd99b1038..e1a39e90841d809451517c7dc2b8b51cf424c329 100644 (file)
@@ -94,7 +94,7 @@ struct expr *expr_copy(const struct expr *org)
                e->right.expr = expr_copy(org->right.expr);
                break;
        default:
-               printf("can't copy type %d\n", e->type);
+               fprintf(stderr, "can't copy type %d\n", e->type);
                free(e);
                e = NULL;
                break;
@@ -113,7 +113,7 @@ void expr_free(struct expr *e)
                break;
        case E_NOT:
                expr_free(e->left.expr);
-               return;
+               break;
        case E_EQUAL:
        case E_GEQ:
        case E_GTH:
@@ -127,7 +127,7 @@ void expr_free(struct expr *e)
                expr_free(e->right.expr);
                break;
        default:
-               printf("how to free type %d?\n", e->type);
+               fprintf(stderr, "how to free type %d?\n", e->type);
                break;
        }
        free(e);
@@ -138,8 +138,18 @@ static int trans_count;
 #define e1 (*ep1)
 #define e2 (*ep2)
 
+/*
+ * expr_eliminate_eq() helper.
+ *
+ * Walks the two expression trees given in 'ep1' and 'ep2'. Any node that does
+ * not have type 'type' (E_OR/E_AND) is considered a leaf, and is compared
+ * against all other leaves. Two equal leaves are both replaced with either 'y'
+ * or 'n' as appropriate for 'type', to be eliminated later.
+ */
 static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct expr **ep2)
 {
+       /* Recurse down to leaves */
+
        if (e1->type == type) {
                __expr_eliminate_eq(type, &e1->left.expr, &e2);
                __expr_eliminate_eq(type, &e1->right.expr, &e2);
@@ -150,12 +160,18 @@ static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct e
                __expr_eliminate_eq(type, &e1, &e2->right.expr);
                return;
        }
+
+       /* e1 and e2 are leaves. Compare them. */
+
        if (e1->type == E_SYMBOL && e2->type == E_SYMBOL &&
            e1->left.sym == e2->left.sym &&
            (e1->left.sym == &symbol_yes || e1->left.sym == &symbol_no))
                return;
        if (!expr_eq(e1, e2))
                return;
+
+       /* e1 and e2 are equal leaves. Prepare them for elimination. */
+
        trans_count++;
        expr_free(e1); expr_free(e2);
        switch (type) {
@@ -172,6 +188,35 @@ static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct e
        }
 }
 
+/*
+ * Rewrites the expressions 'ep1' and 'ep2' to remove operands common to both.
+ * Example reductions:
+ *
+ *     ep1: A && B           ->  ep1: y
+ *     ep2: A && B && C      ->  ep2: C
+ *
+ *     ep1: A || B           ->  ep1: n
+ *     ep2: A || B || C      ->  ep2: C
+ *
+ *     ep1: A && (B && FOO)  ->  ep1: FOO
+ *     ep2: (BAR && B) && A  ->  ep2: BAR
+ *
+ *     ep1: A && (B || C)    ->  ep1: y
+ *     ep2: (C || B) && A    ->  ep2: y
+ *
+ * Comparisons are done between all operands at the same "level" of && or ||.
+ * For example, in the expression 'e1 && (e2 || e3) && (e4 || e5)', the
+ * following operands will be compared:
+ *
+ *     - 'e1', 'e2 || e3', and 'e4 || e5', against each other
+ *     - e2 against e3
+ *     - e4 against e5
+ *
+ * Parentheses are irrelevant within a single level. 'e1 && (e2 && e3)' and
+ * '(e1 && e2) && e3' are both a single level.
+ *
+ * See __expr_eliminate_eq() as well.
+ */
 void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
 {
        if (!e1 || !e2)
@@ -197,6 +242,12 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
 #undef e1
 #undef e2
 
+/*
+ * Returns true if 'e1' and 'e2' are equal, after minor simplification. Two
+ * &&/|| expressions are considered equal if every operand in one expression
+ * equals some operand in the other (operands do not need to appear in the same
+ * order), recursively.
+ */
 static int expr_eq(struct expr *e1, struct expr *e2)
 {
        int res, old_count;
@@ -243,6 +294,17 @@ static int expr_eq(struct expr *e1, struct expr *e2)
        return 0;
 }
 
+/*
+ * Recursively performs the following simplifications in-place (as well as the
+ * corresponding simplifications with swapped operands):
+ *
+ *     expr && n  ->  n
+ *     expr && y  ->  expr
+ *     expr || n  ->  expr
+ *     expr || y  ->  y
+ *
+ * Returns the optimized expression.
+ */
 static struct expr *expr_eliminate_yn(struct expr *e)
 {
        struct expr *tmp;
@@ -516,12 +578,21 @@ static struct expr *expr_join_and(struct expr *e1, struct expr *e2)
        return NULL;
 }
 
+/*
+ * expr_eliminate_dups() helper.
+ *
+ * Walks the two expression trees given in 'ep1' and 'ep2'. Any node that does
+ * not have type 'type' (E_OR/E_AND) is considered a leaf, and is compared
+ * against all other leaves to look for simplifications.
+ */
 static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct expr **ep2)
 {
 #define e1 (*ep1)
 #define e2 (*ep2)
        struct expr *tmp;
 
+       /* Recurse down to leaves */
+
        if (e1->type == type) {
                expr_eliminate_dups1(type, &e1->left.expr, &e2);
                expr_eliminate_dups1(type, &e1->right.expr, &e2);
@@ -532,6 +603,9 @@ static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct
                expr_eliminate_dups1(type, &e1, &e2->right.expr);
                return;
        }
+
+       /* e1 and e2 are leaves. Compare and process them. */
+
        if (e1 == e2)
                return;
 
@@ -568,6 +642,17 @@ static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct
 #undef e2
 }
 
+/*
+ * Rewrites 'e' in-place to remove ("join") duplicate and other redundant
+ * operands.
+ *
+ * Example simplifications:
+ *
+ *     A || B || A    ->  A || B
+ *     A && B && A=y  ->  A=y && B
+ *
+ * Returns the deduplicated expression.
+ */
 struct expr *expr_eliminate_dups(struct expr *e)
 {
        int oldcount;
@@ -584,6 +669,7 @@ struct expr *expr_eliminate_dups(struct expr *e)
                        ;
                }
                if (!trans_count)
+                       /* No simplifications done in this pass. We're done */
                        break;
                e = expr_eliminate_yn(e);
        }
@@ -591,6 +677,12 @@ struct expr *expr_eliminate_dups(struct expr *e)
        return e;
 }
 
+/*
+ * Performs various simplifications involving logical operators and
+ * comparisons.
+ *
+ * Allocates and returns a new expression.
+ */
 struct expr *expr_transform(struct expr *e)
 {
        struct expr *tmp;
@@ -805,6 +897,20 @@ bool expr_depends_symbol(struct expr *dep, struct symbol *sym)
        return false;
 }
 
+/*
+ * Inserts explicit comparisons of type 'type' to symbol 'sym' into the
+ * expression 'e'.
+ *
+ * Examples transformations for type == E_UNEQUAL, sym == &symbol_no:
+ *
+ *     A              ->  A!=n
+ *     !A             ->  A=n
+ *     A && B         ->  !(A=n || B=n)
+ *     A || B         ->  !(A=n && B=n)
+ *     A && (B || C)  ->  !(A=n || (B=n && C=n))
+ *
+ * Allocates and returns a new expression.
+ */
 struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym)
 {
        struct expr *e1, *e2;
@@ -893,7 +999,10 @@ static enum string_value_kind expr_parse_string(const char *str,
        switch (type) {
        case S_BOOLEAN:
        case S_TRISTATE:
-               return k_string;
+               val->s = !strcmp(str, "n") ? 0 :
+                        !strcmp(str, "m") ? 1 :
+                        !strcmp(str, "y") ? 2 : -1;
+               return k_signed;
        case S_INT:
                val->s = strtoll(str, &tail, 10);
                kind = k_signed;
@@ -1028,49 +1137,9 @@ static int expr_compare_type(enum expr_type t1, enum expr_type t2)
        return 0;
 }
 
-static inline struct expr *
-expr_get_leftmost_symbol(const struct expr *e)
-{
-
-       if (e == NULL)
-               return NULL;
-
-       while (e->type != E_SYMBOL)
-               e = e->left.expr;
-
-       return expr_copy(e);
-}
-
-/*
- * Given expression `e1' and `e2', returns the leaf of the longest
- * sub-expression of `e1' not containing 'e2.
- */
-struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
-{
-       struct expr *ret;
-
-       switch (e1->type) {
-       case E_OR:
-               return expr_alloc_and(
-                   expr_simplify_unmet_dep(e1->left.expr, e2),
-                   expr_simplify_unmet_dep(e1->right.expr, e2));
-       case E_AND: {
-               struct expr *e;
-               e = expr_alloc_and(expr_copy(e1), expr_copy(e2));
-               e = expr_eliminate_dups(e);
-               ret = (!expr_eq(e, e1)) ? e1 : NULL;
-               expr_free(e);
-               break;
-               }
-       default:
-               ret = e1;
-               break;
-       }
-
-       return expr_get_leftmost_symbol(ret);
-}
-
-void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
+void expr_print(struct expr *e,
+               void (*fn)(void *, struct symbol *, const char *),
+               void *data, int prevtoken)
 {
        if (!e) {
                fn(data, NULL, "y");
@@ -1204,3 +1273,33 @@ void expr_gstr_print(struct expr *e, struct gstr *gs)
 {
        expr_print(e, expr_print_gstr_helper, gs, E_NONE);
 }
+
+/*
+ * Transform the top level "||" tokens into newlines and prepend each
+ * line with a minus. This makes expressions much easier to read.
+ * Suitable for reverse dependency expressions.
+ */
+static void expr_print_revdep(struct expr *e,
+                             void (*fn)(void *, struct symbol *, const char *),
+                             void *data, tristate pr_type, const char **title)
+{
+       if (e->type == E_OR) {
+               expr_print_revdep(e->left.expr, fn, data, pr_type, title);
+               expr_print_revdep(e->right.expr, fn, data, pr_type, title);
+       } else if (expr_calc_value(e) == pr_type) {
+               if (*title) {
+                       fn(data, NULL, *title);
+                       *title = NULL;
+               }
+
+               fn(data, NULL, "  - ");
+               expr_print(e, fn, data, E_NONE);
+               fn(data, NULL, "\n");
+       }
+}
+
+void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
+                           tristate pr_type, const char *title)
+{
+       expr_print_revdep(e, expr_print_gstr_helper, gs, pr_type, &title);
+}
index a73f762c48d6964e1ef7adb97bfea9e8fb471078..94a383b21df6405f4a9f6b6c08758d6c822381d8 100644 (file)
@@ -74,17 +74,60 @@ enum {
        S_DEF_COUNT
 };
 
+/*
+ * Represents a configuration symbol.
+ *
+ * Choices are represented as a special kind of symbol and have the
+ * SYMBOL_CHOICE bit set in 'flags'.
+ */
 struct symbol {
+       /* The next symbol in the same bucket in the symbol hash table */
        struct symbol *next;
+
+       /* The name of the symbol, e.g. "FOO" for 'config FOO' */
        char *name;
+
+       /* S_BOOLEAN, S_TRISTATE, ... */
        enum symbol_type type;
+
+       /*
+        * The calculated value of the symbol. The SYMBOL_VALID bit is set in
+        * 'flags' when this is up to date. Note that this value might differ
+        * from the user value set in e.g. a .config file, due to visibility.
+        */
        struct symbol_value curr;
+
+       /*
+        * Values for the symbol provided from outside. def[S_DEF_USER] holds
+        * the .config value.
+        */
        struct symbol_value def[S_DEF_COUNT];
+
+       /*
+        * An upper bound on the tristate value the user can set for the symbol
+        * if it is a boolean or tristate. Calculated from prompt dependencies,
+        * which also inherit dependencies from enclosing menus, choices, and
+        * ifs. If 'n', the user value will be ignored.
+        *
+        * Symbols lacking prompts always have visibility 'n'.
+        */
        tristate visible;
+
+       /* SYMBOL_* flags */
        int flags;
+
+       /* List of properties. See prop_type. */
        struct property *prop;
+
+       /* Dependencies from enclosing menus, choices, and ifs */
        struct expr_value dir_dep;
+
+       /* Reverse dependencies through being selected by other symbols */
        struct expr_value rev_dep;
+
+       /*
+        * "Weak" reverse dependencies through being implied by other symbols
+        */
        struct expr_value implied;
 };
 
@@ -133,7 +176,7 @@ enum prop_type {
        P_UNKNOWN,
        P_PROMPT,   /* prompt "foo prompt" or "BAZ Value" */
        P_COMMENT,  /* text associated with a comment */
-       P_MENU,     /* prompt associated with a menuconfig option */
+       P_MENU,     /* prompt associated with a menu or menuconfig symbol */
        P_DEFAULT,  /* default y */
        P_CHOICE,   /* choice value */
        P_SELECT,   /* select BAR */
@@ -166,22 +209,67 @@ struct property {
        for (st = sym->prop; st; st = st->next) \
                if (st->text)
 
+/*
+ * Represents a node in the menu tree, as seen in e.g. menuconfig (though used
+ * for all front ends). Each symbol, menu, etc. defined in the Kconfig files
+ * gets a node. A symbol defined in multiple locations gets one node at each
+ * location.
+ */
 struct menu {
+       /* The next menu node at the same level */
        struct menu *next;
+
+       /* The parent menu node, corresponding to e.g. a menu or choice */
        struct menu *parent;
+
+       /* The first child menu node, for e.g. menus and choices */
        struct menu *list;
+
+       /*
+        * The symbol associated with the menu node. Choices are implemented as
+        * a special kind of symbol. NULL for menus, comments, and ifs.
+        */
        struct symbol *sym;
+
+       /*
+        * The prompt associated with the node. This holds the prompt for a
+        * symbol as well as the text for a menu or comment, along with the
+        * type (P_PROMPT, P_MENU, etc.)
+        */
        struct property *prompt;
+
+       /*
+        * 'visible if' dependencies. If more than one is given, they will be
+        * ANDed together.
+        */
        struct expr *visibility;
+
+       /*
+        * Ordinary dependencies from e.g. 'depends on' and 'if', ANDed
+        * together
+        */
        struct expr *dep;
+
+       /* MENU_* flags */
        unsigned int flags;
+
+       /* Any help text associated with the node */
        char *help;
+
+       /* The location where the menu node appears in the Kconfig files */
        struct file *file;
        int lineno;
+
+       /* For use by front ends that need to store auxiliary data */
        void *data;
 };
 
+/*
+ * Set on a menu node when the corresponding symbol changes state in some way.
+ * Can be checked by front ends.
+ */
 #define MENU_CHANGED           0x0001
+
 #define MENU_ROOT              0x0002
 
 struct jump_key {
@@ -217,11 +305,12 @@ struct expr *expr_transform(struct expr *e);
 int expr_contains_symbol(struct expr *dep, struct symbol *sym);
 bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
 struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
-struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
 
 void expr_fprint(struct expr *e, FILE *out);
 struct gstr; /* forward */
 void expr_gstr_print(struct expr *e, struct gstr *gs);
+void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
+                           tristate pr_type, const char *title);
 
 static inline int expr_is_yes(struct expr *e)
 {
index 26d208b435a0d347b8f11df13bcb79cf3618770c..cfddddb9c9d722b63c522450a5b277a4fd22d318 100644 (file)
@@ -914,7 +914,7 @@ on_treeview2_button_press_event(GtkWidget * widget,
                        current = menu;
                        display_tree_part();
                        gtk_widget_set_sensitive(back_btn, TRUE);
-               } else if ((col == COL_OPTION)) {
+               } else if (col == COL_OPTION) {
                        toggle_sym_value(menu);
                        gtk_tree_view_expand_row(view, path, TRUE);
                }
diff --git a/scripts/kconfig/kconf_id.c b/scripts/kconfig/kconf_id.c
new file mode 100644 (file)
index 0000000..3ea9c5f
--- /dev/null
@@ -0,0 +1,53 @@
+
+static struct kconf_id kconf_id_array[] = {
+       { "mainmenu",           T_MAINMENU,             TF_COMMAND },
+       { "menu",               T_MENU,                 TF_COMMAND },
+       { "endmenu",            T_ENDMENU,              TF_COMMAND },
+       { "source",             T_SOURCE,               TF_COMMAND },
+       { "choice",             T_CHOICE,               TF_COMMAND },
+       { "endchoice",          T_ENDCHOICE,            TF_COMMAND },
+       { "comment",            T_COMMENT,              TF_COMMAND },
+       { "config",             T_CONFIG,               TF_COMMAND },
+       { "menuconfig",         T_MENUCONFIG,           TF_COMMAND },
+       { "help",               T_HELP,                 TF_COMMAND },
+       { "---help---",         T_HELP,                 TF_COMMAND },
+       { "if",                 T_IF,                   TF_COMMAND|TF_PARAM },
+       { "endif",              T_ENDIF,                TF_COMMAND },
+       { "depends",            T_DEPENDS,              TF_COMMAND },
+       { "optional",           T_OPTIONAL,             TF_COMMAND },
+       { "default",            T_DEFAULT,              TF_COMMAND, S_UNKNOWN },
+       { "prompt",             T_PROMPT,               TF_COMMAND },
+       { "tristate",           T_TYPE,                 TF_COMMAND, S_TRISTATE },
+       { "def_tristate",       T_DEFAULT,              TF_COMMAND, S_TRISTATE },
+       { "bool",               T_TYPE,                 TF_COMMAND, S_BOOLEAN },
+       { "def_bool",           T_DEFAULT,              TF_COMMAND, S_BOOLEAN },
+       { "int",                T_TYPE,                 TF_COMMAND, S_INT },
+       { "hex",                T_TYPE,                 TF_COMMAND, S_HEX },
+       { "string",             T_TYPE,                 TF_COMMAND, S_STRING },
+       { "select",             T_SELECT,               TF_COMMAND },
+       { "imply",              T_IMPLY,                TF_COMMAND },
+       { "range",              T_RANGE,                TF_COMMAND },
+       { "visible",            T_VISIBLE,              TF_COMMAND },
+       { "option",             T_OPTION,               TF_COMMAND },
+       { "on",                 T_ON,                   TF_PARAM },
+       { "modules",            T_OPT_MODULES,          TF_OPTION },
+       { "defconfig_list",     T_OPT_DEFCONFIG_LIST,   TF_OPTION },
+       { "env",                T_OPT_ENV,              TF_OPTION },
+       { "allnoconfig_y",      T_OPT_ALLNOCONFIG_Y,    TF_OPTION },
+};
+
+#define KCONF_ID_ARRAY_SIZE (sizeof(kconf_id_array)/sizeof(struct kconf_id))
+
+static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len)
+{
+       int i;
+
+       for (i = 0; i < KCONF_ID_ARRAY_SIZE; i++) {
+               struct kconf_id *id = kconf_id_array+i;
+               int l = strlen(id->name);
+
+               if (len == l && !memcmp(str, id->name, len))
+                       return id;
+       }
+       return NULL;
+}
index 2858738b22d5aeac27154f74af433540839d37a6..240880a89111df06e95da0b44b08fa8aa184fa58 100644 (file)
@@ -101,7 +101,7 @@ static struct message *message__new(const char *msg, char *option,
        if (self->files == NULL)
                goto out_fail;
 
-       self->msg = strdup(msg);
+       self->msg = xstrdup(msg);
        if (self->msg == NULL)
                goto out_fail_msg;
 
index 2cf23f002d3f48f6b51ac9898fde7681ea39cf53..45cb237ab7ef7a9f17779647220da6a30afd06fc 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #ifndef LIST_H
 #define LIST_H
 
index 91ca126ea0802e40278bbbf09b3413ce59c1bc15..f4394af6e4b81c8d0c0f18acf6eb97852e79cc72 100644 (file)
@@ -62,12 +62,13 @@ enum conf_def_mode {
 #define T_OPT_ALLNOCONFIG_Y    4
 
 struct kconf_id {
-       int name;
+       const char *name;
        int token;
        unsigned int flags;
        enum symbol_type stype;
 };
 
+extern int yylineno;
 void zconfdump(FILE *out);
 void zconf_starthelp(void);
 FILE *zconf_fopen(const char *name);
@@ -100,7 +101,6 @@ void menu_warn(struct menu *menu, const char *fmt, ...);
 struct menu *menu_add_menu(void);
 void menu_end_menu(void);
 void menu_add_entry(struct symbol *sym);
-void menu_end_entry(void);
 void menu_add_dep(struct expr *dep);
 void menu_add_visibility(struct expr *dep);
 struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
@@ -115,6 +115,8 @@ struct file *file_lookup(const char *name);
 int file_write_dep(const char *name);
 void *xmalloc(size_t size);
 void *xcalloc(size_t nmemb, size_t size);
+void *xrealloc(void *p, size_t size);
+char *xstrdup(const char *s);
 
 struct gstr {
        size_t len;
index d5398718ec2ae3337dac3cb3d19654c8508c3007..9dc8abfb1dc3cf1aa6d6753940c909e1dd4ec889 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <stdarg.h>
 
 /* confdata.c */
@@ -30,7 +31,7 @@ extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
 
 struct symbol * sym_lookup(const char *name, int flags);
 struct symbol * sym_find(const char *name);
-const char * sym_expand_string_value(const char *in);
+char *sym_expand_string_value(const char *in);
 const char * sym_escape_string_value(const char *in);
 struct symbol ** sym_re_search(const char *pattern);
 const char * sym_type_name(enum symbol_type type);
index 5075ebf2d3b995bee04c146d942abce4515b4559..6c0bcd9c472d6bee0b9fdadab18e9d46e5b05cdb 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
 # Check ncurses compatibility
 
 # What library to link
@@ -54,7 +55,8 @@ EOF
            echo " *** required header files."                            1>&2
            echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
            echo " *** "                                                  1>&2
-           echo " *** Install ncurses (ncurses-devel) and try again."    1>&2
+           echo " *** Install ncurses (ncurses-devel or libncurses-dev " 1>&2
+           echo " *** depending on your distribution) and try again."    1>&2
            echo " *** "                                                  1>&2
            exit 1
        fi
index 315ce2c7cb9dbc48b545329ee144c27e569d5c81..c829be8bb19fb3e0b37ee72a7e632074dd3f1b11 100644 (file)
@@ -246,7 +246,7 @@ search_help[] = N_(
        "  Selected by: BAR [=n]\n"
        "-----------------------------------------------------------------\n"
        "o The line 'Type:' shows the type of the configuration option for\n"
-       "  this symbol (boolean, tristate, string, ...)\n"
+       "  this symbol (bool, tristate, string, ...)\n"
        "o The line 'Prompt:' shows the text used in the menu structure for\n"
        "  this symbol\n"
        "o The 'Defined at' line tells at what file / line number the symbol\n"
index e9357931b47db3fdf7f63da842a045697e038ed9..5c5c1374b151f2a3b25217817d68a0af4b8a120f 100644 (file)
@@ -62,13 +62,8 @@ void menu_add_entry(struct symbol *sym)
                menu_add_symbol(P_SYMBOL, sym, NULL);
 }
 
-void menu_end_entry(void)
-{
-}
-
 struct menu *menu_add_menu(void)
 {
-       menu_end_entry();
        last_entry_ptr = &current_entry->list;
        return current_menu = current_entry;
 }
@@ -79,19 +74,23 @@ void menu_end_menu(void)
        current_menu = current_menu->parent;
 }
 
-static struct expr *menu_check_dep(struct expr *e)
+/*
+ * Rewrites 'm' to 'm' && MODULES, so that it evaluates to 'n' when running
+ * without modules
+ */
+static struct expr *rewrite_m(struct expr *e)
 {
        if (!e)
                return e;
 
        switch (e->type) {
        case E_NOT:
-               e->left.expr = menu_check_dep(e->left.expr);
+               e->left.expr = rewrite_m(e->left.expr);
                break;
        case E_OR:
        case E_AND:
-               e->left.expr = menu_check_dep(e->left.expr);
-               e->right.expr = menu_check_dep(e->right.expr);
+               e->left.expr = rewrite_m(e->left.expr);
+               e->right.expr = rewrite_m(e->right.expr);
                break;
        case E_SYMBOL:
                /* change 'm' into 'm' && MODULES */
@@ -106,7 +105,7 @@ static struct expr *menu_check_dep(struct expr *e)
 
 void menu_add_dep(struct expr *dep)
 {
-       current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep));
+       current_entry->dep = expr_alloc_and(current_entry->dep, dep);
 }
 
 void menu_set_type(int type)
@@ -131,7 +130,7 @@ static struct property *menu_add_prop(enum prop_type type, char *prompt, struct
 
        prop->menu = current_entry;
        prop->expr = expr;
-       prop->visible.expr = menu_check_dep(dep);
+       prop->visible.expr = dep;
 
        if (prompt) {
                if (isspace(*prompt)) {
@@ -213,6 +212,7 @@ void menu_add_option(int token, char *arg)
                        sym_defconfig_list = current_entry->sym;
                else if (sym_defconfig_list != current_entry->sym)
                        zconf_error("trying to redefine defconfig symbol");
+               sym_defconfig_list->flags |= SYMBOL_AUTO;
                break;
        case T_OPT_ENV:
                prop_add_env(arg);
@@ -252,6 +252,16 @@ static void sym_check_prop(struct symbol *sym)
                                            "'%s': number is invalid",
                                            sym->name);
                        }
+                       if (sym_is_choice(sym)) {
+                               struct property *choice_prop =
+                                       sym_get_choice_prop(sym2);
+
+                               if (!choice_prop ||
+                                   prop_get_symbol(choice_prop) != sym)
+                                       prop_warn(prop,
+                                                 "choice default symbol '%s' is not contained in the choice",
+                                                 sym2->name);
+                       }
                        break;
                case P_SELECT:
                case P_IMPLY:
@@ -260,13 +270,13 @@ static void sym_check_prop(struct symbol *sym)
                        if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE)
                                prop_warn(prop,
                                    "config symbol '%s' uses %s, but is "
-                                   "not boolean or tristate", sym->name, use);
+                                   "not bool or tristate", sym->name, use);
                        else if (sym2->type != S_UNKNOWN &&
                                 sym2->type != S_BOOLEAN &&
                                 sym2->type != S_TRISTATE)
                                prop_warn(prop,
                                    "'%s' has wrong type. '%s' only "
-                                   "accept arguments of boolean and "
+                                   "accept arguments of bool and "
                                    "tristate type", sym2->name, use);
                        break;
                case P_RANGE:
@@ -292,6 +302,11 @@ void menu_finalize(struct menu *parent)
 
        sym = parent->sym;
        if (parent->list) {
+               /*
+                * This menu node has children. We (recursively) process them
+                * and propagate parent dependencies before moving on.
+                */
+
                if (sym && sym_is_choice(sym)) {
                        if (sym->type == S_UNKNOWN) {
                                /* find the first choice value to find out choice type */
@@ -309,30 +324,83 @@ void menu_finalize(struct menu *parent)
                                if (menu->sym && menu->sym->type == S_UNKNOWN)
                                        menu_set_type(sym->type);
                        }
+
+                       /*
+                        * Use the choice itself as the parent dependency of
+                        * the contained items. This turns the mode of the
+                        * choice into an upper bound on the visibility of the
+                        * choice value symbols.
+                        */
                        parentdep = expr_alloc_symbol(sym);
                } else if (parent->prompt)
+                       /* Menu node for 'menu' */
                        parentdep = parent->prompt->visible.expr;
                else
+                       /* Menu node for 'if' */
                        parentdep = parent->dep;
 
+               /* For each child menu node... */
                for (menu = parent->list; menu; menu = menu->next) {
-                       basedep = expr_transform(menu->dep);
+                       /*
+                        * Propagate parent dependencies to the child menu
+                        * node, also rewriting and simplifying expressions
+                        */
+                       basedep = rewrite_m(menu->dep);
+                       basedep = expr_transform(basedep);
                        basedep = expr_alloc_and(expr_copy(parentdep), basedep);
                        basedep = expr_eliminate_dups(basedep);
                        menu->dep = basedep;
+
                        if (menu->sym)
+                               /*
+                                * Note: For symbols, all prompts are included
+                                * too in the symbol's own property list
+                                */
                                prop = menu->sym->prop;
                        else
+                               /*
+                                * For non-symbol menu nodes, we just need to
+                                * handle the prompt
+                                */
                                prop = menu->prompt;
+
+                       /* For each property... */
                        for (; prop; prop = prop->next) {
                                if (prop->menu != menu)
+                                       /*
+                                        * Two possibilities:
+                                        *
+                                        * 1. The property lacks dependencies
+                                        *    and so isn't location-specific,
+                                        *    e.g. an 'option'
+                                        *
+                                        * 2. The property belongs to a symbol
+                                        *    defined in multiple locations and
+                                        *    is from some other location. It
+                                        *    will be handled there in that
+                                        *    case.
+                                        *
+                                        * Skip the property.
+                                        */
                                        continue;
-                               dep = expr_transform(prop->visible.expr);
+
+                               /*
+                                * Propagate parent dependencies to the
+                                * property's condition, rewriting and
+                                * simplifying expressions at the same time
+                                */
+                               dep = rewrite_m(prop->visible.expr);
+                               dep = expr_transform(dep);
                                dep = expr_alloc_and(expr_copy(basedep), dep);
                                dep = expr_eliminate_dups(dep);
                                if (menu->sym && menu->sym->type != S_TRISTATE)
                                        dep = expr_trans_bool(dep);
                                prop->visible.expr = dep;
+
+                               /*
+                                * Handle selects and implies, which modify the
+                                * dependencies of the selected/implied symbol
+                                */
                                if (prop->type == P_SELECT) {
                                        struct symbol *es = prop_get_symbol(prop);
                                        es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr,
@@ -344,34 +412,81 @@ void menu_finalize(struct menu *parent)
                                }
                        }
                }
+
+               if (sym && sym_is_choice(sym))
+                       expr_free(parentdep);
+
+               /*
+                * Recursively process children in the same fashion before
+                * moving on
+                */
                for (menu = parent->list; menu; menu = menu->next)
                        menu_finalize(menu);
        } else if (sym) {
+               /*
+                * Automatic submenu creation. If sym is a symbol and A, B, C,
+                * ... are consecutive items (symbols, menus, ifs, etc.) that
+                * all depend on sym, then the following menu structure is
+                * created:
+                *
+                *      sym
+                *       +-A
+                *       +-B
+                *       +-C
+                *       ...
+                *
+                * This also works recursively, giving the following structure
+                * if A is a symbol and B depends on A:
+                *
+                *      sym
+                *       +-A
+                *       | +-B
+                *       +-C
+                *       ...
+                */
+
                basedep = parent->prompt ? parent->prompt->visible.expr : NULL;
                basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
                basedep = expr_eliminate_dups(expr_transform(basedep));
+
+               /* Examine consecutive elements after sym */
                last_menu = NULL;
                for (menu = parent->next; menu; menu = menu->next) {
                        dep = menu->prompt ? menu->prompt->visible.expr : menu->dep;
                        if (!expr_contains_symbol(dep, sym))
+                               /* No dependency, quit */
                                break;
                        if (expr_depends_symbol(dep, sym))
+                               /* Absolute dependency, put in submenu */
                                goto next;
+
+                       /*
+                        * Also consider it a dependency on sym if our
+                        * dependencies contain sym and are a "superset" of
+                        * sym's dependencies, e.g. '(sym || Q) && R' when sym
+                        * depends on R.
+                        *
+                        * Note that 'R' might be from an enclosing menu or if,
+                        * making this a more common case than it might seem.
+                        */
                        dep = expr_trans_compare(dep, E_UNEQUAL, &symbol_no);
                        dep = expr_eliminate_dups(expr_transform(dep));
                        dep2 = expr_copy(basedep);
                        expr_eliminate_eq(&dep, &dep2);
                        expr_free(dep);
                        if (!expr_is_yes(dep2)) {
+                               /* Not superset, quit */
                                expr_free(dep2);
                                break;
                        }
+                       /* Superset, put in submenu */
                        expr_free(dep2);
                next:
                        menu_finalize(menu);
                        menu->parent = parent;
                        last_menu = menu;
                }
+               expr_free(basedep);
                if (last_menu) {
                        parent->list = parent->next;
                        parent->next = last_menu->next;
@@ -420,6 +535,35 @@ void menu_finalize(struct menu *parent)
                        *ep = expr_alloc_one(E_LIST, NULL);
                        (*ep)->right.sym = menu->sym;
                }
+
+               /*
+                * This code serves two purposes:
+                *
+                * (1) Flattening 'if' blocks, which do not specify a submenu
+                *     and only add dependencies.
+                *
+                *     (Automatic submenu creation might still create a submenu
+                *     from an 'if' before this code runs.)
+                *
+                * (2) "Undoing" any automatic submenus created earlier below
+                *     promptless symbols.
+                *
+                * Before:
+                *
+                *      A
+                *      if ... (or promptless symbol)
+                *       +-B
+                *       +-C
+                *      D
+                *
+                * After:
+                *
+                *      A
+                *      if ... (or promptless symbol)
+                *      B
+                *      C
+                *      D
+                */
                if (menu->list && (!menu->prompt || !menu->prompt->text)) {
                        for (last_menu = menu->list; ; last_menu = last_menu->next) {
                                last_menu->parent = parent;
@@ -444,6 +588,15 @@ void menu_finalize(struct menu *parent)
                sym->flags |= SYMBOL_WARNED;
        }
 
+       /*
+        * For non-optional choices, add a reverse dependency (corresponding to
+        * a select) of '<visibility> && m'. This prevents the user from
+        * setting the choice mode to 'n' when the choice is visible.
+        *
+        * This would also work for non-choice symbols, but only non-optional
+        * choices clear SYMBOL_OPTIONAL as of writing. Choices are implemented
+        * as a type of symbol.
+        */
        if (sym && !sym_is_optional(sym) && parent->prompt) {
                sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr,
                                expr_alloc_and(parent->prompt->visible.expr,
@@ -675,16 +828,16 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
 
        get_symbol_props_str(r, sym, P_SELECT, _("  Selects: "));
        if (sym->rev_dep.expr) {
-               str_append(r, _("  Selected by: "));
-               expr_gstr_print(sym->rev_dep.expr, r);
-               str_append(r, "\n");
+               expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, "  Selected by [y]:\n");
+               expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, "  Selected by [m]:\n");
+               expr_gstr_print_revdep(sym->rev_dep.expr, r, no, "  Selected by [n]:\n");
        }
 
        get_symbol_props_str(r, sym, P_IMPLY, _("  Implies: "));
        if (sym->implied.expr) {
-               str_append(r, _("  Implied by: "));
-               expr_gstr_print(sym->implied.expr, r);
-               str_append(r, "\n");
+               expr_gstr_print_revdep(sym->implied.expr, r, yes, "  Implied by [y]:\n");
+               expr_gstr_print_revdep(sym->implied.expr, r, mod, "  Implied by [m]:\n");
+               expr_gstr_print_revdep(sym->implied.expr, r, no, "  Implied by [n]:\n");
        }
 
        str_append(r, "\n\n");
index a9bc5334a478d6774d1409a837665b4f143d8597..0031147798153bdd06aa5c1f3d6f2015298b5b5d 100644 (file)
@@ -271,7 +271,7 @@ static struct mitem k_menu_items[MAX_MENU_ITEMS];
 static int items_num;
 static int global_exit;
 /* the currently selected button */
-const char *current_instructions = menu_instructions;
+static const char *current_instructions = menu_instructions;
 
 static char *dialog_input_result;
 static int dialog_input_result_len;
@@ -305,7 +305,7 @@ struct function_keys {
 };
 
 static const int function_keys_num = 9;
-struct function_keys function_keys[] = {
+static struct function_keys function_keys[] = {
        {
                .key_str = "F1",
                .func = "Help",
@@ -508,7 +508,7 @@ static int get_mext_match(const char *match_str, match_f flag)
        index = (index + items_num) % items_num;
        while (true) {
                char *str = k_menu_items[index].str;
-               if (strcasestr(str, match_str) != 0)
+               if (strcasestr(str, match_str) != NULL)
                        return index;
                if (flag == FIND_NEXT_MATCH_UP ||
                    flag == MATCH_TINKER_PATTERN_UP)
@@ -1067,7 +1067,7 @@ static int do_match(int key, struct match_state *state, int *ans)
 
 static void conf(struct menu *menu)
 {
-       struct menu *submenu = 0;
+       struct menu *submenu = NULL;
        const char *prompt = menu_get_prompt(menu);
        struct symbol *sym;
        int res;
@@ -1234,7 +1234,7 @@ static void show_help(struct menu *menu)
 static void conf_choice(struct menu *menu)
 {
        const char *prompt = _(menu_get_prompt(menu));
-       struct menu *child = 0;
+       struct menu *child = NULL;
        struct symbol *active;
        int selected_index = 0;
        int last_top_row = 0;
@@ -1456,7 +1456,7 @@ static void conf_save(void)
        }
 }
 
-void setup_windows(void)
+static void setup_windows(void)
 {
        int lines, columns;
 
index 4b2f44c20caf8941d150f261074b40d589a10376..88874acfda3670afe03fd73c3e17c9cf56b0a569 100644 (file)
@@ -6,6 +6,7 @@
  *
  */
 #include "nconf.h"
+#include "lkc.h"
 
 /* a list of all the different widgets we use */
 attributes_t attributes[ATTR_MAX+1] = {0};
@@ -129,7 +130,7 @@ static void no_colors_theme(void)
        mkattrn(FUNCTION_TEXT, A_REVERSE);
 }
 
-void set_colors()
+void set_colors(void)
 {
        start_color();
        use_default_colors();
@@ -192,7 +193,7 @@ const char *get_line(const char *text, int line_no)
        int lines = 0;
 
        if (!text)
-               return 0;
+               return NULL;
 
        for (i = 0; text[i] != '\0' && lines < line_no; i++)
                if (text[i] == '\n')
@@ -374,7 +375,7 @@ int dialog_inputbox(WINDOW *main_window,
 
        if (strlen(init)+1 > *result_len) {
                *result_len = strlen(init)+1;
-               *resultp = result = realloc(result, *result_len);
+               *resultp = result = xrealloc(result, *result_len);
        }
 
        /* find the widest line of msg: */
index 0d5261705ef5c88d162321fe1806b3342b303188..9f6f21d3b0d4674baab323071e5cd4d057d86c2f 100644 (file)
@@ -15,7 +15,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <locale.h>
-#include <curses.h>
+#include <ncurses.h>
 #include <menu.h>
 #include <panel.h>
 #include <form.h>
@@ -24,8 +24,6 @@
 #include <time.h>
 #include <sys/time.h>
 
-#include "ncurses.h"
-
 #define max(a, b) ({\
                typeof(a) _a = a;\
                typeof(b) _b = b;\
index b8c7b29affc59d4da88998a7fd379f6307dc64af..a2e83ab17de3cc2c4c5a15f06b8c0f0eecc4ed99 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Copyright 2005-2009 - Steven Rostedt
 # Licensed under the terms of the GNU GPL License version 2
@@ -42,6 +42,7 @@
 #    mv config_strip .config
 #    make oldconfig
 #
+use warnings;
 use strict;
 use Getopt::Long;
 
index 3c8bd9bb4267a874cd1fa112d4a21b569bd56296..f0b2e3b3102d50f957af12db07e3d4235297dffe 100644 (file)
@@ -77,7 +77,7 @@ const char *sym_type_name(enum symbol_type type)
 {
        switch (type) {
        case S_BOOLEAN:
-               return "boolean";
+               return "bool";
        case S_TRISTATE:
                return "tristate";
        case S_INT:
@@ -183,7 +183,7 @@ static void sym_validate_range(struct symbol *sym)
                sprintf(str, "%lld", val2);
        else
                sprintf(str, "0x%llx", val2);
-       sym->curr.val = strdup(str);
+       sym->curr.val = xstrdup(str);
 }
 
 static void sym_set_changed(struct symbol *sym)
@@ -243,7 +243,7 @@ static void sym_calc_visibility(struct symbol *sym)
        tri = yes;
        if (sym->dir_dep.expr)
                tri = expr_calc_value(sym->dir_dep.expr);
-       if (tri == mod)
+       if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
                tri = yes;
        if (sym->dir_dep.tri != tri) {
                sym->dir_dep.tri = tri;
@@ -333,6 +333,27 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
        return def_sym;
 }
 
+static void sym_warn_unmet_dep(struct symbol *sym)
+{
+       struct gstr gs = str_new();
+
+       str_printf(&gs,
+                  "\nWARNING: unmet direct dependencies detected for %s\n",
+                  sym->name);
+       str_printf(&gs,
+                  "  Depends on [%c]: ",
+                  sym->dir_dep.tri == mod ? 'm' : 'n');
+       expr_gstr_print(sym->dir_dep.expr, &gs);
+       str_printf(&gs, "\n");
+
+       expr_gstr_print_revdep(sym->rev_dep.expr, &gs, yes,
+                              "  Selected by [y]:\n");
+       expr_gstr_print_revdep(sym->rev_dep.expr, &gs, mod,
+                              "  Selected by [m]:\n");
+
+       fputs(str_get(&gs), stderr);
+}
+
 void sym_calc_value(struct symbol *sym)
 {
        struct symbol_value newval, oldval;
@@ -371,11 +392,13 @@ void sym_calc_value(struct symbol *sym)
                sym->curr.tri = no;
                return;
        }
-       if (!sym_is_choice_value(sym))
-               sym->flags &= ~SYMBOL_WRITE;
+       sym->flags &= ~SYMBOL_WRITE;
 
        sym_calc_visibility(sym);
 
+       if (sym->visible != no)
+               sym->flags |= SYMBOL_WRITE;
+
        /* set default if recursively called */
        sym->curr = newval;
 
@@ -390,7 +413,6 @@ void sym_calc_value(struct symbol *sym)
                                /* if the symbol is visible use the user value
                                 * if available, otherwise try the default value
                                 */
-                               sym->flags |= SYMBOL_WRITE;
                                if (sym_has_value(sym)) {
                                        newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
                                                              sym->visible);
@@ -402,9 +424,10 @@ void sym_calc_value(struct symbol *sym)
                        if (!sym_is_choice(sym)) {
                                prop = sym_get_default_prop(sym);
                                if (prop) {
-                                       sym->flags |= SYMBOL_WRITE;
                                        newval.tri = EXPR_AND(expr_calc_value(prop->expr),
                                                              prop->visible.tri);
+                                       if (newval.tri != no)
+                                               sym->flags |= SYMBOL_WRITE;
                                }
                                if (sym->implied.tri != no) {
                                        sym->flags |= SYMBOL_WRITE;
@@ -412,18 +435,8 @@ void sym_calc_value(struct symbol *sym)
                                }
                        }
                calc_newval:
-                       if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
-                               struct expr *e;
-                               e = expr_simplify_unmet_dep(sym->rev_dep.expr,
-                                   sym->dir_dep.expr);
-                               fprintf(stderr, "warning: (");
-                               expr_fprint(e, stderr);
-                               fprintf(stderr, ") selects %s which has unmet direct dependencies (",
-                                       sym->name);
-                               expr_fprint(sym->dir_dep.expr, stderr);
-                               fprintf(stderr, ")\n");
-                               expr_free(e);
-                       }
+                       if (sym->dir_dep.tri < sym->rev_dep.tri)
+                               sym_warn_unmet_dep(sym);
                        newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
                }
                if (newval.tri == mod &&
@@ -433,12 +446,9 @@ void sym_calc_value(struct symbol *sym)
        case S_STRING:
        case S_HEX:
        case S_INT:
-               if (sym->visible != no) {
-                       sym->flags |= SYMBOL_WRITE;
-                       if (sym_has_value(sym)) {
-                               newval.val = sym->def[S_DEF_USER].val;
-                               break;
-                       }
+               if (sym->visible != no && sym_has_value(sym)) {
+                       newval.val = sym->def[S_DEF_USER].val;
+                       break;
                }
                prop = sym_get_default_prop(sym);
                if (prop) {
@@ -851,7 +861,7 @@ struct symbol *sym_lookup(const char *name, int flags)
                                   : !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
                                return symbol;
                }
-               new_name = strdup(name);
+               new_name = xstrdup(name);
        } else {
                new_name = NULL;
                hash = 0;
@@ -901,12 +911,16 @@ struct symbol *sym_find(const char *name)
  * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
  * the empty string.
  */
-const char *sym_expand_string_value(const char *in)
+char *sym_expand_string_value(const char *in)
 {
        const char *src;
        char *res;
        size_t reslen;
 
+       /*
+        * Note: 'in' might come from a token that's about to be
+        * freed, so make sure to always allocate a new string
+        */
        reslen = strlen(in) + 1;
        res = xmalloc(reslen);
        res[0] = '\0';
@@ -934,7 +948,7 @@ const char *sym_expand_string_value(const char *in)
                newlen = strlen(res) + strlen(symval) + strlen(src) + 1;
                if (newlen > reslen) {
                        reslen = newlen;
-                       res = realloc(res, reslen);
+                       res = xrealloc(res, reslen);
                }
 
                strcat(res, symval);
@@ -1150,8 +1164,7 @@ static void sym_check_print_recursive(struct symbol *last_sym)
                if (stack->sym == last_sym)
                        fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
                                prop->file->name, prop->lineno);
-                       fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n");
-                       fprintf(stderr, "subsection \"Kconfig recursive dependency limitations\"\n");
+
                if (stack->expr) {
                        fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
                                prop->file->name, prop->lineno,
@@ -1181,6 +1194,11 @@ static void sym_check_print_recursive(struct symbol *last_sym)
                }
        }
 
+       fprintf(stderr,
+               "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n"
+               "subsection \"Kconfig recursive dependency limitations\"\n"
+               "\n");
+
        if (check_top == &cv_stack)
                dep_stack_remove();
 }
@@ -1215,7 +1233,7 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
        default:
                break;
        }
-       printf("Oops! How to check %d?\n", e->type);
+       fprintf(stderr, "Oops! How to check %d?\n", e->type);
        return NULL;
 }
 
diff --git a/scripts/kconfig/tests/auto_submenu/Kconfig b/scripts/kconfig/tests/auto_submenu/Kconfig
new file mode 100644 (file)
index 0000000..c17bf2c
--- /dev/null
@@ -0,0 +1,50 @@
+config A
+       bool "A"
+       default y
+
+config A0
+       bool "A0"
+       depends on A
+       default y
+       help
+         This depends on A, so should be a submenu of A.
+
+config A0_0
+       bool "A1_0"
+       depends on A0
+       help
+         Submenus are created recursively.
+         This should be a submenu of A0.
+
+config A1
+       bool "A1"
+       depends on A
+       default y
+       help
+         This should line up with A0.
+
+choice
+       prompt "choice"
+       depends on A1
+       help
+         Choice should become a submenu as well.
+
+config A1_0
+       bool "A1_0"
+
+config A1_1
+       bool "A1_1"
+
+endchoice
+
+config B
+       bool "B"
+       help
+         This is independent of A.
+
+config C
+       bool "C"
+       depends on A
+       help
+         This depends on A, but not a consecutive item, so can/should not
+         be a submenu.
diff --git a/scripts/kconfig/tests/auto_submenu/__init__.py b/scripts/kconfig/tests/auto_submenu/__init__.py
new file mode 100644 (file)
index 0000000..32e79b8
--- /dev/null
@@ -0,0 +1,12 @@
+"""
+Create submenu for symbols that depend on the preceding one.
+
+If a symbols has dependency on the preceding symbol, the menu entry
+should become the submenu of the preceding one, and displayed with
+deeper indentation.
+"""
+
+
+def test(conf):
+    assert conf.oldaskconfig() == 0
+    assert conf.stdout_contains('expected_stdout')
diff --git a/scripts/kconfig/tests/auto_submenu/expected_stdout b/scripts/kconfig/tests/auto_submenu/expected_stdout
new file mode 100644 (file)
index 0000000..bf5236f
--- /dev/null
@@ -0,0 +1,10 @@
+A (A) [Y/n/?] (NEW) 
+  A0 (A0) [Y/n/?] (NEW) 
+    A1_0 (A0_0) [N/y/?] (NEW) 
+  A1 (A1) [Y/n/?] (NEW) 
+    choice
+    > 1. A1_0 (A1_0) (NEW)
+      2. A1_1 (A1_1) (NEW)
+    choice[1-2?]: 
+B (B) [N/y/?] (NEW) 
+C (C) [N/y/?] (NEW) 
diff --git a/scripts/kconfig/tests/choice/Kconfig b/scripts/kconfig/tests/choice/Kconfig
new file mode 100644 (file)
index 0000000..cc60e9c
--- /dev/null
@@ -0,0 +1,54 @@
+config MODULES
+       bool "Enable loadable module support"
+       option modules
+       default y
+
+choice
+       prompt "boolean choice"
+       default BOOL_CHOICE1
+
+config BOOL_CHOICE0
+       bool "choice 0"
+
+config BOOL_CHOICE1
+       bool "choice 1"
+
+endchoice
+
+choice
+       prompt "optional boolean choice"
+       optional
+       default OPT_BOOL_CHOICE1
+
+config OPT_BOOL_CHOICE0
+       bool "choice 0"
+
+config OPT_BOOL_CHOICE1
+       bool "choice 1"
+
+endchoice
+
+choice
+       prompt "tristate choice"
+       default TRI_CHOICE1
+
+config TRI_CHOICE0
+       tristate "choice 0"
+
+config TRI_CHOICE1
+       tristate "choice 1"
+
+endchoice
+
+choice
+       prompt "optional tristate choice"
+       optional
+       default OPT_TRI_CHOICE1
+
+config OPT_TRI_CHOICE0
+       tristate "choice 0"
+
+config OPT_TRI_CHOICE1
+       tristate "choice 1"
+
+endchoice
diff --git a/scripts/kconfig/tests/choice/__init__.py b/scripts/kconfig/tests/choice/__init__.py
new file mode 100644 (file)
index 0000000..9edcc52
--- /dev/null
@@ -0,0 +1,40 @@
+"""
+Basic choice tests.
+
+The handling of 'choice' is a bit complicated part in Kconfig.
+
+The behavior of 'y' choice is intuitive.  If choice values are tristate,
+the choice can be 'm' where each value can be enabled independently.
+Also, if a choice is marked as 'optional', the whole choice can be
+invisible.
+"""
+
+
+def test_oldask0(conf):
+    assert conf.oldaskconfig() == 0
+    assert conf.stdout_contains('oldask0_expected_stdout')
+
+
+def test_oldask1(conf):
+    assert conf.oldaskconfig('oldask1_config') == 0
+    assert conf.stdout_contains('oldask1_expected_stdout')
+
+
+def test_allyes(conf):
+    assert conf.allyesconfig() == 0
+    assert conf.config_contains('allyes_expected_config')
+
+
+def test_allmod(conf):
+    assert conf.allmodconfig() == 0
+    assert conf.config_contains('allmod_expected_config')
+
+
+def test_allno(conf):
+    assert conf.allnoconfig() == 0
+    assert conf.config_contains('allno_expected_config')
+
+
+def test_alldef(conf):
+    assert conf.alldefconfig() == 0
+    assert conf.config_contains('alldef_expected_config')
diff --git a/scripts/kconfig/tests/choice/alldef_expected_config b/scripts/kconfig/tests/choice/alldef_expected_config
new file mode 100644 (file)
index 0000000..7a754bf
--- /dev/null
@@ -0,0 +1,5 @@
+CONFIG_MODULES=y
+# CONFIG_BOOL_CHOICE0 is not set
+CONFIG_BOOL_CHOICE1=y
+# CONFIG_TRI_CHOICE0 is not set
+# CONFIG_TRI_CHOICE1 is not set
diff --git a/scripts/kconfig/tests/choice/allmod_expected_config b/scripts/kconfig/tests/choice/allmod_expected_config
new file mode 100644 (file)
index 0000000..f1f5dcd
--- /dev/null
@@ -0,0 +1,9 @@
+CONFIG_MODULES=y
+# CONFIG_BOOL_CHOICE0 is not set
+CONFIG_BOOL_CHOICE1=y
+# CONFIG_OPT_BOOL_CHOICE0 is not set
+CONFIG_OPT_BOOL_CHOICE1=y
+CONFIG_TRI_CHOICE0=m
+CONFIG_TRI_CHOICE1=m
+CONFIG_OPT_TRI_CHOICE0=m
+CONFIG_OPT_TRI_CHOICE1=m
diff --git a/scripts/kconfig/tests/choice/allno_expected_config b/scripts/kconfig/tests/choice/allno_expected_config
new file mode 100644 (file)
index 0000000..b88ee7a
--- /dev/null
@@ -0,0 +1,5 @@
+# CONFIG_MODULES is not set
+# CONFIG_BOOL_CHOICE0 is not set
+CONFIG_BOOL_CHOICE1=y
+# CONFIG_TRI_CHOICE0 is not set
+CONFIG_TRI_CHOICE1=y
diff --git a/scripts/kconfig/tests/choice/allyes_expected_config b/scripts/kconfig/tests/choice/allyes_expected_config
new file mode 100644 (file)
index 0000000..e5a062a
--- /dev/null
@@ -0,0 +1,9 @@
+CONFIG_MODULES=y
+# CONFIG_BOOL_CHOICE0 is not set
+CONFIG_BOOL_CHOICE1=y
+# CONFIG_OPT_BOOL_CHOICE0 is not set
+CONFIG_OPT_BOOL_CHOICE1=y
+# CONFIG_TRI_CHOICE0 is not set
+CONFIG_TRI_CHOICE1=y
+# CONFIG_OPT_TRI_CHOICE0 is not set
+CONFIG_OPT_TRI_CHOICE1=y
diff --git a/scripts/kconfig/tests/choice/oldask0_expected_stdout b/scripts/kconfig/tests/choice/oldask0_expected_stdout
new file mode 100644 (file)
index 0000000..b251bba
--- /dev/null
@@ -0,0 +1,10 @@
+Enable loadable module support (MODULES) [Y/n/?] (NEW) 
+boolean choice
+  1. choice 0 (BOOL_CHOICE0) (NEW)
+> 2. choice 1 (BOOL_CHOICE1) (NEW)
+choice[1-2?]: 
+optional boolean choice [N/y/?] (NEW) 
+tristate choice [M/y/?] (NEW) 
+  choice 0 (TRI_CHOICE0) [N/m/?] (NEW) 
+  choice 1 (TRI_CHOICE1) [N/m/?] (NEW) 
+optional tristate choice [N/m/y/?] (NEW) 
diff --git a/scripts/kconfig/tests/choice/oldask1_config b/scripts/kconfig/tests/choice/oldask1_config
new file mode 100644 (file)
index 0000000..b67bfe3
--- /dev/null
@@ -0,0 +1,2 @@
+# CONFIG_MODULES is not set
+CONFIG_OPT_BOOL_CHOICE0=y
diff --git a/scripts/kconfig/tests/choice/oldask1_expected_stdout b/scripts/kconfig/tests/choice/oldask1_expected_stdout
new file mode 100644 (file)
index 0000000..c2125e9
--- /dev/null
@@ -0,0 +1,15 @@
+Enable loadable module support (MODULES) [N/y/?] 
+boolean choice
+  1. choice 0 (BOOL_CHOICE0) (NEW)
+> 2. choice 1 (BOOL_CHOICE1) (NEW)
+choice[1-2?]: 
+optional boolean choice [Y/n/?] (NEW) 
+optional boolean choice
+> 1. choice 0 (OPT_BOOL_CHOICE0)
+  2. choice 1 (OPT_BOOL_CHOICE1) (NEW)
+choice[1-2?]: 
+tristate choice
+  1. choice 0 (TRI_CHOICE0) (NEW)
+> 2. choice 1 (TRI_CHOICE1) (NEW)
+choice[1-2?]: 
+optional tristate choice [N/y/?] 
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig b/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig
new file mode 100644 (file)
index 0000000..11ac25c
--- /dev/null
@@ -0,0 +1,19 @@
+config MODULES
+       def_bool y
+       option modules
+
+config DEP
+       tristate
+       default m
+
+choice
+       prompt "Tristate Choice"
+
+config CHOICE0
+       tristate "Choice 0"
+
+config CHOICE1
+       tristate "Choice 1"
+       depends on DEP
+
+endchoice
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py b/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
new file mode 100644 (file)
index 0000000..f8d728c
--- /dev/null
@@ -0,0 +1,15 @@
+"""
+Hide tristate choice values with mod dependency in y choice.
+
+If tristate choice values depend on symbols set to 'm', they should be
+hidden when the choice containing them is changed from 'm' to 'y'
+(i.e. exclusive choice).
+
+Related Linux commit: fa64e5f6a35efd5e77d639125d973077ca506074
+"""
+
+
+def test(conf):
+    assert conf.oldaskconfig('config', 'y') == 0
+    assert conf.config_contains('expected_config')
+    assert conf.stdout_contains('expected_stdout')
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/config b/scripts/kconfig/tests/choice_value_with_m_dep/config
new file mode 100644 (file)
index 0000000..3a126b7
--- /dev/null
@@ -0,0 +1,2 @@
+CONFIG_CHOICE0=m
+CONFIG_CHOICE1=m
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/expected_config b/scripts/kconfig/tests/choice_value_with_m_dep/expected_config
new file mode 100644 (file)
index 0000000..4d07b44
--- /dev/null
@@ -0,0 +1,3 @@
+CONFIG_MODULES=y
+CONFIG_DEP=m
+CONFIG_CHOICE0=y
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout b/scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout
new file mode 100644 (file)
index 0000000..2b50ab6
--- /dev/null
@@ -0,0 +1,4 @@
+Tristate Choice [M/y/?] y
+Tristate Choice
+> 1. Choice 0 (CHOICE0)
+choice[1]: 1
diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py
new file mode 100644 (file)
index 0000000..0345ef6
--- /dev/null
@@ -0,0 +1,291 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com>
+#
+
+"""
+Kconfig unit testing framework.
+
+This provides fixture functions commonly used from test files.
+"""
+
+import os
+import pytest
+import shutil
+import subprocess
+import tempfile
+
+CONF_PATH = os.path.abspath(os.path.join('scripts', 'kconfig', 'conf'))
+
+
+class Conf:
+    """Kconfig runner and result checker.
+
+    This class provides methods to run text-based interface of Kconfig
+    (scripts/kconfig/conf) and retrieve the resulted configuration,
+    stdout, and stderr.  It also provides methods to compare those
+    results with expectations.
+    """
+
+    def __init__(self, request):
+        """Create a new Conf instance.
+
+        request: object to introspect the requesting test module
+        """
+        # the directory of the test being run
+        self._test_dir = os.path.dirname(str(request.fspath))
+
+    # runners
+    def _run_conf(self, mode, dot_config=None, out_file='.config',
+                  interactive=False, in_keys=None, extra_env={}):
+        """Run text-based Kconfig executable and save the result.
+
+        mode: input mode option (--oldaskconfig, --defconfig=<file> etc.)
+        dot_config: .config file to use for configuration base
+        out_file: file name to contain the output config data
+        interactive: flag to specify the interactive mode
+        in_keys: key inputs for interactive modes
+        extra_env: additional environments
+        returncode: exit status of the Kconfig executable
+        """
+        command = [CONF_PATH, mode, 'Kconfig']
+
+        # Override 'srctree' environment to make the test as the top directory
+        extra_env['srctree'] = self._test_dir
+
+        # Run Kconfig in a temporary directory.
+        # This directory is automatically removed when done.
+        with tempfile.TemporaryDirectory() as temp_dir:
+
+            # if .config is given, copy it to the working directory
+            if dot_config:
+                shutil.copyfile(os.path.join(self._test_dir, dot_config),
+                                os.path.join(temp_dir, '.config'))
+
+            ps = subprocess.Popen(command,
+                                  stdin=subprocess.PIPE,
+                                  stdout=subprocess.PIPE,
+                                  stderr=subprocess.PIPE,
+                                  cwd=temp_dir,
+                                  env=dict(os.environ, **extra_env))
+
+            # If input key sequence is given, feed it to stdin.
+            if in_keys:
+                ps.stdin.write(in_keys.encode('utf-8'))
+
+            while ps.poll() is None:
+                # For interactive modes such as oldaskconfig, oldconfig,
+                # send 'Enter' key until the program finishes.
+                if interactive:
+                    ps.stdin.write(b'\n')
+
+            self.retcode = ps.returncode
+            self.stdout = ps.stdout.read().decode()
+            self.stderr = ps.stderr.read().decode()
+
+            # Retrieve the resulted config data only when .config is supposed
+            # to exist.  If the command fails, the .config does not exist.
+            # 'listnewconfig' does not produce .config in the first place.
+            if self.retcode == 0 and out_file:
+                with open(os.path.join(temp_dir, out_file)) as f:
+                    self.config = f.read()
+            else:
+                self.config = None
+
+        # Logging:
+        # Pytest captures the following information by default.  In failure
+        # of tests, the captured log will be displayed.  This will be useful to
+        # figure out what has happened.
+
+        print("[command]\n{}\n".format(' '.join(command)))
+
+        print("[retcode]\n{}\n".format(self.retcode))
+
+        print("[stdout]")
+        print(self.stdout)
+
+        print("[stderr]")
+        print(self.stderr)
+
+        if self.config is not None:
+            print("[output for '{}']".format(out_file))
+            print(self.config)
+
+        return self.retcode
+
+    def oldaskconfig(self, dot_config=None, in_keys=None):
+        """Run oldaskconfig.
+
+        dot_config: .config file to use for configuration base (optional)
+        in_key: key inputs (optional)
+        returncode: exit status of the Kconfig executable
+        """
+        return self._run_conf('--oldaskconfig', dot_config=dot_config,
+                              interactive=True, in_keys=in_keys)
+
+    def oldconfig(self, dot_config=None, in_keys=None):
+        """Run oldconfig.
+
+        dot_config: .config file to use for configuration base (optional)
+        in_key: key inputs (optional)
+        returncode: exit status of the Kconfig executable
+        """
+        return self._run_conf('--oldconfig', dot_config=dot_config,
+                              interactive=True, in_keys=in_keys)
+
+    def olddefconfig(self, dot_config=None):
+        """Run olddefconfig.
+
+        dot_config: .config file to use for configuration base (optional)
+        returncode: exit status of the Kconfig executable
+        """
+        return self._run_conf('--olddefconfig', dot_config=dot_config)
+
+    def defconfig(self, defconfig):
+        """Run defconfig.
+
+        defconfig: defconfig file for input
+        returncode: exit status of the Kconfig executable
+        """
+        defconfig_path = os.path.join(self._test_dir, defconfig)
+        return self._run_conf('--defconfig={}'.format(defconfig_path))
+
+    def _allconfig(self, mode, all_config):
+        if all_config:
+            all_config_path = os.path.join(self._test_dir, all_config)
+            extra_env = {'KCONFIG_ALLCONFIG': all_config_path}
+        else:
+            extra_env = {}
+
+        return self._run_conf('--{}config'.format(mode), extra_env=extra_env)
+
+    def allyesconfig(self, all_config=None):
+        """Run allyesconfig.
+
+        all_config: fragment config file for KCONFIG_ALLCONFIG (optional)
+        returncode: exit status of the Kconfig executable
+        """
+        return self._allconfig('allyes', all_config)
+
+    def allmodconfig(self, all_config=None):
+        """Run allmodconfig.
+
+        all_config: fragment config file for KCONFIG_ALLCONFIG (optional)
+        returncode: exit status of the Kconfig executable
+        """
+        return self._allconfig('allmod', all_config)
+
+    def allnoconfig(self, all_config=None):
+        """Run allnoconfig.
+
+        all_config: fragment config file for KCONFIG_ALLCONFIG (optional)
+        returncode: exit status of the Kconfig executable
+        """
+        return self._allconfig('allno', all_config)
+
+    def alldefconfig(self, all_config=None):
+        """Run alldefconfig.
+
+        all_config: fragment config file for KCONFIG_ALLCONFIG (optional)
+        returncode: exit status of the Kconfig executable
+        """
+        return self._allconfig('alldef', all_config)
+
+    def randconfig(self, all_config=None):
+        """Run randconfig.
+
+        all_config: fragment config file for KCONFIG_ALLCONFIG (optional)
+        returncode: exit status of the Kconfig executable
+        """
+        return self._allconfig('rand', all_config)
+
+    def savedefconfig(self, dot_config):
+        """Run savedefconfig.
+
+        dot_config: .config file for input
+        returncode: exit status of the Kconfig executable
+        """
+        return self._run_conf('--savedefconfig', out_file='defconfig')
+
+    def listnewconfig(self, dot_config=None):
+        """Run listnewconfig.
+
+        dot_config: .config file to use for configuration base (optional)
+        returncode: exit status of the Kconfig executable
+        """
+        return self._run_conf('--listnewconfig', dot_config=dot_config,
+                              out_file=None)
+
+    # checkers
+    def _read_and_compare(self, compare, expected):
+        """Compare the result with expectation.
+
+        compare: function to compare the result with expectation
+        expected: file that contains the expected data
+        """
+        with open(os.path.join(self._test_dir, expected)) as f:
+            expected_data = f.read()
+        return compare(self, expected_data)
+
+    def _contains(self, attr, expected):
+        return self._read_and_compare(
+                                    lambda s, e: getattr(s, attr).find(e) >= 0,
+                                    expected)
+
+    def _matches(self, attr, expected):
+        return self._read_and_compare(lambda s, e: getattr(s, attr) == e,
+                                      expected)
+
+    def config_contains(self, expected):
+        """Check if resulted configuration contains expected data.
+
+        expected: file that contains the expected data
+        returncode: True if result contains the expected data, False otherwise
+        """
+        return self._contains('config', expected)
+
+    def config_matches(self, expected):
+        """Check if resulted configuration exactly matches expected data.
+
+        expected: file that contains the expected data
+        returncode: True if result matches the expected data, False otherwise
+        """
+        return self._matches('config', expected)
+
+    def stdout_contains(self, expected):
+        """Check if resulted stdout contains expected data.
+
+        expected: file that contains the expected data
+        returncode: True if result contains the expected data, False otherwise
+        """
+        return self._contains('stdout', expected)
+
+    def stdout_matches(self, expected):
+        """Check if resulted stdout exactly matches expected data.
+
+        expected: file that contains the expected data
+        returncode: True if result matches the expected data, False otherwise
+        """
+        return self._matches('stdout', expected)
+
+    def stderr_contains(self, expected):
+        """Check if resulted stderr contains expected data.
+
+        expected: file that contains the expected data
+        returncode: True if result contains the expected data, False otherwise
+        """
+        return self._contains('stderr', expected)
+
+    def stderr_matches(self, expected):
+        """Check if resulted stderr exactly matches expected data.
+
+        expected: file that contains the expected data
+        returncode: True if result matches the expected data, False otherwise
+        """
+        return self._matches('stderr', expected)
+
+
+@pytest.fixture(scope="module")
+def conf(request):
+    """Create a Conf instance and provide it to test functions."""
+    return Conf(request)
diff --git a/scripts/kconfig/tests/err_recursive_inc/Kconfig b/scripts/kconfig/tests/err_recursive_inc/Kconfig
new file mode 100644 (file)
index 0000000..0e4c875
--- /dev/null
@@ -0,0 +1 @@
+source "Kconfig.inc1"
diff --git a/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc1 b/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc1
new file mode 100644 (file)
index 0000000..00e408d
--- /dev/null
@@ -0,0 +1,4 @@
+
+
+
+source "Kconfig.inc2"
diff --git a/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc2 b/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc2
new file mode 100644 (file)
index 0000000..349ea2d
--- /dev/null
@@ -0,0 +1,3 @@
+
+
+source "Kconfig.inc3"
diff --git a/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc3 b/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc3
new file mode 100644 (file)
index 0000000..0e4c875
--- /dev/null
@@ -0,0 +1 @@
+source "Kconfig.inc1"
diff --git a/scripts/kconfig/tests/err_recursive_inc/__init__.py b/scripts/kconfig/tests/err_recursive_inc/__init__.py
new file mode 100644 (file)
index 0000000..0e4c839
--- /dev/null
@@ -0,0 +1,10 @@
+"""
+Detect recursive inclusion error.
+
+If recursive inclusion is detected, it should fail with error messages.
+"""
+
+
+def test(conf):
+    assert conf.oldaskconfig() != 0
+    assert conf.stderr_contains('expected_stderr')
diff --git a/scripts/kconfig/tests/err_recursive_inc/expected_stderr b/scripts/kconfig/tests/err_recursive_inc/expected_stderr
new file mode 100644 (file)
index 0000000..6b582ee
--- /dev/null
@@ -0,0 +1,6 @@
+Recursive inclusion detected.
+Inclusion path:
+  current file : Kconfig.inc1
+  included from: Kconfig.inc3:1
+  included from: Kconfig.inc2:3
+  included from: Kconfig.inc1:4
diff --git a/scripts/kconfig/tests/inter_choice/Kconfig b/scripts/kconfig/tests/inter_choice/Kconfig
new file mode 100644 (file)
index 0000000..e44449f
--- /dev/null
@@ -0,0 +1,23 @@
+config MODULES
+       def_bool y
+       option modules
+
+choice
+       prompt "Choice"
+
+config CHOICE_VAL0
+       tristate "Choice 0"
+
+config CHOIVE_VAL1
+       tristate "Choice 1"
+
+endchoice
+
+choice
+       prompt "Another choice"
+       depends on CHOICE_VAL0
+
+config DUMMY
+       bool "dummy"
+
+endchoice
diff --git a/scripts/kconfig/tests/inter_choice/__init__.py b/scripts/kconfig/tests/inter_choice/__init__.py
new file mode 100644 (file)
index 0000000..5c7fc36
--- /dev/null
@@ -0,0 +1,14 @@
+"""
+Do not affect user-assigned choice value by another choice.
+
+Handling of state flags for choices is complecated.  In old days,
+the defconfig result of a choice could be affected by another choice
+if those choices interact by 'depends on', 'select', etc.
+
+Related Linux commit: fbe98bb9ed3dae23e320c6b113e35f129538d14a
+"""
+
+
+def test(conf):
+    assert conf.defconfig('defconfig') == 0
+    assert conf.config_contains('expected_config')
diff --git a/scripts/kconfig/tests/inter_choice/defconfig b/scripts/kconfig/tests/inter_choice/defconfig
new file mode 100644 (file)
index 0000000..162c414
--- /dev/null
@@ -0,0 +1 @@
+CONFIG_CHOICE_VAL0=y
diff --git a/scripts/kconfig/tests/inter_choice/expected_config b/scripts/kconfig/tests/inter_choice/expected_config
new file mode 100644 (file)
index 0000000..5dceefb
--- /dev/null
@@ -0,0 +1,4 @@
+CONFIG_MODULES=y
+CONFIG_CHOICE_VAL0=y
+# CONFIG_CHOIVE_VAL1 is not set
+CONFIG_DUMMY=y
diff --git a/scripts/kconfig/tests/new_choice_with_dep/Kconfig b/scripts/kconfig/tests/new_choice_with_dep/Kconfig
new file mode 100644 (file)
index 0000000..53ef1b8
--- /dev/null
@@ -0,0 +1,37 @@
+config A
+       bool "A"
+       help
+         This is a new symbol.
+
+choice
+       prompt "Choice ?"
+       depends on A
+       help
+         "depends on A" has been newly added.
+
+config CHOICE_B
+       bool "Choice B"
+
+config CHOICE_C
+       bool "Choice C"
+       help
+         This is a new symbol, so should be asked.
+
+endchoice
+
+choice
+       prompt "Choice2 ?"
+
+config CHOICE_D
+       bool "Choice D"
+
+config CHOICE_E
+       bool "Choice E"
+
+config CHOICE_F
+       bool "Choice F"
+       depends on A
+       help
+         This is a new symbol, so should be asked.
+
+endchoice
diff --git a/scripts/kconfig/tests/new_choice_with_dep/__init__.py b/scripts/kconfig/tests/new_choice_with_dep/__init__.py
new file mode 100644 (file)
index 0000000..f0e0ead
--- /dev/null
@@ -0,0 +1,14 @@
+"""
+Ask new choice values when they become visible.
+
+If new choice values are added with new dependency, and they become
+visible during user configuration, oldconfig should recognize them
+as (NEW), and ask the user for choice.
+
+Related Linux commit: 5d09598d488f081e3be23f885ed65cbbe2d073b5
+"""
+
+
+def test(conf):
+    assert conf.oldconfig('config', 'y') == 0
+    assert conf.stdout_contains('expected_stdout')
diff --git a/scripts/kconfig/tests/new_choice_with_dep/config b/scripts/kconfig/tests/new_choice_with_dep/config
new file mode 100644 (file)
index 0000000..47ef95d
--- /dev/null
@@ -0,0 +1,3 @@
+CONFIG_CHOICE_B=y
+# CONFIG_CHOICE_D is not set
+CONFIG_CHOICE_E=y
diff --git a/scripts/kconfig/tests/new_choice_with_dep/expected_stdout b/scripts/kconfig/tests/new_choice_with_dep/expected_stdout
new file mode 100644 (file)
index 0000000..74dc0bc
--- /dev/null
@@ -0,0 +1,10 @@
+A (A) [N/y/?] (NEW) y
+  Choice ?
+  > 1. Choice B (CHOICE_B)
+    2. Choice C (CHOICE_C) (NEW)
+  choice[1-2?]: 
+Choice2 ?
+  1. Choice D (CHOICE_D)
+> 2. Choice E (CHOICE_E)
+  3. Choice F (CHOICE_F) (NEW)
+choice[1-3?]: 
diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig b/scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig
new file mode 100644 (file)
index 0000000..c00b8fe
--- /dev/null
@@ -0,0 +1,14 @@
+config A
+       bool "A"
+
+choice
+       prompt "Choice ?"
+       depends on A
+
+config CHOICE_B
+       bool "Choice B"
+
+config CHOICE_C
+       bool "Choice C"
+
+endchoice
diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py b/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py
new file mode 100644 (file)
index 0000000..207261b
--- /dev/null
@@ -0,0 +1,19 @@
+"""
+Do not write choice values to .config if the dependency is unmet.
+
+"# CONFIG_... is not set" should not be written into the .config file
+for symbols with unmet dependency.
+
+This was not working correctly for choice values because choice needs
+a bit different symbol computation.
+
+This checks that no unneeded "# COFIG_... is not set" is contained in
+the .config file.
+
+Related Linux commit: cb67ab2cd2b8abd9650292c986c79901e3073a59
+"""
+
+
+def test(conf):
+    assert conf.oldaskconfig('config', 'n') == 0
+    assert conf.config_matches('expected_config')
diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/config b/scripts/kconfig/tests/no_write_if_dep_unmet/config
new file mode 100644 (file)
index 0000000..abd280e
--- /dev/null
@@ -0,0 +1 @@
+CONFIG_A=y
diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/expected_config b/scripts/kconfig/tests/no_write_if_dep_unmet/expected_config
new file mode 100644 (file)
index 0000000..0d15e41
--- /dev/null
@@ -0,0 +1,5 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux Kernel Configuration
+#
+# CONFIG_A is not set
diff --git a/scripts/kconfig/tests/pytest.ini b/scripts/kconfig/tests/pytest.ini
new file mode 100644 (file)
index 0000000..85d7ce8
--- /dev/null
@@ -0,0 +1,7 @@
+[pytest]
+addopts = --verbose
+
+# Pytest requires that test files have unique names, because pytest imports
+# them as top-level modules.  It is silly to prefix or suffix a test file with
+# the directory name that contains it.  Use __init__.py for all test files.
+python_files = __init__.py
diff --git a/scripts/kconfig/tests/rand_nested_choice/Kconfig b/scripts/kconfig/tests/rand_nested_choice/Kconfig
new file mode 100644 (file)
index 0000000..c591d51
--- /dev/null
@@ -0,0 +1,33 @@
+choice
+       prompt "choice"
+
+config A
+       bool "A"
+
+config B
+       bool "B"
+
+if B
+choice
+       prompt "sub choice"
+
+config C
+       bool "C"
+
+config D
+       bool "D"
+
+if D
+choice
+       prompt "subsub choice"
+
+config E
+       bool "E"
+
+endchoice
+endif # D
+
+endchoice
+endif # B
+
+endchoice
diff --git a/scripts/kconfig/tests/rand_nested_choice/__init__.py b/scripts/kconfig/tests/rand_nested_choice/__init__.py
new file mode 100644 (file)
index 0000000..e729a4e
--- /dev/null
@@ -0,0 +1,16 @@
+"""
+Set random values recursively in nested choices.
+
+Kconfig can create a choice-in-choice structure by using 'if' statement.
+randconfig should correctly set random choice values.
+
+Related Linux commit: 3b9a19e08960e5cdad5253998637653e592a3c29
+"""
+
+
+def test(conf):
+    for i in range(20):
+        assert conf.randconfig() == 0
+        assert (conf.config_contains('expected_stdout0') or
+                conf.config_contains('expected_stdout1') or
+                conf.config_contains('expected_stdout2'))
diff --git a/scripts/kconfig/tests/rand_nested_choice/expected_stdout0 b/scripts/kconfig/tests/rand_nested_choice/expected_stdout0
new file mode 100644 (file)
index 0000000..05450f3
--- /dev/null
@@ -0,0 +1,2 @@
+CONFIG_A=y
+# CONFIG_B is not set
diff --git a/scripts/kconfig/tests/rand_nested_choice/expected_stdout1 b/scripts/kconfig/tests/rand_nested_choice/expected_stdout1
new file mode 100644 (file)
index 0000000..37ab295
--- /dev/null
@@ -0,0 +1,4 @@
+# CONFIG_A is not set
+CONFIG_B=y
+CONFIG_C=y
+# CONFIG_D is not set
diff --git a/scripts/kconfig/tests/rand_nested_choice/expected_stdout2 b/scripts/kconfig/tests/rand_nested_choice/expected_stdout2
new file mode 100644 (file)
index 0000000..849ff47
--- /dev/null
@@ -0,0 +1,5 @@
+# CONFIG_A is not set
+CONFIG_B=y
+# CONFIG_C is not set
+CONFIG_D=y
+CONFIG_E=y
diff --git a/scripts/kconfig/tests/warn_recursive_dep/Kconfig b/scripts/kconfig/tests/warn_recursive_dep/Kconfig
new file mode 100644 (file)
index 0000000..a65bfcb
--- /dev/null
@@ -0,0 +1,62 @@
+# depends on itself
+
+config A
+       bool "A"
+       depends on A
+
+# select itself
+
+config B
+       bool
+       select B
+
+# depends on each other
+
+config C1
+       bool "C1"
+       depends on C2
+
+config C2
+       bool "C2"
+       depends on C1
+
+# depends on and select
+
+config D1
+       bool "D1"
+       depends on D2
+       select D2
+
+config D2
+       bool
+
+# depends on and imply
+# This is not recursive dependency
+
+config E1
+       bool "E1"
+       depends on E2
+       imply E2
+
+config E2
+       bool "E2"
+
+# property
+
+config F1
+       bool "F1"
+       default F2
+
+config F2
+       bool "F2"
+       depends on F1
+
+# menu
+
+menu "menu depending on its content"
+       depends on G
+
+config G
+       bool "G"
+
+endmenu
diff --git a/scripts/kconfig/tests/warn_recursive_dep/__init__.py b/scripts/kconfig/tests/warn_recursive_dep/__init__.py
new file mode 100644 (file)
index 0000000..adb2195
--- /dev/null
@@ -0,0 +1,9 @@
+"""
+Warn recursive inclusion.
+
+Recursive dependency should be warned.
+"""
+
+def test(conf):
+    assert conf.oldaskconfig() == 0
+    assert conf.stderr_contains('expected_stderr')
diff --git a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr b/scripts/kconfig/tests/warn_recursive_dep/expected_stderr
new file mode 100644 (file)
index 0000000..3de807d
--- /dev/null
@@ -0,0 +1,30 @@
+Kconfig:9:error: recursive dependency detected!
+Kconfig:9:     symbol B is selected by B
+For a resolution refer to Documentation/kbuild/kconfig-language.txt
+subsection "Kconfig recursive dependency limitations"
+
+Kconfig:3:error: recursive dependency detected!
+Kconfig:3:     symbol A depends on A
+For a resolution refer to Documentation/kbuild/kconfig-language.txt
+subsection "Kconfig recursive dependency limitations"
+
+Kconfig:15:error: recursive dependency detected!
+Kconfig:15:    symbol C1 depends on C2
+Kconfig:19:    symbol C2 depends on C1
+For a resolution refer to Documentation/kbuild/kconfig-language.txt
+subsection "Kconfig recursive dependency limitations"
+
+Kconfig:30:error: recursive dependency detected!
+Kconfig:30:    symbol D2 is selected by D1
+Kconfig:25:    symbol D1 depends on D2
+For a resolution refer to Documentation/kbuild/kconfig-language.txt
+subsection "Kconfig recursive dependency limitations"
+
+Kconfig:59:error: recursive dependency detected!
+Kconfig:59:    symbol G depends on G
+For a resolution refer to Documentation/kbuild/kconfig-language.txt
+subsection "Kconfig recursive dependency limitations"
+
+Kconfig:50:error: recursive dependency detected!
+Kconfig:50:    symbol F2 depends on F1
+Kconfig:48:    symbol F1 default value contains F2
index 0e76042473ccd3633aa0870da3cce23e0b1788c6..c6f6e21b809ffe7a6f60acd2a7f016ee88971d5c 100644 (file)
 struct file *file_lookup(const char *name)
 {
        struct file *file;
-       const char *file_name = sym_expand_string_value(name);
+       char *file_name = sym_expand_string_value(name);
 
        for (file = file_list; file; file = file->next) {
                if (!strcmp(name, file->name)) {
-                       free((void *)file_name);
+                       free(file_name);
                        return file;
                }
        }
@@ -104,7 +104,7 @@ void str_append(struct gstr *gs, const char *s)
        if (s) {
                l = strlen(gs->s) + strlen(s) + 1;
                if (l > gs->len) {
-                       gs->s   = realloc(gs->s, l);
+                       gs->s = xrealloc(gs->s, l);
                        gs->len = l;
                }
                strcat(gs->s, s);
@@ -145,3 +145,23 @@ void *xcalloc(size_t nmemb, size_t size)
        fprintf(stderr, "Out of memory.\n");
        exit(1);
 }
+
+void *xrealloc(void *p, size_t size)
+{
+       p = realloc(p, size);
+       if (p)
+               return p;
+       fprintf(stderr, "Out of memory.\n");
+       exit(1);
+}
+
+char *xstrdup(const char *s)
+{
+       char *p;
+
+       p = strdup(s);
+       if (p)
+               return p;
+       fprintf(stderr, "Out of memory.\n");
+       exit(1);
+}
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
deleted file mode 100644 (file)
index ead02ed..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-%language=ANSI-C
-%define hash-function-name kconf_id_hash
-%define lookup-function-name kconf_id_lookup
-%define string-pool-name kconf_id_strings
-%compare-strncmp
-%enum
-%pic
-%struct-type
-
-struct kconf_id;
-
-static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
-
-%%
-mainmenu,      T_MAINMENU,     TF_COMMAND
-menu,          T_MENU,         TF_COMMAND
-endmenu,       T_ENDMENU,      TF_COMMAND
-source,                T_SOURCE,       TF_COMMAND
-choice,                T_CHOICE,       TF_COMMAND
-endchoice,     T_ENDCHOICE,    TF_COMMAND
-comment,       T_COMMENT,      TF_COMMAND
-config,                T_CONFIG,       TF_COMMAND
-menuconfig,    T_MENUCONFIG,   TF_COMMAND
-help,          T_HELP,         TF_COMMAND
----help---,    T_HELP,         TF_COMMAND
-if,            T_IF,           TF_COMMAND|TF_PARAM
-endif,         T_ENDIF,        TF_COMMAND
-depends,       T_DEPENDS,      TF_COMMAND
-optional,      T_OPTIONAL,     TF_COMMAND
-default,       T_DEFAULT,      TF_COMMAND, S_UNKNOWN
-prompt,                T_PROMPT,       TF_COMMAND
-tristate,      T_TYPE,         TF_COMMAND, S_TRISTATE
-def_tristate,  T_DEFAULT,      TF_COMMAND, S_TRISTATE
-bool,          T_TYPE,         TF_COMMAND, S_BOOLEAN
-boolean,       T_TYPE,         TF_COMMAND, S_BOOLEAN
-def_bool,      T_DEFAULT,      TF_COMMAND, S_BOOLEAN
-int,           T_TYPE,         TF_COMMAND, S_INT
-hex,           T_TYPE,         TF_COMMAND, S_HEX
-string,                T_TYPE,         TF_COMMAND, S_STRING
-select,                T_SELECT,       TF_COMMAND
-imply,         T_IMPLY,        TF_COMMAND
-range,         T_RANGE,        TF_COMMAND
-visible,       T_VISIBLE,      TF_COMMAND
-option,                T_OPTION,       TF_COMMAND
-on,            T_ON,           TF_PARAM
-modules,       T_OPT_MODULES,  TF_OPTION
-defconfig_list,        T_OPT_DEFCONFIG_LIST,TF_OPTION
-env,           T_OPT_ENV,      TF_OPTION
-allnoconfig_y, T_OPT_ALLNOCONFIG_Y,TF_OPTION
-%%
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped
deleted file mode 100644 (file)
index d51b15d..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-/* ANSI-C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -t --output-file scripts/kconfig/zconf.hash.c_shipped -a -C -E -g -k '1,3,$' -p -t scripts/kconfig/zconf.gperf  */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
-      && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
-      && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
-      && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
-      && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
-      && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
-      && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
-      && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
-      && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
-      && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
-      && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
-      && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
-      && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
-      && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
-      && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
-      && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
-      && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
-      && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
-      && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
-      && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
-      && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
-      && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
-      && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646.  */
-#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 10 "scripts/kconfig/zconf.gperf"
-struct kconf_id;
-
-static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
-/* maximum key range = 71, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-kconf_id_hash (register const char *str, register unsigned int len)
-{
-  static const unsigned char asso_values[] =
-    {
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73,  0, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 10, 25, 25,
-       0,  0,  0,  5,  0,  0, 73, 73,  5,  0,
-      10,  5, 45, 73, 20, 20,  0, 15, 15, 73,
-      20,  0, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-      73, 73, 73, 73, 73, 73
-    };
-  register int hval = len;
-
-  switch (hval)
-    {
-      default:
-        hval += asso_values[(unsigned char)str[2]];
-      /*FALLTHROUGH*/
-      case 2:
-      case 1:
-        hval += asso_values[(unsigned char)str[0]];
-        break;
-    }
-  return hval + asso_values[(unsigned char)str[len - 1]];
-}
-
-struct kconf_id_strings_t
-  {
-    char kconf_id_strings_str2[sizeof("if")];
-    char kconf_id_strings_str3[sizeof("int")];
-    char kconf_id_strings_str5[sizeof("endif")];
-    char kconf_id_strings_str7[sizeof("default")];
-    char kconf_id_strings_str8[sizeof("tristate")];
-    char kconf_id_strings_str9[sizeof("endchoice")];
-    char kconf_id_strings_str10[sizeof("---help---")];
-    char kconf_id_strings_str12[sizeof("def_tristate")];
-    char kconf_id_strings_str13[sizeof("def_bool")];
-    char kconf_id_strings_str14[sizeof("defconfig_list")];
-    char kconf_id_strings_str17[sizeof("on")];
-    char kconf_id_strings_str18[sizeof("optional")];
-    char kconf_id_strings_str21[sizeof("option")];
-    char kconf_id_strings_str22[sizeof("endmenu")];
-    char kconf_id_strings_str23[sizeof("mainmenu")];
-    char kconf_id_strings_str25[sizeof("menuconfig")];
-    char kconf_id_strings_str27[sizeof("modules")];
-    char kconf_id_strings_str28[sizeof("allnoconfig_y")];
-    char kconf_id_strings_str29[sizeof("menu")];
-    char kconf_id_strings_str31[sizeof("select")];
-    char kconf_id_strings_str32[sizeof("comment")];
-    char kconf_id_strings_str33[sizeof("env")];
-    char kconf_id_strings_str35[sizeof("range")];
-    char kconf_id_strings_str36[sizeof("choice")];
-    char kconf_id_strings_str39[sizeof("bool")];
-    char kconf_id_strings_str41[sizeof("source")];
-    char kconf_id_strings_str42[sizeof("visible")];
-    char kconf_id_strings_str43[sizeof("hex")];
-    char kconf_id_strings_str46[sizeof("config")];
-    char kconf_id_strings_str47[sizeof("boolean")];
-    char kconf_id_strings_str50[sizeof("imply")];
-    char kconf_id_strings_str51[sizeof("string")];
-    char kconf_id_strings_str54[sizeof("help")];
-    char kconf_id_strings_str56[sizeof("prompt")];
-    char kconf_id_strings_str72[sizeof("depends")];
-  };
-static const struct kconf_id_strings_t kconf_id_strings_contents =
-  {
-    "if",
-    "int",
-    "endif",
-    "default",
-    "tristate",
-    "endchoice",
-    "---help---",
-    "def_tristate",
-    "def_bool",
-    "defconfig_list",
-    "on",
-    "optional",
-    "option",
-    "endmenu",
-    "mainmenu",
-    "menuconfig",
-    "modules",
-    "allnoconfig_y",
-    "menu",
-    "select",
-    "comment",
-    "env",
-    "range",
-    "choice",
-    "bool",
-    "source",
-    "visible",
-    "hex",
-    "config",
-    "boolean",
-    "imply",
-    "string",
-    "help",
-    "prompt",
-    "depends"
-  };
-#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-const struct kconf_id *
-kconf_id_lookup (register const char *str, register unsigned int len)
-{
-  enum
-    {
-      TOTAL_KEYWORDS = 35,
-      MIN_WORD_LENGTH = 2,
-      MAX_WORD_LENGTH = 14,
-      MIN_HASH_VALUE = 2,
-      MAX_HASH_VALUE = 72
-    };
-
-  static const struct kconf_id wordlist[] =
-    {
-      {-1}, {-1},
-#line 26 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2,            T_IF,           TF_COMMAND|TF_PARAM},
-#line 37 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3,            T_TYPE,         TF_COMMAND, S_INT},
-      {-1},
-#line 27 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5,            T_ENDIF,        TF_COMMAND},
-      {-1},
-#line 30 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7,    T_DEFAULT,      TF_COMMAND, S_UNKNOWN},
-#line 32 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8,    T_TYPE,         TF_COMMAND, S_TRISTATE},
-#line 20 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9,    T_ENDCHOICE,    TF_COMMAND},
-#line 25 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10,   T_HELP,         TF_COMMAND},
-      {-1},
-#line 33 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12,   T_DEFAULT,      TF_COMMAND, S_TRISTATE},
-#line 36 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13,   T_DEFAULT,      TF_COMMAND, S_BOOLEAN},
-#line 47 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14,   T_OPT_DEFCONFIG_LIST,TF_OPTION},
-      {-1}, {-1},
-#line 45 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17,           T_ON,           TF_PARAM},
-#line 29 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18,   T_OPTIONAL,     TF_COMMAND},
-      {-1}, {-1},
-#line 44 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21,           T_OPTION,       TF_COMMAND},
-#line 17 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22,   T_ENDMENU,      TF_COMMAND},
-#line 15 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23,   T_MAINMENU,     TF_COMMAND},
-      {-1},
-#line 23 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str25,   T_MENUCONFIG,   TF_COMMAND},
-      {-1},
-#line 46 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27,   T_OPT_MODULES,  TF_OPTION},
-#line 49 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28,   T_OPT_ALLNOCONFIG_Y,TF_OPTION},
-#line 16 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29,           T_MENU,         TF_COMMAND},
-      {-1},
-#line 40 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31,           T_SELECT,       TF_COMMAND},
-#line 21 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32,   T_COMMENT,      TF_COMMAND},
-#line 48 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33,           T_OPT_ENV,      TF_OPTION},
-      {-1},
-#line 42 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35,           T_RANGE,        TF_COMMAND},
-#line 19 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36,           T_CHOICE,       TF_COMMAND},
-      {-1}, {-1},
-#line 34 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str39,           T_TYPE,         TF_COMMAND, S_BOOLEAN},
-      {-1},
-#line 18 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41,           T_SOURCE,       TF_COMMAND},
-#line 43 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42,   T_VISIBLE,      TF_COMMAND},
-#line 38 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str43,           T_TYPE,         TF_COMMAND, S_HEX},
-      {-1}, {-1},
-#line 22 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46,           T_CONFIG,       TF_COMMAND},
-#line 35 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47,   T_TYPE,         TF_COMMAND, S_BOOLEAN},
-      {-1}, {-1},
-#line 41 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str50,           T_IMPLY,        TF_COMMAND},
-#line 39 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51,           T_TYPE,         TF_COMMAND, S_STRING},
-      {-1}, {-1},
-#line 24 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str54,           T_HELP,         TF_COMMAND},
-      {-1},
-#line 31 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str56,           T_PROMPT,       TF_COMMAND},
-      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 28 "scripts/kconfig/zconf.gperf"
-      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str72,   T_DEPENDS,      TF_COMMAND}
-    };
-
-  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
-    {
-      register int key = kconf_id_hash (str, len);
-
-      if (key <= MAX_HASH_VALUE && key >= 0)
-        {
-          register int o = wordlist[key].name;
-          if (o >= 0)
-            {
-              register const char *s = o + kconf_id_strings;
-
-              if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
-                return &wordlist[key];
-            }
-        }
-    }
-  return 0;
-}
-#line 50 "scripts/kconfig/zconf.gperf"
-
index c410d257da0602dc9b4de92dac457e237c097399..045093d827e11640c67fdb2c3ca4bb85734d2a7e 100644 (file)
@@ -1,5 +1,5 @@
 %option nostdinit noyywrap never-interactive full ecs
-%option 8bit nodefault perf-report perf-report
+%option 8bit nodefault yylineno
 %option noinput
 %x COMMAND HELP STRING PARAM
 %{
@@ -52,7 +52,7 @@ static void append_string(const char *str, int size)
        if (new_size > text_asize) {
                new_size += START_STRSIZE - 1;
                new_size &= -START_STRSIZE;
-               text = realloc(text, new_size);
+               text = xrealloc(text, new_size);
                text_asize = new_size;
        }
        memcpy(text + text_size, str, size);
@@ -83,7 +83,6 @@ n     [A-Za-z0-9_-]
 
 [ \t]*#.*\n    |
 [ \t]*\n       {
-       current_file->lineno++;
        return T_EOL;
 }
 [ \t]*#.*
@@ -104,19 +103,18 @@ n [A-Za-z0-9_-]
                const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
                BEGIN(PARAM);
                current_pos.file = current_file;
-               current_pos.lineno = current_file->lineno;
+               current_pos.lineno = yylineno;
                if (id && id->flags & TF_COMMAND) {
-                       zconflval.id = id;
+                       yylval.id = id;
                        return id->token;
                }
                alloc_string(yytext, yyleng);
-               zconflval.string = text;
+               yylval.string = text;
                return T_WORD;
        }
        .       warn_ignored_character(*yytext);
        \n      {
                BEGIN(INITIAL);
-               current_file->lineno++;
                return T_EOL;
        }
 }
@@ -138,19 +136,19 @@ n [A-Za-z0-9_-]
                new_string();
                BEGIN(STRING);
        }
-       \n      BEGIN(INITIAL); current_file->lineno++; return T_EOL;
+       \n      BEGIN(INITIAL); return T_EOL;
        ({n}|[/.])+     {
                const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
                if (id && id->flags & TF_PARAM) {
-                       zconflval.id = id;
+                       yylval.id = id;
                        return id->token;
                }
                alloc_string(yytext, yyleng);
-               zconflval.string = text;
+               yylval.string = text;
                return T_WORD;
        }
        #.*     /* comment */
-       \\\n    current_file->lineno++;
+       \\\n    ;
        [[:blank:]]+
        .       warn_ignored_character(*yytext);
        <<EOF>> {
@@ -161,7 +159,7 @@ n   [A-Za-z0-9_-]
 <STRING>{
        [^'"\\\n]+/\n   {
                append_string(yytext, yyleng);
-               zconflval.string = text;
+               yylval.string = text;
                return T_WORD_QUOTE;
        }
        [^'"\\\n]+      {
@@ -169,7 +167,7 @@ n   [A-Za-z0-9_-]
        }
        \\.?/\n {
                append_string(yytext + 1, yyleng - 1);
-               zconflval.string = text;
+               yylval.string = text;
                return T_WORD_QUOTE;
        }
        \\.?    {
@@ -178,14 +176,15 @@ n [A-Za-z0-9_-]
        \'|\"   {
                if (str == yytext[0]) {
                        BEGIN(PARAM);
-                       zconflval.string = text;
+                       yylval.string = text;
                        return T_WORD_QUOTE;
                } else
                        append_string(yytext, 1);
        }
        \n      {
-               printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
-               current_file->lineno++;
+               fprintf(stderr,
+                       "%s:%d:warning: multi-line strings not supported\n",
+                       zconf_curname(), zconf_lineno());
                BEGIN(INITIAL);
                return T_EOL;
        }
@@ -218,12 +217,10 @@ n [A-Za-z0-9_-]
                }
        }
        [ \t]*\n/[^ \t\n] {
-               current_file->lineno++;
                zconf_endhelp();
                return T_HELPTEXT;
        }
        [ \t]*\n        {
-               current_file->lineno++;
                append_string("\n", 1);
        }
        [^ \t\n].* {
@@ -261,7 +258,7 @@ void zconf_starthelp(void)
 
 static void zconf_endhelp(void)
 {
-       zconflval.string = text;
+       yylval.string = text;
        BEGIN(INITIAL);
 }
 
@@ -294,7 +291,7 @@ void zconf_initscan(const char *name)
 {
        yyin = zconf_fopen(name);
        if (!yyin) {
-               printf("can't find file %s\n", name);
+               fprintf(stderr, "can't find file %s\n", name);
                exit(1);
        }
 
@@ -302,7 +299,7 @@ void zconf_initscan(const char *name)
        memset(current_buf, 0, sizeof(*current_buf));
 
        current_file = file_lookup(name);
-       current_file->lineno = 1;
+       yylineno = 1;
 }
 
 void zconf_nextfile(const char *name)
@@ -315,35 +312,34 @@ void zconf_nextfile(const char *name)
        current_buf->state = YY_CURRENT_BUFFER;
        yyin = zconf_fopen(file->name);
        if (!yyin) {
-               printf("%s:%d: can't open file \"%s\"\n",
-                   zconf_curname(), zconf_lineno(), file->name);
+               fprintf(stderr, "%s:%d: can't open file \"%s\"\n",
+                       zconf_curname(), zconf_lineno(), file->name);
                exit(1);
        }
        yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
        buf->parent = current_buf;
        current_buf = buf;
 
-       for (iter = current_file->parent; iter; iter = iter->parent ) {
-               if (!strcmp(current_file->name,iter->name) ) {
-                       printf("%s:%d: recursive inclusion detected. "
-                              "Inclusion path:\n  current file : '%s'\n",
-                              zconf_curname(), zconf_lineno(),
-                              zconf_curname());
-                       iter = current_file->parent;
-                       while (iter && \
-                              strcmp(iter->name,current_file->name)) {
-                               printf("  included from: '%s:%d'\n",
-                                      iter->name, iter->lineno-1);
+       current_file->lineno = yylineno;
+       file->parent = current_file;
+
+       for (iter = current_file; iter; iter = iter->parent) {
+               if (!strcmp(iter->name, file->name)) {
+                       fprintf(stderr,
+                               "Recursive inclusion detected.\n"
+                               "Inclusion path:\n"
+                               "  current file : %s\n", file->name);
+                       iter = file;
+                       do {
                                iter = iter->parent;
-                       }
-                       if (iter)
-                               printf("  included from: '%s:%d'\n",
-                                      iter->name, iter->lineno+1);
+                               fprintf(stderr, "  included from: %s:%d\n",
+                                       iter->name, iter->lineno - 1);
+                       } while (strcmp(iter->name, file->name));
                        exit(1);
                }
        }
-       file->lineno = 1;
-       file->parent = current_file;
+
+       yylineno = 1;
        current_file = file;
 }
 
@@ -352,6 +348,8 @@ static void zconf_endfile(void)
        struct buffer *parent;
 
        current_file = current_file->parent;
+       if (current_file)
+               yylineno = current_file->lineno;
 
        parent = current_buf->parent;
        if (parent) {
diff --git a/scripts/kconfig/zconf.lex.c_shipped b/scripts/kconfig/zconf.lex.c_shipped
deleted file mode 100644 (file)
index 37fdf61..0000000
+++ /dev/null
@@ -1,2473 +0,0 @@
-
-#line 3 "scripts/kconfig/zconf.lex.c_shipped"
-
-#define  YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define yy_create_buffer zconf_create_buffer
-#define yy_delete_buffer zconf_delete_buffer
-#define yy_flex_debug zconf_flex_debug
-#define yy_init_buffer zconf_init_buffer
-#define yy_flush_buffer zconf_flush_buffer
-#define yy_load_buffer_state zconf_load_buffer_state
-#define yy_switch_to_buffer zconf_switch_to_buffer
-#define yyin zconfin
-#define yyleng zconfleng
-#define yylex zconflex
-#define yylineno zconflineno
-#define yyout zconfout
-#define yyrestart zconfrestart
-#define yytext zconftext
-#define yywrap zconfwrap
-#define yyalloc zconfalloc
-#define yyrealloc zconfrealloc
-#define yyfree zconffree
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with  platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types. 
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN               (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN              (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN              (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX               (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX              (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX              (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX              (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX             (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX             (4294967295U)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else  /* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index.  If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition.  This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN (yy_start) = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state.  The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START (((yy_start) - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE zconfrestart(zconfin  )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-extern int zconfleng;
-
-extern FILE *zconfin, *zconfout;
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-    #define YY_LESS_LINENO(n)
-    
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
-       do \
-               { \
-               /* Undo effects of setting up zconftext. */ \
-        int yyless_macro_arg = (n); \
-        YY_LESS_LINENO(yyless_macro_arg);\
-               *yy_cp = (yy_hold_char); \
-               YY_RESTORE_YY_MORE_OFFSET \
-               (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
-               YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
-               } \
-       while ( 0 )
-
-#define unput(c) yyunput( c, (yytext_ptr)  )
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
-       {
-       FILE *yy_input_file;
-
-       char *yy_ch_buf;                /* input buffer */
-       char *yy_buf_pos;               /* current position in input buffer */
-
-       /* Size of input buffer in bytes, not including room for EOB
-        * characters.
-        */
-       yy_size_t yy_buf_size;
-
-       /* Number of characters read into yy_ch_buf, not including EOB
-        * characters.
-        */
-       int yy_n_chars;
-
-       /* Whether we "own" the buffer - i.e., we know we created it,
-        * and can realloc() it to grow it, and should free() it to
-        * delete it.
-        */
-       int yy_is_our_buffer;
-
-       /* Whether this is an "interactive" input source; if so, and
-        * if we're using stdio for input, then we want to use getc()
-        * instead of fread(), to make sure we stop fetching input after
-        * each newline.
-        */
-       int yy_is_interactive;
-
-       /* Whether we're considered to be at the beginning of a line.
-        * If so, '^' rules will be active on the next match, otherwise
-        * not.
-        */
-       int yy_at_bol;
-
-    int yy_bs_lineno; /**< The line count. */
-    int yy_bs_column; /**< The column count. */
-    
-       /* Whether to try to fill the input buffer when we reach the
-        * end of it.
-        */
-       int yy_fill_buffer;
-
-       int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
-       /* When an EOF's been seen but there's still some text to process
-        * then we mark the buffer as YY_EOF_PENDING, to indicate that we
-        * shouldn't try reading from the input source any more.  We might
-        * still have a bunch of tokens to match, though, because of
-        * possible backing-up.
-        *
-        * When we actually see the EOF, we change the status to "new"
-        * (via zconfrestart()), so that the user can continue scanning by
-        * just pointing zconfin at a new input file.
-        */
-#define YY_BUFFER_EOF_PENDING 2
-
-       };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* Stack of input buffers. */
-static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
-static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
-                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
-                          : NULL)
-
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
-
-/* yy_hold_char holds the character lost when zconftext is formed. */
-static char yy_hold_char;
-static int yy_n_chars;         /* number of characters read into yy_ch_buf */
-int zconfleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 0;                /* whether we need to initialize */
-static int yy_start = 0;       /* start state number */
-
-/* Flag which is used to allow zconfwrap()'s to do buffer switches
- * instead of setting up a fresh zconfin.  A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void zconfrestart (FILE *input_file  );
-void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
-YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size  );
-void zconf_delete_buffer (YY_BUFFER_STATE b  );
-void zconf_flush_buffer (YY_BUFFER_STATE b  );
-void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer  );
-void zconfpop_buffer_state (void );
-
-static void zconfensure_buffer_stack (void );
-static void zconf_load_buffer_state (void );
-static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file  );
-
-#define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
-
-YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size  );
-YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len  );
-
-void *zconfalloc (yy_size_t  );
-void *zconfrealloc (void *,yy_size_t  );
-void zconffree (void *  );
-
-#define yy_new_buffer zconf_create_buffer
-
-#define yy_set_interactive(is_interactive) \
-       { \
-       if ( ! YY_CURRENT_BUFFER ){ \
-        zconfensure_buffer_stack (); \
-               YY_CURRENT_BUFFER_LVALUE =    \
-            zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
-       } \
-       YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
-       }
-
-#define yy_set_bol(at_bol) \
-       { \
-       if ( ! YY_CURRENT_BUFFER ){\
-        zconfensure_buffer_stack (); \
-               YY_CURRENT_BUFFER_LVALUE =    \
-            zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
-       } \
-       YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
-       }
-
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
-
-#define zconfwrap(n) 1
-#define YY_SKIP_YYWRAP
-
-typedef unsigned char YY_CHAR;
-
-FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
-
-typedef int yy_state_type;
-
-extern int zconflineno;
-
-int zconflineno = 1;
-
-extern char *zconftext;
-#define yytext_ptr zconftext
-static yyconst flex_int16_t yy_nxt[][18] =
-    {
-    {
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0
-    },
-
-    {
-       11,   12,   13,   14,   12,   12,   15,   12,   12,   12,
-       12,   12,   12,   12,   12,   12,   12,   12
-    },
-
-    {
-       11,   12,   13,   14,   12,   12,   15,   12,   12,   12,
-       12,   12,   12,   12,   12,   12,   12,   12
-    },
-
-    {
-       11,   16,   16,   17,   16,   16,   16,   16,   16,   16,
-       16,   18,   16,   16,   16,   16,   16,   16
-    },
-
-    {
-       11,   16,   16,   17,   16,   16,   16,   16,   16,   16,
-       16,   18,   16,   16,   16,   16,   16,   16
-
-    },
-
-    {
-       11,   19,   20,   21,   19,   19,   19,   19,   19,   19,
-       19,   19,   19,   19,   19,   19,   19,   19
-    },
-
-    {
-       11,   19,   20,   21,   19,   19,   19,   19,   19,   19,
-       19,   19,   19,   19,   19,   19,   19,   19
-    },
-
-    {
-       11,   22,   22,   23,   22,   24,   22,   22,   24,   22,
-       22,   22,   22,   22,   22,   22,   25,   22
-    },
-
-    {
-       11,   22,   22,   23,   22,   24,   22,   22,   24,   22,
-       22,   22,   22,   22,   22,   22,   25,   22
-    },
-
-    {
-       11,   26,   27,   28,   29,   30,   31,   32,   30,   33,
-       34,   35,   35,   36,   37,   38,   39,   40
-
-    },
-
-    {
-       11,   26,   27,   28,   29,   30,   31,   32,   30,   33,
-       34,   35,   35,   36,   37,   38,   39,   40
-    },
-
-    {
-      -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,
-      -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11
-    },
-
-    {
-       11,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,
-      -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12
-    },
-
-    {
-       11,  -13,   41,   42,  -13,  -13,   43,  -13,  -13,  -13,
-      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13
-    },
-
-    {
-       11,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,
-      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14
-
-    },
-
-    {
-       11,   44,   44,   45,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44
-    },
-
-    {
-       11,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
-      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16
-    },
-
-    {
-       11,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,
-      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17
-    },
-
-    {
-       11,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,
-      -18,   46,  -18,  -18,  -18,  -18,  -18,  -18
-    },
-
-    {
-       11,   47,   47,  -19,   47,   47,   47,   47,   47,   47,
-       47,   47,   47,   47,   47,   47,   47,   47
-
-    },
-
-    {
-       11,  -20,   48,   49,  -20,  -20,  -20,  -20,  -20,  -20,
-      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20
-    },
-
-    {
-       11,   50,  -21,  -21,   50,   50,   50,   50,   50,   50,
-       50,   50,   50,   50,   50,   50,   50,   50
-    },
-
-    {
-       11,   51,   51,   52,   51,  -22,   51,   51,  -22,   51,
-       51,   51,   51,   51,   51,   51,  -22,   51
-    },
-
-    {
-       11,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
-      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23
-    },
-
-    {
-       11,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
-      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24
-
-    },
-
-    {
-       11,   53,   53,   54,   53,   53,   53,   53,   53,   53,
-       53,   53,   53,   53,   53,   53,   53,   53
-    },
-
-    {
-       11,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,
-      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26
-    },
-
-    {
-       11,  -27,   55,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
-      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27
-    },
-
-    {
-       11,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,
-      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28
-    },
-
-    {
-       11,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,
-      -29,  -29,  -29,  -29,   56,  -29,  -29,  -29
-
-    },
-
-    {
-       11,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,
-      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30
-    },
-
-    {
-       11,   57,   57,  -31,   57,   57,   57,   57,   57,   57,
-       57,   57,   57,   57,   57,   57,   57,   57
-    },
-
-    {
-       11,  -32,  -32,  -32,  -32,  -32,  -32,   58,  -32,  -32,
-      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32
-    },
-
-    {
-       11,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
-      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33
-    },
-
-    {
-       11,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
-      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34
-
-    },
-
-    {
-       11,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
-      -35,   59,   59,  -35,  -35,  -35,  -35,  -35
-    },
-
-    {
-       11,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
-      -36,  -36,  -36,  -36,   60,  -36,  -36,  -36
-    },
-
-    {
-       11,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,
-      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37
-    },
-
-    {
-       11,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
-      -38,  -38,  -38,  -38,   61,  -38,  -38,  -38
-    },
-
-    {
-       11,  -39,  -39,   62,  -39,  -39,  -39,  -39,  -39,  -39,
-      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39
-
-    },
-
-    {
-       11,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
-      -40,  -40,  -40,  -40,  -40,  -40,  -40,   63
-    },
-
-    {
-       11,  -41,   41,   42,  -41,  -41,   43,  -41,  -41,  -41,
-      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41
-    },
-
-    {
-       11,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
-      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42
-    },
-
-    {
-       11,   44,   44,   45,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44
-    },
-
-    {
-       11,   44,   44,   45,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44
-
-    },
-
-    {
-       11,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,
-      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45
-    },
-
-    {
-       11,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
-      -46,   46,  -46,  -46,  -46,  -46,  -46,  -46
-    },
-
-    {
-       11,   47,   47,  -47,   47,   47,   47,   47,   47,   47,
-       47,   47,   47,   47,   47,   47,   47,   47
-    },
-
-    {
-       11,  -48,   48,   49,  -48,  -48,  -48,  -48,  -48,  -48,
-      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48
-    },
-
-    {
-       11,   50,  -49,  -49,   50,   50,   50,   50,   50,   50,
-       50,   50,   50,   50,   50,   50,   50,   50
-
-    },
-
-    {
-       11,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
-      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50
-    },
-
-    {
-       11,   51,   51,   52,   51,  -51,   51,   51,  -51,   51,
-       51,   51,   51,   51,   51,   51,  -51,   51
-    },
-
-    {
-       11,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,
-      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52
-    },
-
-    {
-       11,  -53,  -53,   54,  -53,  -53,  -53,  -53,  -53,  -53,
-      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53
-    },
-
-    {
-       11,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
-      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54
-
-    },
-
-    {
-       11,  -55,   55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
-      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55
-    },
-
-    {
-       11,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
-      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56
-    },
-
-    {
-       11,   57,   57,  -57,   57,   57,   57,   57,   57,   57,
-       57,   57,   57,   57,   57,   57,   57,   57
-    },
-
-    {
-       11,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
-      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58
-    },
-
-    {
-       11,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
-      -59,   59,   59,  -59,  -59,  -59,  -59,  -59
-
-    },
-
-    {
-       11,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
-      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60
-    },
-
-    {
-       11,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,
-      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61
-    },
-
-    {
-       11,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
-      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62
-    },
-
-    {
-       11,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,
-      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63
-    },
-
-    } ;
-
-static yy_state_type yy_get_previous_state (void );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
-static int yy_get_next_buffer (void );
-static void yy_fatal_error (yyconst char msg[]  );
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up zconftext.
- */
-#define YY_DO_BEFORE_ACTION \
-       (yytext_ptr) = yy_bp; \
-       zconfleng = (size_t) (yy_cp - yy_bp); \
-       (yy_hold_char) = *yy_cp; \
-       *yy_cp = '\0'; \
-       (yy_c_buf_p) = yy_cp;
-
-#define YY_NUM_RULES 37
-#define YY_END_OF_BUFFER 38
-/* This struct is not used in this scanner,
-   but its presence is necessary. */
-struct yy_trans_info
-       {
-       flex_int32_t yy_verify;
-       flex_int32_t yy_nxt;
-       };
-static yyconst flex_int16_t yy_accept[64] =
-    {   0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-       38,    5,    4,    2,    3,    7,    8,    6,   36,   33,
-       35,   28,   32,   31,   30,   26,   25,   21,   13,   20,
-       23,   26,   11,   12,   22,   18,   14,   19,   26,   26,
-        4,    2,    3,    3,    1,    6,   36,   33,   35,   34,
-       28,   27,   30,   29,   25,   15,   23,    9,   22,   16,
-       17,   24,   10
-    } ;
-
-static yyconst flex_int32_t yy_ec[256] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    4,    5,    6,    1,    1,    7,    8,    9,
-       10,    1,    1,    1,   11,   12,   12,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,    1,    1,   13,
-       14,   15,    1,    1,   11,   11,   11,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
-        1,   16,    1,    1,   11,    1,   11,   11,   11,   11,
-
-       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
-       11,   11,    1,   17,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
-
-extern int zconf_flex_debug;
-int zconf_flex_debug = 0;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-char *zconftext;
-#define YY_NO_INPUT 1
-
-/*
- * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
- * Released under the terms of the GNU GPL v2.0.
- */
-
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "lkc.h"
-
-#define START_STRSIZE  16
-
-static struct {
-       struct file *file;
-       int lineno;
-} current_pos;
-
-static char *text;
-static int text_size, text_asize;
-
-struct buffer {
-       struct buffer *parent;
-       YY_BUFFER_STATE state;
-};
-
-struct buffer *current_buf;
-
-static int last_ts, first_ts;
-
-static void zconf_endhelp(void);
-static void zconf_endfile(void);
-
-static void new_string(void)
-{
-       text = xmalloc(START_STRSIZE);
-       text_asize = START_STRSIZE;
-       text_size = 0;
-       *text = 0;
-}
-
-static void append_string(const char *str, int size)
-{
-       int new_size = text_size + size + 1;
-       if (new_size > text_asize) {
-               new_size += START_STRSIZE - 1;
-               new_size &= -START_STRSIZE;
-               text = realloc(text, new_size);
-               text_asize = new_size;
-       }
-       memcpy(text + text_size, str, size);
-       text_size += size;
-       text[text_size] = 0;
-}
-
-static void alloc_string(const char *str, int size)
-{
-       text = xmalloc(size + 1);
-       memcpy(text, str, size);
-       text[size] = 0;
-}
-
-static void warn_ignored_character(char chr)
-{
-       fprintf(stderr,
-               "%s:%d:warning: ignoring unsupported character '%c'\n",
-               zconf_curname(), zconf_lineno(), chr);
-}
-
-#define INITIAL 0
-#define COMMAND 1
-#define HELP 2
-#define STRING 3
-#define PARAM 4
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-static int yy_init_globals (void );
-
-/* Accessor methods to globals.
-   These are made visible to non-reentrant scanners for convenience. */
-
-int zconflex_destroy (void );
-
-int zconfget_debug (void );
-
-void zconfset_debug (int debug_flag  );
-
-YY_EXTRA_TYPE zconfget_extra (void );
-
-void zconfset_extra (YY_EXTRA_TYPE user_defined  );
-
-FILE *zconfget_in (void );
-
-void zconfset_in  (FILE * in_str  );
-
-FILE *zconfget_out (void );
-
-void zconfset_out  (FILE * out_str  );
-
-int zconfget_leng (void );
-
-char *zconfget_text (void );
-
-int zconfget_lineno (void );
-
-void zconfset_lineno (int line_number  );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int zconfwrap (void );
-#else
-extern int zconfwrap (void );
-#endif
-#endif
-
-    static void yyunput (int c,char *buf_ptr  );
-    
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
-#endif
-
-#ifndef YY_NO_INPUT
-
-#ifdef __cplusplus
-static int yyinput (void );
-#else
-static int input (void );
-#endif
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0)
-#endif
-
-/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-       errno=0; \
-       while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
-       { \
-               if( errno != EINTR) \
-               { \
-                       YY_FATAL_ERROR( "input in flex scanner failed" ); \
-                       break; \
-               } \
-               errno=0; \
-               clearerr(zconfin); \
-       }\
-\
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* end tables serialization structures and prototypes */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int zconflex (void);
-
-#define YY_DECL int zconflex (void)
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after zconftext and zconfleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
-       YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
-       register yy_state_type yy_current_state;
-       register char *yy_cp, *yy_bp;
-       register int yy_act;
-    
-       int str = 0;
-       int ts, i;
-
-       if ( !(yy_init) )
-               {
-               (yy_init) = 1;
-
-#ifdef YY_USER_INIT
-               YY_USER_INIT;
-#endif
-
-               if ( ! (yy_start) )
-                       (yy_start) = 1; /* first start state */
-
-               if ( ! zconfin )
-                       zconfin = stdin;
-
-               if ( ! zconfout )
-                       zconfout = stdout;
-
-               if ( ! YY_CURRENT_BUFFER ) {
-                       zconfensure_buffer_stack ();
-                       YY_CURRENT_BUFFER_LVALUE =
-                               zconf_create_buffer(zconfin,YY_BUF_SIZE );
-               }
-
-               zconf_load_buffer_state( );
-               }
-
-       while ( 1 )             /* loops until end-of-file is reached */
-               {
-               yy_cp = (yy_c_buf_p);
-
-               /* Support of zconftext. */
-               *yy_cp = (yy_hold_char);
-
-               /* yy_bp points to the position in yy_ch_buf of the start of
-                * the current run.
-                */
-               yy_bp = yy_cp;
-
-               yy_current_state = (yy_start);
-yy_match:
-               while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)]  ]) > 0 )
-                       ++yy_cp;
-
-               yy_current_state = -yy_current_state;
-
-yy_find_action:
-               yy_act = yy_accept[yy_current_state];
-
-               YY_DO_BEFORE_ACTION;
-
-do_action:     /* This label is used only to access EOF actions. */
-
-               switch ( yy_act )
-       { /* beginning of action switch */
-case 1:
-/* rule 1 can match eol */
-case 2:
-/* rule 2 can match eol */
-YY_RULE_SETUP
-{
-       current_file->lineno++;
-       return T_EOL;
-}
-       YY_BREAK
-case 3:
-YY_RULE_SETUP
-
-       YY_BREAK
-case 4:
-YY_RULE_SETUP
-{
-       BEGIN(COMMAND);
-}
-       YY_BREAK
-case 5:
-YY_RULE_SETUP
-{
-       unput(zconftext[0]);
-       BEGIN(COMMAND);
-}
-       YY_BREAK
-
-case 6:
-YY_RULE_SETUP
-{
-               const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
-               BEGIN(PARAM);
-               current_pos.file = current_file;
-               current_pos.lineno = current_file->lineno;
-               if (id && id->flags & TF_COMMAND) {
-                       zconflval.id = id;
-                       return id->token;
-               }
-               alloc_string(zconftext, zconfleng);
-               zconflval.string = text;
-               return T_WORD;
-       }
-       YY_BREAK
-case 7:
-YY_RULE_SETUP
-warn_ignored_character(*zconftext);
-       YY_BREAK
-case 8:
-/* rule 8 can match eol */
-YY_RULE_SETUP
-{
-               BEGIN(INITIAL);
-               current_file->lineno++;
-               return T_EOL;
-       }
-       YY_BREAK
-
-case 9:
-YY_RULE_SETUP
-return T_AND;
-       YY_BREAK
-case 10:
-YY_RULE_SETUP
-return T_OR;
-       YY_BREAK
-case 11:
-YY_RULE_SETUP
-return T_OPEN_PAREN;
-       YY_BREAK
-case 12:
-YY_RULE_SETUP
-return T_CLOSE_PAREN;
-       YY_BREAK
-case 13:
-YY_RULE_SETUP
-return T_NOT;
-       YY_BREAK
-case 14:
-YY_RULE_SETUP
-return T_EQUAL;
-       YY_BREAK
-case 15:
-YY_RULE_SETUP
-return T_UNEQUAL;
-       YY_BREAK
-case 16:
-YY_RULE_SETUP
-return T_LESS_EQUAL;
-       YY_BREAK
-case 17:
-YY_RULE_SETUP
-return T_GREATER_EQUAL;
-       YY_BREAK
-case 18:
-YY_RULE_SETUP
-return T_LESS;
-       YY_BREAK
-case 19:
-YY_RULE_SETUP
-return T_GREATER;
-       YY_BREAK
-case 20:
-YY_RULE_SETUP
-{
-               str = zconftext[0];
-               new_string();
-               BEGIN(STRING);
-       }
-       YY_BREAK
-case 21:
-/* rule 21 can match eol */
-YY_RULE_SETUP
-BEGIN(INITIAL); current_file->lineno++; return T_EOL;
-       YY_BREAK
-case 22:
-YY_RULE_SETUP
-{
-               const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
-               if (id && id->flags & TF_PARAM) {
-                       zconflval.id = id;
-                       return id->token;
-               }
-               alloc_string(zconftext, zconfleng);
-               zconflval.string = text;
-               return T_WORD;
-       }
-       YY_BREAK
-case 23:
-YY_RULE_SETUP
-/* comment */
-       YY_BREAK
-case 24:
-/* rule 24 can match eol */
-YY_RULE_SETUP
-current_file->lineno++;
-       YY_BREAK
-case 25:
-YY_RULE_SETUP
-
-       YY_BREAK
-case 26:
-YY_RULE_SETUP
-warn_ignored_character(*zconftext);
-       YY_BREAK
-case YY_STATE_EOF(PARAM):
-{
-               BEGIN(INITIAL);
-       }
-       YY_BREAK
-
-case 27:
-/* rule 27 can match eol */
-*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
-(yy_c_buf_p) = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up zconftext again */
-YY_RULE_SETUP
-{
-               append_string(zconftext, zconfleng);
-               zconflval.string = text;
-               return T_WORD_QUOTE;
-       }
-       YY_BREAK
-case 28:
-YY_RULE_SETUP
-{
-               append_string(zconftext, zconfleng);
-       }
-       YY_BREAK
-case 29:
-/* rule 29 can match eol */
-*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
-(yy_c_buf_p) = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up zconftext again */
-YY_RULE_SETUP
-{
-               append_string(zconftext + 1, zconfleng - 1);
-               zconflval.string = text;
-               return T_WORD_QUOTE;
-       }
-       YY_BREAK
-case 30:
-YY_RULE_SETUP
-{
-               append_string(zconftext + 1, zconfleng - 1);
-       }
-       YY_BREAK
-case 31:
-YY_RULE_SETUP
-{
-               if (str == zconftext[0]) {
-                       BEGIN(PARAM);
-                       zconflval.string = text;
-                       return T_WORD_QUOTE;
-               } else
-                       append_string(zconftext, 1);
-       }
-       YY_BREAK
-case 32:
-/* rule 32 can match eol */
-YY_RULE_SETUP
-{
-               printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
-               current_file->lineno++;
-               BEGIN(INITIAL);
-               return T_EOL;
-       }
-       YY_BREAK
-case YY_STATE_EOF(STRING):
-{
-               BEGIN(INITIAL);
-       }
-       YY_BREAK
-
-case 33:
-YY_RULE_SETUP
-{
-               ts = 0;
-               for (i = 0; i < zconfleng; i++) {
-                       if (zconftext[i] == '\t')
-                               ts = (ts & ~7) + 8;
-                       else
-                               ts++;
-               }
-               last_ts = ts;
-               if (first_ts) {
-                       if (ts < first_ts) {
-                               zconf_endhelp();
-                               return T_HELPTEXT;
-                       }
-                       ts -= first_ts;
-                       while (ts > 8) {
-                               append_string("        ", 8);
-                               ts -= 8;
-                       }
-                       append_string("        ", ts);
-               }
-       }
-       YY_BREAK
-case 34:
-/* rule 34 can match eol */
-*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
-(yy_c_buf_p) = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up zconftext again */
-YY_RULE_SETUP
-{
-               current_file->lineno++;
-               zconf_endhelp();
-               return T_HELPTEXT;
-       }
-       YY_BREAK
-case 35:
-/* rule 35 can match eol */
-YY_RULE_SETUP
-{
-               current_file->lineno++;
-               append_string("\n", 1);
-       }
-       YY_BREAK
-case 36:
-YY_RULE_SETUP
-{
-               while (zconfleng) {
-                       if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
-                               break;
-                       zconfleng--;
-               }
-               append_string(zconftext, zconfleng);
-               if (!first_ts)
-                       first_ts = last_ts;
-       }
-       YY_BREAK
-case YY_STATE_EOF(HELP):
-{
-               zconf_endhelp();
-               return T_HELPTEXT;
-       }
-       YY_BREAK
-
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(COMMAND):
-{
-       if (current_file) {
-               zconf_endfile();
-               return T_EOL;
-       }
-       fclose(zconfin);
-       yyterminate();
-}
-       YY_BREAK
-case 37:
-YY_RULE_SETUP
-YY_FATAL_ERROR( "flex scanner jammed" );
-       YY_BREAK
-
-       case YY_END_OF_BUFFER:
-               {
-               /* Amount of text matched not including the EOB char. */
-               int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
-
-               /* Undo the effects of YY_DO_BEFORE_ACTION. */
-               *yy_cp = (yy_hold_char);
-               YY_RESTORE_YY_MORE_OFFSET
-
-               if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
-                       {
-                       /* We're scanning a new file or input source.  It's
-                        * possible that this happened because the user
-                        * just pointed zconfin at a new source and called
-                        * zconflex().  If so, then we have to assure
-                        * consistency between YY_CURRENT_BUFFER and our
-                        * globals.  Here is the right place to do so, because
-                        * this is the first action (other than possibly a
-                        * back-up) that will match for the new input source.
-                        */
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-                       YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
-                       }
-
-               /* Note that here we test for yy_c_buf_p "<=" to the position
-                * of the first EOB in the buffer, since yy_c_buf_p will
-                * already have been incremented past the NUL character
-                * (since all states make transitions on EOB to the
-                * end-of-buffer state).  Contrast this with the test
-                * in input().
-                */
-               if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       { /* This was really a NUL. */
-                       yy_state_type yy_next_state;
-
-                       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
-
-                       yy_current_state = yy_get_previous_state(  );
-
-                       /* Okay, we're now positioned to make the NUL
-                        * transition.  We couldn't have
-                        * yy_get_previous_state() go ahead and do it
-                        * for us because it doesn't know how to deal
-                        * with the possibility of jamming (and we don't
-                        * want to build jamming into it because then it
-                        * will run more slowly).
-                        */
-
-                       yy_next_state = yy_try_NUL_trans( yy_current_state );
-
-                       yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-
-                       if ( yy_next_state )
-                               {
-                               /* Consume the NUL. */
-                               yy_cp = ++(yy_c_buf_p);
-                               yy_current_state = yy_next_state;
-                               goto yy_match;
-                               }
-
-                       else
-                               {
-                               yy_cp = (yy_c_buf_p);
-                               goto yy_find_action;
-                               }
-                       }
-
-               else switch ( yy_get_next_buffer(  ) )
-                       {
-                       case EOB_ACT_END_OF_FILE:
-                               {
-                               (yy_did_buffer_switch_on_eof) = 0;
-
-                               if ( zconfwrap( ) )
-                                       {
-                                       /* Note: because we've taken care in
-                                        * yy_get_next_buffer() to have set up
-                                        * zconftext, we can now set up
-                                        * yy_c_buf_p so that if some total
-                                        * hoser (like flex itself) wants to
-                                        * call the scanner after we return the
-                                        * YY_NULL, it'll still work - another
-                                        * YY_NULL will get returned.
-                                        */
-                                       (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
-
-                                       yy_act = YY_STATE_EOF(YY_START);
-                                       goto do_action;
-                                       }
-
-                               else
-                                       {
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
-                                       }
-                               break;
-                               }
-
-                       case EOB_ACT_CONTINUE_SCAN:
-                               (yy_c_buf_p) =
-                                       (yytext_ptr) + yy_amount_of_matched_text;
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_match;
-
-                       case EOB_ACT_LAST_MATCH:
-                               (yy_c_buf_p) =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_find_action;
-                       }
-               break;
-               }
-
-       default:
-               YY_FATAL_ERROR(
-                       "fatal flex scanner internal error--no action found" );
-       } /* end of action switch */
-               } /* end of scanning one token */
-} /* end of zconflex */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- *     EOB_ACT_LAST_MATCH -
- *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- *     EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (void)
-{
-       register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-       register char *source = (yytext_ptr);
-       register int number_to_move, i;
-       int ret_val;
-
-       if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
-               YY_FATAL_ERROR(
-               "fatal flex scanner internal error--end of buffer missed" );
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
-               { /* Don't try to fill the buffer, so this is an EOF. */
-               if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
-                       {
-                       /* We matched a single character, the EOB, so
-                        * treat this as a final EOF.
-                        */
-                       return EOB_ACT_END_OF_FILE;
-                       }
-
-               else
-                       {
-                       /* We matched some text prior to the EOB, first
-                        * process it.
-                        */
-                       return EOB_ACT_LAST_MATCH;
-                       }
-               }
-
-       /* Try to read more data. */
-
-       /* First move last chars to start of buffer. */
-       number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
-
-       for ( i = 0; i < number_to_move; ++i )
-               *(dest++) = *(source++);
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
-               /* don't do the read, it's not guaranteed to return an EOF,
-                * just force an EOF
-                */
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
-
-       else
-               {
-                       int num_to_read =
-                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
-               while ( num_to_read <= 0 )
-                       { /* Not enough room in the buffer - grow it. */
-
-                       /* just a shorter name for the current buffer */
-                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
-                       int yy_c_buf_p_offset =
-                               (int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-                       if ( b->yy_is_our_buffer )
-                               {
-                               int new_size = b->yy_buf_size * 2;
-
-                               if ( new_size <= 0 )
-                                       b->yy_buf_size += b->yy_buf_size / 8;
-                               else
-                                       b->yy_buf_size *= 2;
-
-                               b->yy_ch_buf = (char *)
-                                       /* Include room in for 2 EOB chars. */
-                                       zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
-                               }
-                       else
-                               /* Can't grow it, we don't own it. */
-                               b->yy_ch_buf = 0;
-
-                       if ( ! b->yy_ch_buf )
-                               YY_FATAL_ERROR(
-                               "fatal error - scanner input buffer overflow" );
-
-                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
-
-                       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
-                                               number_to_move - 1;
-
-                       }
-
-               if ( num_to_read > YY_READ_BUF_SIZE )
-                       num_to_read = YY_READ_BUF_SIZE;
-
-               /* Read in more data. */
-               YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       (yy_n_chars), (size_t) num_to_read );
-
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       if ( (yy_n_chars) == 0 )
-               {
-               if ( number_to_move == YY_MORE_ADJ )
-                       {
-                       ret_val = EOB_ACT_END_OF_FILE;
-                       zconfrestart(zconfin  );
-                       }
-
-               else
-                       {
-                       ret_val = EOB_ACT_LAST_MATCH;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
-                               YY_BUFFER_EOF_PENDING;
-                       }
-               }
-
-       else
-               ret_val = EOB_ACT_CONTINUE_SCAN;
-
-       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-               /* Extend the array by 50%, plus the number we really need. */
-               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
-               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
-               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-       }
-
-       (yy_n_chars) += number_to_move;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
-
-       (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
-       return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-    static yy_state_type yy_get_previous_state (void)
-{
-       register yy_state_type yy_current_state;
-       register char *yy_cp;
-    
-       yy_current_state = (yy_start);
-
-       for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-               {
-               yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
-               }
-
-       return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- *     next_state = yy_try_NUL_trans( current_state );
- */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
-{
-       register int yy_is_jam;
-    
-       yy_current_state = yy_nxt[yy_current_state][1];
-       yy_is_jam = (yy_current_state <= 0);
-
-       return yy_is_jam ? 0 : yy_current_state;
-}
-
-    static void yyunput (int c, register char * yy_bp )
-{
-       register char *yy_cp;
-    
-    yy_cp = (yy_c_buf_p);
-
-       /* undo effects of setting up zconftext */
-       *yy_cp = (yy_hold_char);
-
-       if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-               { /* need to shift things up to make room */
-               /* +2 for EOB chars. */
-               register int number_to_move = (yy_n_chars) + 2;
-               register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-                                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-               register char *source =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
-
-               while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-                       *--dest = *--source;
-
-               yy_cp += (int) (dest - source);
-               yy_bp += (int) (dest - source);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
-
-               if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-                       YY_FATAL_ERROR( "flex scanner push-back overflow" );
-               }
-
-       *--yy_cp = (char) c;
-
-       (yytext_ptr) = yy_bp;
-       (yy_hold_char) = *yy_cp;
-       (yy_c_buf_p) = yy_cp;
-}
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-    static int yyinput (void)
-#else
-    static int input  (void)
-#endif
-
-{
-       int c;
-    
-       *(yy_c_buf_p) = (yy_hold_char);
-
-       if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
-               {
-               /* yy_c_buf_p now points to the character we want to return.
-                * If this occurs *before* the EOB characters, then it's a
-                * valid NUL; if not, then we've hit the end of the buffer.
-                */
-               if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       /* This was really a NUL. */
-                       *(yy_c_buf_p) = '\0';
-
-               else
-                       { /* need more input */
-                       int offset = (yy_c_buf_p) - (yytext_ptr);
-                       ++(yy_c_buf_p);
-
-                       switch ( yy_get_next_buffer(  ) )
-                               {
-                               case EOB_ACT_LAST_MATCH:
-                                       /* This happens because yy_g_n_b()
-                                        * sees that we've accumulated a
-                                        * token and flags that we need to
-                                        * try matching the token before
-                                        * proceeding.  But for input(),
-                                        * there's no matching to consider.
-                                        * So convert the EOB_ACT_LAST_MATCH
-                                        * to EOB_ACT_END_OF_FILE.
-                                        */
-
-                                       /* Reset buffer status. */
-                                       zconfrestart(zconfin );
-
-                                       /*FALLTHROUGH*/
-
-                               case EOB_ACT_END_OF_FILE:
-                                       {
-                                       if ( zconfwrap( ) )
-                                               return EOF;
-
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
-#ifdef __cplusplus
-                                       return yyinput();
-#else
-                                       return input();
-#endif
-                                       }
-
-                               case EOB_ACT_CONTINUE_SCAN:
-                                       (yy_c_buf_p) = (yytext_ptr) + offset;
-                                       break;
-                               }
-                       }
-               }
-
-       c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
-       *(yy_c_buf_p) = '\0';   /* preserve zconftext */
-       (yy_hold_char) = *++(yy_c_buf_p);
-
-       return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * 
- * @note This function does not reset the start condition to @c INITIAL .
- */
-    void zconfrestart  (FILE * input_file )
-{
-    
-       if ( ! YY_CURRENT_BUFFER ){
-        zconfensure_buffer_stack ();
-               YY_CURRENT_BUFFER_LVALUE =
-            zconf_create_buffer(zconfin,YY_BUF_SIZE );
-       }
-
-       zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
-       zconf_load_buffer_state( );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * 
- */
-    void zconf_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
-{
-    
-       /* TODO. We should be able to replace this entire function body
-        * with
-        *              zconfpop_buffer_state();
-        *              zconfpush_buffer_state(new_buffer);
-     */
-       zconfensure_buffer_stack ();
-       if ( YY_CURRENT_BUFFER == new_buffer )
-               return;
-
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-       zconf_load_buffer_state( );
-
-       /* We don't actually know whether we did this switch during
-        * EOF (zconfwrap()) processing, but the only time this flag
-        * is looked at is after zconfwrap() is called, so it's safe
-        * to go ahead and always set it.
-        */
-       (yy_did_buffer_switch_on_eof) = 1;
-}
-
-static void zconf_load_buffer_state  (void)
-{
-       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-       (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
-       zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
-       (yy_hold_char) = *(yy_c_buf_p);
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * 
- * @return the allocated buffer state.
- */
-    YY_BUFFER_STATE zconf_create_buffer  (FILE * file, int  size )
-{
-       YY_BUFFER_STATE b;
-    
-       b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
-
-       b->yy_buf_size = size;
-
-       /* yy_ch_buf has to be 2 characters longer than the size given because
-        * we need to put in 2 end-of-buffer characters.
-        */
-       b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2  );
-       if ( ! b->yy_ch_buf )
-               YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
-
-       b->yy_is_our_buffer = 1;
-
-       zconf_init_buffer(b,file );
-
-       return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with zconf_create_buffer()
- * 
- */
-    void zconf_delete_buffer (YY_BUFFER_STATE  b )
-{
-    
-       if ( ! b )
-               return;
-
-       if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
-               YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
-       if ( b->yy_is_our_buffer )
-               zconffree((void *) b->yy_ch_buf  );
-
-       zconffree((void *) b  );
-}
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a zconfrestart() or at EOF.
- */
-    static void zconf_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
-
-{
-       int oerrno = errno;
-    
-       zconf_flush_buffer(b );
-
-       b->yy_input_file = file;
-       b->yy_fill_buffer = 1;
-
-    /* If b is the current buffer, then zconf_init_buffer was _probably_
-     * called from zconfrestart() or through yy_get_next_buffer.
-     * In that case, we don't want to reset the lineno or column.
-     */
-    if (b != YY_CURRENT_BUFFER){
-        b->yy_bs_lineno = 1;
-        b->yy_bs_column = 0;
-    }
-
-        b->yy_is_interactive = 0;
-    
-       errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * 
- */
-    void zconf_flush_buffer (YY_BUFFER_STATE  b )
-{
-       if ( ! b )
-               return;
-
-       b->yy_n_chars = 0;
-
-       /* We always need two end-of-buffer characters.  The first causes
-        * a transition to the end-of-buffer state.  The second causes
-        * a jam in that state.
-        */
-       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
-       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
-       b->yy_buf_pos = &b->yy_ch_buf[0];
-
-       b->yy_at_bol = 1;
-       b->yy_buffer_status = YY_BUFFER_NEW;
-
-       if ( b == YY_CURRENT_BUFFER )
-               zconf_load_buffer_state( );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- *  the current state. This function will allocate the stack
- *  if necessary.
- *  @param new_buffer The new state.
- *  
- */
-void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
-{
-       if (new_buffer == NULL)
-               return;
-
-       zconfensure_buffer_stack();
-
-       /* This block is copied from zconf_switch_to_buffer. */
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       /* Only push if top exists. Otherwise, replace top. */
-       if (YY_CURRENT_BUFFER)
-               (yy_buffer_stack_top)++;
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
-       /* copied from zconf_switch_to_buffer. */
-       zconf_load_buffer_state( );
-       (yy_did_buffer_switch_on_eof) = 1;
-}
-
-/** Removes and deletes the top of the stack, if present.
- *  The next element becomes the new top.
- *  
- */
-void zconfpop_buffer_state (void)
-{
-       if (!YY_CURRENT_BUFFER)
-               return;
-
-       zconf_delete_buffer(YY_CURRENT_BUFFER );
-       YY_CURRENT_BUFFER_LVALUE = NULL;
-       if ((yy_buffer_stack_top) > 0)
-               --(yy_buffer_stack_top);
-
-       if (YY_CURRENT_BUFFER) {
-               zconf_load_buffer_state( );
-               (yy_did_buffer_switch_on_eof) = 1;
-       }
-}
-
-/* Allocates the stack if it does not exist.
- *  Guarantees space for at least one push.
- */
-static void zconfensure_buffer_stack (void)
-{
-       int num_to_alloc;
-    
-       if (!(yy_buffer_stack)) {
-
-               /* First allocation is just for 2 elements, since we don't know if this
-                * scanner will even need a stack. We use 2 instead of 1 to avoid an
-                * immediate realloc on the next call.
-         */
-               num_to_alloc = 1;
-               (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
-                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
-                                                                 
-               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-                               
-               (yy_buffer_stack_max) = num_to_alloc;
-               (yy_buffer_stack_top) = 0;
-               return;
-       }
-
-       if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
-
-               /* Increase the buffer to prepare for a possible push. */
-               int grow_size = 8 /* arbitrary grow size */;
-
-               num_to_alloc = (yy_buffer_stack_max) + grow_size;
-               (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
-                                                               ((yy_buffer_stack),
-                                                               num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
-
-               /* zero only the new slots.*/
-               memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
-               (yy_buffer_stack_max) = num_to_alloc;
-       }
-}
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * 
- * @return the newly allocated buffer state object. 
- */
-YY_BUFFER_STATE zconf_scan_buffer  (char * base, yy_size_t  size )
-{
-       YY_BUFFER_STATE b;
-    
-       if ( size < 2 ||
-            base[size-2] != YY_END_OF_BUFFER_CHAR ||
-            base[size-1] != YY_END_OF_BUFFER_CHAR )
-               /* They forgot to leave room for the EOB's. */
-               return 0;
-
-       b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
-
-       b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
-       b->yy_buf_pos = b->yy_ch_buf = base;
-       b->yy_is_our_buffer = 0;
-       b->yy_input_file = 0;
-       b->yy_n_chars = b->yy_buf_size;
-       b->yy_is_interactive = 0;
-       b->yy_at_bol = 1;
-       b->yy_fill_buffer = 0;
-       b->yy_buffer_status = YY_BUFFER_NEW;
-
-       zconf_switch_to_buffer(b  );
-
-       return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to zconflex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * 
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- *       zconf_scan_bytes() instead.
- */
-YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
-{
-    
-       return zconf_scan_bytes(yystr,strlen(yystr) );
-}
-
-/** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
- * scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- * 
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE zconf_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
-{
-       YY_BUFFER_STATE b;
-       char *buf;
-       yy_size_t n;
-       int i;
-    
-       /* Get memory for full buffer, including space for trailing EOB's. */
-       n = _yybytes_len + 2;
-       buf = (char *) zconfalloc(n  );
-       if ( ! buf )
-               YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
-
-       for ( i = 0; i < _yybytes_len; ++i )
-               buf[i] = yybytes[i];
-
-       buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
-       b = zconf_scan_buffer(buf,n );
-       if ( ! b )
-               YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
-
-       /* It's okay to grow etc. this buffer, and we should throw it
-        * away when we're done.
-        */
-       b->yy_is_our_buffer = 1;
-
-       return b;
-}
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yy_fatal_error (yyconst char* msg )
-{
-       (void) fprintf( stderr, "%s\n", msg );
-       exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
-       do \
-               { \
-               /* Undo effects of setting up zconftext. */ \
-        int yyless_macro_arg = (n); \
-        YY_LESS_LINENO(yyless_macro_arg);\
-               zconftext[zconfleng] = (yy_hold_char); \
-               (yy_c_buf_p) = zconftext + yyless_macro_arg; \
-               (yy_hold_char) = *(yy_c_buf_p); \
-               *(yy_c_buf_p) = '\0'; \
-               zconfleng = yyless_macro_arg; \
-               } \
-       while ( 0 )
-
-/* Accessor  methods (get/set functions) to struct members. */
-
-/** Get the current line number.
- * 
- */
-int zconfget_lineno  (void)
-{
-        
-    return zconflineno;
-}
-
-/** Get the input stream.
- * 
- */
-FILE *zconfget_in  (void)
-{
-        return zconfin;
-}
-
-/** Get the output stream.
- * 
- */
-FILE *zconfget_out  (void)
-{
-        return zconfout;
-}
-
-/** Get the length of the current token.
- * 
- */
-int zconfget_leng  (void)
-{
-        return zconfleng;
-}
-
-/** Get the current token.
- * 
- */
-
-char *zconfget_text  (void)
-{
-        return zconftext;
-}
-
-/** Set the current line number.
- * @param line_number
- * 
- */
-void zconfset_lineno (int  line_number )
-{
-    
-    zconflineno = line_number;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param in_str A readable stream.
- * 
- * @see zconf_switch_to_buffer
- */
-void zconfset_in (FILE *  in_str )
-{
-        zconfin = in_str ;
-}
-
-void zconfset_out (FILE *  out_str )
-{
-        zconfout = out_str ;
-}
-
-int zconfget_debug  (void)
-{
-        return zconf_flex_debug;
-}
-
-void zconfset_debug (int  bdebug )
-{
-        zconf_flex_debug = bdebug ;
-}
-
-static int yy_init_globals (void)
-{
-        /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from zconflex_destroy(), so don't allocate here.
-     */
-
-    (yy_buffer_stack) = 0;
-    (yy_buffer_stack_top) = 0;
-    (yy_buffer_stack_max) = 0;
-    (yy_c_buf_p) = (char *) 0;
-    (yy_init) = 0;
-    (yy_start) = 0;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
-    zconfin = stdin;
-    zconfout = stdout;
-#else
-    zconfin = (FILE *) 0;
-    zconfout = (FILE *) 0;
-#endif
-
-    /* For future reference: Set errno on error, since we are called by
-     * zconflex_init()
-     */
-    return 0;
-}
-
-/* zconflex_destroy is for both reentrant and non-reentrant scanners. */
-int zconflex_destroy  (void)
-{
-    
-    /* Pop the buffer stack, destroying each element. */
-       while(YY_CURRENT_BUFFER){
-               zconf_delete_buffer(YY_CURRENT_BUFFER  );
-               YY_CURRENT_BUFFER_LVALUE = NULL;
-               zconfpop_buffer_state();
-       }
-
-       /* Destroy the stack itself. */
-       zconffree((yy_buffer_stack) );
-       (yy_buffer_stack) = NULL;
-
-    /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * zconflex() is called, initialization will occur. */
-    yy_init_globals( );
-
-    return 0;
-}
-
-/*
- * Internal utility routines.
- */
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
-{
-       register int i;
-       for ( i = 0; i < n; ++i )
-               s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s )
-{
-       register int n;
-       for ( n = 0; s[n]; ++n )
-               ;
-
-       return n;
-}
-#endif
-
-void *zconfalloc (yy_size_t  size )
-{
-       return (void *) malloc( size );
-}
-
-void *zconfrealloc  (void * ptr, yy_size_t  size )
-{
-       /* The cast to (char *) in the following accommodates both
-        * implementations that use char* generic pointers, and those
-        * that use void* generic pointers.  It works with the latter
-        * because both ANSI C and C++ allow castless assignment from
-        * any pointer type to void*, and deal with argument conversions
-        * as though doing an assignment.
-        */
-       return (void *) realloc( (char *) ptr, size );
-}
-
-void zconffree (void * ptr )
-{
-       free( (char *) ptr );   /* see zconfrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-void zconf_starthelp(void)
-{
-       new_string();
-       last_ts = first_ts = 0;
-       BEGIN(HELP);
-}
-
-static void zconf_endhelp(void)
-{
-       zconflval.string = text;
-       BEGIN(INITIAL);
-}
-
-/*
- * Try to open specified file with following names:
- * ./name
- * $(srctree)/name
- * The latter is used when srctree is separate from objtree
- * when compiling the kernel.
- * Return NULL if file is not found.
- */
-FILE *zconf_fopen(const char *name)
-{
-       char *env, fullname[PATH_MAX+1];
-       FILE *f;
-
-       f = fopen(name, "r");
-       if (!f && name != NULL && name[0] != '/') {
-               env = getenv(SRCTREE);
-               if (env) {
-                       sprintf(fullname, "%s/%s", env, name);
-                       f = fopen(fullname, "r");
-               }
-       }
-       return f;
-}
-
-void zconf_initscan(const char *name)
-{
-       zconfin = zconf_fopen(name);
-       if (!zconfin) {
-               printf("can't find file %s\n", name);
-               exit(1);
-       }
-
-       current_buf = xmalloc(sizeof(*current_buf));
-       memset(current_buf, 0, sizeof(*current_buf));
-
-       current_file = file_lookup(name);
-       current_file->lineno = 1;
-}
-
-void zconf_nextfile(const char *name)
-{
-       struct file *iter;
-       struct file *file = file_lookup(name);
-       struct buffer *buf = xmalloc(sizeof(*buf));
-       memset(buf, 0, sizeof(*buf));
-
-       current_buf->state = YY_CURRENT_BUFFER;
-       zconfin = zconf_fopen(file->name);
-       if (!zconfin) {
-               printf("%s:%d: can't open file \"%s\"\n",
-                   zconf_curname(), zconf_lineno(), file->name);
-               exit(1);
-       }
-       zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
-       buf->parent = current_buf;
-       current_buf = buf;
-
-       for (iter = current_file->parent; iter; iter = iter->parent ) {
-               if (!strcmp(current_file->name,iter->name) ) {
-                       printf("%s:%d: recursive inclusion detected. "
-                              "Inclusion path:\n  current file : '%s'\n",
-                              zconf_curname(), zconf_lineno(),
-                              zconf_curname());
-                       iter = current_file->parent;
-                       while (iter && \
-                              strcmp(iter->name,current_file->name)) {
-                               printf("  included from: '%s:%d'\n",
-                                      iter->name, iter->lineno-1);
-                               iter = iter->parent;
-                       }
-                       if (iter)
-                               printf("  included from: '%s:%d'\n",
-                                      iter->name, iter->lineno+1);
-                       exit(1);
-               }
-       }
-       file->lineno = 1;
-       file->parent = current_file;
-       current_file = file;
-}
-
-static void zconf_endfile(void)
-{
-       struct buffer *parent;
-
-       current_file = current_file->parent;
-
-       parent = current_buf->parent;
-       if (parent) {
-               fclose(zconfin);
-               zconf_delete_buffer(YY_CURRENT_BUFFER);
-               zconf_switch_to_buffer(parent->state);
-       }
-       free(current_buf);
-       current_buf = parent;
-}
-
-int zconf_lineno(void)
-{
-       return current_pos.lineno;
-}
-
-const char *zconf_curname(void)
-{
-       return current_pos.file ? current_pos.file->name : "<none>";
-}
-
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
deleted file mode 100644 (file)
index 65b7515..0000000
+++ /dev/null
@@ -1,2471 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
-
-/* Bison implementation for Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
-   simplifying the original so-called "semantic" parser.  */
-
-/* All symbols defined below should begin with yy or YY, to avoid
-   infringing on user name space.  This should be done even for local
-   variables, as they might otherwise be expanded by user macros.
-   There are some unavoidable exceptions within include files to
-   define necessary library symbols; they are noted "INFRINGES ON
-   USER NAME SPACE" below.  */
-
-/* Identify Bison output.  */
-#define YYBISON 1
-
-/* Bison version.  */
-#define YYBISON_VERSION "3.0.4"
-
-/* Skeleton name.  */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers.  */
-#define YYPURE 0
-
-/* Push parsers.  */
-#define YYPUSH 0
-
-/* Pull parsers.  */
-#define YYPULL 1
-
-
-/* Substitute the variable and function names.  */
-#define yyparse         zconfparse
-#define yylex           zconflex
-#define yyerror         zconferror
-#define yydebug         zconfdebug
-#define yynerrs         zconfnerrs
-
-#define yylval          zconflval
-#define yychar          zconfchar
-
-/* Copy the first part of user declarations.  */
-
-
-/*
- * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
- * Released under the terms of the GNU GPL v2.0.
- */
-
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdbool.h>
-
-#include "lkc.h"
-
-#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
-
-#define PRINTD         0x0001
-#define DEBUG_PARSE    0x0002
-
-int cdebug = PRINTD;
-
-extern int zconflex(void);
-static void zconfprint(const char *err, ...);
-static void zconf_error(const char *err, ...);
-static void zconferror(const char *err);
-static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
-
-struct symbol *symbol_hash[SYMBOL_HASHSIZE];
-
-static struct menu *current_menu, *current_entry;
-
-
-
-
-# ifndef YY_NULLPTR
-#  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
-#  else
-#   define YY_NULLPTR 0
-#  endif
-# endif
-
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-
-/* Debug traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
-#if YYDEBUG
-extern int zconfdebug;
-#endif
-
-/* Token type.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-  enum yytokentype
-  {
-    T_MAINMENU = 258,
-    T_MENU = 259,
-    T_ENDMENU = 260,
-    T_SOURCE = 261,
-    T_CHOICE = 262,
-    T_ENDCHOICE = 263,
-    T_COMMENT = 264,
-    T_CONFIG = 265,
-    T_MENUCONFIG = 266,
-    T_HELP = 267,
-    T_HELPTEXT = 268,
-    T_IF = 269,
-    T_ENDIF = 270,
-    T_DEPENDS = 271,
-    T_OPTIONAL = 272,
-    T_PROMPT = 273,
-    T_TYPE = 274,
-    T_DEFAULT = 275,
-    T_SELECT = 276,
-    T_IMPLY = 277,
-    T_RANGE = 278,
-    T_VISIBLE = 279,
-    T_OPTION = 280,
-    T_ON = 281,
-    T_WORD = 282,
-    T_WORD_QUOTE = 283,
-    T_UNEQUAL = 284,
-    T_LESS = 285,
-    T_LESS_EQUAL = 286,
-    T_GREATER = 287,
-    T_GREATER_EQUAL = 288,
-    T_CLOSE_PAREN = 289,
-    T_OPEN_PAREN = 290,
-    T_EOL = 291,
-    T_OR = 292,
-    T_AND = 293,
-    T_EQUAL = 294,
-    T_NOT = 295
-  };
-#endif
-
-/* Value type.  */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
-union YYSTYPE
-{
-
-
-       char *string;
-       struct file *file;
-       struct symbol *symbol;
-       struct expr *expr;
-       struct menu *menu;
-       const struct kconf_id *id;
-
-
-};
-
-typedef union YYSTYPE YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-
-extern YYSTYPE zconflval;
-
-int zconfparse (void);
-
-
-
-/* Copy the second part of user declarations.  */
-
-
-/* Include zconf.hash.c here so it can see the token constants. */
-#include "zconf.hash.c"
-
-
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#else
-typedef signed char yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-#  define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-#  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYSIZE_T size_t
-# else
-#  define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-#  if ENABLE_NLS
-#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-#  endif
-# endif
-# ifndef YY_
-#  define YY_(Msgid) Msgid
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__                                               \
-      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
-     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-#  define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E.  */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
-#else
-# define YYUSE(E) /* empty */
-#endif
-
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
-    _Pragma ("GCC diagnostic push") \
-    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
-    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
-    _Pragma ("GCC diagnostic pop")
-#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols.  */
-
-# ifdef YYSTACK_USE_ALLOCA
-#  if YYSTACK_USE_ALLOCA
-#   ifdef __GNUC__
-#    define YYSTACK_ALLOC __builtin_alloca
-#   elif defined __BUILTIN_VA_ARG_INCR
-#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-#   elif defined _AIX
-#    define YYSTACK_ALLOC __alloca
-#   elif defined _MSC_VER
-#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-#    define alloca _alloca
-#   else
-#    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
-#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
-#     ifndef EXIT_SUCCESS
-#      define EXIT_SUCCESS 0
-#     endif
-#    endif
-#   endif
-#  endif
-# endif
-
-# ifdef YYSTACK_ALLOC
-   /* Pacify GCC's 'empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-    /* The OS might guarantee only one guard page at the bottom of the stack,
-       and a page size can be as small as 4096 bytes.  So we cannot safely
-       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
-       to allow for a few compiler-allocated temporary stack slots.  */
-#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-#  endif
-# else
-#  define YYSTACK_ALLOC YYMALLOC
-#  define YYSTACK_FREE YYFREE
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-#  endif
-#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
-       && ! ((defined YYMALLOC || defined malloc) \
-             && (defined YYFREE || defined free)))
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef EXIT_SUCCESS
-#    define EXIT_SUCCESS 0
-#   endif
-#  endif
-#  ifndef YYMALLOC
-#   define YYMALLOC malloc
-#   if ! defined malloc && ! defined EXIT_SUCCESS
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-#  ifndef YYFREE
-#   define YYFREE free
-#   if ! defined free && ! defined EXIT_SUCCESS
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
-     && (! defined __cplusplus \
-         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member.  */
-union yyalloc
-{
-  yytype_int16 yyss_alloc;
-  YYSTYPE yyvs_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
-   N elements.  */
-# define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
-      + YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one.  The
-   local variables YYSIZE and YYSTACKSIZE give the old and new number of
-   elements in the stack, and YYPTR gives the new location of the
-   stack.  Advance YYPTR to a properly aligned location for the next
-   stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
-    do                                                                  \
-      {                                                                 \
-        YYSIZE_T yynewbytes;                                            \
-        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
-        Stack = &yyptr->Stack_alloc;                                    \
-        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-        yyptr += yynewbytes / sizeof (*yyptr);                          \
-      }                                                                 \
-    while (0)
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(Dst, Src, Count) \
-      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
-#  else
-#   define YYCOPY(Dst, Src, Count)              \
-      do                                        \
-        {                                       \
-          YYSIZE_T yyi;                         \
-          for (yyi = 0; yyi < (Count); yyi++)   \
-            (Dst)[yyi] = (Src)[yyi];            \
-        }                                       \
-      while (0)
-#  endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  11
-/* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   301
-
-/* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  41
-/* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  50
-/* YYNRULES -- Number of rules.  */
-#define YYNRULES  124
-/* YYNSTATES -- Number of states.  */
-#define YYNSTATES  204
-
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
-   by yylex, with out-of-bounds checking.  */
-#define YYUNDEFTOK  2
-#define YYMAXUTOK   295
-
-#define YYTRANSLATE(YYX)                                                \
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex, without out-of-bounds checking.  */
-static const yytype_uint8 yytranslate[] =
-{
-       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
-      35,    36,    37,    38,    39,    40
-};
-
-#if YYDEBUG
-  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
-static const yytype_uint16 yyrline[] =
-{
-       0,   109,   109,   109,   111,   111,   113,   115,   116,   117,
-     118,   119,   120,   124,   128,   128,   128,   128,   128,   128,
-     128,   128,   128,   132,   133,   134,   135,   136,   137,   141,
-     142,   148,   156,   162,   170,   180,   182,   183,   184,   185,
-     186,   187,   190,   198,   204,   214,   220,   226,   232,   235,
-     237,   248,   249,   254,   263,   268,   276,   279,   281,   282,
-     283,   284,   285,   288,   294,   305,   311,   321,   323,   328,
-     336,   344,   347,   349,   350,   351,   356,   363,   370,   375,
-     383,   386,   388,   389,   390,   393,   401,   408,   415,   421,
-     428,   430,   431,   432,   435,   443,   445,   446,   449,   456,
-     458,   463,   464,   467,   468,   469,   473,   474,   477,   478,
-     481,   482,   483,   484,   485,   486,   487,   488,   489,   490,
-     491,   494,   495,   498,   499
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || 0
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
-   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
-static const char *const yytname[] =
-{
-  "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
-  "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
-  "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
-  "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_IMPLY",
-  "T_RANGE", "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE",
-  "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER", "T_GREATER_EQUAL",
-  "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
-  "T_NOT", "$accept", "input", "start", "stmt_list", "option_name",
-  "common_stmt", "option_error", "config_entry_start", "config_stmt",
-  "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
-  "config_option", "symbol_option", "symbol_option_list",
-  "symbol_option_arg", "choice", "choice_entry", "choice_end",
-  "choice_stmt", "choice_option_list", "choice_option", "choice_block",
-  "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu",
-  "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
-  "comment", "comment_stmt", "help_start", "help", "depends_list",
-  "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt",
-  "end", "nl", "if_expr", "expr", "symbol", "word_opt", YY_NULLPTR
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
-   (internal) symbol number NUM (which must be that of a token).  */
-static const yytype_uint16 yytoknum[] =
-{
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
-     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
-     295
-};
-# endif
-
-#define YYPACT_NINF -92
-
-#define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-92)))
-
-#define YYTABLE_NINF -88
-
-#define yytable_value_is_error(Yytable_value) \
-  0
-
-  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-     STATE-NUM.  */
-static const yytype_int16 yypact[] =
-{
-      17,    41,   -92,    15,   -92,   150,   -92,    19,   -92,   -92,
-     -13,   -92,    28,    41,    38,    41,    50,    47,    41,    79,
-      82,    44,    76,   -92,   -92,   -92,   -92,   -92,   -92,   -92,
-     -92,   -92,   118,   -92,   129,   -92,   -92,   -92,   -92,   -92,
-     -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,
-     -92,   -92,   184,   -92,   -92,   107,   -92,   111,   -92,   113,
-     -92,   116,   -92,   139,   140,   151,   -92,   -92,    44,    44,
-     142,   256,   -92,   160,   173,    27,   117,    80,    51,   255,
-     -15,   255,   217,   -92,   -92,   -92,   -92,   -92,   -92,    -8,
-     -92,    44,    44,   107,    87,    87,    87,    87,    87,    87,
-     -92,   -92,   174,   176,   187,    41,    41,    44,   188,   189,
-      87,   -92,   213,   -92,   -92,   -92,   -92,   206,   -92,   -92,
-     193,    41,    41,   203,   -92,   -92,   -92,   -92,   -92,   -92,
-     -92,   -92,   -92,   -92,   -92,   -92,   -92,   229,   -92,   241,
-     -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,
-     216,   -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,
-      44,   229,   222,   229,    64,   229,   229,    87,    31,   231,
-     -92,   -92,   229,   236,   229,    44,   -92,   145,   242,   -92,
-     -92,   243,   244,   245,   229,   251,   -92,   -92,   247,   -92,
-     257,   125,   -92,   -92,   -92,   -92,   -92,   260,    41,   -92,
-     -92,   -92,   -92,   -92
-};
-
-  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-     Performed when YYTABLE does not specify something else to do.  Zero
-     means the default is an error.  */
-static const yytype_uint8 yydefact[] =
-{
-       6,     0,   106,     0,     3,     0,     6,     6,   101,   102,
-       0,     1,     0,     0,     0,     0,   123,     0,     0,     0,
-       0,     0,     0,    14,    19,    15,    16,    21,    17,    18,
-      20,    22,     0,    23,     0,     7,    35,    26,    35,    27,
-      57,    67,     8,    72,    24,    95,    81,     9,    28,    90,
-      25,    10,     0,   107,     2,    76,    13,     0,   103,     0,
-     124,     0,   104,     0,     0,     0,   121,   122,     0,     0,
-       0,   110,   105,     0,     0,     0,     0,     0,     0,     0,
-      90,     0,     0,    77,    85,    53,    86,    31,    33,     0,
-     118,     0,     0,    69,     0,     0,     0,     0,     0,     0,
-      11,    12,     0,     0,     0,     0,    99,     0,     0,     0,
-       0,    49,     0,    41,    40,    36,    37,     0,    39,    38,
-       0,     0,    99,     0,    61,    62,    58,    60,    59,    68,
-      56,    55,    73,    75,    71,    74,    70,   108,    97,     0,
-      96,    82,    84,    80,    83,    79,    92,    93,    91,   117,
-     119,   120,   116,   111,   112,   113,   114,   115,    30,    88,
-       0,   108,     0,   108,   108,   108,   108,     0,     0,     0,
-      89,    65,   108,     0,   108,     0,    98,     0,     0,    42,
-     100,     0,     0,     0,   108,    51,    48,    29,     0,    64,
-       0,   109,    94,    43,    44,    45,    46,     0,     0,    50,
-      63,    66,    47,    52
-};
-
-  /* YYPGOTO[NTERM-NUM].  */
-static const yytype_int16 yypgoto[] =
-{
-     -92,   -92,   285,   291,   -92,    32,   -66,   -92,   -92,   -92,
-     -92,   261,   -92,   -92,   -92,   -92,   -92,   -92,   -92,     1,
-     -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,   -92,
-     -92,    24,   -92,   -92,   -92,   -92,   -92,   221,   220,   -64,
-     -92,   -92,   179,    -1,    67,     0,   110,   -67,   -91,   -92
-};
-
-  /* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int16 yydefgoto[] =
-{
-      -1,     3,     4,     5,    34,    35,   114,    36,    37,    38,
-      39,    75,   115,   116,   168,   199,    40,    41,   130,    42,
-      77,   126,    78,    43,   134,    44,    79,     6,    45,    46,
-     143,    47,    81,    48,    49,    50,   117,   118,    82,   119,
-      80,   140,   162,   163,    51,     7,   176,    70,    71,    61
-};
-
-  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-     positive, shift that token.  If negative, reduce the rule whose
-     number is the opposite.  If YYTABLE_NINF, syntax error.  */
-static const yytype_int16 yytable[] =
-{
-      10,    89,    90,   152,   153,   154,   155,   156,   157,   137,
-      55,   125,    57,   128,    59,    11,   147,    63,   148,   167,
-       1,   138,     1,     2,   150,   151,   149,   -32,   102,    91,
-      92,   -32,   -32,   -32,   -32,   -32,   -32,   -32,   -32,   103,
-     164,   -32,   -32,   104,   -32,   105,   106,   107,   108,   109,
-     110,   -32,   111,     2,   112,    53,    14,    15,   185,    17,
-      18,    19,    20,   113,    56,    21,    22,   186,     8,     9,
-      93,    66,    67,   147,    58,   148,   184,    60,   175,    68,
-     133,   102,   142,    62,    69,   -54,   -54,    33,   -54,   -54,
-     -54,   -54,   103,   177,   -54,   -54,   104,   120,   121,   122,
-     123,    91,    92,   135,   161,   144,    64,   112,   191,    65,
-     129,   132,    72,   141,    66,    67,   124,   -34,   102,    73,
-     172,   -34,   -34,   -34,   -34,   -34,   -34,   -34,   -34,   103,
-      74,   -34,   -34,   104,   -34,   105,   106,   107,   108,   109,
-     110,   -34,   111,    53,   112,   131,   136,    83,   145,    84,
-      -5,    12,    85,   113,    13,    14,    15,    16,    17,    18,
-      19,    20,    91,    92,    21,    22,    23,    24,    25,    26,
-      27,    28,    29,    30,    31,    86,    87,    32,     2,    91,
-      92,   192,    91,    92,    -4,    12,    33,    88,    13,    14,
-      15,    16,    17,    18,    19,    20,   100,   203,    21,    22,
-      23,    24,    25,    26,    27,    28,    29,    30,    31,   101,
-     158,    32,   159,   160,   169,   165,   166,   -87,   102,   170,
-      33,   -87,   -87,   -87,   -87,   -87,   -87,   -87,   -87,   171,
-     174,   -87,   -87,   104,   -87,   -87,   -87,   -87,   -87,   -87,
-     -87,   -87,   102,   175,   112,   -78,   -78,   -78,   -78,   -78,
-     -78,   -78,   -78,   146,    92,   -78,   -78,   104,   179,    13,
-      14,    15,    16,    17,    18,    19,    20,   187,   112,    21,
-      22,   178,   189,   180,   181,   182,   183,   146,   193,   194,
-     195,   196,   188,   200,   190,    94,    95,    96,    97,    98,
-     198,    33,    54,   201,   197,    99,   202,    52,   127,    76,
-     139,   173
-};
-
-static const yytype_uint8 yycheck[] =
-{
-       1,    68,    69,    94,    95,    96,    97,    98,    99,    24,
-      10,    77,    13,    77,    15,     0,    82,    18,    82,   110,
-       3,    36,     3,    36,    91,    92,    34,     0,     1,    37,
-      38,     4,     5,     6,     7,     8,     9,    10,    11,    12,
-     107,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,    25,    36,    27,    36,     5,     6,    27,     8,
-       9,    10,    11,    36,    36,    14,    15,    36,    27,    28,
-      70,    27,    28,   139,    36,   139,   167,    27,    14,    35,
-      79,     1,    81,    36,    40,     5,     6,    36,     8,     9,
-      10,    11,    12,   160,    14,    15,    16,    17,    18,    19,
-      20,    37,    38,    79,   105,    81,    27,    27,   175,    27,
-      78,    79,    36,    81,    27,    28,    36,     0,     1,     1,
-     121,     4,     5,     6,     7,     8,     9,    10,    11,    12,
-       1,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,    25,    36,    27,    78,    79,    36,    81,    36,
-       0,     1,    36,    36,     4,     5,     6,     7,     8,     9,
-      10,    11,    37,    38,    14,    15,    16,    17,    18,    19,
-      20,    21,    22,    23,    24,    36,    36,    27,    36,    37,
-      38,    36,    37,    38,     0,     1,    36,    36,     4,     5,
-       6,     7,     8,     9,    10,    11,    36,   198,    14,    15,
-      16,    17,    18,    19,    20,    21,    22,    23,    24,    36,
-      36,    27,    36,    26,     1,    27,    27,     0,     1,    13,
-      36,     4,     5,     6,     7,     8,     9,    10,    11,    36,
-      27,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,     1,    14,    27,     4,     5,     6,     7,     8,
-       9,    10,    11,    36,    38,    14,    15,    16,    36,     4,
-       5,     6,     7,     8,     9,    10,    11,    36,    27,    14,
-      15,   161,    36,   163,   164,   165,   166,    36,    36,    36,
-      36,    36,   172,    36,   174,    29,    30,    31,    32,    33,
-      39,    36,     7,    36,   184,    39,    36,     6,    77,    38,
-      80,   122
-};
-
-  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.  */
-static const yytype_uint8 yystos[] =
-{
-       0,     3,    36,    42,    43,    44,    68,    86,    27,    28,
-      84,     0,     1,     4,     5,     6,     7,     8,     9,    10,
-      11,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,    27,    36,    45,    46,    48,    49,    50,    51,
-      57,    58,    60,    64,    66,    69,    70,    72,    74,    75,
-      76,    85,    44,    36,    43,    86,    36,    84,    36,    84,
-      27,    90,    36,    84,    27,    27,    27,    28,    35,    40,
-      88,    89,    36,     1,     1,    52,    52,    61,    63,    67,
-      81,    73,    79,    36,    36,    36,    36,    36,    36,    88,
-      88,    37,    38,    86,    29,    30,    31,    32,    33,    39,
-      36,    36,     1,    12,    16,    18,    19,    20,    21,    22,
-      23,    25,    27,    36,    47,    53,    54,    77,    78,    80,
-      17,    18,    19,    20,    36,    47,    62,    78,    80,    46,
-      59,    85,    46,    60,    65,    72,    85,    24,    36,    79,
-      82,    46,    60,    71,    72,    85,    36,    47,    80,    34,
-      88,    88,    89,    89,    89,    89,    89,    89,    36,    36,
-      26,    84,    83,    84,    88,    27,    27,    89,    55,     1,
-      13,    36,    84,    83,    27,    14,    87,    88,    87,    36,
-      87,    87,    87,    87,    89,    27,    36,    36,    87,    36,
-      87,    88,    36,    36,    36,    36,    36,    87,    39,    56,
-      36,    36,    36,    84
-};
-
-  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,    41,    42,    42,    43,    43,    44,    44,    44,    44,
-      44,    44,    44,    44,    45,    45,    45,    45,    45,    45,
-      45,    45,    45,    46,    46,    46,    46,    46,    46,    47,
-      47,    48,    49,    50,    51,    52,    52,    52,    52,    52,
-      52,    52,    53,    53,    53,    53,    53,    53,    54,    55,
-      55,    56,    56,    57,    58,    59,    60,    61,    61,    61,
-      61,    61,    61,    62,    62,    62,    62,    63,    63,    64,
-      65,    66,    67,    67,    67,    67,    68,    69,    70,    71,
-      72,    73,    73,    73,    73,    74,    75,    76,    77,    78,
-      79,    79,    79,    79,    80,    81,    81,    81,    82,    83,
-      83,    84,    84,    85,    85,    85,    86,    86,    87,    87,
-      88,    88,    88,    88,    88,    88,    88,    88,    88,    88,
-      88,    89,    89,    90,    90
-};
-
-  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     2,     1,     2,     1,     0,     2,     2,     2,
-       2,     4,     4,     3,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     3,
-       2,     3,     2,     3,     2,     0,     2,     2,     2,     2,
-       2,     2,     3,     4,     4,     4,     4,     5,     3,     0,
-       3,     0,     2,     3,     2,     1,     3,     0,     2,     2,
-       2,     2,     2,     4,     3,     2,     4,     0,     2,     3,
-       1,     3,     0,     2,     2,     2,     3,     3,     3,     1,
-       3,     0,     2,     2,     2,     3,     3,     2,     2,     2,
-       0,     2,     2,     2,     4,     0,     2,     2,     2,     0,
-       2,     1,     1,     2,     2,     2,     1,     2,     0,     2,
-       1,     3,     3,     3,     3,     3,     3,     3,     2,     3,
-       3,     1,     1,     0,     1
-};
-
-
-#define yyerrok         (yyerrstatus = 0)
-#define yyclearin       (yychar = YYEMPTY)
-#define YYEMPTY         (-2)
-#define YYEOF           0
-
-#define YYACCEPT        goto yyacceptlab
-#define YYABORT         goto yyabortlab
-#define YYERROR         goto yyerrorlab
-
-
-#define YYRECOVERING()  (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value)                                  \
-do                                                              \
-  if (yychar == YYEMPTY)                                        \
-    {                                                           \
-      yychar = (Token);                                         \
-      yylval = (Value);                                         \
-      YYPOPSTACK (yylen);                                       \
-      yystate = *yyssp;                                         \
-      goto yybackup;                                            \
-    }                                                           \
-  else                                                          \
-    {                                                           \
-      yyerror (YY_("syntax error: cannot back up")); \
-      YYERROR;                                                  \
-    }                                                           \
-while (0)
-
-/* Error token number */
-#define YYTERROR        1
-#define YYERRCODE       256
-
-
-
-/* Enable debugging if requested.  */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args)                        \
-do {                                            \
-  if (yydebug)                                  \
-    YYFPRINTF Args;                             \
-} while (0)
-
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
-do {                                                                      \
-  if (yydebug)                                                            \
-    {                                                                     \
-      YYFPRINTF (stderr, "%s ", Title);                                   \
-      yy_symbol_print (stderr,                                            \
-                  Type, Value); \
-      YYFPRINTF (stderr, "\n");                                           \
-    }                                                                     \
-} while (0)
-
-
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT.  |
-`----------------------------------------*/
-
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-{
-  FILE *yyo = yyoutput;
-  YYUSE (yyo);
-  if (!yyvaluep)
-    return;
-# ifdef YYPRINT
-  if (yytype < YYNTOKENS)
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
-  YYUSE (yytype);
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
-
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-{
-  YYFPRINTF (yyoutput, "%s %s (",
-             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
-
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
-  YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included).                                                   |
-`------------------------------------------------------------------*/
-
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-{
-  YYFPRINTF (stderr, "Stack now");
-  for (; yybottom <= yytop; yybottom++)
-    {
-      int yybot = *yybottom;
-      YYFPRINTF (stderr, " %d", yybot);
-    }
-  YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top)                            \
-do {                                                            \
-  if (yydebug)                                                  \
-    yy_stack_print ((Bottom), (Top));                           \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced.  |
-`------------------------------------------------*/
-
-static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
-{
-  unsigned long int yylno = yyrline[yyrule];
-  int yynrhs = yyr2[yyrule];
-  int yyi;
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
-             yyrule - 1, yylno);
-  /* The symbols being reduced.  */
-  for (yyi = 0; yyi < yynrhs; yyi++)
-    {
-      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr,
-                       yystos[yyssp[yyi + 1 - yynrhs]],
-                       &(yyvsp[(yyi + 1) - (yynrhs)])
-                                              );
-      YYFPRINTF (stderr, "\n");
-    }
-}
-
-# define YY_REDUCE_PRINT(Rule)          \
-do {                                    \
-  if (yydebug)                          \
-    yy_reduce_print (yyssp, yyvsp, Rule); \
-} while (0)
-
-/* Nonzero means print parse trace.  It is left uninitialized so that
-   multiple parsers can coexist.  */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
-   if the built-in stack extension method is used).
-
-   Do not make this value too large; the results are undefined if
-   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
-   evaluated with infinite-precision integer arithmetic.  */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-#  if defined __GLIBC__ && defined _STRING_H
-#   define yystrlen strlen
-#  else
-/* Return the length of YYSTR.  */
-static YYSIZE_T
-yystrlen (const char *yystr)
-{
-  YYSIZE_T yylen;
-  for (yylen = 0; yystr[yylen]; yylen++)
-    continue;
-  return yylen;
-}
-#  endif
-# endif
-
-# ifndef yystpcpy
-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-#   define yystpcpy stpcpy
-#  else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-   YYDEST.  */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
-  char *yyd = yydest;
-  const char *yys = yysrc;
-
-  while ((*yyd++ = *yys++) != '\0')
-    continue;
-
-  return yyd - 1;
-}
-#  endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
-   quotes and backslashes, so that it's suitable for yyerror.  The
-   heuristic is that double-quoting is unnecessary unless the string
-   contains an apostrophe, a comma, or backslash (other than
-   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
-   null, do not copy; instead, return the length of what the result
-   would have been.  */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
-  if (*yystr == '"')
-    {
-      YYSIZE_T yyn = 0;
-      char const *yyp = yystr;
-
-      for (;;)
-        switch (*++yyp)
-          {
-          case '\'':
-          case ',':
-            goto do_not_strip_quotes;
-
-          case '\\':
-            if (*++yyp != '\\')
-              goto do_not_strip_quotes;
-            /* Fall through.  */
-          default:
-            if (yyres)
-              yyres[yyn] = *yyp;
-            yyn++;
-            break;
-
-          case '"':
-            if (yyres)
-              yyres[yyn] = '\0';
-            return yyn;
-          }
-    do_not_strip_quotes: ;
-    }
-
-  if (! yyres)
-    return yystrlen (yystr);
-
-  return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
-   about the unexpected token YYTOKEN for the state stack whose top is
-   YYSSP.
-
-   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
-   not large enough to hold the message.  In that case, also set
-   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
-   required number of bytes is too large to store.  */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
-                yytype_int16 *yyssp, int yytoken)
-{
-  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
-  YYSIZE_T yysize = yysize0;
-  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-  /* Internationalized format string. */
-  const char *yyformat = YY_NULLPTR;
-  /* Arguments of yyformat. */
-  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-  /* Number of reported tokens (one for the "unexpected", one per
-     "expected"). */
-  int yycount = 0;
-
-  /* There are many possibilities here to consider:
-     - If this state is a consistent state with a default action, then
-       the only way this function was invoked is if the default action
-       is an error action.  In that case, don't check for expected
-       tokens because there are none.
-     - The only way there can be no lookahead present (in yychar) is if
-       this state is a consistent state with a default action.  Thus,
-       detecting the absence of a lookahead is sufficient to determine
-       that there is no unexpected or expected token to report.  In that
-       case, just report a simple "syntax error".
-     - Don't assume there isn't a lookahead just because this state is a
-       consistent state with a default action.  There might have been a
-       previous inconsistent state, consistent state with a non-default
-       action, or user semantic action that manipulated yychar.
-     - Of course, the expected token list depends on states to have
-       correct lookahead information, and it depends on the parser not
-       to perform extra reductions after fetching a lookahead from the
-       scanner and before detecting a syntax error.  Thus, state merging
-       (from LALR or IELR) and default reductions corrupt the expected
-       token list.  However, the list is correct for canonical LR with
-       one exception: it will still contain any token that will not be
-       accepted due to an error action in a later state.
-  */
-  if (yytoken != YYEMPTY)
-    {
-      int yyn = yypact[*yyssp];
-      yyarg[yycount++] = yytname[yytoken];
-      if (!yypact_value_is_default (yyn))
-        {
-          /* Start YYX at -YYN if negative to avoid negative indexes in
-             YYCHECK.  In other words, skip the first -YYN actions for
-             this state because they are default actions.  */
-          int yyxbegin = yyn < 0 ? -yyn : 0;
-          /* Stay within bounds of both yycheck and yytname.  */
-          int yychecklim = YYLAST - yyn + 1;
-          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-          int yyx;
-
-          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
-                && !yytable_value_is_error (yytable[yyx + yyn]))
-              {
-                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-                  {
-                    yycount = 1;
-                    yysize = yysize0;
-                    break;
-                  }
-                yyarg[yycount++] = yytname[yyx];
-                {
-                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
-                  if (! (yysize <= yysize1
-                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-                    return 2;
-                  yysize = yysize1;
-                }
-              }
-        }
-    }
-
-  switch (yycount)
-    {
-# define YYCASE_(N, S)                      \
-      case N:                               \
-        yyformat = S;                       \
-      break
-      YYCASE_(0, YY_("syntax error"));
-      YYCASE_(1, YY_("syntax error, unexpected %s"));
-      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
-      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
-      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
-      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
-    }
-
-  {
-    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
-    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-      return 2;
-    yysize = yysize1;
-  }
-
-  if (*yymsg_alloc < yysize)
-    {
-      *yymsg_alloc = 2 * yysize;
-      if (! (yysize <= *yymsg_alloc
-             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
-        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
-      return 1;
-    }
-
-  /* Avoid sprintf, as that infringes on the user's name space.
-     Don't have undefined behavior even if the translation
-     produced a string with the wrong number of "%s"s.  */
-  {
-    char *yyp = *yymsg;
-    int yyi = 0;
-    while ((*yyp = *yyformat) != '\0')
-      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
-        {
-          yyp += yytnamerr (yyp, yyarg[yyi++]);
-          yyformat += 2;
-        }
-      else
-        {
-          yyp++;
-          yyformat++;
-        }
-  }
-  return 0;
-}
-#endif /* YYERROR_VERBOSE */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol.  |
-`-----------------------------------------------*/
-
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-{
-  YYUSE (yyvaluep);
-  if (!yymsg)
-    yymsg = "Deleting";
-  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  switch (yytype)
-    {
-          case 58: /* choice_entry  */
-
-      {
-       fprintf(stderr, "%s:%d: missing end statement for this entry\n",
-               ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
-       if (current_menu == ((*yyvaluep).menu))
-               menu_end_menu();
-}
-
-        break;
-
-    case 64: /* if_entry  */
-
-      {
-       fprintf(stderr, "%s:%d: missing end statement for this entry\n",
-               ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
-       if (current_menu == ((*yyvaluep).menu))
-               menu_end_menu();
-}
-
-        break;
-
-    case 70: /* menu_entry  */
-
-      {
-       fprintf(stderr, "%s:%d: missing end statement for this entry\n",
-               ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
-       if (current_menu == ((*yyvaluep).menu))
-               menu_end_menu();
-}
-
-        break;
-
-
-      default:
-        break;
-    }
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
-}
-
-
-
-
-/* The lookahead symbol.  */
-int yychar;
-
-/* The semantic value of the lookahead symbol.  */
-YYSTYPE yylval;
-/* Number of syntax errors so far.  */
-int yynerrs;
-
-
-/*----------.
-| yyparse.  |
-`----------*/
-
-int
-yyparse (void)
-{
-    int yystate;
-    /* Number of tokens to shift before error messages enabled.  */
-    int yyerrstatus;
-
-    /* The stacks and their tools:
-       'yyss': related to states.
-       'yyvs': related to semantic values.
-
-       Refer to the stacks through separate pointers, to allow yyoverflow
-       to reallocate them elsewhere.  */
-
-    /* The state stack.  */
-    yytype_int16 yyssa[YYINITDEPTH];
-    yytype_int16 *yyss;
-    yytype_int16 *yyssp;
-
-    /* The semantic value stack.  */
-    YYSTYPE yyvsa[YYINITDEPTH];
-    YYSTYPE *yyvs;
-    YYSTYPE *yyvsp;
-
-    YYSIZE_T yystacksize;
-
-  int yyn;
-  int yyresult;
-  /* Lookahead token as an internal (translated) token number.  */
-  int yytoken = 0;
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
-
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
-
-  /* The number of symbols on the RHS of the reduced rule.
-     Keep to zero when no symbol should be popped.  */
-  int yylen = 0;
-
-  yyssp = yyss = yyssa;
-  yyvsp = yyvs = yyvsa;
-  yystacksize = YYINITDEPTH;
-
-  YYDPRINTF ((stderr, "Starting parse\n"));
-
-  yystate = 0;
-  yyerrstatus = 0;
-  yynerrs = 0;
-  yychar = YYEMPTY; /* Cause a token to be read.  */
-  goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
-`------------------------------------------------------------*/
- yynewstate:
-  /* In all cases, when you get here, the value and location stacks
-     have just been pushed.  So pushing a state here evens the stacks.  */
-  yyssp++;
-
- yysetstate:
-  *yyssp = yystate;
-
-  if (yyss + yystacksize - 1 <= yyssp)
-    {
-      /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
-      {
-        /* Give user a chance to reallocate the stack.  Use copies of
-           these so that the &'s don't force the real ones into
-           memory.  */
-        YYSTYPE *yyvs1 = yyvs;
-        yytype_int16 *yyss1 = yyss;
-
-        /* Each stack pointer address is followed by the size of the
-           data in use in that stack, in bytes.  This used to be a
-           conditional around just the two extra args, but that might
-           be undefined if yyoverflow is a macro.  */
-        yyoverflow (YY_("memory exhausted"),
-                    &yyss1, yysize * sizeof (*yyssp),
-                    &yyvs1, yysize * sizeof (*yyvsp),
-                    &yystacksize);
-
-        yyss = yyss1;
-        yyvs = yyvs1;
-      }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyexhaustedlab;
-# else
-      /* Extend the stack our own way.  */
-      if (YYMAXDEPTH <= yystacksize)
-        goto yyexhaustedlab;
-      yystacksize *= 2;
-      if (YYMAXDEPTH < yystacksize)
-        yystacksize = YYMAXDEPTH;
-
-      {
-        yytype_int16 *yyss1 = yyss;
-        union yyalloc *yyptr =
-          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-        if (! yyptr)
-          goto yyexhaustedlab;
-        YYSTACK_RELOCATE (yyss_alloc, yyss);
-        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-#  undef YYSTACK_RELOCATE
-        if (yyss1 != yyssa)
-          YYSTACK_FREE (yyss1);
-      }
-# endif
-#endif /* no yyoverflow */
-
-      yyssp = yyss + yysize - 1;
-      yyvsp = yyvs + yysize - 1;
-
-      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                  (unsigned long int) yystacksize));
-
-      if (yyss + yystacksize - 1 <= yyssp)
-        YYABORT;
-    }
-
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
-  if (yystate == YYFINAL)
-    YYACCEPT;
-
-  goto yybackup;
-
-/*-----------.
-| yybackup.  |
-`-----------*/
-yybackup:
-
-  /* Do appropriate processing given the current state.  Read a
-     lookahead token if we need one and don't already have one.  */
-
-  /* First try to decide what to do without reference to lookahead token.  */
-  yyn = yypact[yystate];
-  if (yypact_value_is_default (yyn))
-    goto yydefault;
-
-  /* Not known => get a lookahead token if don't already have one.  */
-
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
-  if (yychar == YYEMPTY)
-    {
-      YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = yylex ();
-    }
-
-  if (yychar <= YYEOF)
-    {
-      yychar = yytoken = YYEOF;
-      YYDPRINTF ((stderr, "Now at end of input.\n"));
-    }
-  else
-    {
-      yytoken = YYTRANSLATE (yychar);
-      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
-    }
-
-  /* If the proper action on seeing token YYTOKEN is to reduce or to
-     detect an error, take that action.  */
-  yyn += yytoken;
-  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
-    goto yydefault;
-  yyn = yytable[yyn];
-  if (yyn <= 0)
-    {
-      if (yytable_value_is_error (yyn))
-        goto yyerrlab;
-      yyn = -yyn;
-      goto yyreduce;
-    }
-
-  /* Count tokens shifted since error; after three, turn off error
-     status.  */
-  if (yyerrstatus)
-    yyerrstatus--;
-
-  /* Shift the lookahead token.  */
-  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
-  /* Discard the shifted token.  */
-  yychar = YYEMPTY;
-
-  yystate = yyn;
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
-
-  goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state.  |
-`-----------------------------------------------------------*/
-yydefault:
-  yyn = yydefact[yystate];
-  if (yyn == 0)
-    goto yyerrlab;
-  goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction.  |
-`-----------------------------*/
-yyreduce:
-  /* yyn is the number of a rule to reduce with.  */
-  yylen = yyr2[yyn];
-
-  /* If YYLEN is nonzero, implement the default value of the action:
-     '$$ = $1'.
-
-     Otherwise, the following line sets YYVAL to garbage.
-     This behavior is undocumented and Bison
-     users should not rely upon it.  Assigning to YYVAL
-     unconditionally makes the parser a bit smaller, and it avoids a
-     GCC warning that YYVAL may be used uninitialized.  */
-  yyval = yyvsp[1-yylen];
-
-
-  YY_REDUCE_PRINT (yyn);
-  switch (yyn)
-    {
-        case 10:
-
-    { zconf_error("unexpected end statement"); }
-
-    break;
-
-  case 11:
-
-    { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); }
-
-    break;
-
-  case 12:
-
-    {
-       zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name);
-}
-
-    break;
-
-  case 13:
-
-    { zconf_error("invalid statement"); }
-
-    break;
-
-  case 29:
-
-    { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); }
-
-    break;
-
-  case 30:
-
-    { zconf_error("invalid option"); }
-
-    break;
-
-  case 31:
-
-    {
-       struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
-       sym->flags |= SYMBOL_OPTIONAL;
-       menu_add_entry(sym);
-       printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
-}
-
-    break;
-
-  case 32:
-
-    {
-       menu_end_entry();
-       printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 33:
-
-    {
-       struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
-       sym->flags |= SYMBOL_OPTIONAL;
-       menu_add_entry(sym);
-       printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
-}
-
-    break;
-
-  case 34:
-
-    {
-       if (current_entry->prompt)
-               current_entry->prompt->type = P_MENU;
-       else
-               zconfprint("warning: menuconfig statement without prompt");
-       menu_end_entry();
-       printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 42:
-
-    {
-       menu_set_type((yyvsp[-2].id)->stype);
-       printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
-               zconf_curname(), zconf_lineno(),
-               (yyvsp[-2].id)->stype);
-}
-
-    break;
-
-  case 43:
-
-    {
-       menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
-       printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 44:
-
-    {
-       menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
-       if ((yyvsp[-3].id)->stype != S_UNKNOWN)
-               menu_set_type((yyvsp[-3].id)->stype);
-       printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
-               zconf_curname(), zconf_lineno(),
-               (yyvsp[-3].id)->stype);
-}
-
-    break;
-
-  case 45:
-
-    {
-       menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
-       printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 46:
-
-    {
-       menu_add_symbol(P_IMPLY, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
-       printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 47:
-
-    {
-       menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
-       printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 50:
-
-    {
-       const struct kconf_id *id = kconf_id_lookup((yyvsp[-1].string), strlen((yyvsp[-1].string)));
-       if (id && id->flags & TF_OPTION)
-               menu_add_option(id->token, (yyvsp[0].string));
-       else
-               zconfprint("warning: ignoring unknown option %s", (yyvsp[-1].string));
-       free((yyvsp[-1].string));
-}
-
-    break;
-
-  case 51:
-
-    { (yyval.string) = NULL; }
-
-    break;
-
-  case 52:
-
-    { (yyval.string) = (yyvsp[0].string); }
-
-    break;
-
-  case 53:
-
-    {
-       struct symbol *sym = sym_lookup((yyvsp[-1].string), SYMBOL_CHOICE);
-       sym->flags |= SYMBOL_AUTO;
-       menu_add_entry(sym);
-       menu_add_expr(P_CHOICE, NULL, NULL);
-       printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 54:
-
-    {
-       (yyval.menu) = menu_add_menu();
-}
-
-    break;
-
-  case 55:
-
-    {
-       if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) {
-               menu_end_menu();
-               printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
-       }
-}
-
-    break;
-
-  case 63:
-
-    {
-       menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
-       printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 64:
-
-    {
-       if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) {
-               menu_set_type((yyvsp[-2].id)->stype);
-               printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
-                       zconf_curname(), zconf_lineno(),
-                       (yyvsp[-2].id)->stype);
-       } else
-               YYERROR;
-}
-
-    break;
-
-  case 65:
-
-    {
-       current_entry->sym->flags |= SYMBOL_OPTIONAL;
-       printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 66:
-
-    {
-       if ((yyvsp[-3].id)->stype == S_UNKNOWN) {
-               menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
-               printd(DEBUG_PARSE, "%s:%d:default\n",
-                       zconf_curname(), zconf_lineno());
-       } else
-               YYERROR;
-}
-
-    break;
-
-  case 69:
-
-    {
-       printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
-       menu_add_entry(NULL);
-       menu_add_dep((yyvsp[-1].expr));
-       (yyval.menu) = menu_add_menu();
-}
-
-    break;
-
-  case 70:
-
-    {
-       if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) {
-               menu_end_menu();
-               printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
-       }
-}
-
-    break;
-
-  case 76:
-
-    {
-       menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
-}
-
-    break;
-
-  case 77:
-
-    {
-       menu_add_entry(NULL);
-       menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
-       printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 78:
-
-    {
-       (yyval.menu) = menu_add_menu();
-}
-
-    break;
-
-  case 79:
-
-    {
-       if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) {
-               menu_end_menu();
-               printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
-       }
-}
-
-    break;
-
-  case 85:
-
-    {
-       printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
-       zconf_nextfile((yyvsp[-1].string));
-}
-
-    break;
-
-  case 86:
-
-    {
-       menu_add_entry(NULL);
-       menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
-       printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 87:
-
-    {
-       menu_end_entry();
-}
-
-    break;
-
-  case 88:
-
-    {
-       printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
-       zconf_starthelp();
-}
-
-    break;
-
-  case 89:
-
-    {
-       current_entry->help = (yyvsp[0].string);
-}
-
-    break;
-
-  case 94:
-
-    {
-       menu_add_dep((yyvsp[-1].expr));
-       printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
-}
-
-    break;
-
-  case 98:
-
-    {
-       menu_add_visibility((yyvsp[0].expr));
-}
-
-    break;
-
-  case 100:
-
-    {
-       menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
-}
-
-    break;
-
-  case 103:
-
-    { (yyval.id) = (yyvsp[-1].id); }
-
-    break;
-
-  case 104:
-
-    { (yyval.id) = (yyvsp[-1].id); }
-
-    break;
-
-  case 105:
-
-    { (yyval.id) = (yyvsp[-1].id); }
-
-    break;
-
-  case 108:
-
-    { (yyval.expr) = NULL; }
-
-    break;
-
-  case 109:
-
-    { (yyval.expr) = (yyvsp[0].expr); }
-
-    break;
-
-  case 110:
-
-    { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); }
-
-    break;
-
-  case 111:
-
-    { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
-
-    break;
-
-  case 112:
-
-    { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
-
-    break;
-
-  case 113:
-
-    { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
-
-    break;
-
-  case 114:
-
-    { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
-
-    break;
-
-  case 115:
-
-    { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
-
-    break;
-
-  case 116:
-
-    { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
-
-    break;
-
-  case 117:
-
-    { (yyval.expr) = (yyvsp[-1].expr); }
-
-    break;
-
-  case 118:
-
-    { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); }
-
-    break;
-
-  case 119:
-
-    { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-
-    break;
-
-  case 120:
-
-    { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-
-    break;
-
-  case 121:
-
-    { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); }
-
-    break;
-
-  case 122:
-
-    { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); }
-
-    break;
-
-  case 123:
-
-    { (yyval.string) = NULL; }
-
-    break;
-
-
-
-      default: break;
-    }
-  /* User semantic actions sometimes alter yychar, and that requires
-     that yytoken be updated with the new translation.  We take the
-     approach of translating immediately before every use of yytoken.
-     One alternative is translating here after every semantic action,
-     but that translation would be missed if the semantic action invokes
-     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
-     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
-     incorrect destructor might then be invoked immediately.  In the
-     case of YYERROR or YYBACKUP, subsequent parser actions might lead
-     to an incorrect destructor call or verbose syntax error message
-     before the lookahead is translated.  */
-  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
-  YYPOPSTACK (yylen);
-  yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
-
-  *++yyvsp = yyval;
-
-  /* Now 'shift' the result of the reduction.  Determine what state
-     that goes to, based on the state we popped back to and the rule
-     number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTOKENS];
-
-  goto yynewstate;
-
-
-/*--------------------------------------.
-| yyerrlab -- here on detecting error.  |
-`--------------------------------------*/
-yyerrlab:
-  /* Make sure we have latest lookahead translation.  See comments at
-     user semantic actions for why this is necessary.  */
-  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
-  /* If not already recovering from an error, report this error.  */
-  if (!yyerrstatus)
-    {
-      ++yynerrs;
-#if ! YYERROR_VERBOSE
-      yyerror (YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
-                                        yyssp, yytoken)
-      {
-        char const *yymsgp = YY_("syntax error");
-        int yysyntax_error_status;
-        yysyntax_error_status = YYSYNTAX_ERROR;
-        if (yysyntax_error_status == 0)
-          yymsgp = yymsg;
-        else if (yysyntax_error_status == 1)
-          {
-            if (yymsg != yymsgbuf)
-              YYSTACK_FREE (yymsg);
-            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
-            if (!yymsg)
-              {
-                yymsg = yymsgbuf;
-                yymsg_alloc = sizeof yymsgbuf;
-                yysyntax_error_status = 2;
-              }
-            else
-              {
-                yysyntax_error_status = YYSYNTAX_ERROR;
-                yymsgp = yymsg;
-              }
-          }
-        yyerror (yymsgp);
-        if (yysyntax_error_status == 2)
-          goto yyexhaustedlab;
-      }
-# undef YYSYNTAX_ERROR
-#endif
-    }
-
-
-
-  if (yyerrstatus == 3)
-    {
-      /* If just tried and failed to reuse lookahead token after an
-         error, discard it.  */
-
-      if (yychar <= YYEOF)
-        {
-          /* Return failure if at end of input.  */
-          if (yychar == YYEOF)
-            YYABORT;
-        }
-      else
-        {
-          yydestruct ("Error: discarding",
-                      yytoken, &yylval);
-          yychar = YYEMPTY;
-        }
-    }
-
-  /* Else will try to reuse lookahead token after shifting the error
-     token.  */
-  goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR.  |
-`---------------------------------------------------*/
-yyerrorlab:
-
-  /* Pacify compilers like GCC when the user code never invokes
-     YYERROR and the label yyerrorlab therefore never appears in user
-     code.  */
-  if (/*CONSTCOND*/ 0)
-     goto yyerrorlab;
-
-  /* Do not reclaim the symbols of the rule whose action triggered
-     this YYERROR.  */
-  YYPOPSTACK (yylen);
-  yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
-  yystate = *yyssp;
-  goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR.  |
-`-------------------------------------------------------------*/
-yyerrlab1:
-  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
-
-  for (;;)
-    {
-      yyn = yypact[yystate];
-      if (!yypact_value_is_default (yyn))
-        {
-          yyn += YYTERROR;
-          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-            {
-              yyn = yytable[yyn];
-              if (0 < yyn)
-                break;
-            }
-        }
-
-      /* Pop the current state because it cannot handle the error token.  */
-      if (yyssp == yyss)
-        YYABORT;
-
-
-      yydestruct ("Error: popping",
-                  yystos[yystate], yyvsp);
-      YYPOPSTACK (1);
-      yystate = *yyssp;
-      YY_STACK_PRINT (yyss, yyssp);
-    }
-
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
-
-
-  /* Shift the error token.  */
-  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
-  yystate = yyn;
-  goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here.  |
-`-------------------------------------*/
-yyacceptlab:
-  yyresult = 0;
-  goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here.  |
-`-----------------------------------*/
-yyabortlab:
-  yyresult = 1;
-  goto yyreturn;
-
-#if !defined yyoverflow || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here.  |
-`-------------------------------------------------*/
-yyexhaustedlab:
-  yyerror (YY_("memory exhausted"));
-  yyresult = 2;
-  /* Fall through.  */
-#endif
-
-yyreturn:
-  if (yychar != YYEMPTY)
-    {
-      /* Make sure we have latest lookahead translation.  See comments at
-         user semantic actions for why this is necessary.  */
-      yytoken = YYTRANSLATE (yychar);
-      yydestruct ("Cleanup: discarding lookahead",
-                  yytoken, &yylval);
-    }
-  /* Do not reclaim the symbols of the rule whose action triggered
-     this YYABORT or YYACCEPT.  */
-  YYPOPSTACK (yylen);
-  YY_STACK_PRINT (yyss, yyssp);
-  while (yyssp != yyss)
-    {
-      yydestruct ("Cleanup: popping",
-                  yystos[*yyssp], yyvsp);
-      YYPOPSTACK (1);
-    }
-#ifndef yyoverflow
-  if (yyss != yyssa)
-    YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
-  if (yymsg != yymsgbuf)
-    YYSTACK_FREE (yymsg);
-#endif
-  return yyresult;
-}
-
-
-
-void conf_parse(const char *name)
-{
-       struct symbol *sym;
-       int i;
-
-       zconf_initscan(name);
-
-       sym_init();
-       _menu_init();
-       rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
-
-       if (getenv("ZCONF_DEBUG"))
-               zconfdebug = 1;
-       zconfparse();
-       if (zconfnerrs)
-               exit(1);
-       if (!modules_sym)
-               modules_sym = sym_find( "n" );
-
-       rootmenu.prompt->text = _(rootmenu.prompt->text);
-       rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
-
-       menu_finalize(&rootmenu);
-       for_all_symbols(i, sym) {
-               if (sym_check_deps(sym))
-                       zconfnerrs++;
-       }
-       if (zconfnerrs)
-               exit(1);
-       sym_set_change_count(1);
-}
-
-static const char *zconf_tokenname(int token)
-{
-       switch (token) {
-       case T_MENU:            return "menu";
-       case T_ENDMENU:         return "endmenu";
-       case T_CHOICE:          return "choice";
-       case T_ENDCHOICE:       return "endchoice";
-       case T_IF:              return "if";
-       case T_ENDIF:           return "endif";
-       case T_DEPENDS:         return "depends";
-       case T_VISIBLE:         return "visible";
-       }
-       return "<token>";
-}
-
-static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
-{
-       if (id->token != endtoken) {
-               zconf_error("unexpected '%s' within %s block",
-                       kconf_id_strings + id->name, zconf_tokenname(starttoken));
-               zconfnerrs++;
-               return false;
-       }
-       if (current_menu->file != current_file) {
-               zconf_error("'%s' in different file than '%s'",
-                       kconf_id_strings + id->name, zconf_tokenname(starttoken));
-               fprintf(stderr, "%s:%d: location of the '%s'\n",
-                       current_menu->file->name, current_menu->lineno,
-                       zconf_tokenname(starttoken));
-               zconfnerrs++;
-               return false;
-       }
-       return true;
-}
-
-static void zconfprint(const char *err, ...)
-{
-       va_list ap;
-
-       fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
-       va_start(ap, err);
-       vfprintf(stderr, err, ap);
-       va_end(ap);
-       fprintf(stderr, "\n");
-}
-
-static void zconf_error(const char *err, ...)
-{
-       va_list ap;
-
-       zconfnerrs++;
-       fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
-       va_start(ap, err);
-       vfprintf(stderr, err, ap);
-       va_end(ap);
-       fprintf(stderr, "\n");
-}
-
-static void zconferror(const char *err)
-{
-       fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
-}
-
-static void print_quoted_string(FILE *out, const char *str)
-{
-       const char *p;
-       int len;
-
-       putc('"', out);
-       while ((p = strchr(str, '"'))) {
-               len = p - str;
-               if (len)
-                       fprintf(out, "%.*s", len, str);
-               fputs("\\\"", out);
-               str = p + 1;
-       }
-       fputs(str, out);
-       putc('"', out);
-}
-
-static void print_symbol(FILE *out, struct menu *menu)
-{
-       struct symbol *sym = menu->sym;
-       struct property *prop;
-
-       if (sym_is_choice(sym))
-               fprintf(out, "\nchoice\n");
-       else
-               fprintf(out, "\nconfig %s\n", sym->name);
-       switch (sym->type) {
-       case S_BOOLEAN:
-               fputs("  boolean\n", out);
-               break;
-       case S_TRISTATE:
-               fputs("  tristate\n", out);
-               break;
-       case S_STRING:
-               fputs("  string\n", out);
-               break;
-       case S_INT:
-               fputs("  integer\n", out);
-               break;
-       case S_HEX:
-               fputs("  hex\n", out);
-               break;
-       default:
-               fputs("  ???\n", out);
-               break;
-       }
-       for (prop = sym->prop; prop; prop = prop->next) {
-               if (prop->menu != menu)
-                       continue;
-               switch (prop->type) {
-               case P_PROMPT:
-                       fputs("  prompt ", out);
-                       print_quoted_string(out, prop->text);
-                       if (!expr_is_yes(prop->visible.expr)) {
-                               fputs(" if ", out);
-                               expr_fprint(prop->visible.expr, out);
-                       }
-                       fputc('\n', out);
-                       break;
-               case P_DEFAULT:
-                       fputs( "  default ", out);
-                       expr_fprint(prop->expr, out);
-                       if (!expr_is_yes(prop->visible.expr)) {
-                               fputs(" if ", out);
-                               expr_fprint(prop->visible.expr, out);
-                       }
-                       fputc('\n', out);
-                       break;
-               case P_CHOICE:
-                       fputs("  #choice value\n", out);
-                       break;
-               case P_SELECT:
-                       fputs( "  select ", out);
-                       expr_fprint(prop->expr, out);
-                       fputc('\n', out);
-                       break;
-               case P_IMPLY:
-                       fputs( "  imply ", out);
-                       expr_fprint(prop->expr, out);
-                       fputc('\n', out);
-                       break;
-               case P_RANGE:
-                       fputs( "  range ", out);
-                       expr_fprint(prop->expr, out);
-                       fputc('\n', out);
-                       break;
-               case P_MENU:
-                       fputs( "  menu ", out);
-                       print_quoted_string(out, prop->text);
-                       fputc('\n', out);
-                       break;
-               default:
-                       fprintf(out, "  unknown prop %d!\n", prop->type);
-                       break;
-               }
-       }
-       if (menu->help) {
-               int len = strlen(menu->help);
-               while (menu->help[--len] == '\n')
-                       menu->help[len] = 0;
-               fprintf(out, "  help\n%s\n", menu->help);
-       }
-}
-
-void zconfdump(FILE *out)
-{
-       struct property *prop;
-       struct symbol *sym;
-       struct menu *menu;
-
-       menu = rootmenu.list;
-       while (menu) {
-               if ((sym = menu->sym))
-                       print_symbol(out, menu);
-               else if ((prop = menu->prompt)) {
-                       switch (prop->type) {
-                       case P_COMMENT:
-                               fputs("\ncomment ", out);
-                               print_quoted_string(out, prop->text);
-                               fputs("\n", out);
-                               break;
-                       case P_MENU:
-                               fputs("\nmenu ", out);
-                               print_quoted_string(out, prop->text);
-                               fputs("\n", out);
-                               break;
-                       default:
-                               ;
-                       }
-                       if (!expr_is_yes(prop->visible.expr)) {
-                               fputs("  depends ", out);
-                               expr_fprint(prop->visible.expr, out);
-                               fputc('\n', out);
-                       }
-               }
-
-               if (menu->list)
-                       menu = menu->list;
-               else if (menu->next)
-                       menu = menu->next;
-               else while ((menu = menu->parent)) {
-                       if (menu->prompt && menu->prompt->type == P_MENU)
-                               fputs("\nendmenu\n", out);
-                       if (menu->next) {
-                               menu = menu->next;
-                               break;
-                       }
-               }
-       }
-}
-
-#include "zconf.lex.c"
-#include "util.c"
-#include "confdata.c"
-#include "expr.c"
-#include "symbol.c"
-#include "menu.c"
index 001305fa080bd3ad7b8114c111dc2cc9ff609d45..ad6305b0f40cb962edf922ae73639c75b63c60c0 100644 (file)
 
 int cdebug = PRINTD;
 
-extern int zconflex(void);
+int yylex(void);
+static void yyerror(const char *err);
 static void zconfprint(const char *err, ...);
 static void zconf_error(const char *err, ...);
-static void zconferror(const char *err);
 static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
 
 struct symbol *symbol_hash[SYMBOL_HASHSIZE];
@@ -85,6 +85,7 @@ static struct menu *current_menu, *current_entry;
 %nonassoc T_NOT
 
 %type <string> prompt
+%type <symbol> nonconst_symbol
 %type <symbol> symbol
 %type <expr> expr
 %type <expr> if_expr
@@ -101,14 +102,34 @@ static struct menu *current_menu, *current_entry;
 } if_entry menu_entry choice_entry
 
 %{
-/* Include zconf.hash.c here so it can see the token constants. */
-#include "zconf.hash.c"
+/* Include kconf_id.c here so it can see the token constants. */
+#include "kconf_id.c"
 %}
 
 %%
 input: nl start | start;
 
-start: mainmenu_stmt stmt_list | stmt_list;
+start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list;
+
+/* mainmenu entry */
+
+mainmenu_stmt: T_MAINMENU prompt nl
+{
+       menu_add_prompt(P_MENU, $2, NULL);
+};
+
+/* Default main menu, if there's no mainmenu entry */
+
+no_mainmenu_stmt: /* empty */
+{
+       /*
+        * Hack: Keep the main menu title on the heap so we can safely free it
+        * later regardless of whether it comes from the 'prompt' in
+        * mainmenu_stmt or here
+        */
+       menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL);
+};
+
 
 stmt_list:
          /* empty */
@@ -119,7 +140,7 @@ stmt_list:
        | stmt_list T_WORD error T_EOL  { zconf_error("unknown statement \"%s\"", $2); }
        | stmt_list option_name error T_EOL
 {
-       zconf_error("unexpected option \"%s\"", kconf_id_strings + $2->name);
+       zconf_error("unexpected option \"%s\"", $2->name);
 }
        | stmt_list error T_EOL         { zconf_error("invalid statement"); }
 ;
@@ -145,26 +166,23 @@ option_error:
 
 /* config/menuconfig entry */
 
-config_entry_start: T_CONFIG T_WORD T_EOL
+config_entry_start: T_CONFIG nonconst_symbol T_EOL
 {
-       struct symbol *sym = sym_lookup($2, 0);
-       sym->flags |= SYMBOL_OPTIONAL;
-       menu_add_entry(sym);
-       printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2);
+       $2->flags |= SYMBOL_OPTIONAL;
+       menu_add_entry($2);
+       printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2->name);
 };
 
 config_stmt: config_entry_start config_option_list
 {
-       menu_end_entry();
        printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
 };
 
-menuconfig_entry_start: T_MENUCONFIG T_WORD T_EOL
+menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL
 {
-       struct symbol *sym = sym_lookup($2, 0);
-       sym->flags |= SYMBOL_OPTIONAL;
-       menu_add_entry(sym);
-       printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2);
+       $2->flags |= SYMBOL_OPTIONAL;
+       menu_add_entry($2);
+       printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2->name);
 };
 
 menuconfig_stmt: menuconfig_entry_start config_option_list
@@ -173,7 +191,6 @@ menuconfig_stmt: menuconfig_entry_start config_option_list
                current_entry->prompt->type = P_MENU;
        else
                zconfprint("warning: menuconfig statement without prompt");
-       menu_end_entry();
        printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
 };
 
@@ -211,15 +228,15 @@ config_option: T_DEFAULT expr if_expr T_EOL
                $1->stype);
 };
 
-config_option: T_SELECT T_WORD if_expr T_EOL
+config_option: T_SELECT nonconst_symbol if_expr T_EOL
 {
-       menu_add_symbol(P_SELECT, sym_lookup($2, 0), $3);
+       menu_add_symbol(P_SELECT, $2, $3);
        printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
 };
 
-config_option: T_IMPLY T_WORD if_expr T_EOL
+config_option: T_IMPLY nonconst_symbol if_expr T_EOL
 {
-       menu_add_symbol(P_IMPLY, sym_lookup($2, 0), $3);
+       menu_add_symbol(P_IMPLY, $2, $3);
        printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
 };
 
@@ -237,8 +254,10 @@ symbol_option_list:
        | symbol_option_list T_WORD symbol_option_arg
 {
        const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
-       if (id && id->flags & TF_OPTION)
+       if (id && id->flags & TF_OPTION) {
                menu_add_option(id->token, $3);
+               free($3);
+       }
        else
                zconfprint("warning: ignoring unknown option %s", $2);
        free($2);
@@ -257,6 +276,7 @@ choice: T_CHOICE word_opt T_EOL
        sym->flags |= SYMBOL_AUTO;
        menu_add_entry(sym);
        menu_add_expr(P_CHOICE, NULL, NULL);
+       free($2);
        printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
 };
 
@@ -308,10 +328,10 @@ choice_option: T_OPTIONAL T_EOL
        printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
 };
 
-choice_option: T_DEFAULT T_WORD if_expr T_EOL
+choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL
 {
        if ($1->stype == S_UNKNOWN) {
-               menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3);
+               menu_add_symbol(P_DEFAULT, $2, $3);
                printd(DEBUG_PARSE, "%s:%d:default\n",
                        zconf_curname(), zconf_lineno());
        } else
@@ -351,13 +371,6 @@ if_block:
        | if_block choice_stmt
 ;
 
-/* mainmenu entry */
-
-mainmenu_stmt: T_MAINMENU prompt nl
-{
-       menu_add_prompt(P_MENU, $2, NULL);
-};
-
 /* menu entry */
 
 menu: T_MENU prompt T_EOL
@@ -394,6 +407,7 @@ source_stmt: T_SOURCE prompt T_EOL
 {
        printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
        zconf_nextfile($2);
+       free($2);
 };
 
 /* comment entry */
@@ -406,9 +420,7 @@ comment: T_COMMENT prompt T_EOL
 };
 
 comment_stmt: comment depends_list
-{
-       menu_end_entry();
-};
+;
 
 /* help option */
 
@@ -420,6 +432,17 @@ help_start: T_HELP T_EOL
 
 help: help_start T_HELPTEXT
 {
+       if (current_entry->help) {
+               free(current_entry->help);
+               zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used",
+                          current_entry->sym->name ?: "<choice>");
+       }
+
+       /* Is the help text empty or all whitespace? */
+       if ($2[strspn($2, " \f\n\r\t\v")] == '\0')
+               zconfprint("warning: '%s' defined with blank help text",
+                          current_entry->sym->name ?: "<choice>");
+
        current_entry->help = $2;
 };
 
@@ -491,7 +514,10 @@ expr:        symbol                                { $$ = expr_alloc_symbol($1); }
        | expr T_AND expr                       { $$ = expr_alloc_two(E_AND, $1, $3); }
 ;
 
-symbol:          T_WORD        { $$ = sym_lookup($1, 0); free($1); }
+/* For symbol definitions, selects, etc., where quotes are not accepted */
+nonconst_symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); };
+
+symbol:          nonconst_symbol
        | T_WORD_QUOTE  { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
 ;
 
@@ -502,6 +528,7 @@ word_opt: /* empty */                       { $$ = NULL; }
 
 void conf_parse(const char *name)
 {
+       const char *tmp;
        struct symbol *sym;
        int i;
 
@@ -509,25 +536,26 @@ void conf_parse(const char *name)
 
        sym_init();
        _menu_init();
-       rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
 
        if (getenv("ZCONF_DEBUG"))
-               zconfdebug = 1;
-       zconfparse();
-       if (zconfnerrs)
+               yydebug = 1;
+       yyparse();
+       if (yynerrs)
                exit(1);
        if (!modules_sym)
                modules_sym = sym_find( "n" );
 
+       tmp = rootmenu.prompt->text;
        rootmenu.prompt->text = _(rootmenu.prompt->text);
        rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
+       free((char*)tmp);
 
        menu_finalize(&rootmenu);
        for_all_symbols(i, sym) {
                if (sym_check_deps(sym))
-                       zconfnerrs++;
+                       yynerrs++;
        }
-       if (zconfnerrs)
+       if (yynerrs)
                exit(1);
        sym_set_change_count(1);
 }
@@ -551,17 +579,17 @@ static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtok
 {
        if (id->token != endtoken) {
                zconf_error("unexpected '%s' within %s block",
-                       kconf_id_strings + id->name, zconf_tokenname(starttoken));
-               zconfnerrs++;
+                       id->name, zconf_tokenname(starttoken));
+               yynerrs++;
                return false;
        }
        if (current_menu->file != current_file) {
                zconf_error("'%s' in different file than '%s'",
-                       kconf_id_strings + id->name, zconf_tokenname(starttoken));
+                       id->name, zconf_tokenname(starttoken));
                fprintf(stderr, "%s:%d: location of the '%s'\n",
                        current_menu->file->name, current_menu->lineno,
                        zconf_tokenname(starttoken));
-               zconfnerrs++;
+               yynerrs++;
                return false;
        }
        return true;
@@ -582,7 +610,7 @@ static void zconf_error(const char *err, ...)
 {
        va_list ap;
 
-       zconfnerrs++;
+       yynerrs++;
        fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
        va_start(ap, err);
        vfprintf(stderr, err, ap);
@@ -590,7 +618,7 @@ static void zconf_error(const char *err, ...)
        fprintf(stderr, "\n");
 }
 
-static void zconferror(const char *err)
+static void yyerror(const char *err)
 {
        fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
 }
@@ -623,7 +651,7 @@ static void print_symbol(FILE *out, struct menu *menu)
                fprintf(out, "\nconfig %s\n", sym->name);
        switch (sym->type) {
        case S_BOOLEAN:
-               fputs("  boolean\n", out);
+               fputs("  bool\n", out);
                break;
        case S_TRISTATE:
                fputs("  tristate\n", out);
diff --git a/snapshot.commit b/snapshot.commit
deleted file mode 100644 (file)
index 8d26309..0000000
+++ /dev/null
@@ -1 +0,0 @@
-$Format:%H  %cD$
index 552d700935a3afb1540006e237aea6f4d797a9ba..8b72fe42edc6ebdca5666be0527ff0159ea82803 100644 (file)
@@ -425,7 +425,7 @@ static const struct udevice_id fdt_dummy_ids[] = {
 };
 
 UCLASS_DRIVER(fdt_dummy) = {
-       .name           = "fdt_dummy",
+       .name           = "fdt-dummy",
        .id             = UCLASS_TEST_DUMMY,
        .flags          = DM_UC_FLAG_SEQ_ALIAS,
 };
index d1c2a36d8f2541dc01e4c18e7271d9213b8fba5c..605275b03992d2ad732fbb892b892cf581e5bcb4 100644 (file)
@@ -12,7 +12,7 @@ import pytest
 
 LOGL_FIRST, LOGL_WARNING, LOGL_INFO = (0, 4, 6)
 
-@pytest.mark.buildconfigspec('log')
+@pytest.mark.buildconfigspec('cmd_log')
 def test_log(u_boot_console):
     """Test that U-Boot logging works correctly."""
     def check_log_entries(lines, mask, max_level=LOGL_INFO):
@@ -98,7 +98,7 @@ def test_log(u_boot_console):
     test8()
     test9()
 
-@pytest.mark.buildconfigspec('log')
+@pytest.mark.buildconfigspec('cmd_log')
 def test_log_format(u_boot_console):
     """Test the 'log format' and 'log rec' commands"""
     def run_with_format(fmt, expected_output):
index e475084faecab2c5e31544f0c74b2dc50c95c00c..68fc7c8c887fafb9721e4d4f3a2b573bfd9a1db0 100644 (file)
@@ -25,7 +25,7 @@ int fdt_remove_unused_strings(const void *old, void *new)
                new_prop = (struct fdt_property *)(unsigned long)
                        fdt_get_property_by_offset(new, offset, NULL);
                str = fdt_string(old, fdt32_to_cpu(old_prop->nameoff));
-               ret = _fdt_find_add_string(new, str);
+               ret = fdt_find_add_string_(new, str);
                if (ret < 0)
                        return ret;
                new_prop->nameoff = cpu_to_fdt32(ret);
diff --git a/tools/logos/u-boot_logo.bmp b/tools/logos/u-boot_logo.bmp
new file mode 100644 (file)
index 0000000..40245dd
Binary files /dev/null and b/tools/logos/u-boot_logo.bmp differ
diff --git a/tools/logos/u-boot_logo.svg b/tools/logos/u-boot_logo.svg
new file mode 100644 (file)
index 0000000..e45ef2e
--- /dev/null
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
+
+<!-- Copyright (c) 2018, Heinrich Schuchardt <xypron.glpk@gmx.de> -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="186"
+   height="186"
+   viewBox="0 0 186 186"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.92.3 (2405546, 2018-03-11)"
+   sodipodi:docname="u-boot_logo.svg"
+   inkscape:export-filename="tools/logos/u-boot_logo.png"
+   inkscape:export-xdpi="41.290001"
+   inkscape:export-ydpi="41.290001">
+  <title
+     id="title30">U-Boot Logo</title>
+  <metadata
+     id="metadata31">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title>U-Boot Logo</dc:title>
+        <cc:license
+           rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>Heinrich Schuchardt &lt;xypron.glpk@gmx.de&gt;</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <dc:date>May 21st, 2018</dc:date>
+      </cc:Work>
+      <cc:License
+         rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Reproduction" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Distribution" />
+        <cc:requires
+           rdf:resource="http://creativecommons.org/ns#Notice" />
+        <cc:requires
+           rdf:resource="http://creativecommons.org/ns#Attribution" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+        <cc:requires
+           rdf:resource="http://creativecommons.org/ns#ShareAlike" />
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs29" />
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1440"
+     inkscape:window-height="871"
+     id="namedview27"
+     showgrid="false"
+     inkscape:zoom="3"
+     inkscape:cx="93"
+     inkscape:cy="93"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="layer1" />
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,0)">
+    <rect
+       style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0"
+       id="rect31"
+       width="186"
+       height="186"
+       x="0"
+       y="0" />
+    <circle
+       style="fill:#004466;fill-opacity:1;stroke-width:0;stroke:none"
+       id="path835"
+       cx="93"
+       cy="93"
+       r="93" />
+    <path
+       inkscape:connector-curvature="0"
+       style="fill:#ffcc88;fill-opacity:1;stroke:none;stroke-width:0;stroke:none"
+       d="m 116,76 a 20,20 0 0 1 -20,-20 20,20 0 0 1 20,-20 v 11 a 9,9 0 0 0 -9,9 9,9 0 0 0 9,9 z"
+       id="path4136-6-6-1-6-3-5" />
+    <path
+       inkscape:connector-curvature="0"
+       style="fill:#ffcc88;fill-opacity:1;stroke:none;stroke-width:0"
+       d="m 116,66 a 10,10 0 0 1 -10,-10 10,10 0 0 1 10,-10 v 1 a 9,9 0 0 0 -9,9 9,9 0 0 0 9,9 z"
+       id="path4136-6-6-1-6-3-5-1-9" />
+    <ellipse
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4136-6-6-1-6-3-5-1-2"
+       cx="116"
+       cy="41.5"
+       rx="4"
+       ry="5.5" />
+    <circle
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4352"
+       cx="86"
+       cy="66"
+       r="10" />
+    <circle
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4352-1"
+       cx="126"
+       cy="66"
+       r="10" />
+    <rect
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="rect4399"
+       width="39"
+       height="20"
+       x="86.5"
+       y="56" />
+    <rect
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="rect4660"
+       width="60"
+       height="9.5"
+       x="76"
+       y="66.5" />
+    <circle
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4549-5"
+       cx="36"
+       cy="81"
+       r="15" />
+    <circle
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4549-5-5"
+       cx="36"
+       cy="121"
+       r="15" />
+    <ellipse
+       style="fill:#ffcc88;fill-opacity:1;stroke:#000000;stroke-width:0"
+       id="path4136-6-6"
+       cx="15"
+       cy="91"
+       rx="4"
+       ry="10" />
+    <ellipse
+       style="fill:#ffcc88;fill-opacity:1;stroke:#000000;stroke-width:0"
+       id="path4136-6-6-1"
+       cx="15"
+       cy="111"
+       rx="4"
+       ry="10" />
+    <rect
+       style="fill:#dd9955;fill-opacity:1;stroke:#000000;stroke-width:0"
+       id="rect4213"
+       width="65"
+       height="4"
+       x="11"
+       y="99" />
+    <ellipse
+       style="fill:#ffcc88;fill-opacity:1;stroke:#000000;stroke-width:0"
+       id="path4136"
+       cx="100.5"
+       cy="100.5"
+       rx="74.5"
+       ry="34.5" />
+    <ellipse
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4416"
+       cx="70"
+       cy="95.5"
+       rx="15"
+       ry="12.5" />
+    <ellipse
+       style="fill:#ffcc88;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4416-9"
+       cx="70"
+       cy="95.5"
+       rx="14"
+       ry="11.5" />
+    <ellipse
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4416-0"
+       cx="70"
+       cy="95.5"
+       rx="11"
+       ry="8.5" />
+    <ellipse
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4416-94"
+       cx="110"
+       cy="95.5"
+       rx="15"
+       ry="12.5" />
+    <ellipse
+       style="fill:#ffcc88;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4416-9-1"
+       cx="110"
+       cy="95.5"
+       rx="14"
+       ry="11.5" />
+    <ellipse
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4416-0-1"
+       cx="110"
+       cy="95.5"
+       rx="11"
+       ry="8.5" />
+    <ellipse
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4416-94-2"
+       cx="150"
+       cy="95.5"
+       rx="15"
+       ry="12.5" />
+    <ellipse
+       style="fill:#ffcc88;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4416-9-1-2"
+       cx="150"
+       cy="95.5"
+       rx="14"
+       ry="11.5" />
+    <ellipse
+       style="fill:#dd9955;fill-opacity:1;stroke:none;stroke-width:0"
+       id="path4416-0-1-9"
+       cx="150"
+       cy="95.5"
+       rx="11"
+       ry="8.5" />
+  </g>
+</svg>