summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-09-25 08:06:20 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-09-25 08:06:20 +0200
commit39bdcdfb814a22c8143c04938268378e9994b7dd (patch)
tree4eeea3247892cab65f10a25d2910fad021cbe7f0
parente083790340aa4cf1b8edaa50f6b9fbb1edfe56d0 (diff)
parent8fb0a2bf6efb67084a5d7a7f3822b4d480fca685 (diff)
downloadbarebox-39bdcdfb814a22c8143c04938268378e9994b7dd.tar.gz
barebox-39bdcdfb814a22c8143c04938268378e9994b7dd.tar.xz
Merge branch 'for-next/misc' into master
-rw-r--r--Documentation/boards/stm32mp.rst13
-rw-r--r--Documentation/user/booting-linux.rst2
-rw-r--r--README68
-rw-r--r--arch/arm/boards/edb93xx/flash_cfg.c3
-rw-r--r--arch/arm/boards/edb93xx/pll_cfg.c3
-rw-r--r--arch/arm/boards/edb93xx/sdram_cfg.c3
-rw-r--r--arch/arm/boards/karo-tx28/tx28-stk5.c2
-rw-r--r--arch/arm/boards/karo-tx28/tx28.c4
-rw-r--r--arch/arm/boards/karo-tx28/tx28.h3
-rw-r--r--arch/arm/configs/at91sam9263ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9x5ek_defconfig1
-rw-r--r--arch/arm/configs/freescale-mx21-ads_defconfig1
-rw-r--r--arch/arm/configs/imx_defconfig1
-rw-r--r--arch/arm/configs/imx_v8_defconfig2
-rw-r--r--arch/arm/configs/kindle-mx50_defconfig1
-rw-r--r--arch/arm/configs/layerscape_defconfig2
-rw-r--r--arch/arm/configs/microchip_ksz9477_evb_defconfig1
-rw-r--r--arch/arm/configs/socfpga-arria10_defconfig1
-rw-r--r--arch/arm/configs/stm32mp_defconfig1
-rw-r--r--arch/arm/configs/virt2real_defconfig1
-rw-r--r--arch/arm/configs/zii_vf610_dev_defconfig1
-rw-r--r--arch/arm/cpu/smccc-call.S16
-rw-r--r--arch/arm/cpu/smccc-call_64.S16
-rw-r--r--arch/arm/dts/stm32mp151.dtsi4
-rw-r--r--arch/arm/dts/tegra20-colibri-iris.dts36
-rw-r--r--arch/arm/dts/tps65217.dtsi56
-rw-r--r--arch/arm/lib32/bootm.c44
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c2
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c2
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c2
-rw-r--r--arch/arm/mach-at91/sama5d3.c2
-rw-r--r--arch/arm/mach-at91/sama5d4.c2
-rw-r--r--arch/arm/mach-clps711x/reset.c2
-rw-r--r--arch/arm/mach-davinci/time.c2
-rw-r--r--arch/arm/mach-ep93xx/clocksource.c2
-rw-r--r--arch/arm/mach-ep93xx/header.c2
-rw-r--r--arch/arm/mach-highbank/reset.c2
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.c2
-rw-r--r--arch/arm/mach-mvebu/dove.c2
-rw-r--r--arch/arm/mach-mvebu/kirkwood.c2
-rw-r--r--arch/arm/mach-mxs/soc-imx23.c2
-rw-r--r--arch/arm/mach-mxs/soc-imx28.c2
-rw-r--r--arch/arm/mach-nomadik/reset.c2
-rw-r--r--arch/arm/mach-omap/am33xx_generic.c2
-rw-r--r--arch/arm/mach-omap/omap3_generic.c2
-rw-r--r--arch/arm/mach-omap/omap4_generic.c2
-rw-r--r--arch/arm/mach-pxa/common.c2
-rw-r--r--arch/arm/mach-rockchip/rk3188.c2
-rw-r--r--arch/arm/mach-rockchip/rk3288.c2
-rw-r--r--arch/arm/mach-samsung/generic.c2
-rw-r--r--arch/arm/mach-socfpga/arria10-generic.c2
-rw-r--r--arch/arm/mach-socfpga/cyclone5-reset-manager.c2
-rw-r--r--arch/arm/mach-tegra/tegra20-pmc.c2
-rw-r--r--arch/arm/mach-versatile/core.c15
-rw-r--r--arch/arm/mach-vexpress/reset.c2
-rw-r--r--arch/arm/mach-zynq/zynq.c2
-rw-r--r--arch/kvx/configs/generic_defconfig12
-rw-r--r--arch/kvx/cpu/reset.c2
-rw-r--r--arch/mips/configs/bcm47xx_defconfig1
-rw-r--r--arch/mips/configs/qemu-malta_defconfig1
-rw-r--r--arch/mips/mach-ar231x/ar231x_reset.c2
-rw-r--r--arch/mips/mach-ath79/reset.c2
-rw-r--r--arch/mips/mach-bcm47xx/reset.c2
-rw-r--r--arch/mips/mach-loongson/loongson1_reset.c2
-rw-r--r--arch/mips/mach-malta/reset.c2
-rw-r--r--arch/nios2/cpu/cpu.c2
-rw-r--r--arch/openrisc/cpu/cache.c3
-rw-r--r--arch/openrisc/cpu/cpu.c2
-rw-r--r--arch/openrisc/cpu/exceptions.c4
-rw-r--r--arch/openrisc/lib/board.c3
-rw-r--r--arch/openrisc/lib/cpuinfo.c2
-rw-r--r--arch/powerpc/mach-mpc5xxx/cpu.c2
-rw-r--r--arch/powerpc/mach-mpc85xx/cpu.c2
-rw-r--r--arch/sandbox/Kconfig10
-rw-r--r--arch/sandbox/Makefile2
-rw-r--r--arch/sandbox/board/dtb.c2
-rw-r--r--arch/sandbox/board/hostfile.c118
-rw-r--r--arch/sandbox/board/poweroff.c25
-rw-r--r--arch/sandbox/configs/hosttools_defconfig7
-rw-r--r--arch/sandbox/dts/sandbox-state-example.dtsi2
-rw-r--r--arch/sandbox/dts/skeleton.dtsi4
-rw-r--r--arch/sandbox/lib/unwind.c2
-rw-r--r--arch/sandbox/mach-sandbox/include/mach/hostfile.h3
-rw-r--r--arch/sandbox/mach-sandbox/include/mach/linux.h2
-rw-r--r--arch/sandbox/os/common.c90
-rw-r--r--arch/sandbox/os/tap.c2
-rw-r--r--arch/x86/configs/efi_defconfig2
-rw-r--r--commands/Kconfig13
-rw-r--r--commands/Makefile2
-rw-r--r--commands/boot.c2
-rw-r--r--commands/clk.c15
-rw-r--r--commands/ls.c13
-rw-r--r--commands/reset.c27
-rw-r--r--commands/setenv.c14
-rw-r--r--common/Kconfig2
-rw-r--r--common/blspec.c5
-rw-r--r--common/bootm.c31
-rw-r--r--common/complete.c6
-rw-r--r--common/efi/efi.c2
-rw-r--r--common/globalvar.c8
-rw-r--r--common/restart.c37
-rw-r--r--drivers/clk/clk-bulk.c80
-rw-r--r--drivers/clk/clk.c50
-rw-r--r--drivers/clk/mvebu/armada-38x.c2
-rw-r--r--drivers/clk/mvebu/armada-xp.c2
-rw-r--r--drivers/mci/Kconfig1
-rw-r--r--drivers/remoteproc/imx_rproc.c8
-rw-r--r--drivers/remoteproc/remoteproc_core.c2
-rw-r--r--drivers/usb/dwc3/dwc3-of-simple.c60
-rw-r--r--drivers/video/imx-ipu-v3/imx-pd.c31
-rw-r--r--drivers/video/simple-panel.c2
-rw-r--r--drivers/watchdog/efi_wdt.c2
-rw-r--r--drivers/watchdog/stpmic1_wdt.c2
-rw-r--r--images/Makefile.zynq2
-rw-r--r--include/bootm.h2
-rw-r--r--include/complete.h1
-rw-r--r--include/globalvar.h14
-rw-r--r--include/linux/clk.h47
-rw-r--r--include/linux/mtd/bbm.h2
-rw-r--r--include/linux/string.h3
-rw-r--r--include/regulator.h5
-rw-r--r--include/restart.h6
-rw-r--r--lib/lzo/Kconfig4
-rw-r--r--lib/lzo/Makefile3
-rw-r--r--lib/lzo/lzo1x_compress.c279
-rw-r--r--lib/readkey.c2
-rw-r--r--lib/string.c78
-rw-r--r--lib/ubsan.c88
-rw-r--r--scripts/Kconfig.include5
-rw-r--r--scripts/compiler.h1
-rw-r--r--scripts/imx/imx-usb-loader.c2
-rw-r--r--scripts/imx/imx.c2
-rw-r--r--scripts/kconfig/.gitignore2
-rw-r--r--scripts/kconfig/Makefile24
-rw-r--r--scripts/kconfig/images.c30
-rw-r--r--scripts/kconfig/images.h30
-rw-r--r--scripts/kconfig/lexer.l4
-rw-r--r--scripts/kconfig/menu.c3
-rw-r--r--scripts/kconfig/parser.y30
-rw-r--r--scripts/kconfig/qconf.cc629
-rw-r--r--scripts/kconfig/qconf.h89
-rwxr-xr-xscripts/kconfig/streamline_config.pl21
-rw-r--r--scripts/kconfig/symbol.c16
-rw-r--r--scripts/kconfig/tests/rand_nested_choice/Kconfig35
-rw-r--r--scripts/kconfig/tests/rand_nested_choice/__init__.py17
-rw-r--r--scripts/kconfig/tests/rand_nested_choice/expected_stdout02
-rw-r--r--scripts/kconfig/tests/rand_nested_choice/expected_stdout14
-rw-r--r--scripts/kconfig/tests/rand_nested_choice/expected_stdout25
-rw-r--r--scripts/kwbimage.c4
-rw-r--r--scripts/mkublheader.c2
-rw-r--r--scripts/mxsimage.c2
-rw-r--r--scripts/omap4_usbboot.c14
-rw-r--r--scripts/pblimage.c2
-rw-r--r--scripts/socfpga_mkimage.c2
-rw-r--r--scripts/tegra/context.c1
-rw-r--r--scripts/tegra/t114/nvbctlib_t114.c12
-rw-r--r--scripts/tegra/t124/nvbctlib_t124.c12
-rw-r--r--scripts/tegra/t20/nvbctlib_t20.c12
-rw-r--r--scripts/tegra/t30/nvbctlib_t30.c12
163 files changed, 1385 insertions, 1279 deletions
diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index 7c657eb990..b235c39927 100644
--- a/Documentation/boards/stm32mp.rst
+++ b/Documentation/boards/stm32mp.rst
@@ -64,7 +64,7 @@ An appropriate image for a SD-Card can be generated with following
}
For eMMC, the boot partitions are used as the FSBL partitions and so the user
-partitions may look like this:
+partitions may look like this::
image @STM32MP_BOARD@.img {
partition ssbl {
@@ -80,6 +80,17 @@ partitions may look like this:
The fsbl1 and fsbl2 can be flashed by writing to barebox ``/dev/mmcX.boot0`` and
``/dev/mmcX.boot1`` respectively or from a booted operating system.
+Additionally, the eMMC's ``ext_csd`` register must be modified to activate the
+boot acknowledge signal (``BOOT_ACK``) and to select a boot partition.
+
+Assuming ``CONFIG_CMD_MMC_EXTCSD`` is enabled and the board shall boot from
+``/dev/mmc1.boot1``::
+
+ mmc_extcsd /dev/mmc1 -i 179 -v 0x50
+
+The STM32MP1 BootROM does *not* support booting from eMMC without fast boot
+acknowledge.
+
Boot source selection
---------------------
diff --git a/Documentation/user/booting-linux.rst b/Documentation/user/booting-linux.rst
index 983b56deef..60babb513c 100644
--- a/Documentation/user/booting-linux.rst
+++ b/Documentation/user/booting-linux.rst
@@ -274,7 +274,7 @@ In any case, make sure that the specified mountpoint is exported by your NFS
server.
For more information about booting with ``nfsroot``, see
-`Documentation/filesystems/nfs/nfsroot.txt <https://github.com/torvalds/linux/blob/master/Documentation/filesystems/nfs/nfsroot.txt>`__
+`Documentation/admin-guide/nfs/nfsroot.rst <https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/nfs/nfsroot.rst>`__
in the Linux kernel documentation.
If the preconfigured paths or names are not suitable, they can be adjusted in
diff --git a/README b/README
index d8077d21b6..7c5ef9f818 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-only
-Barebox
+barebox
-------
-Barebox is a bootloader that follows the tradition of Das U-Boot, while
+barebox is a bootloader that follows the tradition of Das U-Boot, while
adopting modern design ideas from the Linux kernel.
@@ -18,33 +18,34 @@ Features
- The environment is not a variable store anymore, but a file store. It has
currently some limitations, of course. The environment is not a real
- read/write filesystem, it is more like a tar archive, or even more like
- an ar archive, because it cannot handle directories. The saveenv command
- saves the files under a certain directory (by default /env) in persistent
- storage (by default /dev/env0). There is a counterpart called loadenv, too.
+ read/write filesystem, but more like a tar archive.
+ The saveenv command saves the files under a certain directory (by default
+ /env) in persistent storage (by default /dev/env0). There is a counterpart
+ called loadenv, too.
- filesystem support
The loader starts up with mounting a ramdisk on /. Then a devfs is mounted
on /dev allowing the user (or shell commands) to access devices. Apart from
- these two filesystems there is currently one filesystem ported: cramfs. One
- can mount it with the usual mount command.
+ these two filesystems there are a number of different filesystems ported:
+ ext4, efi, efivarfs, ext4, fat, jffs2, NFS, pstore, squashfs, ubifs,
+ u-boot variable FS among others.
- device/driver model
Devices are no longer described by defines in the config file. Instead
- there are devices which can be registered in the board .c file or
- dynamically allocated. Drivers will match upon the devices automatically.
+ devices are registered as they are discovered (e.g. through OpenFirmware
+ device tree traversal or EFI handles) or by board code.
+ Drivers will match upon the devices automatically.
- clocksource support
Timekeeping has been simplified by the use of the Linux clocksource API.
- Only one function is needed for a new board, no [gs]et_timer[masked]() or
- reset_timer[masked]() functions.
+ no [gs]et_timer[masked]() or reset_timer[masked]() functions.
- Kconfig and Kernel build system
Only targets which are really needed get recompiled. Parallel builds are
no problem anymore. This also removes the need for many many ifdefs in
the code.
-- simulation target
+- ARCH=sandbox simulation target
barebox can be compiled to run under Linux. While this is rather useless
in real world this is a great debugging and development aid. New features
can be easily developed and tested on long train journeys and started
@@ -53,7 +54,7 @@ Features
devices under barebox to emulate storage devices.
- device parameter support
- Each device can have a unlimited number of parameters. They can be accessed
+ Each device can have an unlimited number of parameters. They can be accessed
on the command line with <devid>.<param>="...", for example
'eth0.ip=192.168.0.7' or 'echo $eth0.ip'
@@ -71,10 +72,10 @@ Features
except the ones really needed: moving the cursor and typing characters.
-Building Barebox
+Building barebox
----------------
-Barebox uses the Linux kernel's build system. It consists of two parts:
+barebox uses the Linux kernel's build system. It consists of two parts:
the Makefile infrastructure (kbuild), plus a configuration system
(kconfig). So building barebox is very similar to building the Linux
kernel.
@@ -83,7 +84,7 @@ For the examples below, we use the User Mode barebox implementation, which
is a port of barebox to the Linux userspace. This makes it possible to
test drive the code without having real hardware. So for this test
scenario, ARCH=sandbox is the valid architecture selection. This currently
-only works on ia32 hosts and partly on x86-64.
+works on at least IA32 hosts and x86-64 hosts.
Selection of the architecture and the cross compiler can be done by using
the environment variables ARCH and CROSS_COMPILE.
@@ -108,13 +109,13 @@ If everything goes well, the result is a file called barebox:
# ls -l barebox
-rwxr-xr-x 1 rsc ptx 114073 Jun 26 22:34 barebox
-Barebox usually needs an environment for storing the configuration data.
+barebox usually needs an environment for storing the configuration data.
You can generate an environment using the example environment contained
in board/sandbox/env:
# ./scripts/bareboxenv -s -p 0x10000 arch/sandbox/board/env env.bin
-To get some files to play with you can generate a cramfs image:
+To get some files to play with, you can generate a cramfs image:
# mkcramfs somedir/ cramfs.bin
The barebox image is a normal Linux executable, so it can be started
@@ -133,14 +134,14 @@ given with '-i' will appear as /dev/fd[n].
If barebox finds a valid configuration sector on /dev/env0 it will
load it to /env. It then executes /env/init if it exists. If you have
-loaded the example environment barebox will show you a menu asking for
+loaded the example environment, barebox will show you a menu asking for
your settings.
-If you have started barebox as root you will find a new tap device on your
-host which you can configure using ifconfig. Once you configured bareboxs
+If you have started barebox as root, you will find a new tap device on your
+host which you can configure using ifconfig. Once you configured barebox'
network settings accordingly you can do a ping or tftpboot.
-If you have mapped a cramfs image try mounting it with
+If you have mapped a cramfs image, try mounting it with
# mkdir /cram
# mount /dev/fd0 cramfs /cram
@@ -157,16 +158,15 @@ Directory Layout
Most of the directory layout is based upon the Linux Kernel:
-arch/*/ -> contains architecture specific parts
-arch/*/mach-*/ -> SoC specific code
+arch/* -> contains architecture specific parts
+arch/*/include -> architecture specific includes
+arch/*/mach-* -> SoC specific code
+arch/*/mach-*/include -> SoC specific includes
drivers/serial -> drivers
drivers/net
drivers/...
-include/asm-* -> architecture specific includes
-include/asm-*/arch-* -> SoC specific includes
-
fs/ -> filesystem support and filesystem drivers
lib/ -> generic library functions (getopt, readline and the
@@ -188,7 +188,7 @@ Documentation/ -> Sphinx generated documentation. Call "make docs" to
Release Strategy
----------------
-Barebox is developed with git. From time to time, tarball releases are
+barebox is developed with git. On a monthly schedule, tarball releases are
branched from the repository and released on the project web site. Here
are the release rules:
@@ -228,15 +228,15 @@ are the release rules:
Contributing
------------
-For any questions regarding Barebox, send a mail to the mailing list at
+For any questions regarding barebox, send a mail to the mailing list at
<barebox@lists.infradead.org>. The archives for this list are available
publicly at <http://lists.infradead.org/pipermail/barebox/> and
<https://www.mail-archive.com/barebox@lists.infradead.org/>.
-The same list should also be used to send patches. Barebox uses a similar
+The same list should also be used to send patches. barebox uses a similar
process as the Linux kernel, so most of the Linux guide for submitting patches
<https://www.kernel.org/doc/html/latest/process/submitting-patches.html> also
-applies to Barebox (except the step for selecting your recipient - we don't
+applies to barebox (except the step for selecting your recipient - we don't
have a MAINTAINERS file, instead all patches go to the list).
@@ -246,7 +246,7 @@ License
Copyright (C) 2000 - 2005 Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Copyright (C) 2018 Sascha Hauer, Pengutronix, and individual contributors
-Barebox is free software: you can redistribute it and/or modify it under the
+barebox is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License, version 2, as published by the Free
Software Foundation.
@@ -266,6 +266,6 @@ the above copyright and warranty notices:
This eases machine processing of licensing information based on the SPDX
License Identifiers that are available at http://spdx.org/licenses/.
-Also note that some files in the Barebox source tree are available under
+Also note that some files in the barebox source tree are available under
several different GPLv2-compatible open-source licenses. This fact is noted
clearly in the file headers of the respective files.
diff --git a/arch/arm/boards/edb93xx/flash_cfg.c b/arch/arm/boards/edb93xx/flash_cfg.c
index 6b742f967c..8400db69de 100644
--- a/arch/arm/boards/edb93xx/flash_cfg.c
+++ b/arch/arm/boards/edb93xx/flash_cfg.c
@@ -11,6 +11,9 @@
SMC_BCR_BLE | 2 << SMC_BCR_WST2_SHIFT | \
1 << SMC_BCR_MW_SHIFT)
+/* Called from assembly */
+void flash_cfg(void);
+
void flash_cfg(void)
{
struct smc_regs *smc = (struct smc_regs *)SMC_BASE;
diff --git a/arch/arm/boards/edb93xx/pll_cfg.c b/arch/arm/boards/edb93xx/pll_cfg.c
index 1f03acf915..1a1c01aba2 100644
--- a/arch/arm/boards/edb93xx/pll_cfg.c
+++ b/arch/arm/boards/edb93xx/pll_cfg.c
@@ -9,6 +9,9 @@
#include "pll_cfg.h"
#include "early_udelay.h"
+/* Called from assembly */
+void pll_cfg(void);
+
void pll_cfg(void)
{
struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
diff --git a/arch/arm/boards/edb93xx/sdram_cfg.c b/arch/arm/boards/edb93xx/sdram_cfg.c
index a9f591f197..3cee834910 100644
--- a/arch/arm/boards/edb93xx/sdram_cfg.c
+++ b/arch/arm/boards/edb93xx/sdram_cfg.c
@@ -17,6 +17,9 @@ static void precharge_all_banks(void);
static void setup_refresh_timer(void);
static void program_mode_registers(void);
+/* Called from assembly */
+void sdram_cfg(void);
+
void sdram_cfg(void)
{
struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE;
diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c
index c9b947953b..56211d7a3a 100644
--- a/arch/arm/boards/karo-tx28/tx28-stk5.c
+++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
@@ -22,6 +22,8 @@
#include <mach/iomux.h>
#include <generated/mach-types.h>
+#include "tx28.h"
+
static struct mxs_mci_platform_data mci_pdata = {
.caps = MMC_CAP_4_BIT_DATA,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
diff --git a/arch/arm/boards/karo-tx28/tx28.c b/arch/arm/boards/karo-tx28/tx28.c
index 52f74b5f36..8bd2252410 100644
--- a/arch/arm/boards/karo-tx28/tx28.c
+++ b/arch/arm/boards/karo-tx28/tx28.c
@@ -15,6 +15,8 @@
#include <mach/iomux.h>
#include <asm/mmu.h>
+#include "tx28.h"
+
/* setup the CPU card internal signals */
static const uint32_t tx28_pad_setup[] = {
/* NAND interface */
@@ -61,8 +63,6 @@ static const uint32_t tx28_pad_setup[] = {
};
-extern void base_board_init(void);
-
static int tx28_devices_init(void)
{
int i;
diff --git a/arch/arm/boards/karo-tx28/tx28.h b/arch/arm/boards/karo-tx28/tx28.h
new file mode 100644
index 0000000000..5fb1e13412
--- /dev/null
+++ b/arch/arm/boards/karo-tx28/tx28.h
@@ -0,0 +1,3 @@
+
+void base_board_init(void);
+
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig
index 45c6f79de4..0cde5396af 100644
--- a/arch/arm/configs/at91sam9263ek_defconfig
+++ b/arch/arm/configs/at91sam9263ek_defconfig
@@ -1,4 +1,3 @@
-CONFIG_ARCH_AT91SAM9263=y
CONFIG_AT91_MULTI_BOARDS=y
CONFIG_MACH_AT91SAM9263EK=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
diff --git a/arch/arm/configs/at91sam9x5ek_defconfig b/arch/arm/configs/at91sam9x5ek_defconfig
index 11d1e4511e..7b743abfaa 100644
--- a/arch/arm/configs/at91sam9x5ek_defconfig
+++ b/arch/arm/configs/at91sam9x5ek_defconfig
@@ -1,4 +1,3 @@
-CONFIG_ARCH_AT91SAM9X5=y
CONFIG_AT91_MULTI_BOARDS=y
CONFIG_MACH_AT91SAM9X5EK=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
diff --git a/arch/arm/configs/freescale-mx21-ads_defconfig b/arch/arm/configs/freescale-mx21-ads_defconfig
index e1843db3e2..b1d37f76a8 100644
--- a/arch/arm/configs/freescale-mx21-ads_defconfig
+++ b/arch/arm/configs/freescale-mx21-ads_defconfig
@@ -1,6 +1,5 @@
CONFIG_TEXT_BASE=0xc3000000
CONFIG_ARCH_IMX=y
-CONFIG_MACH_IMX21ADS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_MALLOC_SIZE=0x2000000
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/imx_defconfig b/arch/arm/configs/imx_defconfig
index 02e33e122e..e6333220b6 100644
--- a/arch/arm/configs/imx_defconfig
+++ b/arch/arm/configs/imx_defconfig
@@ -13,7 +13,6 @@ CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
-CONFIG_RELOCATABLE=y
CONFIG_PANIC_HANG=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/imx_v8_defconfig b/arch/arm/configs/imx_v8_defconfig
index 268770ec3f..06d79f594d 100644
--- a/arch/arm/configs/imx_v8_defconfig
+++ b/arch/arm/configs/imx_v8_defconfig
@@ -10,7 +10,6 @@ CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
-CONFIG_RELOCATABLE=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
@@ -130,7 +129,6 @@ CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=y
CONFIG_GENERIC_PHY=y
CONFIG_USB_NOP_XCEIV=y
-CONFIG_PHY_FSL_IMX8MQ_USB=y
CONFIG_FS_EXT4=y
CONFIG_FS_TFTP=y
CONFIG_FS_NFS=y
diff --git a/arch/arm/configs/kindle-mx50_defconfig b/arch/arm/configs/kindle-mx50_defconfig
index 552b2d6d33..95fafd56e6 100644
--- a/arch/arm/configs/kindle-mx50_defconfig
+++ b/arch/arm/configs/kindle-mx50_defconfig
@@ -9,7 +9,6 @@ CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
-CONFIG_RELOCATABLE=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/arm/configs/layerscape_defconfig b/arch/arm/configs/layerscape_defconfig
index b36f1944ec..394cd95c98 100644
--- a/arch/arm/configs/layerscape_defconfig
+++ b/arch/arm/configs/layerscape_defconfig
@@ -78,7 +78,6 @@ CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_NET=y
CONFIG_NET_NETCONSOLE=y
-CONFIG_OFDEVICE=y
CONFIG_OF_BAREBOX_DRIVERS=y
CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_DRIVER_NET_FSL_FMAN=y
@@ -105,7 +104,6 @@ CONFIG_EEPROM_AT24=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_IMX=y
CONFIG_GPIO_PCA953X=y
-CONFIG_NVMEM=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED=y
CONFIG_FS_EXT4=y
diff --git a/arch/arm/configs/microchip_ksz9477_evb_defconfig b/arch/arm/configs/microchip_ksz9477_evb_defconfig
index 4189b2c039..7130499490 100644
--- a/arch/arm/configs/microchip_ksz9477_evb_defconfig
+++ b/arch/arm/configs/microchip_ksz9477_evb_defconfig
@@ -1,4 +1,3 @@
-CONFIG_ARCH_SAMA5D3=y
CONFIG_AT91_MULTI_BOARDS=y
CONFIG_MACH_MICROCHIP_KSZ9477_EVB=y
CONFIG_AEABI=y
diff --git a/arch/arm/configs/socfpga-arria10_defconfig b/arch/arm/configs/socfpga-arria10_defconfig
index e47a0ab183..a37bae6217 100644
--- a/arch/arm/configs/socfpga-arria10_defconfig
+++ b/arch/arm/configs/socfpga-arria10_defconfig
@@ -18,7 +18,6 @@ CONFIG_BOOTM_INITRD=y
CONFIG_BOOTM_OFTREE=y
CONFIG_DEFAULT_COMPRESSION_LZO=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_POLLER=y
CONFIG_STATE=y
CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index c98908debc..92bdf5b040 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -37,6 +37,7 @@ CONFIG_CMD_MEMINFO=y
CONFIG_CMD_ARM_MMUINFO=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_MMC=y
+CONFIG_CMD_MMC_EXTCSD=y
# CONFIG_CMD_BOOTU is not set
CONFIG_CMD_GO=y
CONFIG_CMD_RESET=y
diff --git a/arch/arm/configs/virt2real_defconfig b/arch/arm/configs/virt2real_defconfig
index 814fe69e42..62315b8cb3 100644
--- a/arch/arm/configs/virt2real_defconfig
+++ b/arch/arm/configs/virt2real_defconfig
@@ -36,7 +36,6 @@ CONFIG_CMD_LED=y
CONFIG_CMD_OF_NODE=y
CONFIG_CMD_OF_PROPERTY=y
CONFIG_CMD_OFTREE=y
-CONFIG_OFDEVICE=y
CONFIG_OF_BAREBOX_DRIVERS=y
CONFIG_DRIVER_SERIAL_NS16550=y
# CONFIG_SPI is not set
diff --git a/arch/arm/configs/zii_vf610_dev_defconfig b/arch/arm/configs/zii_vf610_dev_defconfig
index 45c24d6df4..3ed5d37458 100644
--- a/arch/arm/configs/zii_vf610_dev_defconfig
+++ b/arch/arm/configs/zii_vf610_dev_defconfig
@@ -8,7 +8,6 @@ CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
-CONFIG_RELOCATABLE=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
diff --git a/arch/arm/cpu/smccc-call.S b/arch/arm/cpu/smccc-call.S
index b6bdc8b3b5..9875e1f947 100644
--- a/arch/arm/cpu/smccc-call.S
+++ b/arch/arm/cpu/smccc-call.S
@@ -1,16 +1,6 @@
-/*
- * Copyright (c) 2015, Linaro Limited
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* SPDX-FileCopyrightText: 2015 Linaro Limited */
+
#include <linux/linkage.h>
#include <asm/unwind.h>
diff --git a/arch/arm/cpu/smccc-call_64.S b/arch/arm/cpu/smccc-call_64.S
index 44888fb594..c2959050d2 100644
--- a/arch/arm/cpu/smccc-call_64.S
+++ b/arch/arm/cpu/smccc-call_64.S
@@ -1,16 +1,6 @@
-/*
- * Copyright (c) 2015, Linaro Limited
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License Version 2 as
- * published by the Free Software Foundation.
- *
- * 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.
- *
- */
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* SPDX-FileCopyrightText: 2015 Linaro Limited */
+
#include <linux/linkage.h>
#include <linux/arm-smccc.h>
#include <asm/asm-offsets.h>
diff --git a/arch/arm/dts/stm32mp151.dtsi b/arch/arm/dts/stm32mp151.dtsi
index 5ff3b96fae..cc25400475 100644
--- a/arch/arm/dts/stm32mp151.dtsi
+++ b/arch/arm/dts/stm32mp151.dtsi
@@ -37,10 +37,6 @@
compatible = "simple-bus";
};
-&{/psci} {
- compatible = "arm,psci-0.2";
-};
-
&{/soc} {
memory-controller@5a003000 {
compatible = "st,stm32mp1-ddr";
diff --git a/arch/arm/dts/tegra20-colibri-iris.dts b/arch/arm/dts/tegra20-colibri-iris.dts
index 9c615816ca..da5ef7a7e7 100644
--- a/arch/arm/dts/tegra20-colibri-iris.dts
+++ b/arch/arm/dts/tegra20-colibri-iris.dts
@@ -75,26 +75,22 @@
vqmmc-supply = <&vcc_sd_reg>;
};
- regulators {
- regulator@0 {
- compatible = "regulator-fixed";
- reg = <0>;
- regulator-name = "usb_host_vbus";
- regulator-min-microvolt = <5000000>;
- regulator-max-microvolt = <5000000>;
- regulator-boot-on;
- regulator-always-on;
- gpio = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>;
- };
+ regulator_usb_host_vbus {
+ compatible = "regulator-fixed";
+ regulator-name = "usb_host_vbus";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-boot-on;
+ regulator-always-on;
+ gpio = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>;
+ };
- vcc_sd_reg: regulator@1 {
- compatible = "regulator-fixed";
- reg = <1>;
- regulator-name = "vcc_sd";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
- regulator-boot-on;
- regulator-always-on;
- };
+ vcc_sd_reg: regulator_vcc_sd {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc_sd";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-boot-on;
+ regulator-always-on;
};
};
diff --git a/arch/arm/dts/tps65217.dtsi b/arch/arm/dts/tps65217.dtsi
deleted file mode 100644
index a63272422d..0000000000
--- a/arch/arm/dts/tps65217.dtsi
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-/*
- * Integrated Power Management Chip
- * http://www.ti.com/lit/ds/symlink/tps65217.pdf
- */
-
-&tps {
- compatible = "ti,tps65217";
-
- regulators {
- #address-cells = <1>;
- #size-cells = <0>;
-
- dcdc1_reg: regulator@0 {
- reg = <0>;
- regulator-compatible = "dcdc1";
- };
-
- dcdc2_reg: regulator@1 {
- reg = <1>;
- regulator-compatible = "dcdc2";
- };
-
- dcdc3_reg: regulator@2 {
- reg = <2>;
- regulator-compatible = "dcdc3";
- };
-
- ldo1_reg: regulator@3 {
- reg = <3>;
- regulator-compatible = "ldo1";
- };
-
- ldo2_reg: regulator@4 {
- reg = <4>;
- regulator-compatible = "ldo2";
- };
-
- ldo3_reg: regulator@5 {
- reg = <5>;
- regulator-compatible = "ldo3";
- };
-
- ldo4_reg: regulator@6 {
- reg = <6>;
- regulator-compatible = "ldo4";
- };
- };
-};
diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c
index 971ebee8ac..c33ecc2ad8 100644
--- a/arch/arm/lib32/bootm.c
+++ b/arch/arm/lib32/bootm.c
@@ -20,7 +20,7 @@
#include <restart.h>
#include <globalvar.h>
#include <tee/optee.h>
-
+#include <image-fit.h>
#include <asm/byteorder.h>
#include <asm/setup.h>
#include <asm/barebox-arm.h>
@@ -166,6 +166,34 @@ static int optee_verify_header_request_region(struct image_data *data, struct op
return ret;
}
+static int bootm_load_tee_from_fit(struct image_data *data)
+{
+ int ret = 0;
+ struct optee_header hdr;
+
+ if (data->os_fit &&
+ fit_has_image(data->os_fit, data->fit_config, "tee")) {
+ const void *tee;
+ unsigned long tee_size;
+
+ ret = fit_open_image(data->os_fit, data->fit_config, "tee",
+ &tee, &tee_size);
+ if (ret) {
+ pr_err("Error opening tee fit image: %s\n", strerror(-ret));
+ return ret;
+ }
+ memcpy(&hdr, tee, sizeof(hdr));
+ if (optee_verify_header_request_region(data, &hdr) < 0) {
+ pr_err("%s", strerror(errno));
+ ret = -errno;
+ goto out;
+ }
+ memcpy((void *)data->tee_res->start, tee + sizeof(hdr), hdr.init_size);
+ printf("Read optee image to %pa, size 0x%08x\n", (void *)data->tee_res->start, hdr.init_size);
+ }
+out:
+ return ret;
+}
static int bootm_load_tee_from_file(struct image_data *data)
{
int fd, ret;
@@ -262,10 +290,16 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem,
return ret;
}
- if (IS_ENABLED(CONFIG_BOOTM_OPTEE) && data->tee_file) {
- ret = bootm_load_tee_from_file(data);
- if (ret)
- return ret;
+ if (IS_ENABLED(CONFIG_BOOTM_OPTEE)) {
+ if (data->tee_file && !IS_ENABLED(CONFIG_BOOTM_FORCE_SIGNED_IMAGES)) {
+ ret = bootm_load_tee_from_file(data);
+ if (ret)
+ return ret;
+ } else if (IS_ENABLED(CONFIG_FITIMAGE)) {
+ ret = bootm_load_tee_from_fit(data);
+ if (ret)
+ return ret;
+ }
}
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index 975cd956c9..f89983fe63 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -88,7 +88,7 @@ static void __noreturn at91rm9200_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(at91rm9200_restart_soc);
+ restart_handler_register_fn("soc-wdt", at91rm9200_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 56327a2c47..fdd8ea014e 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -243,7 +243,7 @@ static void at91sam9260_initialize(void)
at91_add_pit(AT91SAM9260_BASE_PIT);
at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9260_BASE_SMC, 0x200);
- restart_handler_register_fn(at91sam9260_restart);
+ restart_handler_register_fn("soc", at91sam9260_restart);
}
static int at91sam9260_setup(void)
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 4abc556354..0465ed9524 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -235,7 +235,7 @@ static void at91sam9261_initialize(void)
at91_add_pit(AT91SAM9261_BASE_PIT);
at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9261_BASE_SMC, 0x200);
- restart_handler_register_fn(at91sam9261_restart);
+ restart_handler_register_fn("soc", at91sam9261_restart);
}
static int at91sam9261_setup(void)
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 690f8e06bb..dc5dddfb64 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -256,7 +256,7 @@ static void at91sam9263_initialize(void)
at91_add_sam9_smc(0, AT91SAM9263_BASE_SMC0, 0x200);
at91_add_sam9_smc(1, AT91SAM9263_BASE_SMC1, 0x200);
- restart_handler_register_fn(at91sam9263_restart);
+ restart_handler_register_fn("soc", at91sam9263_restart);
}
static int at91sam9263_setup(void)
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 569aa274fc..affc624b1d 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -270,7 +270,7 @@ static void at91sam9g45_initialize(void)
at91_add_pit(AT91SAM9G45_BASE_PIT);
at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9G45_BASE_SMC, 0x200);
- restart_handler_register_fn(at91sam9g45_restart);
+ restart_handler_register_fn("soc", at91sam9g45_restart);
}
static int at91sam9g45_setup(void)
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index 365bded56e..850d34604a 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -226,7 +226,7 @@ static void at91sam9n12_initialize(void)
at91_add_pit(AT91SAM9N12_BASE_PIT);
at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9N12_BASE_SMC, 0x200);
- restart_handler_register_fn(at91sam9n12_restart);
+ restart_handler_register_fn("soc", at91sam9n12_restart);
}
static int at91sam9n12_setup(void)
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 40ba9ed56e..086e27a79f 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -13,7 +13,7 @@ static void at91sam9x5_restart(struct restart_handler *rst)
static int at91sam9x5_initialize(void)
{
- restart_handler_register_fn(at91sam9x5_restart);
+ restart_handler_register_fn("soc", at91sam9x5_restart);
return 0;
}
diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c
index a5d464eca0..b1e7b2c565 100644
--- a/arch/arm/mach-at91/sama5d3.c
+++ b/arch/arm/mach-at91/sama5d3.c
@@ -397,7 +397,7 @@ static void sama5d3_initialize(void)
at91_add_pit(SAMA5D3_BASE_PIT);
at91_add_sam9_smc(DEVICE_ID_SINGLE, SAMA5D3_BASE_HSMC + 0x600, 0xa0);
- restart_handler_register_fn(sama5d3_restart);
+ restart_handler_register_fn("soc", sama5d3_restart);
}
static int sama5d3_setup(void)
diff --git a/arch/arm/mach-at91/sama5d4.c b/arch/arm/mach-at91/sama5d4.c
index ca09dfe425..62e466fe51 100644
--- a/arch/arm/mach-at91/sama5d4.c
+++ b/arch/arm/mach-at91/sama5d4.c
@@ -305,7 +305,7 @@ static void sama5d4_initialize(void)
at91_add_pit(SAMA5D4_BASE_PIT);
at91_add_sam9_smc(DEVICE_ID_SINGLE, SAMA5D4_BASE_HSMC + 0x600, 0xa0);
- restart_handler_register_fn(sama5d4_restart);
+ restart_handler_register_fn("soc", sama5d4_restart);
}
static int sama5d4_setup(void)
diff --git a/arch/arm/mach-clps711x/reset.c b/arch/arm/mach-clps711x/reset.c
index 03f40b73fa..90ddb8f5d2 100644
--- a/arch/arm/mach-clps711x/reset.c
+++ b/arch/arm/mach-clps711x/reset.c
@@ -22,7 +22,7 @@ static void __noreturn clps711x_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(clps711x_restart_soc);
+ restart_handler_register_fn("vector", clps711x_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 4d1b570aa0..5b57fe6192 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -210,7 +210,7 @@ static void __noreturn davinci_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(davinci_restart_soc);
+ restart_handler_register_fn("soc-wdt", davinci_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-ep93xx/clocksource.c b/arch/arm/mach-ep93xx/clocksource.c
index 4fdcc36b1c..1f3ff7f8f2 100644
--- a/arch/arm/mach-ep93xx/clocksource.c
+++ b/arch/arm/mach-ep93xx/clocksource.c
@@ -85,7 +85,7 @@ static void __noreturn ep92xx_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(ep92xx_restart_soc);
+ restart_handler_register_fn("soc", ep92xx_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-ep93xx/header.c b/arch/arm/mach-ep93xx/header.c
index 4e6a2e57c8..a9dde2d8b0 100644
--- a/arch/arm/mach-ep93xx/header.c
+++ b/arch/arm/mach-ep93xx/header.c
@@ -2,6 +2,8 @@
#include <linux/compiler.h>
#include <asm/barebox-arm-head.h>
+void go(void);
+
void __naked __section(.flash_header_start) go(void)
{
barebox_arm_head();
diff --git a/arch/arm/mach-highbank/reset.c b/arch/arm/mach-highbank/reset.c
index d73a0a76a5..ea3908ec2b 100644
--- a/arch/arm/mach-highbank/reset.c
+++ b/arch/arm/mach-highbank/reset.c
@@ -33,7 +33,7 @@ static void __noreturn highbank_poweroff(struct poweroff_handler *handler)
static int highbank_init(void)
{
- restart_handler_register_fn(highbank_restart_soc);
+ restart_handler_register_fn("soc", highbank_restart_soc);
poweroff_handler_register_fn(highbank_poweroff);
return 0;
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index 2589f4fe72..9a35c51985 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -132,7 +132,7 @@ static int armada_370_xp_init_soc(void)
if (!of_machine_is_compatible("marvell,armada-370-xp"))
return 0;
- restart_handler_register_fn(armada_370_xp_restart_soc);
+ restart_handler_register_fn("soc", armada_370_xp_restart_soc);
barebox_set_model("Marvell Armada 370/XP");
barebox_set_hostname("armada");
diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
index 37fde63f18..3c6302dd2d 100644
--- a/arch/arm/mach-mvebu/dove.c
+++ b/arch/arm/mach-mvebu/dove.c
@@ -36,7 +36,7 @@ static int dove_init_soc(void)
if (!of_machine_is_compatible("marvell,dove"))
return 0;
- restart_handler_register_fn(dove_restart_soc);
+ restart_handler_register_fn("soc", dove_restart_soc);
barebox_set_model("Marvell Dove");
barebox_set_hostname("dove");
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
index 59fb95ff4a..e50d7501c8 100644
--- a/arch/arm/mach-mvebu/kirkwood.c
+++ b/arch/arm/mach-mvebu/kirkwood.c
@@ -34,7 +34,7 @@ static int kirkwood_init_soc(void)
if (!of_machine_is_compatible("marvell,kirkwood"))
return 0;
- restart_handler_register_fn(kirkwood_restart_soc);
+ restart_handler_register_fn("soc", kirkwood_restart_soc);
barebox_set_model("Marvell Kirkwood");
barebox_set_hostname("kirkwood");
diff --git a/arch/arm/mach-mxs/soc-imx23.c b/arch/arm/mach-mxs/soc-imx23.c
index f25fff18c3..8c47c766cc 100644
--- a/arch/arm/mach-mxs/soc-imx23.c
+++ b/arch/arm/mach-mxs/soc-imx23.c
@@ -49,7 +49,7 @@ static int imx23_devices_init(void)
add_generic_device("imx23-gpio", 0, NULL, IMX_IOMUXC_BASE, 0x2000, IORESOURCE_MEM, NULL);
add_generic_device("imx23-gpio", 1, NULL, IMX_IOMUXC_BASE, 0x2000, IORESOURCE_MEM, NULL);
add_generic_device("imx23-gpio", 2, NULL, IMX_IOMUXC_BASE, 0x2000, IORESOURCE_MEM, NULL);
- restart_handler_register_fn(imx23_restart_soc);
+ restart_handler_register_fn("soc", imx23_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-mxs/soc-imx28.c b/arch/arm/mach-mxs/soc-imx28.c
index 49f870b5bf..a214e2b7a6 100644
--- a/arch/arm/mach-mxs/soc-imx28.c
+++ b/arch/arm/mach-mxs/soc-imx28.c
@@ -51,7 +51,7 @@ static int imx28_init(void)
HW_CLKCTRL_WDOG_POR_DISABLE;
writel(reg, IMX_CCM_BASE + HW_CLKCTRL_RESET);
- restart_handler_register_fn(imx28_restart_soc);
+ restart_handler_register_fn("soc", imx28_restart_soc);
arm_add_mem_device("ram0", IMX_MEMORY_BASE, imx28_get_memsize());
diff --git a/arch/arm/mach-nomadik/reset.c b/arch/arm/mach-nomadik/reset.c
index 8bdaada8a1..d5266068e2 100644
--- a/arch/arm/mach-nomadik/reset.c
+++ b/arch/arm/mach-nomadik/reset.c
@@ -35,7 +35,7 @@ static void __noreturn nomadik_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(nomadik_restart_soc);
+ restart_handler_register_fn("soc", nomadik_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-omap/am33xx_generic.c b/arch/arm/mach-omap/am33xx_generic.c
index 7577df761c..3c5cdf065c 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -244,7 +244,7 @@ int am33xx_init(void)
{
omap_gpmc_base = (void *)AM33XX_GPMC_BASE;
- restart_handler_register_fn(am33xx_restart_soc);
+ restart_handler_register_fn("soc", am33xx_restart_soc);
am33xx_enable_per_clocks();
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index cff4a4fb11..3f6a346277 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -540,7 +540,7 @@ int omap3_init(void)
{
omap_gpmc_base = (void *)OMAP3_GPMC_BASE;
- restart_handler_register_fn(omap3_restart_soc);
+ restart_handler_register_fn("soc", omap3_restart_soc);
if (IS_ENABLED(CONFIG_RESET_SOURCE))
omap3_detect_reset_reason();
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index 1f71153848..848a664064 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -535,7 +535,7 @@ int omap4_init(void)
{
omap_gpmc_base = (void *)OMAP44XX_GPMC_BASE;
- restart_handler_register_fn(omap4_restart_soc);
+ restart_handler_register_fn("soc", omap4_restart_soc);
return omap4_bootsource();
}
diff --git a/arch/arm/mach-pxa/common.c b/arch/arm/mach-pxa/common.c
index 106ca3020e..5b980cb81b 100644
--- a/arch/arm/mach-pxa/common.c
+++ b/arch/arm/mach-pxa/common.c
@@ -41,7 +41,7 @@ static void __noreturn pxa_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(pxa_restart_soc);
+ restart_handler_register_fn("soc-wdt", pxa_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-rockchip/rk3188.c b/arch/arm/mach-rockchip/rk3188.c
index e7cbf36457..572e9dc58f 100644
--- a/arch/arm/mach-rockchip/rk3188.c
+++ b/arch/arm/mach-rockchip/rk3188.c
@@ -29,7 +29,7 @@ static void __noreturn rockchip_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(rockchip_restart_soc);
+ restart_handler_register_fn("soc", rockchip_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-rockchip/rk3288.c b/arch/arm/mach-rockchip/rk3288.c
index 4e8fb4a123..9076fd9227 100644
--- a/arch/arm/mach-rockchip/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288.c
@@ -60,7 +60,7 @@ static void rk3288_detect_reset_reason(void)
static int rk3288_init(void)
{
- restart_handler_register_fn(rockchip_restart_soc);
+ restart_handler_register_fn("soc", rockchip_restart_soc);
if (IS_ENABLED(CONFIG_RESET_SOURCE))
rk3288_detect_reset_reason();
diff --git a/arch/arm/mach-samsung/generic.c b/arch/arm/mach-samsung/generic.c
index de38d47e21..ed3d30d995 100644
--- a/arch/arm/mach-samsung/generic.c
+++ b/arch/arm/mach-samsung/generic.c
@@ -44,7 +44,7 @@ static void __noreturn samsung_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(samsung_restart_soc);
+ restart_handler_register_fn("soc-wdt", samsung_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-socfpga/arria10-generic.c b/arch/arm/mach-socfpga/arria10-generic.c
index 53ec278739..38558309f8 100644
--- a/arch/arm/mach-socfpga/arria10-generic.c
+++ b/arch/arm/mach-socfpga/arria10-generic.c
@@ -70,7 +70,7 @@ static int arria10_generic_init(void)
arria10_init_emac();
pr_debug("Register restart handler\n");
- restart_handler_register_fn(arria10_restart_soc);
+ restart_handler_register_fn("soc", arria10_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-socfpga/cyclone5-reset-manager.c b/arch/arm/mach-socfpga/cyclone5-reset-manager.c
index 8635806846..4ee90b1bb0 100644
--- a/arch/arm/mach-socfpga/cyclone5-reset-manager.c
+++ b/arch/arm/mach-socfpga/cyclone5-reset-manager.c
@@ -37,7 +37,7 @@ static void __noreturn socfpga_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(socfpga_restart_soc);
+ restart_handler_register_fn("soc", socfpga_restart_soc);
return 0;
}
diff --git a/arch/arm/mach-tegra/tegra20-pmc.c b/arch/arm/mach-tegra/tegra20-pmc.c
index f7c7ac918f..a252c995ea 100644
--- a/arch/arm/mach-tegra/tegra20-pmc.c
+++ b/arch/arm/mach-tegra/tegra20-pmc.c
@@ -246,7 +246,7 @@ static struct driver_d tegra20_pmc_driver = {
static int tegra20_pmc_init(void)
{
- restart_handler_register_fn(tegra20_restart_soc);
+ restart_handler_register_fn("soc", tegra20_restart_soc);
return platform_driver_register(&tegra20_pmc_driver);
}
coredevice_initcall(tegra20_pmc_init);
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 7c6e9523a2..eb94a07dc9 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -75,19 +75,6 @@ void clk_disable(struct clk *clk)
}
EXPORT_SYMBOL(clk_disable);
-/* Create a clock structure with the given name */
-int vpb_clk_create(struct clk *clk, const char *dev_id)
-{
- struct clk_lookup *clkdev;
-
- clkdev = clkdev_alloc(clk, NULL, dev_id);
- if (!clkdev)
- return -ENOMEM;
-
- clkdev_add(clkdev);
- return 0;
-}
-
/* 1Mhz / 256 */
#define TIMER_FREQ (1000000/256)
@@ -205,7 +192,7 @@ static int versatile_init(void)
amba_apb_device_add(NULL, "pl061_gpio", 1, 0x101e5000, 4096, NULL, 0);
amba_apb_device_add(NULL, "pl061_gpio", 2, 0x101e6000, 4096, NULL, 0);
amba_apb_device_add(NULL, "pl061_gpio", 3, 0x101e7000, 4096, NULL, 0);
- restart_handler_register_fn(versatile_reset_soc);
+ restart_handler_register_fn("soc", versatile_reset_soc);
return 0;
}
coredevice_initcall(versatile_init);
diff --git a/arch/arm/mach-vexpress/reset.c b/arch/arm/mach-vexpress/reset.c
index 3164ae3079..78e452936d 100644
--- a/arch/arm/mach-vexpress/reset.c
+++ b/arch/arm/mach-vexpress/reset.c
@@ -24,7 +24,7 @@ static void vexpress_reset_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(vexpress_reset_soc);
+ restart_handler_register_fn("soc-wdt", vexpress_reset_soc);
return 0;
}
diff --git a/arch/arm/mach-zynq/zynq.c b/arch/arm/mach-zynq/zynq.c
index 79a6b908e0..806aeb9130 100644
--- a/arch/arm/mach-zynq/zynq.c
+++ b/arch/arm/mach-zynq/zynq.c
@@ -69,7 +69,7 @@ static int zynq_init(void)
writel(val, 0xf8f00000);
dmb();
- restart_handler_register_fn(zynq_restart_soc);
+ restart_handler_register_fn("soc", zynq_restart_soc);
bootsource_set(zynq_bootsource_get());
diff --git a/arch/kvx/configs/generic_defconfig b/arch/kvx/configs/generic_defconfig
index 8162171741..0d971ff3d5 100644
--- a/arch/kvx/configs/generic_defconfig
+++ b/arch/kvx/configs/generic_defconfig
@@ -1,15 +1,13 @@
CONFIG_AUTO_COMPLETE=y
-CONFIG_BAUDRATE=115200
-CONFIG_CLOCKSOURCE_KVX=y
+CONFIG_CONSOLE_RATP=y
CONFIG_CMD_BOOT=y
-CONFIG_CMD_BOOTM=y
+CONFIG_CMD_RESET=y
CONFIG_CMD_CMP=y
-CONFIG_CMD_OF_DUMP=y
CONFIG_CMD_POWEROFF=y
-CONFIG_CMD_RESET=y
CONFIG_CMD_WD=y
-CONFIG_CONSOLE_RATP=y
+CONFIG_CMD_OF_DUMP=y
CONFIG_DRIVER_SERIAL_NS16550=y
-CONFIG_PINCTRL_SINGLE=y
+CONFIG_CLOCKSOURCE_KVX=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_KVX=y
+CONFIG_PINCTRL_SINGLE=y
diff --git a/arch/kvx/cpu/reset.c b/arch/kvx/cpu/reset.c
index c7f2018e00..df36764cb6 100644
--- a/arch/kvx/cpu/reset.c
+++ b/arch/kvx/cpu/reset.c
@@ -60,7 +60,7 @@ static int kvx_reset_init(void)
break;
}
- restart_handler_register_fn(kvx_restart_soc);
+ restart_handler_register_fn("soc", kvx_restart_soc);
return 0;
}
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index 0cd0e9e650..9cf172a70e 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -9,7 +9,6 @@ CONFIG_MENU=y
CONFIG_BOOTM_SHOW_TYPE=y
CONFIG_PARTITION=y
# CONFIG_DEFAULT_ENVIRONMENT is not set
-CONFIG_POLLER=y
CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_MEMINFO=y
diff --git a/arch/mips/configs/qemu-malta_defconfig b/arch/mips/configs/qemu-malta_defconfig
index 2465c0260d..ac0577c217 100644
--- a/arch/mips/configs/qemu-malta_defconfig
+++ b/arch/mips/configs/qemu-malta_defconfig
@@ -12,7 +12,6 @@ CONFIG_BOOTM_SHOW_TYPE=y
CONFIG_CONSOLE_ALLOW_COLOR=y
CONFIG_PARTITION=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_POLLER=y
CONFIG_CMD_DMESG=y
CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
diff --git a/arch/mips/mach-ar231x/ar231x_reset.c b/arch/mips/mach-ar231x/ar231x_reset.c
index f88167ba4c..91414edd26 100644
--- a/arch/mips/mach-ar231x/ar231x_reset.c
+++ b/arch/mips/mach-ar231x/ar231x_reset.c
@@ -68,7 +68,7 @@ static struct driver_d ar231x_reset_driver = {
static int ar231x_reset_init(void)
{
- restart_handler_register_fn(ar2312x_restart_soc);
+ restart_handler_register_fn("soc-wdt", ar2312x_restart_soc);
return platform_driver_register(&ar231x_reset_driver);
}
coredevice_initcall(ar231x_reset_init);
diff --git a/arch/mips/mach-ath79/reset.c b/arch/mips/mach-ath79/reset.c
index b756c859d8..393ca00b08 100644
--- a/arch/mips/mach-ath79/reset.c
+++ b/arch/mips/mach-ath79/reset.c
@@ -22,7 +22,7 @@ static void __noreturn ath79_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(ath79_restart_soc);
+ restart_handler_register_fn("soc", ath79_restart_soc);
return 0;
}
diff --git a/arch/mips/mach-bcm47xx/reset.c b/arch/mips/mach-bcm47xx/reset.c
index 33dfb7b3b5..3ab9b0ce4b 100644
--- a/arch/mips/mach-bcm47xx/reset.c
+++ b/arch/mips/mach-bcm47xx/reset.c
@@ -19,7 +19,7 @@ static void __noreturn bcm47xx_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(bcm47xx_restart_soc);
+ restart_handler_register_fn("soc", bcm47xx_restart_soc);
return 0;
}
diff --git a/arch/mips/mach-loongson/loongson1_reset.c b/arch/mips/mach-loongson/loongson1_reset.c
index a6c05905de..85752f4ab8 100644
--- a/arch/mips/mach-loongson/loongson1_reset.c
+++ b/arch/mips/mach-loongson/loongson1_reset.c
@@ -20,7 +20,7 @@ static void __noreturn longhorn_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(longhorn_restart_soc);
+ restart_handler_register_fn("soc-wdt", longhorn_restart_soc);
return 0;
}
diff --git a/arch/mips/mach-malta/reset.c b/arch/mips/mach-malta/reset.c
index df7be0ae55..ad0de2741b 100644
--- a/arch/mips/mach-malta/reset.c
+++ b/arch/mips/mach-malta/reset.c
@@ -24,7 +24,7 @@ static void __noreturn malta_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(malta_restart_soc);
+ restart_handler_register_fn("soc", malta_restart_soc);
return 0;
}
diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index 62bcf40f63..9f86c911cc 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -30,7 +30,7 @@ static void __noreturn nios2_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- return restart_handler_register_fn(nios2_restart_soc);
+ return restart_handler_register_fn("vector", nios2_restart_soc);
}
coredevice_initcall(restart_register_feature);
diff --git a/arch/openrisc/cpu/cache.c b/arch/openrisc/cpu/cache.c
index 1da2380c03..a124d6612c 100644
--- a/arch/openrisc/cpu/cache.c
+++ b/arch/openrisc/cpu/cache.c
@@ -17,6 +17,7 @@
#include <common.h>
#include <init.h>
#include <asm/system.h>
+#include <asm/cache.h>
void flush_dcache_range(unsigned long addr, unsigned long stop)
{
@@ -130,7 +131,7 @@ void icache_disable(void)
mtspr(SPR_SR, mfspr(SPR_SR) & ~SPR_SR_ICE);
}
-int cache_init(void)
+static int cache_init(void)
{
if (mfspr(SPR_UPR) & SPR_UPR_ICP) {
icache_disable();
diff --git a/arch/openrisc/cpu/cpu.c b/arch/openrisc/cpu/cpu.c
index 8afd22bdea..47d8ab4288 100644
--- a/arch/openrisc/cpu/cpu.c
+++ b/arch/openrisc/cpu/cpu.c
@@ -33,6 +33,6 @@ static void __noreturn openrisc_restart_cpu(struct restart_handler *rst)
static int restart_register_feature(void)
{
- return restart_handler_register_fn(openrisc_restart_cpu);
+ return restart_handler_register_fn("vector", openrisc_restart_cpu);
}
coredevice_initcall(restart_register_feature);
diff --git a/arch/openrisc/cpu/exceptions.c b/arch/openrisc/cpu/exceptions.c
index d01fbfbb1c..c69ceafe80 100644
--- a/arch/openrisc/cpu/exceptions.c
+++ b/arch/openrisc/cpu/exceptions.c
@@ -16,6 +16,7 @@
#include <common.h>
#include <asm/system.h>
+#include <asm/openrisc_exc.h>
static const char * const excp_table[] = {
"Unknown exception",
@@ -69,6 +70,9 @@ static void exception_hang(int vect)
hang();
}
+/* Called from assembly */
+void exception_handler(int vect);
+
void exception_handler(int vect)
{
int exception = vect >> 8;
diff --git a/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c
index 67ea96fc02..9591120fee 100644
--- a/arch/openrisc/lib/board.c
+++ b/arch/openrisc/lib/board.c
@@ -19,6 +19,9 @@
#include <memory.h>
#include <asm-generic/memory_layout.h>
+/* Called from assembly */
+void openrisc_start_barebox(void);
+
void __noreturn openrisc_start_barebox(void)
{
mem_malloc_init((void *)(OPENRISC_SOPC_TEXT_BASE - MALLOC_SIZE),
diff --git a/arch/openrisc/lib/cpuinfo.c b/arch/openrisc/lib/cpuinfo.c
index 4c52a65421..d94178ea59 100644
--- a/arch/openrisc/lib/cpuinfo.c
+++ b/arch/openrisc/lib/cpuinfo.c
@@ -95,7 +95,7 @@ static void cpu_implementation(ulong vr2, char *string)
}
}
-int checkcpu(void)
+static int checkcpu(void)
{
ulong upr = mfspr(SPR_UPR);
ulong vr = mfspr(SPR_VR);
diff --git a/arch/powerpc/mach-mpc5xxx/cpu.c b/arch/powerpc/mach-mpc5xxx/cpu.c
index a85e1667bc..5cf5194aa2 100644
--- a/arch/powerpc/mach-mpc5xxx/cpu.c
+++ b/arch/powerpc/mach-mpc5xxx/cpu.c
@@ -92,7 +92,7 @@ static void __noreturn mpc5xxx_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- return restart_handler_register_fn(mpc5xxx_restart_soc);
+ return restart_handler_register_fn("soc-wdt", mpc5xxx_restart_soc);
}
coredevice_initcall(restart_register_feature);
diff --git a/arch/powerpc/mach-mpc85xx/cpu.c b/arch/powerpc/mach-mpc85xx/cpu.c
index 7c8a59edc9..efdff24e6d 100644
--- a/arch/powerpc/mach-mpc85xx/cpu.c
+++ b/arch/powerpc/mach-mpc85xx/cpu.c
@@ -42,7 +42,7 @@ static void __noreturn mpc85xx_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(mpc85xx_restart_soc);
+ restart_handler_register_fn("soc", mpc85xx_restart_soc);
return 0;
}
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 81f7a96bd6..bced81f25e 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -7,6 +7,9 @@ config SANDBOX
select ARCH_HAS_UBSAN_SANITIZE_ALL
select HAVE_ARCH_ASAN
select HAS_DMA
+ select BLOCK
+ select BLOCK_WRITE
+ select PARTITION_DISK
default y
config ARCH_TEXT_BASE
@@ -24,6 +27,13 @@ config SANDBOX_UNWIND
select ARCH_HAS_STACK_DUMP
depends on UBSAN || ASAN
+config SANDBOX_REEXEC
+ prompt "exec(2) reset handler"
+ def_bool y
+ help
+ The normal reset handler hangs barebox. On Linux, barebox
+ instead can exec itself to simulate a reset.
+
config PHYS_ADDR_T_64BIT
bool
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index ce1fe3b672..09112c3ba8 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -25,7 +25,7 @@ KBUILD_CFLAGS += -Dmalloc=barebox_malloc -Dcalloc=barebox_calloc \
-Dglob=barebox_glob -Dglobfree=barebox_globfree \
-Dioctl=barebox_ioctl -Dfstat=barebox_fstat \
-Dopendir=barebox_opendir -Dreaddir=barebox_readdir \
- -Dclosedir=barebox_closedir \
+ -Dclosedir=barebox_closedir -Dreadlink=barebox_readlink \
-Doptarg=barebox_optarg -Doptind=barebox_optind
machdirs := $(patsubst %,arch/sandbox/mach-%/,$(machine-y))
diff --git a/arch/sandbox/board/dtb.c b/arch/sandbox/board/dtb.c
index 74ecbadf42..d11bde0249 100644
--- a/arch/sandbox/board/dtb.c
+++ b/arch/sandbox/board/dtb.c
@@ -46,7 +46,7 @@ static int of_sandbox_init(void)
if (ret)
return ret;
- ret = of_property_write_u32(root, "#size-cells", 1);
+ ret = of_property_write_u32(root, "#size-cells", 2);
if (ret)
return ret;
}
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 5f0d7e0a4b..63530bd25e 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -16,6 +16,8 @@
#include <common.h>
#include <driver.h>
+#include <block.h>
+#include <disks.h>
#include <malloc.h>
#include <mach/linux.h>
#include <init.h>
@@ -27,14 +29,16 @@
#include <linux/err.h>
struct hf_priv {
- struct cdev cdev;
+ union {
+ struct block_device blk;
+ struct cdev cdev;
+ };
const char *filename;
int fd;
};
-static ssize_t hf_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
+static ssize_t hf_read(struct hf_priv *priv, void *buf, size_t count, loff_t offset, ulong flags)
{
- struct hf_priv *priv= cdev->priv;
int fd = priv->fd;
if (linux_lseek(fd, offset) != offset)
@@ -43,9 +47,8 @@ static ssize_t hf_read(struct cdev *cdev, void *buf, size_t count, loff_t offset
return linux_read(fd, buf, count);
}
-static ssize_t hf_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
+static ssize_t hf_write(struct hf_priv *priv, const void *buf, size_t count, loff_t offset, ulong flags)
{
- struct hf_priv *priv = cdev->priv;
int fd = priv->fd;
if (linux_lseek(fd, offset) != offset)
@@ -54,6 +57,40 @@ static ssize_t hf_write(struct cdev *cdev, const void *buf, size_t count, loff_t
return linux_write(fd, buf, count);
}
+static ssize_t hf_cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
+{
+ return hf_read(cdev->priv, buf, count, offset, flags);
+}
+
+static ssize_t hf_cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
+{
+ return hf_write(cdev->priv, buf, count, offset, flags);
+}
+
+static struct cdev_operations hf_cdev_ops = {
+ .read = hf_cdev_read,
+ .write = hf_cdev_write,
+};
+
+static int hf_blk_read(struct block_device *blk, void *buf, int block, int num_blocks)
+{
+ ssize_t ret = hf_read(container_of(blk, struct hf_priv, blk), buf,
+ num_blocks << SECTOR_SHIFT, block << SECTOR_SHIFT, 0);
+ return ret > 0 ? 0 : ret;
+}
+
+static int hf_blk_write(struct block_device *blk, const void *buf, int block, int num_blocks)
+{
+ ssize_t ret = hf_write(container_of(blk, struct hf_priv, blk), buf,
+ num_blocks << SECTOR_SHIFT, block << SECTOR_SHIFT, 0);
+ return ret > 0 ? 0 : ret;
+}
+
+static struct block_device_ops hf_blk_ops = {
+ .read = hf_blk_read,
+ .write = hf_blk_write,
+};
+
static void hf_info(struct device_d *dev)
{
struct hf_priv *priv = dev->priv;
@@ -61,29 +98,28 @@ static void hf_info(struct device_d *dev)
printf("file: %s\n", priv->filename);
}
-static struct cdev_operations hf_fops = {
- .read = hf_read,
- .write = hf_write,
-};
-
static int hf_probe(struct device_d *dev)
{
+ struct device_node *np = dev->device_node;
struct hf_priv *priv = xzalloc(sizeof(*priv));
struct resource *res;
+ struct cdev *cdev;
+ bool is_blockdev;
+ resource_size_t size;
int err;
res = dev_get_resource(dev, IORESOURCE_MEM, 0);
if (IS_ERR(res))
return PTR_ERR(res);
- priv->cdev.size = resource_size(res);
+ size = resource_size(res);
- if (!dev->device_node)
+ if (!np)
return -ENODEV;
- of_property_read_u32(dev->device_node, "barebox,fd", &priv->fd);
+ of_property_read_u32(np, "barebox,fd", &priv->fd);
- err = of_property_read_string(dev->device_node, "barebox,filename",
+ err = of_property_read_string(np, "barebox,filename",
&priv->filename);
if (err)
return err;
@@ -91,20 +127,50 @@ static int hf_probe(struct device_d *dev)
if (!priv->fd)
priv->fd = linux_open(priv->filename, true);
- priv->cdev.name = dev->device_node->name;
- priv->cdev.dev = dev;
- priv->cdev.ops = &hf_fops;
- priv->cdev.priv = priv;
+ if (priv->fd < 0)
+ return priv->fd;
dev->info = hf_info;
dev->priv = priv;
- err = devfs_create(&priv->cdev);
- if (err)
- return err;
+ is_blockdev = of_property_read_bool(np, "barebox,blockdev");
+
+ cdev = is_blockdev ? &priv->blk.cdev : &priv->cdev;
+
+ cdev->device_node = np;
+
+ if (is_blockdev) {
+ cdev->name = np->name;
+ priv->blk.dev = dev;
+ priv->blk.ops = &hf_blk_ops;
+ priv->blk.blockbits = SECTOR_SHIFT;
+ priv->blk.num_blocks = size / SECTOR_SIZE;
- of_parse_partitions(&priv->cdev, dev->device_node);
- of_partitions_register_fixup(&priv->cdev);
+ err = blockdevice_register(&priv->blk);
+ if (err)
+ return err;
+
+ err = parse_partition_table(&priv->blk);
+ if (err)
+ dev_warn(dev, "No partition table found\n");
+
+ dev_info(dev, "registered as block device\n");
+ } else {
+ cdev->name = np->name;
+ cdev->dev = dev;
+ cdev->ops = &hf_cdev_ops;
+ cdev->size = size;
+ cdev->priv = priv;
+
+ err = devfs_create(cdev);
+ if (err)
+ return err;
+
+ dev_info(dev, "registered as character device\n");
+ }
+
+ of_parse_partitions(cdev, np);
+ of_partitions_register_fixup(cdev);
return 0;
}
@@ -122,7 +188,7 @@ static struct driver_d hf_drv = {
.of_compatible = DRV_OF_COMPAT(hostfile_dt_ids),
.probe = hf_probe,
};
-coredevice_platform_driver(hf_drv);
+device_platform_driver(hf_drv);
static int of_hostfile_fixup(struct device_node *root, void *ctx)
{
@@ -131,6 +197,7 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx)
uint32_t reg[] = {
hf->base >> 32,
hf->base,
+ hf->size >> 32,
hf->size
};
int ret;
@@ -151,6 +218,9 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx)
ret = of_property_write_string(node, "barebox,filename", hf->filename);
+ if (hf->is_blockdev)
+ ret = of_property_write_bool(node, "barebox,blockdev", true);
+
return ret;
}
diff --git a/arch/sandbox/board/poweroff.c b/arch/sandbox/board/poweroff.c
index 6b5a6dff15..8ce739af72 100644
--- a/arch/sandbox/board/poweroff.c
+++ b/arch/sandbox/board/poweroff.c
@@ -1,6 +1,7 @@
#include <common.h>
#include <init.h>
#include <poweroff.h>
+#include <restart.h>
#include <mach/linux.h>
static void sandbox_poweroff(struct poweroff_handler *poweroff)
@@ -8,9 +9,33 @@ static void sandbox_poweroff(struct poweroff_handler *poweroff)
linux_exit();
}
+static void sandbox_rst_hang(struct restart_handler *rst)
+{
+ linux_hang();
+}
+
+static struct restart_handler rst_hang = {
+ .name = "hang",
+ .restart = sandbox_rst_hang
+};
+
+static void sandbox_rst_reexec(struct restart_handler *rst)
+{
+ linux_reexec();
+}
+
+static struct restart_handler rst_reexec = {
+ .name = "reexec", .priority = 200,
+ .restart = sandbox_rst_reexec,
+};
+
static int poweroff_register_feature(void)
{
poweroff_handler_register_fn(sandbox_poweroff);
+ restart_handler_register(&rst_hang);
+
+ if (IS_ENABLED(CONFIG_SANDBOX_REEXEC))
+ restart_handler_register(&rst_reexec);
return 0;
}
diff --git a/arch/sandbox/configs/hosttools_defconfig b/arch/sandbox/configs/hosttools_defconfig
new file mode 100644
index 0000000000..72ec0fc462
--- /dev/null
+++ b/arch/sandbox/configs/hosttools_defconfig
@@ -0,0 +1,7 @@
+CONFIG_IMD=y
+CONFIG_COMPILE_HOST_TOOLS=y
+CONFIG_ARCH_IMX_USBLOADER=y
+CONFIG_MVEBU_HOSTTOOLS=y
+CONFIG_MXS_HOSTTOOLS=y
+CONFIG_OMAP3_USB_LOADER=y
+CONFIG_OMAP4_HOSTTOOL_USBBOOT=y
diff --git a/arch/sandbox/dts/sandbox-state-example.dtsi b/arch/sandbox/dts/sandbox-state-example.dtsi
index fc17bd0788..98640f6677 100644
--- a/arch/sandbox/dts/sandbox-state-example.dtsi
+++ b/arch/sandbox/dts/sandbox-state-example.dtsi
@@ -6,7 +6,7 @@
disk {
compatible = "barebox,hostfile";
barebox,filename = "disk";
- reg = <0x0 0x0 0x100000>;
+ reg = <0x0 0x0 0x0 0x100000>;
partitions {
compatible = "fixed-partitions";
diff --git a/arch/sandbox/dts/skeleton.dtsi b/arch/sandbox/dts/skeleton.dtsi
index 38ead821bb..8ba7663eb5 100644
--- a/arch/sandbox/dts/skeleton.dtsi
+++ b/arch/sandbox/dts/skeleton.dtsi
@@ -6,8 +6,8 @@
/ {
#address-cells = <2>;
- #size-cells = <1>;
+ #size-cells = <2>;
chosen { };
aliases { };
- memory { device_type = "memory"; reg = <0 0 0>; };
+ memory { device_type = "memory"; reg = <0 0 0 0>; };
};
diff --git a/arch/sandbox/lib/unwind.c b/arch/sandbox/lib/unwind.c
index 15a2798cc4..f46365ac2b 100644
--- a/arch/sandbox/lib/unwind.c
+++ b/arch/sandbox/lib/unwind.c
@@ -7,5 +7,5 @@ void __sanitizer_print_stack_trace(void);
void dump_stack(void)
{
- __sanitizer_print_stack_trace();
+ __sanitizer_print_stack_trace();
}
diff --git a/arch/sandbox/mach-sandbox/include/mach/hostfile.h b/arch/sandbox/mach-sandbox/include/mach/hostfile.h
index 54f690be5f..c3f9af97c4 100644
--- a/arch/sandbox/mach-sandbox/include/mach/hostfile.h
+++ b/arch/sandbox/mach-sandbox/include/mach/hostfile.h
@@ -4,9 +4,10 @@
struct hf_info {
int fd;
unsigned long long base;
- size_t size;
+ unsigned long long size;
const char *devname;
const char *filename;
+ unsigned int is_blockdev:1;
};
int barebox_register_filedev(struct hf_info *hf);
diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h
index 9759a376ec..1ab48e52a0 100644
--- a/arch/sandbox/mach-sandbox/include/mach/linux.h
+++ b/arch/sandbox/mach-sandbox/include/mach/linux.h
@@ -17,6 +17,8 @@ ssize_t linux_write(int fd, const void *buf, size_t count);
off_t linux_lseek(int fildes, off_t offset);
int linux_tstc(int fd);
void __attribute__((noreturn)) linux_exit(void);
+void linux_hang(void);
+void linux_reexec(void);
int linux_execve(const char * filename, char *const argv[], char *const envp[]);
diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index 9fb5faf41d..43ee95edb6 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -44,6 +44,8 @@
#include <mach/linux.h>
#include <mach/hostfile.h>
+#define DELETED_OFFSET (sizeof(" (deleted)") - 1)
+
void __sanitizer_set_death_callback(void (*callback)(void));
int sdl_xres;
@@ -122,9 +124,40 @@ void __attribute__((noreturn)) linux_exit(void)
exit(0);
}
+static char **saved_argv;
+
+void linux_reexec(void)
+{
+ char buf[4097];
+ ssize_t ret;
+
+ cookmode();
+
+ /* we must follow the symlink, so we can exec an updated executable */
+ ret = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
+ if (0 < ret && ret < sizeof(buf) - 1) {
+ buf[ret] = '\0';
+ execv(buf, saved_argv);
+ if (!strcmp(&buf[ret - DELETED_OFFSET], " (deleted)")) {
+ printf("barebox image on disk changed. Loading new.\n");
+ buf[ret - DELETED_OFFSET] = '\0';
+ execv(buf, saved_argv);
+ }
+ }
+
+ printf("exec(%s) failed: %d\n", buf, errno);
+ /* falls through to generic hang() */
+}
+
+void linux_hang(void)
+{
+ cookmode();
+ /* falls through to generic hang() */
+}
+
int linux_open(const char *filename, int readwrite)
{
- return open(filename, readwrite ? O_RDWR : O_RDONLY);
+ return open(filename, (readwrite ? O_RDWR : O_RDONLY) | O_CLOEXEC);
}
int linux_read(int fd, void *buf, size_t count)
@@ -212,12 +245,14 @@ int linux_execve(const char * filename, char *const argv[], char *const envp[])
extern void start_barebox(void);
extern void mem_malloc_init(void *start, void *end);
-static int add_image(char *str, char *devname_template, int *devname_number)
+extern char * strsep_unescaped(char **s, const char *ct);
+
+static int add_image(const char *_str, char *devname_template, int *devname_number)
{
struct hf_info *hf = malloc(sizeof(struct hf_info));
- char *filename, *devname;
+ char *str, *filename, *devname;
char tmp[16];
- int readonly = 0;
+ int readonly = 0, cdev = 0, blkdev = 0;
struct stat s;
char *opt;
int fd, ret;
@@ -225,15 +260,21 @@ static int add_image(char *str, char *devname_template, int *devname_number)
if (!hf)
return -1;
- filename = strtok(str, ",");
- while ((opt = strtok(NULL, ","))) {
+ str = strdup(_str);
+
+ filename = strsep_unescaped(&str, ",");
+ while ((opt = strsep_unescaped(&str, ","))) {
if (!strcmp(opt, "ro"))
readonly = 1;
+ if (!strcmp(opt, "cdev"))
+ cdev = 1;
+ if (!strcmp(opt, "blkdev"))
+ blkdev = 1;
}
/* parses: "devname=filename" */
- devname = strtok(filename, "=");
- filename = strtok(NULL, "=");
+ devname = strsep_unescaped(&filename, "=");
+ filename = strsep_unescaped(&filename, "=");
if (!filename) {
filename = devname;
snprintf(tmp, sizeof(tmp),
@@ -244,9 +285,10 @@ static int add_image(char *str, char *devname_template, int *devname_number)
printf("add %s backed by file %s%s\n", devname,
filename, readonly ? "(ro)" : "");
- fd = open(filename, readonly ? O_RDONLY : O_RDWR);
+ fd = open(filename, (readonly ? O_RDONLY : O_RDWR) | O_CLOEXEC);
hf->fd = fd;
hf->filename = filename;
+ hf->is_blockdev = blkdev;
if (fd < 0) {
perror("open");
@@ -266,13 +308,25 @@ static int add_image(char *str, char *devname_template, int *devname_number)
perror("ioctl");
goto err_out;
}
+ if (!cdev)
+ hf->is_blockdev = 1;
}
- hf->base = (unsigned long)mmap(NULL, hf->size,
- PROT_READ | (readonly ? 0 : PROT_WRITE),
- MAP_SHARED, fd, 0);
+ if (hf->size <= SIZE_MAX)
+ hf->base = (unsigned long)mmap(NULL, hf->size,
+ PROT_READ | (readonly ? 0 : PROT_WRITE),
+ MAP_SHARED, fd, 0);
+ else
+ printf("warning: %s: contiguous map failed\n", filename);
+
if (hf->base == (unsigned long)MAP_FAILED)
printf("warning: mmapping %s failed: %s\n", filename, strerror(errno));
+ if (blkdev && hf->size % 512 != 0) {
+ printf("warning: registering %s as block device failed: invalid block size\n",
+ filename);
+ return -EINVAL;
+ }
+
ret = barebox_register_filedev(hf);
if (ret)
goto err_out;
@@ -291,7 +345,7 @@ static int add_dtb(const char *file)
void *dtb = NULL;
int fd;
- fd = open(file, O_RDONLY);
+ fd = open(file, O_RDONLY | O_CLOEXEC);
if (fd < 0) {
perror("open");
goto err_out;
@@ -351,6 +405,8 @@ int main(int argc, char *argv[])
__sanitizer_set_death_callback(cookmode);
#endif
+ saved_argv = argv;
+
while (1) {
option_index = 0;
opt = getopt_long(argc, argv, optstring,
@@ -422,7 +478,7 @@ int main(int argc, char *argv[])
exit(1);
break;
case 'O':
- fd = open(optarg, O_WRONLY);
+ fd = open(optarg, O_WRONLY | O_CLOEXEC);
if (fd < 0) {
perror("open");
exit(1);
@@ -431,7 +487,7 @@ int main(int argc, char *argv[])
barebox_register_console(-1, fd);
break;
case 'I':
- fd = open(optarg, O_RDWR);
+ fd = open(optarg, O_RDWR | O_CLOEXEC);
if (fd < 0) {
perror("open");
exit(1);
@@ -447,7 +503,7 @@ int main(int argc, char *argv[])
}
/* open stdout file */
- fd = open(aux + 1, O_WRONLY);
+ fd = open(aux + 1, O_WRONLY | O_CLOEXEC);
if (fd < 0) {
perror("open stdout");
exit(1);
@@ -455,7 +511,7 @@ int main(int argc, char *argv[])
/* open stdin file */
aux = strndup(optarg, aux - optarg);
- fd2 = open(aux, O_RDWR);
+ fd2 = open(aux, O_RDWR | O_CLOEXEC);
if (fd2 < 0) {
perror("open stdin");
exit(1);
diff --git a/arch/sandbox/os/tap.c b/arch/sandbox/os/tap.c
index 72b7fbb5ac..83b97ffd49 100644
--- a/arch/sandbox/os/tap.c
+++ b/arch/sandbox/os/tap.c
@@ -30,7 +30,7 @@ int tap_alloc(const char *dev)
struct ifreq ifr;
int fd, err;
- if ((fd = open("/dev/net/tun", O_RDWR)) < 0) {
+ if ((fd = open("/dev/net/tun", O_RDWR | O_CLOEXEC)) < 0) {
perror("could not open /dev/net/tun");
return -1;
}
diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig
index 47842d10af..83794d7a07 100644
--- a/arch/x86/configs/efi_defconfig
+++ b/arch/x86/configs/efi_defconfig
@@ -14,7 +14,6 @@ CONFIG_BLSPEC=y
CONFIG_CONSOLE_ACTIVATE_ALL=y
CONFIG_PARTITION_DISK_EFI=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_POLLER=y
CONFIG_STATE=y
CONFIG_DEBUG_LL=y
CONFIG_LONGHELP=y
@@ -66,7 +65,6 @@ CONFIG_NET=y
CONFIG_NET_NFS=y
CONFIG_NET_NETCONSOLE=y
CONFIG_DRIVER_SERIAL_EFI_STDIO=y
-CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_DRIVER_NET_EFI_SNP=y
# CONFIG_SPI is not set
CONFIG_DISK=y
diff --git a/commands/Kconfig b/commands/Kconfig
index 3789f33c3b..1399f04d8b 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -718,6 +718,19 @@ config CMD_SAVEENV
/dev/env0. Note that envfs can only handle files, directories are being
skipped silently.
+config CMD_SETENV
+ tristate
+ default y
+ depends on !CONFIG_SHELL_NONE
+ prompt "setenv"
+ help
+ Set environment variable
+
+ Usage: setenv NAME [VALUE]
+
+ Set environment variable NAME to VALUE.
+ If VALUE is ommitted, then the variable is deleted.
+
# end Environment commands
endmenu
diff --git a/commands/Makefile b/commands/Makefile
index 01082de44c..6cc4997cc5 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -41,7 +41,7 @@ obj-$(CONFIG_CMD_FLASH) += flash.o
obj-$(CONFIG_CMD_MEMINFO) += meminfo.o
obj-$(CONFIG_CMD_TIMEOUT) += timeout.o
obj-$(CONFIG_CMD_READLINE) += readline.o
-obj-$(CONFIG_SHELL_SIMPLE) += setenv.o
+obj-$(CONFIG_CMD_SETENV) += setenv.o
obj-$(CONFIG_CMD_EXPORT) += export.o
obj-$(CONFIG_CMD_PRINTENV) += printenv.o
obj-$(CONFIG_CMD_SAVEENV) += saveenv.o
diff --git a/commands/boot.c b/commands/boot.c
index ad2d83a179..d7795bde72 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -76,6 +76,8 @@ static int do_boot(int argc, char *argv[])
entries = bootentries_alloc();
while ((name = next(&handle)) != NULL) {
+ if (!*name)
+ continue;
ret = bootentry_create_from_name(entries, name);
if (ret <= 0)
printf("Nothing bootable found on '%s'\n", name);
diff --git a/commands/clk.c b/commands/clk.c
index 47159dddd2..649a0a7cb2 100644
--- a/commands/clk.c
+++ b/commands/clk.c
@@ -139,6 +139,7 @@ BAREBOX_CMD_END
static int do_clk_dump(int argc, char *argv[])
{
int opt, verbose = 0;
+ struct clk *clk;
while ((opt = getopt(argc, argv, "v")) > 0) {
switch(opt) {
@@ -151,7 +152,16 @@ static int do_clk_dump(int argc, char *argv[])
}
}
- clk_dump(verbose);
+ if (optind == argc) {
+ clk_dump(verbose);
+ return COMMAND_SUCCESS;
+ }
+
+ clk = clk_lookup(argv[optind]);
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+
+ clk_dump_one(clk, verbose);
return COMMAND_SUCCESS;
}
@@ -164,9 +174,10 @@ BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(clk_dump)
.cmd = do_clk_dump,
BAREBOX_CMD_DESC("show information about registered clocks")
- BAREBOX_CMD_OPTS("[-v]")
+ BAREBOX_CMD_OPTS("[-v] [clkname]")
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
BAREBOX_CMD_HELP(cmd_clk_dump_help)
+ BAREBOX_CMD_COMPLETE(clk_name_complete)
BAREBOX_CMD_END
static int do_clk_set_parent(int argc, char *argv[])
diff --git a/commands/ls.c b/commands/ls.c
index 6a5475d094..bedf2e1c42 100644
--- a/commands/ls.c
+++ b/commands/ls.c
@@ -15,7 +15,7 @@
/*
* SIZELEN = strlen(itoa(MAX_LFS_FILESIZE)) + 1;
*/
-#ifdef CONFIG_CPU_64
+#ifdef CONFIG_64BIT
#define SIZELEN 20
#else
#define SIZELEN 14
@@ -75,8 +75,13 @@ int ls(const char *path, ulong flags)
if (!dir)
return -errno;
- while ((d = readdir(dir)))
+ while ((d = readdir(dir))) {
+ if (!strcmp(d->d_name, "."))
+ continue;
+ if (!strcmp(d->d_name, ".."))
+ continue;
string_list_add_sorted(&sl, d->d_name);
+ }
closedir(dir);
@@ -99,10 +104,6 @@ int ls(const char *path, ulong flags)
goto out;
string_list_for_each_entry(entry, &sl) {
- if (!strcmp(entry->str, "."))
- continue;
- if (!strcmp(entry->str, ".."))
- continue;
sprintf(tmp, "%s/%s", path, entry->str);
ret = lstat(tmp, &s);
diff --git a/commands/reset.c b/commands/reset.c
index 2b10f1cd18..fe54e2f9b4 100644
--- a/commands/reset.c
+++ b/commands/reset.c
@@ -11,24 +11,43 @@
static int cmd_reset(int argc, char *argv[])
{
+ struct restart_handler *rst;
int opt, shutdown_flag;
+ const char *name = NULL;
shutdown_flag = 1;
- while ((opt = getopt(argc, argv, "f")) > 0) {
+ while ((opt = getopt(argc, argv, "flr:")) > 0) {
switch (opt) {
case 'f':
shutdown_flag = 0;
break;
+ case 'l':
+ restart_handlers_print();
+ return 0;
+ case 'r':
+ name = optarg;
+ break;
default:
return COMMAND_ERROR_USAGE;
}
}
+ rst = restart_handler_get_by_name(name);
+ if (!rst && name) {
+ printf("reset '%s' does not exist\n", name);
+ return COMMAND_ERROR;
+ }
+
if (shutdown_flag)
shutdown_barebox();
- restart_machine();
+ if (rst) {
+ console_flush();
+ rst->restart(rst);
+ }
+
+ hang();
/* Not reached */
return 1;
@@ -37,12 +56,14 @@ static int cmd_reset(int argc, char *argv[])
BAREBOX_CMD_HELP_START(reset)
BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT("-f", "force RESET, don't call shutdown")
+BAREBOX_CMD_HELP_OPT("-l", "list reset handlers")
+BAREBOX_CMD_HELP_OPT("-r RESET", "use reset handler named RESET")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(reset)
.cmd = cmd_reset,
BAREBOX_CMD_DESC("perform RESET of the CPU")
- BAREBOX_CMD_OPTS("[-f]")
+ BAREBOX_CMD_OPTS("[-flr]")
BAREBOX_CMD_GROUP(CMD_GRP_BOOT)
BAREBOX_CMD_HELP(cmd_reset_help)
BAREBOX_CMD_COMPLETE(empty_complete)
diff --git a/commands/setenv.c b/commands/setenv.c
index 3cf769d24a..ad26770655 100644
--- a/commands/setenv.c
+++ b/commands/setenv.c
@@ -5,15 +5,24 @@
#include <command.h>
#include <errno.h>
#include <environment.h>
+#include <complete.h>
static int do_setenv(int argc, char *argv[])
{
+ char *equal;
+
if (argc < 2)
return COMMAND_ERROR_USAGE;
- setenv(argv[1], argv[2]);
+ equal = strrchr(argv[1], '=');
+ if (equal) {
+ equal[0] = '\0';
+ if (equal[1])
+ argv[2] = &equal[1];
+ }
+
- return 0;
+ return setenv(argv[1], argv[2]) ? COMMAND_ERROR : COMMAND_SUCCESS;
}
BAREBOX_CMD_HELP_START(setenv)
@@ -26,5 +35,6 @@ BAREBOX_CMD_START(setenv)
BAREBOX_CMD_DESC("set environment variable")
BAREBOX_CMD_OPTS("NAME [VALUE]")
BAREBOX_CMD_GROUP(CMD_GRP_ENV)
+ BAREBOX_CMD_COMPLETE(env_param_noeval_complete)
BAREBOX_CMD_HELP(cmd_setenv_help)
BAREBOX_CMD_END
diff --git a/common/Kconfig b/common/Kconfig
index 3626eb2f29..9e6918189b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -411,6 +411,7 @@ choice
select COMMAND_SUPPORT
select PARAMETER
select STDDEV
+ select CMD_SETENV
help
simple shell. No if/then, no return values from commands, no loops
@@ -699,7 +700,6 @@ config IMD
config IMD_TARGET
bool "build bareboximd target tool"
depends on IMD
- depends on !SANDBOX
config KERNEL_INSTALL_TARGET
bool
diff --git a/common/blspec.c b/common/blspec.c
index 9e1036c834..ed66352d11 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -109,8 +109,11 @@ static void blspec_apply_oftree_overlays(const char *overlays,
sep = freep = xstrdup(overlays);
- while ((overlay = strsep(&sep, " ")))
+ while ((overlay = strsep(&sep, " "))) {
+ if (!*overlay)
+ continue;
blspec_apply_oftree_overlay(overlay, abspath, dryrun);
+ }
free(freep);
}
diff --git a/common/bootm.c b/common/bootm.c
index 7f22ca5ced..60b8bf10a8 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -65,6 +65,7 @@ void bootm_data_init_defaults(struct bootm_data *data)
getenv_ul("global.bootm.image.loadaddr", &data->os_address);
getenv_ul("global.bootm.initrd.loadaddr", &data->initrd_address);
data->initrd_file = getenv_nonempty("global.bootm.initrd");
+ data->root_dev = getenv_nonempty("global.bootm.root_dev");
data->verify = bootm_get_verify_mode();
data->appendroot = bootm_appendroot;
data->provide_machine_id = bootm_provide_machine_id;
@@ -232,7 +233,11 @@ int bootm_load_initrd(struct image_data *data, unsigned long load_address)
ret = fit_open_image(data->os_fit, data->fit_config, "ramdisk",
&initrd, &initrd_size);
-
+ if (ret) {
+ pr_err("Cannot open ramdisk image in FIT image: %s\n",
+ strerror(-ret));
+ return ret;
+ }
data->initrd_res = request_sdram_region("initrd",
load_address,
initrd_size);
@@ -711,7 +716,25 @@ int bootm_boot(struct bootm_data *bootm_data)
if (bootm_data->appendroot) {
char *rootarg;
- rootarg = path_get_linux_rootarg(data->os_file);
+ if (bootm_data->root_dev) {
+ const char *root_dev_name = devpath_to_name(bootm_data->root_dev);
+ const struct cdev *root_cdev = cdev_by_name(root_dev_name);
+
+ if (root_cdev && root_cdev->partuuid[0] != 0) {
+ rootarg = basprintf("root=PARTUUID=%s", root_cdev->partuuid);
+ } else {
+ rootarg = ERR_PTR(-EINVAL);
+
+ if (!root_cdev)
+ pr_err("no cdev found for %s, cannot set root= option\n",
+ root_dev_name);
+ else if (!root_cdev->partuuid[0])
+ pr_err("%s doesn't have a PARTUUID, cannot set root= option\n",
+ root_dev_name);
+ }
+ } else {
+ rootarg = path_get_linux_rootarg(data->os_file);
+ }
if (!IS_ERR(rootarg)) {
printf("Adding \"%s\" to Kernel commandline\n", rootarg);
globalvar_add_simple("linux.bootargs.bootm.appendroot",
@@ -802,6 +825,7 @@ static int bootm_init(void)
globalvar_add_simple("bootm.image", NULL);
globalvar_add_simple("bootm.image.loadaddr", NULL);
globalvar_add_simple("bootm.oftree", NULL);
+ globalvar_add_simple("bootm.root_dev", NULL);
globalvar_add_simple("bootm.tee", NULL);
globalvar_add_simple_bool("bootm.appendroot", &bootm_appendroot);
globalvar_add_simple_bool("bootm.provide_machine_id", &bootm_provide_machine_id);
@@ -831,5 +855,6 @@ BAREBOX_MAGICVAR_NAMED(global_bootm_oftree, global.bootm.oftree, "bootm default
BAREBOX_MAGICVAR_NAMED(global_bootm_tee, global.bootm.tee, "bootm default tee image");
BAREBOX_MAGICVAR_NAMED(global_bootm_verify, global.bootm.verify, "bootm default verify level");
BAREBOX_MAGICVAR_NAMED(global_bootm_verbose, global.bootm.verbose, "bootm default verbosity level (0=quiet)");
-BAREBOX_MAGICVAR_NAMED(global_bootm_appendroot, global.bootm.appendroot, "Add root= option to Kernel to mount rootfs from the device the Kernel comes from");
+BAREBOX_MAGICVAR_NAMED(global_bootm_appendroot, global.bootm.appendroot, "Add root= option to Kernel to mount rootfs from the device the Kernel comes from (default, device can be overridden via global.bootm.root_dev)");
+BAREBOX_MAGICVAR_NAMED(global_bootm_root_dev, global.bootm.root_dev, "bootm default root device (overrides default device in global.bootm.appendroot)");
BAREBOX_MAGICVAR_NAMED(global_bootm_provide_machine_id, global.bootm.provide_machine_id, "If true, add systemd.machine_id= with value of global.machine_id to Kernel");
diff --git a/common/complete.c b/common/complete.c
index 919e5abc6a..36e10405c8 100644
--- a/common/complete.c
+++ b/common/complete.c
@@ -336,6 +336,12 @@ static int env_param_complete(struct string_list *sl, char *instr, int eval)
return 0;
}
+int env_param_noeval_complete(struct string_list *sl, char *instr)
+{
+ return env_param_complete(sl, instr, 0);
+}
+EXPORT_SYMBOL(env_param_noeval_complete);
+
static int tab_pressed = 0;
void complete_reset(void)
diff --git a/common/efi/efi.c b/common/efi/efi.c
index 6f55e3970e..01003dc00f 100644
--- a/common/efi/efi.c
+++ b/common/efi/efi.c
@@ -292,7 +292,7 @@ static void __noreturn efi_poweroff_system(struct poweroff_handler *handler)
static int restart_register_feature(void)
{
- restart_handler_register_fn(efi_restart_system);
+ restart_handler_register_fn("efi", efi_restart_system);
poweroff_handler_register_fn(efi_poweroff_system);
return 0;
diff --git a/common/globalvar.c b/common/globalvar.c
index 98a028a68a..6ab4c1f68e 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -514,7 +514,9 @@ int globalvar_add_simple_int(const char *name, int *value,
return 0;
}
-int globalvar_add_simple_bool(const char *name, int *value)
+int globalvar_add_bool(const char *name,
+ int (*set)(struct param_d *, void *),
+ int *value, void *priv)
{
struct param_d *p;
int ret;
@@ -523,8 +525,8 @@ int globalvar_add_simple_bool(const char *name, int *value)
if (ret)
return ret;
- p = dev_add_param_bool(&global_device, name, NULL, NULL,
- value, NULL);
+ p = dev_add_param_bool(&global_device, name, set, NULL,
+ value, priv);
if (IS_ERR(p))
return PTR_ERR(p);
diff --git a/common/restart.c b/common/restart.c
index b19ae54657..2bf7b166b0 100644
--- a/common/restart.c
+++ b/common/restart.c
@@ -19,6 +19,7 @@
#include <of.h>
static LIST_HEAD(restart_handler_list);
+static unsigned resetidx;
/**
* restart_handler_register() - register a handler for restarting the system
@@ -31,7 +32,7 @@ static LIST_HEAD(restart_handler_list);
int restart_handler_register(struct restart_handler *rst)
{
if (!rst->name)
- rst->name = RESTART_DEFAULT_NAME;
+ rst->name = basprintf("reset%u", resetidx);
if (!rst->priority)
rst->priority = RESTART_DEFAULT_PRIORITY;
@@ -40,11 +41,13 @@ int restart_handler_register(struct restart_handler *rst)
pr_debug("registering restart handler \"%s\" with priority %d\n",
rst->name, rst->priority);
+ resetidx++;
return 0;
}
/**
* restart_handler_register_fn() - register a handler function
+ * @name: restart method name or NULL if name should be auto-generated
* @restart_fn: The restart function
*
* convenience wrapper for restart_handler_register() to register a handler
@@ -52,13 +55,15 @@ int restart_handler_register(struct restart_handler *rst)
*
* return: 0 for success or negative error code
*/
-int restart_handler_register_fn(void (*restart_fn)(struct restart_handler *))
+int restart_handler_register_fn(const char *name,
+ void (*restart_fn)(struct restart_handler *))
{
struct restart_handler *rst;
int ret;
rst = xzalloc(sizeof(*rst));
+ rst->name = xstrdup(name);
rst->restart = restart_fn;
ret = restart_handler_register(rst);
@@ -70,20 +75,33 @@ int restart_handler_register_fn(void (*restart_fn)(struct restart_handler *))
}
/**
- * restart_machine() - reset the whole system
+ * restart_handler_get_by_name() - reset the whole system
*/
-void __noreturn restart_machine(void)
+struct restart_handler *restart_handler_get_by_name(const char *name)
{
struct restart_handler *rst = NULL, *tmp;
unsigned int priority = 0;
list_for_each_entry(tmp, &restart_handler_list, list) {
+ if (name && tmp->name && strcmp(name, tmp->name))
+ continue;
if (tmp->priority > priority) {
priority = tmp->priority;
rst = tmp;
}
}
+ return rst;
+}
+
+/**
+ * restart_machine() - reset the whole system
+ */
+void __noreturn restart_machine(void)
+{
+ struct restart_handler *rst;
+
+ rst = restart_handler_get_by_name(NULL);
if (rst) {
pr_debug("%s: using restart handler %s\n", __func__, rst->name);
console_flush();
@@ -107,3 +125,14 @@ unsigned int of_get_restart_priority(struct device_node *node)
return priority;
}
+
+/*
+ * restart_handlers_print - print informations about all restart handlers
+ */
+void restart_handlers_print(void)
+{
+ struct restart_handler *tmp;
+
+ list_for_each_entry(tmp, &restart_handler_list, list)
+ printf("%-20s %6d\n", tmp->name, tmp->priority);
+}
diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
index ddbe32f9c2..b8db60dcbc 100644
--- a/drivers/clk/clk-bulk.c
+++ b/drivers/clk/clk-bulk.c
@@ -53,6 +53,86 @@ err:
}
EXPORT_SYMBOL(clk_bulk_get);
+static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
+ struct clk_bulk_data *clks)
+{
+ int ret;
+ int i;
+
+ for (i = 0; i < num_clks; i++) {
+ clks[i].id = NULL;
+ clks[i].clk = NULL;
+ }
+
+ for (i = 0; i < num_clks; i++) {
+ of_property_read_string_index(np, "clock-names", i, &clks[i].id);
+ clks[i].clk = of_clk_get(np, i);
+ if (IS_ERR(clks[i].clk)) {
+ ret = PTR_ERR(clks[i].clk);
+ pr_err("%pOF: Failed to get clk index: %d ret: %d\n",
+ np, i, ret);
+ clks[i].clk = NULL;
+ goto err;
+ }
+ }
+
+ return 0;
+
+err:
+ clk_bulk_put(i, clks);
+
+ return ret;
+}
+
+static int __must_check of_clk_bulk_get_all(struct device_node *np,
+ struct clk_bulk_data **clks)
+{
+ struct clk_bulk_data *clk_bulk;
+ int num_clks;
+ int ret;
+
+ num_clks = of_clk_get_parent_count(np);
+ if (!num_clks)
+ return 0;
+
+ clk_bulk = kmalloc_array(num_clks, sizeof(*clk_bulk), GFP_KERNEL);
+ if (!clk_bulk)
+ return -ENOMEM;
+
+ ret = of_clk_bulk_get(np, num_clks, clk_bulk);
+ if (ret) {
+ kfree(clk_bulk);
+ return ret;
+ }
+
+ *clks = clk_bulk;
+
+ return num_clks;
+}
+
+void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks)
+{
+ if (IS_ERR_OR_NULL(clks))
+ return;
+
+ clk_bulk_put(num_clks, clks);
+
+ kfree(clks);
+}
+EXPORT_SYMBOL(clk_bulk_put_all);
+
+int __must_check clk_bulk_get_all(struct device_d *dev,
+ struct clk_bulk_data **clks)
+{
+ struct device_node *np = dev->device_node;
+
+ if (!np)
+ return 0;
+
+ return of_clk_bulk_get_all(np, clks);
+}
+EXPORT_SYMBOL(clk_bulk_get_all);
+
/**
* clk_bulk_disable - gate a set of clocks
* @num_clks: the number of clk_bulk_data
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f2e459a760..b04d44593b 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -678,7 +678,6 @@ static const char *clk_hw_stat(struct clk *clk)
static void dump_one(struct clk *clk, int verbose, int indent)
{
- struct clk *c;
int enabled = clk_is_enabled(clk);
const char *hwstat, *stat;
@@ -705,13 +704,19 @@ static void dump_one(struct clk *clk, int verbose, int indent)
printf("\n");
}
}
+}
+
+static void dump_subtree(struct clk *clk, int verbose, int indent)
+{
+ struct clk *c;
+
+ dump_one(clk, verbose, indent);
list_for_each_entry(c, &clks, list) {
struct clk *parent = clk_get_parent(c);
- if (parent == clk) {
- dump_one(c, verbose, indent + 1);
- }
+ if (parent == clk)
+ dump_subtree(c, verbose, indent + 1);
}
}
@@ -723,7 +728,42 @@ void clk_dump(int verbose)
struct clk *parent = clk_get_parent(c);
if (IS_ERR_OR_NULL(parent))
- dump_one(c, verbose, 0);
+ dump_subtree(c, verbose, 0);
+ }
+}
+
+static int clk_print_parent(struct clk *clk, int verbose)
+{
+ struct clk *c;
+ int indent;
+
+ c = clk_get_parent(clk);
+ if (IS_ERR_OR_NULL(c))
+ return 0;
+
+ indent = clk_print_parent(c, verbose);
+
+ dump_one(c, verbose, indent);
+
+ return indent + 1;
+}
+
+void clk_dump_one(struct clk *clk, int verbose)
+{
+ int indent;
+ struct clk *c;
+
+ indent = clk_print_parent(clk, verbose);
+
+ printf("\033[1m");
+ dump_one(clk, verbose, indent);
+ printf("\033[0m");
+
+ list_for_each_entry(c, &clks, list) {
+ struct clk *parent = clk_get_parent(c);
+
+ if (parent == clk)
+ dump_subtree(c, verbose, indent + 1);
}
}
diff --git a/drivers/clk/mvebu/armada-38x.c b/drivers/clk/mvebu/armada-38x.c
index 627de7de6c..80865965e1 100644
--- a/drivers/clk/mvebu/armada-38x.c
+++ b/drivers/clk/mvebu/armada-38x.c
@@ -17,7 +17,7 @@
/*
* Core Clocks
*
- * Armada XP Sample At Reset is a 64 bit bitfiled split in two
+ * Armada XP Sample At Reset is a 64 bit bitfield split in two
* register of 32 bits
*/
diff --git a/drivers/clk/mvebu/armada-xp.c b/drivers/clk/mvebu/armada-xp.c
index d79f846d3f..f0276d32f5 100644
--- a/drivers/clk/mvebu/armada-xp.c
+++ b/drivers/clk/mvebu/armada-xp.c
@@ -16,7 +16,7 @@
/*
* Core Clocks
*
- * Armada XP Sample At Reset is a 64 bit bitfiled split in two
+ * Armada XP Sample At Reset is a 64 bit bitfield split in two
* register of 32 bits
*/
diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig
index f7dc5c5089..09c0569286 100644
--- a/drivers/mci/Kconfig
+++ b/drivers/mci/Kconfig
@@ -69,6 +69,7 @@ config MCI_S3C
config MCI_BCM283X
bool "MCI support for BCM283X"
depends on ARCH_BCM283X || COMPILE_TEST
+ select MCI_SDHCI
config MCI_BCM283X_SDHOST
bool "BCM283X sdhost"
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index c5cba3711a..370bebe6e2 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -172,7 +172,7 @@ static int imx_rproc_start(struct rproc *rproc)
ret = regmap_update_bits(priv->regmap, dcfg->src_reg,
dcfg->src_mask, dcfg->src_start);
if (ret)
- dev_err(dev, "Filed to enable M4!\n");
+ dev_err(dev, "Failed to enable M4!\n");
return ret;
}
@@ -187,7 +187,7 @@ static int imx_rproc_stop(struct rproc *rproc)
ret = regmap_update_bits(priv->regmap, dcfg->src_reg,
dcfg->src_mask, dcfg->src_stop);
if (ret)
- dev_err(dev, "Filed to stop M4!\n");
+ dev_err(dev, "Failed to stop M4!\n");
return ret;
}
@@ -210,7 +210,7 @@ static int imx_rproc_da_to_sys(struct imx_rproc *priv, u64 da,
}
}
- dev_warn(priv->dev, "Translation filed: da = 0x%llx len = 0x%x\n",
+ dev_warn(priv->dev, "Translation failed: da = 0x%llx len = 0x%x\n",
da, len);
return -ENOENT;
}
@@ -353,7 +353,7 @@ static int imx_rproc_probe(struct device_d *dev)
ret = imx_rproc_addr_init(priv, dev);
if (ret) {
- dev_err(dev, "filed on imx_rproc_addr_init\n");
+ dev_err(dev, "failed on imx_rproc_addr_init\n");
goto err_put_rproc;
}
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 8a28c1bafc..a81787bc6c 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -143,7 +143,7 @@ int rproc_add(struct rproc *rproc)
ret = firmwaremgr_register(fh);
if (ret)
- dev_err(dev, "filed to register firmware handler %s\n", rproc->name);
+ dev_err(dev, "failed to register firmware handler %s\n", rproc->name);
else
dev_info(dev, "%s is available\n", rproc->name);
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index e58d9f95fe..ac16d22624 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -21,85 +21,47 @@
struct dwc3_of_simple {
struct device_d *dev;
- struct clk **clks;
+ struct clk_bulk_data *clks;
int num_clocks;
};
-static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count)
-{
- struct device_d *dev = simple->dev;
- struct device_node *np = dev->device_node;
- int i;
-
- simple->num_clocks = count;
-
- if (!count)
- return 0;
-
- simple->clks = xzalloc(sizeof(struct clk *));
- if (!simple->clks)
- return -ENOMEM;
-
- for (i = 0; i < simple->num_clocks; i++) {
- struct clk *clk;
-
- clk = of_clk_get(np, i);
- if (IS_ERR(clk)) {
- while (--i >= 0) {
- clk_disable(simple->clks[i]);
- clk_put(simple->clks[i]);
- }
- return PTR_ERR(clk);
- }
-
- simple->clks[i] = clk;
- }
-
- return 0;
-}
-
static int dwc3_of_simple_probe(struct device_d *dev)
{
struct dwc3_of_simple *simple;
struct device_node *np = dev->device_node;
int ret;
- int i;
simple = xzalloc(sizeof(*simple));
if (!simple)
return -ENOMEM;
- dev->priv = simple;
+ dev->priv = simple;
simple->dev = dev;
- ret = dwc3_of_simple_clk_init(simple, of_count_phandle_with_args(np,
- "clocks", "#clock-cells"));
+ ret = clk_bulk_get_all(simple->dev, &simple->clks);
+ if (ret < 0)
+ return ret;
+
+ simple->num_clocks = ret;
+ ret = clk_bulk_enable(simple->num_clocks, simple->clks);
if (ret)
return ret;
ret = of_platform_populate(np, NULL, dev);
if (ret) {
- for (i = 0; i < simple->num_clocks; i++) {
- clk_disable(simple->clks[i]);
- clk_put(simple->clks[i]);
- }
+ clk_bulk_disable(simple->num_clocks, simple->clks);
return ret;
}
- return 0;
+ return 0;
}
static void dwc3_of_simple_remove(struct device_d *dev)
{
struct dwc3_of_simple *simple = dev->priv;
- int i;
- for (i = 0; i < simple->num_clocks; i++) {
- clk_disable(simple->clks[i]);
- clk_put(simple->clks[i]);
- }
- simple->num_clocks = 0;
+ clk_bulk_disable(simple->num_clocks, simple->clks);
}
static const struct of_device_id of_dwc3_simple_match[] = {
diff --git a/drivers/video/imx-ipu-v3/imx-pd.c b/drivers/video/imx-ipu-v3/imx-pd.c
index 601be35880..fa6314c044 100644
--- a/drivers/video/imx-ipu-v3/imx-pd.c
+++ b/drivers/video/imx-ipu-v3/imx-pd.c
@@ -27,6 +27,8 @@
#include "imx-ipu-v3.h"
+#define IMX_PD_OUTPUT_PORT 1
+
struct imx_pd {
struct device_d *dev;
struct display_timings *timings;
@@ -39,7 +41,6 @@ static int imx_pd_ioctl(struct vpl *vpl, unsigned int port,
{
struct imx_pd *imx_pd = container_of(vpl, struct imx_pd, vpl);
struct ipu_di_mode *mode;
- struct display_timings *timings;
switch (cmd) {
case IMX_IPU_VPL_DI_MODE:
@@ -50,15 +51,21 @@ static int imx_pd_ioctl(struct vpl *vpl, unsigned int port,
return 0;
case VPL_GET_VIDEOMODES:
- timings = data;
-
- timings->num_modes = imx_pd->timings->num_modes;
- timings->native_mode = imx_pd->timings->native_mode;
- timings->modes = imx_pd->timings->modes;
- timings->edid = NULL;
- return 0;
+ if (imx_pd->timings) {
+ struct display_timings *timings = data;
+
+ timings->num_modes = imx_pd->timings->num_modes;
+ timings->native_mode = imx_pd->timings->native_mode;
+ timings->modes = imx_pd->timings->modes;
+ timings->edid = NULL;
+ return 0;
+ }
+ break;
}
+ if (!imx_pd->timings)
+ return vpl_ioctl(vpl, IMX_PD_OUTPUT_PORT, cmd, data);
+
return 0;
}
@@ -66,6 +73,7 @@ static int imx_pd_probe(struct device_d *dev)
{
struct device_node *node = dev->device_node;
struct imx_pd *imx_pd;
+ struct device_node *port;
const char *fmt;
int ret;
@@ -88,8 +96,11 @@ static int imx_pd_probe(struct device_d *dev)
imx_pd->timings = of_get_display_timings(node);
if (!imx_pd->timings) {
- dev_err(dev, "No display timings panel found\n");
- return -EINVAL;
+ port = of_graph_get_port_by_id(node, IMX_PD_OUTPUT_PORT);
+ if (!port) {
+ dev_err(dev, "Neither display timings in nor remote panel found in node\n");
+ return -EINVAL;
+ }
}
imx_pd->vpl.node = node;
diff --git a/drivers/video/simple-panel.c b/drivers/video/simple-panel.c
index 1d05153d16..2f904a7b2b 100644
--- a/drivers/video/simple-panel.c
+++ b/drivers/video/simple-panel.c
@@ -135,7 +135,7 @@ static int simple_panel_ioctl(struct vpl *vpl, unsigned int port,
case VPL_GET_VIDEOMODES:
return simple_panel_get_modes(panel, ptr);
default:
- return -ENOSYS;
+ return 0;
}
}
diff --git a/drivers/watchdog/efi_wdt.c b/drivers/watchdog/efi_wdt.c
index ea1ede1381..1512b1d99a 100644
--- a/drivers/watchdog/efi_wdt.c
+++ b/drivers/watchdog/efi_wdt.c
@@ -24,7 +24,7 @@ static int efi_wdt_set_timeout(struct watchdog *wd, unsigned timeout)
efiret = BS->set_watchdog_timer(timeout, 0, 0, NULL);
if (EFI_ERROR(efiret)) {
- dev_err(priv->dev, "filed to set EFI watchdog: %lx\n", efiret);
+ dev_err(priv->dev, "failed to set EFI watchdog: %lx\n", efiret);
return -EINVAL;
}
diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c
index 458c5c16a3..12280f1447 100644
--- a/drivers/watchdog/stpmic1_wdt.c
+++ b/drivers/watchdog/stpmic1_wdt.c
@@ -200,7 +200,7 @@ static int stpmic1_wdt_probe(struct device_d *dev)
if (ret)
dev_warn(dev, "Cannot register poweroff handler\n");
- stpmic1_set_reset_reason(wdt->regmap);
+ ret = stpmic1_set_reset_reason(wdt->regmap);
if (ret)
dev_warn(dev, "Cannot query reset reason\n");
diff --git a/images/Makefile.zynq b/images/Makefile.zynq
index 062496ac7d..b00e748697 100644
--- a/images/Makefile.zynq
+++ b/images/Makefile.zynq
@@ -3,7 +3,7 @@
#
zynqcfg_cpp_flags = -Wp,-MD,$(depfile) -nostdinc -x assembler-with-cpp \
- -I arch/arm/mach-zynq/include
+ -I $(srctree)/arch/arm/mach-zynq/include
zynqcfg-tmp = $(subst $(comma),_,$(dot-target).zynqcfg.tmp)
diff --git a/include/bootm.h b/include/bootm.h
index ef5148f31e..51e9b3d71a 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -18,6 +18,7 @@ struct bootm_data {
const char *initrd_file;
const char *oftree_file;
const char *tee_file;
+ const char *root_dev;
int verbose;
enum bootm_verify verify;
bool force;
@@ -25,6 +26,7 @@ struct bootm_data {
/*
* appendroot - if true, try to add a suitable root= Kernel option to
* mount the rootfs from the same device as the Kernel comes from.
+ * The default rootfs device can be overridden with root_dev.
*/
bool appendroot;
/*
diff --git a/include/complete.h b/include/complete.h
index 763d256bf4..75a92fc86a 100644
--- a/include/complete.h
+++ b/include/complete.h
@@ -22,5 +22,6 @@ int devicetree_alias_complete(struct string_list *sl, char *instr);
int devicetree_nodepath_complete(struct string_list *sl, char *instr);
int devicetree_complete(struct string_list *sl, char *instr);
int devicetree_file_complete(struct string_list *sl, char *instr);
+int env_param_noeval_complete(struct string_list *sl, char *instr);
#endif /* __COMPLETE_ */
diff --git a/include/globalvar.h b/include/globalvar.h
index fc85e93e14..6f2c6db746 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -19,7 +19,9 @@ void globalvar_set_match(const char *match, const char *val);
int globalvar_add_simple_string(const char *name, char **value);
int globalvar_add_simple_int(const char *name, int *value,
const char *format);
-int globalvar_add_simple_bool(const char *name, int *value);
+int globalvar_add_bool(const char *name,
+ int (*set)(struct param_d *, void *),
+ int *value, void *priv);
int globalvar_add_simple_enum(const char *name, int *value,
const char * const *names, int max);
int globalvar_add_simple_bitmask(const char *name, unsigned long *value,
@@ -51,8 +53,9 @@ static inline int globalvar_add_simple_int(const char *name,
return 0;
}
-static inline int globalvar_add_simple_bool(const char *name,
- int *value)
+static inline int globalvar_add_bool(const char *name,
+ int (*set)(struct param_d *, void *),
+ int *value, void *priv)
{
return 0;
}
@@ -121,4 +124,9 @@ int nvvar_save(void);
int nv_complete(struct string_list *sl, char *instr);
int global_complete(struct string_list *sl, char *instr);
+static inline int globalvar_add_simple_bool(const char *name, int *value)
+{
+ return globalvar_add_bool(name, NULL, value, NULL);
+}
+
#endif /* __GLOBALVAR_H */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 868bf3e4ed..c49fe9a54c 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -83,6 +83,27 @@ int __must_check clk_bulk_get(struct device_d *dev, int num_clks,
struct clk_bulk_data *clks);
/**
+ * clk_bulk_get_all - lookup and obtain all available references to clock
+ * producer.
+ * @dev: device for clock "consumer"
+ * @clks: pointer to the clk_bulk_data table of consumer
+ *
+ * This helper function allows drivers to get all clk consumers in one
+ * operation. If any of the clk cannot be acquired then any clks
+ * that were obtained will be freed before returning to the caller.
+ *
+ * Returns a positive value for the number of clocks obtained while the
+ * clock references are stored in the clk_bulk_data table in @clks field.
+ * Returns 0 if there're none and a negative value if something failed.
+ *
+ * Drivers must assume that the clock source is not enabled.
+ *
+ * clk_bulk_get should not be called from within interrupt context.
+ */
+int __must_check clk_bulk_get_all(struct device_d *dev,
+ struct clk_bulk_data **clks);
+
+/**
* clk_enable - inform the system when the clock source should be running.
* @clk: clock source
*
@@ -156,6 +177,19 @@ unsigned long clk_get_rate(struct clk *clk);
*/
void clk_bulk_put(int num_clks, struct clk_bulk_data *clks);
+/**
+ * clk_bulk_put_all - "free" all the clock source
+ * @num_clks: the number of clk_bulk_data
+ * @clks: the clk_bulk_data table of consumer
+ *
+ * Note: drivers must ensure that all clk_bulk_enable calls made on this
+ * clock source are balanced by clk_bulk_disable calls prior to calling
+ * this function.
+ *
+ * clk_bulk_put_all should not be called from within interrupt context.
+ */
+void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks);
+
/*
* The remaining APIs are optional for machine class support.
*/
@@ -240,8 +274,16 @@ static inline int __must_check clk_bulk_get(struct device_d *dev, int num_clks,
return 0;
}
+static inline int __must_check clk_bulk_get_all(struct device_d *dev,
+ struct clk_bulk_data **clks)
+{
+ return 0;
+}
+
static inline void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) {}
+static inline void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks) {}
+
static inline int clk_enable(struct clk *clk)
{
return 0;
@@ -456,6 +498,7 @@ int clk_register(struct clk *clk);
struct clk *clk_lookup(const char *name);
void clk_dump(int verbose);
+void clk_dump_one(struct clk *clk, int verbose);
struct clk *clk_register_composite(const char *name,
const char * const *parent_names, int num_parents,
@@ -535,6 +578,10 @@ static inline struct clk *of_clk_get_by_name(struct device_node *np,
{
return ERR_PTR(-ENOENT);
}
+static inline unsigned int of_clk_get_parent_count(struct device_node *np)
+{
+ return 0;
+}
static inline int of_clk_init(struct device_node *root,
const struct of_device_id *matches)
{
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 36bb6a503f..1e39883a2d 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -159,7 +159,7 @@ struct bbm_info {
int (*isbad_bbt)(struct mtd_info *mtd, loff_t ofs, int allowbbt);
- /* TODO Add more NAND specific fileds */
+ /* TODO Add more NAND specific fields */
struct nand_bbt_descr *badblock_pattern;
void *priv;
diff --git a/include/linux/string.h b/include/linux/string.h
index fd42f5020a..2b699957e8 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -8,10 +8,9 @@
extern "C" {
#endif
-extern char * ___strtok;
extern char * strpbrk(const char *,const char *);
-extern char * strtok(char *,const char *);
extern char * strsep(char **,const char *);
+extern char * strsep_unescaped(char **,const char *);
extern __kernel_size_t strspn(const char *,const char *);
diff --git a/include/regulator.h b/include/regulator.h
index 12d8e816cd..a9cb6dedca 100644
--- a/include/regulator.h
+++ b/include/regulator.h
@@ -175,6 +175,11 @@ static inline struct regulator *regulator_get(struct device_d *dev, const char *
return NULL;
}
+static inline struct regulator *regulator_get_name(const char *name)
+{
+ return NULL;
+}
+
static inline int regulator_enable(struct regulator *r)
{
return 0;
diff --git a/include/restart.h b/include/restart.h
index 7ec0910e94..2d15c7598a 100644
--- a/include/restart.h
+++ b/include/restart.h
@@ -2,7 +2,9 @@
#ifndef __INCLUDE_RESTART_H
#define __INCLUDE_RESTART_H
+void restart_handlers_print(void);
void __noreturn restart_machine(void);
+struct restart_handler *restart_handler_get_by_name(const char *name);
struct restart_handler {
void (*restart)(struct restart_handler *);
@@ -12,10 +14,10 @@ struct restart_handler {
};
int restart_handler_register(struct restart_handler *);
-int restart_handler_register_fn(void (*restart_fn)(struct restart_handler *));
+int restart_handler_register_fn(const char *name,
+ void (*restart_fn)(struct restart_handler *));
#define RESTART_DEFAULT_PRIORITY 100
-#define RESTART_DEFAULT_NAME "default"
unsigned int of_get_restart_priority(struct device_node *node);
diff --git a/lib/lzo/Kconfig b/lib/lzo/Kconfig
index 9276b2128a..17b0083236 100644
--- a/lib/lzo/Kconfig
+++ b/lib/lzo/Kconfig
@@ -1,7 +1,3 @@
config LZO_DECOMPRESS
bool "include lzo uncompression support"
select UNCOMPRESS
-
-config LZO_COMPRESS
- bool
-
diff --git a/lib/lzo/Makefile b/lib/lzo/Makefile
index f2191f4a3d..0e576a1c10 100644
--- a/lib/lzo/Makefile
+++ b/lib/lzo/Makefile
@@ -1,4 +1 @@
-
-obj-$(CONFIG_LZO_COMPRESS) += lzo1x_compress.o
obj-$(CONFIG_LZO_DECOMPRESS) += lzo1x_decompress_safe.o
-
diff --git a/lib/lzo/lzo1x_compress.c b/lib/lzo/lzo1x_compress.c
deleted file mode 100644
index 236eb21167..0000000000
--- a/lib/lzo/lzo1x_compress.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * LZO1X Compressor from LZO
- *
- * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <markus@oberhumer.com>
- *
- * The full LZO package can be found at:
- * http://www.oberhumer.com/opensource/lzo/
- *
- * Changed for Linux kernel use by:
- * Nitin Gupta <nitingupta910@gmail.com>
- * Richard Purdie <rpurdie@openedhand.com>
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <asm/unaligned.h>
-#include <linux/lzo.h>
-#include "lzodefs.h"
-
-static noinline size_t
-lzo1x_1_do_compress(const unsigned char *in, size_t in_len,
- unsigned char *out, size_t *out_len,
- size_t ti, void *wrkmem)
-{
- const unsigned char *ip;
- unsigned char *op;
- const unsigned char * const in_end = in + in_len;
- const unsigned char * const ip_end = in + in_len - 20;
- const unsigned char *ii;
- lzo_dict_t * const dict = (lzo_dict_t *) wrkmem;
-
- op = out;
- ip = in;
- ii = ip;
- ip += ti < 4 ? 4 - ti : 0;
-
- for (;;) {
- const unsigned char *m_pos;
- size_t t, m_len, m_off;
- u32 dv;
-literal:
- ip += 1 + ((ip - ii) >> 5);
-next:
- if (unlikely(ip >= ip_end))
- break;
- dv = get_unaligned_le32(ip);
- t = ((dv * 0x1824429d) >> (32 - D_BITS)) & D_MASK;
- m_pos = in + dict[t];
- dict[t] = (lzo_dict_t) (ip - in);
- if (unlikely(dv != get_unaligned_le32(m_pos)))
- goto literal;
-
- ii -= ti;
- ti = 0;
- t = ip - ii;
- if (t != 0) {
- if (t <= 3) {
- op[-2] |= t;
- COPY4(op, ii);
- op += t;
- } else if (t <= 16) {
- *op++ = (t - 3);
- COPY8(op, ii);
- COPY8(op + 8, ii + 8);
- op += t;
- } else {
- if (t <= 18) {
- *op++ = (t - 3);
- } else {
- size_t tt = t - 18;
- *op++ = 0;
- while (unlikely(tt > 255)) {
- tt -= 255;
- *op++ = 0;
- }
- *op++ = tt;
- }
- do {
- COPY8(op, ii);
- COPY8(op + 8, ii + 8);
- op += 16;
- ii += 16;
- t -= 16;
- } while (t >= 16);
- if (t > 0) do {
- *op++ = *ii++;
- } while (--t > 0);
- }
- }
-
- m_len = 4;
- {
-#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && defined(LZO_USE_CTZ64)
- u64 v;
- v = get_unaligned((const u64 *) (ip + m_len)) ^
- get_unaligned((const u64 *) (m_pos + m_len));
- if (unlikely(v == 0)) {
- do {
- m_len += 8;
- v = get_unaligned((const u64 *) (ip + m_len)) ^
- get_unaligned((const u64 *) (m_pos + m_len));
- if (unlikely(ip + m_len >= ip_end))
- goto m_len_done;
- } while (v == 0);
- }
-# if defined(__LITTLE_ENDIAN)
- m_len += (unsigned) __builtin_ctzll(v) / 8;
-# elif defined(__BIG_ENDIAN)
- m_len += (unsigned) __builtin_clzll(v) / 8;
-# else
-# error "missing endian definition"
-# endif
-#elif defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && defined(LZO_USE_CTZ32)
- u32 v;
- v = get_unaligned((const u32 *) (ip + m_len)) ^
- get_unaligned((const u32 *) (m_pos + m_len));
- if (unlikely(v == 0)) {
- do {
- m_len += 4;
- v = get_unaligned((const u32 *) (ip + m_len)) ^
- get_unaligned((const u32 *) (m_pos + m_len));
- if (v != 0)
- break;
- m_len += 4;
- v = get_unaligned((const u32 *) (ip + m_len)) ^
- get_unaligned((const u32 *) (m_pos + m_len));
- if (unlikely(ip + m_len >= ip_end))
- goto m_len_done;
- } while (v == 0);
- }
-# if defined(__LITTLE_ENDIAN)
- m_len += (unsigned) __builtin_ctz(v) / 8;
-# elif defined(__BIG_ENDIAN)
- m_len += (unsigned) __builtin_clz(v) / 8;
-# else
-# error "missing endian definition"
-# endif
-#else
- if (unlikely(ip[m_len] == m_pos[m_len])) {
- do {
- m_len += 1;
- if (ip[m_len] != m_pos[m_len])
- break;
- m_len += 1;
- if (ip[m_len] != m_pos[m_len])
- break;
- m_len += 1;
- if (ip[m_len] != m_pos[m_len])
- break;
- m_len += 1;
- if (ip[m_len] != m_pos[m_len])
- break;
- m_len += 1;
- if (ip[m_len] != m_pos[m_len])
- break;
- m_len += 1;
- if (ip[m_len] != m_pos[m_len])
- break;
- m_len += 1;
- if (ip[m_len] != m_pos[m_len])
- break;
- m_len += 1;
- if (unlikely(ip + m_len >= ip_end))
- goto m_len_done;
- } while (ip[m_len] == m_pos[m_len]);
- }
-#endif
- }
-m_len_done:
-
- m_off = ip - m_pos;
- ip += m_len;
- ii = ip;
- if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) {
- m_off -= 1;
- *op++ = (((m_len - 1) << 5) | ((m_off & 7) << 2));
- *op++ = (m_off >> 3);
- } else if (m_off <= M3_MAX_OFFSET) {
- m_off -= 1;
- if (m_len <= M3_MAX_LEN)
- *op++ = (M3_MARKER | (m_len - 2));
- else {
- m_len -= M3_MAX_LEN;
- *op++ = M3_MARKER | 0;
- while (unlikely(m_len > 255)) {
- m_len -= 255;
- *op++ = 0;
- }
- *op++ = (m_len);
- }
- *op++ = (m_off << 2);
- *op++ = (m_off >> 6);
- } else {
- m_off -= 0x4000;
- if (m_len <= M4_MAX_LEN)
- *op++ = (M4_MARKER | ((m_off >> 11) & 8)
- | (m_len - 2));
- else {
- m_len -= M4_MAX_LEN;
- *op++ = (M4_MARKER | ((m_off >> 11) & 8));
- while (unlikely(m_len > 255)) {
- m_len -= 255;
- *op++ = 0;
- }
- *op++ = (m_len);
- }
- *op++ = (m_off << 2);
- *op++ = (m_off >> 6);
- }
- goto next;
- }
- *out_len = op - out;
- return in_end - (ii - ti);
-}
-
-int lzo1x_1_compress(const unsigned char *in, size_t in_len,
- unsigned char *out, size_t *out_len,
- void *wrkmem)
-{
- const unsigned char *ip = in;
- unsigned char *op = out;
- size_t l = in_len;
- size_t t = 0;
-
- while (l > 20) {
- size_t ll = l <= (M4_MAX_OFFSET + 1) ? l : (M4_MAX_OFFSET + 1);
- uintptr_t ll_end = (uintptr_t) ip + ll;
- if ((ll_end + ((t + ll) >> 5)) <= ll_end)
- break;
- BUILD_BUG_ON(D_SIZE * sizeof(lzo_dict_t) > LZO1X_1_MEM_COMPRESS);
- memset(wrkmem, 0, D_SIZE * sizeof(lzo_dict_t));
- t = lzo1x_1_do_compress(ip, ll, op, out_len, t, wrkmem);
- ip += ll;
- op += *out_len;
- l -= ll;
- }
- t += l;
-
- if (t > 0) {
- const unsigned char *ii = in + in_len - t;
-
- if (op == out && t <= 238) {
- *op++ = (17 + t);
- } else if (t <= 3) {
- op[-2] |= t;
- } else if (t <= 18) {
- *op++ = (t - 3);
- } else {
- size_t tt = t - 18;
- *op++ = 0;
- while (tt > 255) {
- tt -= 255;
- *op++ = 0;
- }
- *op++ = tt;
- }
- if (t >= 16) do {
- COPY8(op, ii);
- COPY8(op + 8, ii + 8);
- op += 16;
- ii += 16;
- t -= 16;
- } while (t >= 16);
- if (t > 0) do {
- *op++ = *ii++;
- } while (--t > 0);
- }
-
- *op++ = M4_MARKER | 1;
- *op++ = 0;
- *op++ = 0;
-
- *out_len = op - out;
- return LZO_E_OK;
-}
-EXPORT_SYMBOL_GPL(lzo1x_1_compress);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("LZO1X-1 Compressor");
diff --git a/lib/readkey.c b/lib/readkey.c
index fd72951046..c26e9d51ab 100644
--- a/lib/readkey.c
+++ b/lib/readkey.c
@@ -61,7 +61,7 @@ int read_key(void)
esc[i] = getchar();
if (esc[i++] == '~')
break;
- if (i == ARRAY_SIZE(esc))
+ if (i == ARRAY_SIZE(esc) - 1)
return -1;
}
}
diff --git a/lib/string.c b/lib/string.c
index c0bf372657..003070fa53 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -13,6 +13,9 @@
* * Fri Jun 25 1999, Ingo Oeser <ioe@informatik.tu-chemnitz.de>
* - Added strsep() which will replace strtok() soon (because strsep() is
* reentrant and should be faster). Use only strsep() in new code, please.
+ * * Mon Sep 14 2020, Ahmad Fatoum <a.fatoum@pengutronix.de>
+ * - Kissed strtok() goodbye
+ *
*/
#include <linux/types.h>
@@ -20,8 +23,6 @@
#include <linux/ctype.h>
#include <malloc.h>
-char * ___strtok;
-
#ifndef __HAVE_ARCH_STRNICMP
/**
* strnicmp - Case insensitive, length-limited string comparison
@@ -396,36 +397,6 @@ char * strpbrk(const char * cs,const char * ct)
#endif
EXPORT_SYMBOL(strpbrk);
-#ifndef __HAVE_ARCH_STRTOK
-/**
- * strtok - Split a string into tokens
- * @s: The string to be searched
- * @ct: The characters to search for
- *
- * WARNING: strtok is deprecated, use strsep instead.
- */
-char * strtok(char * s, const char * ct)
-{
- char *sbegin, *send;
-
- sbegin = s ? s : ___strtok;
- if (!sbegin) {
- return NULL;
- }
- sbegin += strspn(sbegin,ct);
- if (*sbegin == '\0') {
- ___strtok = NULL;
- return( NULL );
- }
- send = strpbrk( sbegin, ct);
- if (send && *send != '\0')
- *send++ = '\0';
- ___strtok = send;
- return (sbegin);
-}
-#endif
-EXPORT_SYMBOL(strtok);
-
#ifndef __HAVE_ARCH_STRSEP
/**
* strsep - Split a string into tokens
@@ -455,6 +426,49 @@ char * strsep(char **s, const char *ct)
#endif
EXPORT_SYMBOL(strsep);
+/**
+ * strsep_unescaped - Split a string into tokens, while ignoring escaped delimiters
+ * @s: The string to be searched
+ * @ct: The delimiter characters to search for
+ *
+ * strsep_unescaped() behaves like strsep unless it meets an escaped delimiter.
+ * In that case, it shifts the string back in memory to overwrite the escape's
+ * backslash then continues the search until an unescaped delimiter is found.
+ */
+char *strsep_unescaped(char **s, const char *ct)
+{
+ char *sbegin = *s, *hay;
+ const char *needle;
+ size_t shift = 0;
+
+ if (sbegin == NULL)
+ return NULL;
+
+ for (hay = sbegin; *hay != '\0'; ++hay) {
+ *hay = hay[shift];
+
+ if (*hay == '\\') {
+ *hay = hay[++shift];
+ if (*hay != '\\')
+ continue;
+ }
+
+ for (needle = ct; *needle != '\0'; ++needle) {
+ if (*hay == *needle)
+ goto match;
+ }
+ }
+
+ *s = NULL;
+ return sbegin;
+
+match:
+ *hay = '\0';
+ *s = &hay[shift + 1];
+
+ return sbegin;
+}
+
#ifndef __HAVE_ARCH_STRSWAB
/**
* strswab - swap adjacent even and odd bytes in %NUL-terminated string
diff --git a/lib/ubsan.c b/lib/ubsan.c
index 41a5731dda..085d470cf7 100644
--- a/lib/ubsan.c
+++ b/lib/ubsan.c
@@ -60,8 +60,8 @@ static bool was_reported(struct source_location *location)
static void print_source_location(const char *prefix,
struct source_location *loc)
{
- pr_err("%s %s:%d:%d\n", prefix, loc->file_name,
- loc->line & LINE_MASK, loc->column & COLUMN_MASK);
+ printf("%s %s:%d:%d\n", prefix, loc->file_name,
+ loc->line & LINE_MASK, loc->column & COLUMN_MASK);
}
static bool suppress_report(struct source_location *loc)
@@ -157,16 +157,16 @@ static void ubsan_prologue(struct source_location *location,
{
in_ubsan++;
- pr_err("========================================"
- "========================================\n");
+ printf("========================================"
+ "========================================\n");
print_source_location("UBSAN: Undefined behaviour in", location);
}
static void ubsan_epilogue(unsigned long *flags)
{
dump_stack();
- pr_err("========================================"
- "========================================\n");
+ printf("========================================"
+ "========================================\n");
in_ubsan--;
}
@@ -186,13 +186,13 @@ static void handle_overflow(struct overflow_data *data, void *lhs,
val_to_string(lhs_val_str, sizeof(lhs_val_str), type, lhs);
val_to_string(rhs_val_str, sizeof(rhs_val_str), type, rhs);
- pr_err("%s integer overflow:\n",
- type_is_signed(type) ? "signed" : "unsigned");
- pr_err("%s %c %s cannot be represented in type %s\n",
- lhs_val_str,
- op,
- rhs_val_str,
- type->type_name);
+ printf("%s integer overflow:\n",
+ type_is_signed(type) ? "signed" : "unsigned");
+ printf("%s %c %s cannot be represented in type %s\n",
+ lhs_val_str,
+ op,
+ rhs_val_str,
+ type->type_name);
ubsan_epilogue(&flags);
}
@@ -232,8 +232,8 @@ void __ubsan_handle_negate_overflow(struct overflow_data *data,
val_to_string(old_val_str, sizeof(old_val_str), data->type, old_val);
- pr_err("negation of %s cannot be represented in type %s:\n",
- old_val_str, data->type->type_name);
+ printf("negation of %s cannot be represented in type %s:\n",
+ old_val_str, data->type->type_name);
ubsan_epilogue(&flags);
}
@@ -254,10 +254,10 @@ void __ubsan_handle_divrem_overflow(struct overflow_data *data,
val_to_string(rhs_val_str, sizeof(rhs_val_str), data->type, rhs);
if (type_is_signed(data->type) && get_signed_val(data->type, rhs) == -1)
- pr_err("division of %s by -1 cannot be represented in type %s\n",
- rhs_val_str, data->type->type_name);
+ printf("division of %s by -1 cannot be represented in type %s\n",
+ rhs_val_str, data->type->type_name);
else
- pr_err("division by zero\n");
+ printf("division by zero\n");
ubsan_epilogue(&flags);
}
@@ -272,9 +272,9 @@ static void handle_null_ptr_deref(struct type_mismatch_data_common *data)
ubsan_prologue(data->location, &flags);
- pr_err("%s null pointer of type %s\n",
- type_check_kinds[data->type_check_kind],
- data->type->type_name);
+ printf("%s null pointer of type %s\n",
+ type_check_kinds[data->type_check_kind],
+ data->type->type_name);
ubsan_epilogue(&flags);
}
@@ -289,10 +289,10 @@ static void handle_misaligned_access(struct type_mismatch_data_common *data,
ubsan_prologue(data->location, &flags);
- pr_err("%s misaligned address %p for type %s\n",
- type_check_kinds[data->type_check_kind],
- (void *)ptr, data->type->type_name);
- pr_err("which requires %ld byte alignment\n", data->alignment);
+ printf("%s misaligned address %p for type %s\n",
+ type_check_kinds[data->type_check_kind],
+ (void *)ptr, data->type->type_name);
+ printf("which requires %ld byte alignment\n", data->alignment);
ubsan_epilogue(&flags);
}
@@ -306,10 +306,10 @@ static void handle_object_size_mismatch(struct type_mismatch_data_common *data,
return;
ubsan_prologue(data->location, &flags);
- pr_err("%s address %p with insufficient space\n",
+ printf("%s address %p with insufficient space\n",
type_check_kinds[data->type_check_kind],
(void *) ptr);
- pr_err("for an object of type %s\n", data->type->type_name);
+ printf("for an object of type %s\n", data->type->type_name);
ubsan_epilogue(&flags);
}
@@ -364,8 +364,8 @@ void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, void *index)
ubsan_prologue(&data->location, &flags);
val_to_string(index_str, sizeof(index_str), data->index_type, index);
- pr_err("index %s is out of range for type %s\n", index_str,
- data->array_type->type_name);
+ printf("index %s is out of range for type %s\n", index_str,
+ data->array_type->type_name);
ubsan_epilogue(&flags);
}
EXPORT_SYMBOL(__ubsan_handle_out_of_bounds);
@@ -408,22 +408,22 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data,
val_to_string(lhs_str, sizeof(lhs_str), lhs_type, lhs);
if (val_is_negative(rhs_type, rhs))
- pr_err("shift exponent %s is negative\n", rhs_str);
+ printf("shift exponent %s is negative\n", rhs_str);
else if (get_unsigned_val(rhs_type, rhs) >=
- type_bit_width(lhs_type))
- pr_err("shift exponent %s is too large for %u-bit type %s\n",
- rhs_str,
- type_bit_width(lhs_type),
- lhs_type->type_name);
+ type_bit_width(lhs_type))
+ printf("shift exponent %s is too large for %u-bit type %s\n",
+ rhs_str,
+ type_bit_width(lhs_type),
+ lhs_type->type_name);
else if (val_is_negative(lhs_type, lhs))
- pr_err("left shift of negative value %s\n",
- lhs_str);
+ printf("left shift of negative value %s\n",
+ lhs_str);
else
- pr_err("left shift of %s by %s places cannot be"
- " represented in type %s\n",
- lhs_str, rhs_str,
- lhs_type->type_name);
+ printf("left shift of %s by %s places cannot be"
+ " represented in type %s\n",
+ lhs_str, rhs_str,
+ lhs_type->type_name);
ubsan_epilogue(&flags);
}
@@ -435,7 +435,7 @@ void __ubsan_handle_builtin_unreachable(struct unreachable_data *data)
unsigned long flags;
ubsan_prologue(&data->location, &flags);
- pr_err("calling __builtin_unreachable()\n");
+ printf("calling __builtin_unreachable()\n");
ubsan_epilogue(&flags);
panic("can't return from __builtin_unreachable()");
}
@@ -454,8 +454,8 @@ void __ubsan_handle_load_invalid_value(struct invalid_value_data *data,
val_to_string(val_str, sizeof(val_str), data->type, val);
- pr_err("load of value %s is not a valid value for type %s\n",
- val_str, data->type->type_name);
+ printf("load of value %s is not a valid value for type %s\n",
+ val_str, data->type->type_name);
ubsan_epilogue(&flags);
}
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
index 496d11c92c..a5fe72c504 100644
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y)
# $(cc-option,<flag>)
# Return y if the compiler supports <flag>, n otherwise
-cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null)
+cc-option = $(success,mkdir .tmp_$$$$; trap "rm -rf .tmp_$$$$" EXIT; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$$$/tmp.o)
# $(ld-option,<flag>)
# Return y if the linker supports <flag>, n otherwise
@@ -42,9 +42,6 @@ $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found)
# Fail if the linker is gold as it's not capable of linking the kernel proper
$(error-if,$(success, $(LD) -v | grep -q gold), gold linker '$(LD)' not supported)
-# gcc version including patch level
-gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
-
# machine bit flags
# $(m32-flag): -m32 if the compiler supports it, or an empty string otherwise.
# $(m64-flag): -m64 if the compiler supports it, or an empty string otherwise.
diff --git a/scripts/compiler.h b/scripts/compiler.h
index 0ad25f9e8d..c932f715c5 100644
--- a/scripts/compiler.h
+++ b/scripts/compiler.h
@@ -62,6 +62,7 @@ typedef unsigned int uint;
defined(__NetBSD__) || defined(__DragonFly__)
# include <sys/endian.h>
#else /* assume Linux */
+# include <sys/types.h>
# include <endian.h>
# include <byteswap.h>
#endif
diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 393ac258b6..e277d29035 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -560,7 +560,7 @@ static int transfer(int report, unsigned char *p, unsigned cnt, int *last_trans)
return err;
}
-int do_status(void)
+static int do_status(void)
{
int last_trans;
unsigned char tmp[64];
diff --git a/scripts/imx/imx.c b/scripts/imx/imx.c
index 1fb3922fcf..e9f05b83a3 100644
--- a/scripts/imx/imx.c
+++ b/scripts/imx/imx.c
@@ -275,7 +275,7 @@ static int do_soc(struct config_data *data, int argc, char *argv[])
}
}
- fprintf(stderr, "unkown SoC type \"%s\". Known SoCs are:\n", soc);
+ fprintf(stderr, "unknown SoC type \"%s\". Known SoCs are:\n", soc);
for (i = 0; i < ARRAY_SIZE(socs); i++)
fprintf(stderr, "%s ", socs[i].name);
fprintf(stderr, "\n");
diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore
index 12a67fdab5..c3d537cd02 100644
--- a/scripts/kconfig/.gitignore
+++ b/scripts/kconfig/.gitignore
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
-*.moc
+/qconf-moc.cc
*conf-cfg
#
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index c9d0a4a8ef..52b59bf9ef 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -96,11 +96,13 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
PHONY += kvmconfig
kvmconfig: kvm_guest.config
- @:
+ @echo >&2 "WARNING: 'make $@' will be removed after Linux 5.10"
+ @echo >&2 " Please use 'make $<' instead."
PHONY += xenconfig
xenconfig: xen.config
- @:
+ @echo >&2 "WARNING: 'make $@' will be removed after Linux 5.10"
+ @echo >&2 " Please use 'make $<' instead."
PHONY += tinyconfig
tinyconfig:
@@ -123,7 +125,9 @@ help:
@echo ' gconfig - Update current config utilising a GTK+ based front-end'
@echo ' oldconfig - Update current config utilising a provided .config as base'
@echo ' localmodconfig - Update current config disabling modules not loaded'
+ @echo ' except those preserved by LMC_KEEP environment variable'
@echo ' localyesconfig - Update current config converting local mods to core'
+ @echo ' except those preserved by LMC_KEEP environment variable'
@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'
@@ -137,9 +141,6 @@ help:
@echo ' helpnewconfig - List new options and help text'
@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'
- @echo ' support'
@echo ' tinyconfig - Configure the tiniest possible kernel'
@echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)'
@@ -180,19 +181,22 @@ $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg
# qconf: Used for the xconfig target based on Qt
hostprogs += qconf
-qconf-cxxobjs := qconf.o
+qconf-cxxobjs := qconf.o qconf-moc.o
qconf-objs := images.o $(common-objs)
HOSTLDLIBS_qconf = $(shell . $(obj)/qconf-cfg && echo $$libs)
HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/qconf-cfg && echo $$cflags)
+HOSTCXXFLAGS_qconf-moc.o = $(shell . $(obj)/qconf-cfg && echo $$cflags)
-$(obj)/qconf.o: $(obj)/qconf-cfg $(obj)/qconf.moc
+$(obj)/qconf.o: $(obj)/qconf-cfg
quiet_cmd_moc = MOC $@
- cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) -i $< -o $@
+ cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) $< -o $@
-$(obj)/%.moc: $(src)/%.h $(obj)/qconf-cfg
- $(call cmd,moc)
+$(obj)/qconf-moc.cc: $(src)/qconf.h $(obj)/qconf-cfg FORCE
+ $(call if_changed,moc)
+
+targets += qconf-moc.cc
# gconf: Used for the gconfig target based on GTK+
hostprogs += gconf
diff --git a/scripts/kconfig/images.c b/scripts/kconfig/images.c
index b4fa0e4a63..2f9afffa5d 100644
--- a/scripts/kconfig/images.c
+++ b/scripts/kconfig/images.c
@@ -5,7 +5,7 @@
#include "images.h"
-const char *xpm_load[] = {
+const char * const xpm_load[] = {
"22 22 5 1",
". c None",
"# c #000000",
@@ -35,7 +35,7 @@ const char *xpm_load[] = {
"###############.......",
"......................"};
-const char *xpm_save[] = {
+const char * const xpm_save[] = {
"22 22 5 1",
". c None",
"# c #000000",
@@ -65,7 +65,7 @@ const char *xpm_save[] = {
"..##################..",
"......................"};
-const char *xpm_back[] = {
+const char * const xpm_back[] = {
"22 22 3 1",
". c None",
"# c #000083",
@@ -93,7 +93,7 @@ const char *xpm_back[] = {
"......................",
"......................"};
-const char *xpm_tree_view[] = {
+const char * const xpm_tree_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@@ -120,7 +120,7 @@ const char *xpm_tree_view[] = {
"......................",
"......................"};
-const char *xpm_single_view[] = {
+const char * const xpm_single_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@@ -147,7 +147,7 @@ const char *xpm_single_view[] = {
"......................",
"......................"};
-const char *xpm_split_view[] = {
+const char * const xpm_split_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@@ -174,7 +174,7 @@ const char *xpm_split_view[] = {
"......................",
"......................"};
-const char *xpm_symbol_no[] = {
+const char * const xpm_symbol_no[] = {
"12 12 2 1",
" c white",
". c black",
@@ -191,7 +191,7 @@ const char *xpm_symbol_no[] = {
" .......... ",
" "};
-const char *xpm_symbol_mod[] = {
+const char * const xpm_symbol_mod[] = {
"12 12 2 1",
" c white",
". c black",
@@ -208,7 +208,7 @@ const char *xpm_symbol_mod[] = {
" .......... ",
" "};
-const char *xpm_symbol_yes[] = {
+const char * const xpm_symbol_yes[] = {
"12 12 2 1",
" c white",
". c black",
@@ -225,7 +225,7 @@ const char *xpm_symbol_yes[] = {
" .......... ",
" "};
-const char *xpm_choice_no[] = {
+const char * const xpm_choice_no[] = {
"12 12 2 1",
" c white",
". c black",
@@ -242,7 +242,7 @@ const char *xpm_choice_no[] = {
" .... ",
" "};
-const char *xpm_choice_yes[] = {
+const char * const xpm_choice_yes[] = {
"12 12 2 1",
" c white",
". c black",
@@ -259,7 +259,7 @@ const char *xpm_choice_yes[] = {
" .... ",
" "};
-const char *xpm_menu[] = {
+const char * const xpm_menu[] = {
"12 12 2 1",
" c white",
". c black",
@@ -276,7 +276,7 @@ const char *xpm_menu[] = {
" .......... ",
" "};
-const char *xpm_menu_inv[] = {
+const char * const xpm_menu_inv[] = {
"12 12 2 1",
" c white",
". c black",
@@ -293,7 +293,7 @@ const char *xpm_menu_inv[] = {
" .......... ",
" "};
-const char *xpm_menuback[] = {
+const char * const xpm_menuback[] = {
"12 12 2 1",
" c white",
". c black",
@@ -310,7 +310,7 @@ const char *xpm_menuback[] = {
" .......... ",
" "};
-const char *xpm_void[] = {
+const char * const xpm_void[] = {
"12 12 2 1",
" c white",
". c black",
diff --git a/scripts/kconfig/images.h b/scripts/kconfig/images.h
index d8ff614bd0..7212dec200 100644
--- a/scripts/kconfig/images.h
+++ b/scripts/kconfig/images.h
@@ -10,21 +10,21 @@
extern "C" {
#endif
-extern const char *xpm_load[];
-extern const char *xpm_save[];
-extern const char *xpm_back[];
-extern const char *xpm_tree_view[];
-extern const char *xpm_single_view[];
-extern const char *xpm_split_view[];
-extern const char *xpm_symbol_no[];
-extern const char *xpm_symbol_mod[];
-extern const char *xpm_symbol_yes[];
-extern const char *xpm_choice_no[];
-extern const char *xpm_choice_yes[];
-extern const char *xpm_menu[];
-extern const char *xpm_menu_inv[];
-extern const char *xpm_menuback[];
-extern const char *xpm_void[];
+extern const char * const xpm_load[];
+extern const char * const xpm_save[];
+extern const char * const xpm_back[];
+extern const char * const xpm_tree_view[];
+extern const char * const xpm_single_view[];
+extern const char * const xpm_split_view[];
+extern const char * const xpm_symbol_no[];
+extern const char * const xpm_symbol_mod[];
+extern const char * const xpm_symbol_yes[];
+extern const char * const xpm_choice_no[];
+extern const char * const xpm_choice_yes[];
+extern const char * const xpm_menu[];
+extern const char * const xpm_menu_inv[];
+extern const char * const xpm_menuback[];
+extern const char * const xpm_void[];
#ifdef __cplusplus
}
diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l
index 6354c905b0..240109f965 100644
--- a/scripts/kconfig/lexer.l
+++ b/scripts/kconfig/lexer.l
@@ -36,7 +36,7 @@ struct buffer {
YY_BUFFER_STATE state;
};
-struct buffer *current_buf;
+static struct buffer *current_buf;
static int last_ts, first_ts;
@@ -105,7 +105,7 @@ n [A-Za-z0-9_-]
"endchoice" return T_ENDCHOICE;
"endif" return T_ENDIF;
"endmenu" return T_ENDMENU;
-"help"|"---help---" return T_HELP;
+"help" return T_HELP;
"hex" return T_HEX;
"if" return T_IF;
"imply" return T_IMPLY;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index e436ba44c9..a5fbd6ccc0 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -65,7 +65,8 @@ void menu_add_entry(struct symbol *sym)
struct menu *menu_add_menu(void)
{
last_entry_ptr = &current_entry->list;
- return current_menu = current_entry;
+ current_menu = current_entry;
+ return current_menu;
}
void menu_end_menu(void)
diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y
index 708b6c4b13..190f1117f3 100644
--- a/scripts/kconfig/parser.y
+++ b/scripts/kconfig/parser.y
@@ -119,20 +119,24 @@ mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL
stmt_list:
/* empty */
- | stmt_list common_stmt
+ | stmt_list assignment_stmt
| stmt_list choice_stmt
+ | stmt_list comment_stmt
+ | stmt_list config_stmt
+ | stmt_list if_stmt
| stmt_list menu_stmt
+ | stmt_list menuconfig_stmt
+ | stmt_list source_stmt
| stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
| stmt_list error T_EOL { zconf_error("invalid statement"); }
;
-common_stmt:
- if_stmt
- | comment_stmt
- | config_stmt
- | menuconfig_stmt
- | source_stmt
- | assignment_stmt
+stmt_list_in_choice:
+ /* empty */
+ | stmt_list_in_choice comment_stmt
+ | stmt_list_in_choice config_stmt
+ | stmt_list_in_choice if_stmt_in_choice
+ | stmt_list_in_choice error T_EOL { zconf_error("invalid statement"); }
;
/* config/menuconfig entry */
@@ -254,7 +258,7 @@ choice_end: end
}
};
-choice_stmt: choice_entry choice_block choice_end
+choice_stmt: choice_entry stmt_list_in_choice choice_end
;
choice_option_list:
@@ -305,11 +309,6 @@ default:
| T_DEF_BOOL { $$ = S_BOOLEAN; }
| T_DEF_TRISTATE { $$ = S_TRISTATE; }
-choice_block:
- /* empty */
- | choice_block common_stmt
-;
-
/* if entry */
if_entry: T_IF expr T_EOL
@@ -331,6 +330,9 @@ if_end: end
if_stmt: if_entry stmt_list if_end
;
+if_stmt_in_choice: if_entry stmt_list_in_choice if_end
+;
+
/* menu entry */
menu: T_MENU T_WORD_QUOTE T_EOL
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index c0ac8f7b5f..8638785328 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -4,34 +4,25 @@
* Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>
*/
-#include <qglobal.h>
-
-#include <QMainWindow>
-#include <QList>
-#include <qtextbrowser.h>
#include <QAction>
+#include <QApplication>
+#include <QCloseEvent>
+#include <QDebug>
+#include <QDesktopWidget>
#include <QFileDialog>
+#include <QLabel>
+#include <QLayout>
+#include <QList>
#include <QMenu>
-
-#include <qapplication.h>
-#include <qdesktopwidget.h>
-#include <qtoolbar.h>
-#include <qlayout.h>
-#include <qsplitter.h>
-#include <qlineedit.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qmenubar.h>
-#include <qmessagebox.h>
-#include <qregexp.h>
-#include <qevent.h>
+#include <QMenuBar>
+#include <QMessageBox>
+#include <QToolBar>
#include <stdlib.h>
#include "lkc.h"
#include "qconf.h"
-#include "qconf.moc"
#include "images.h"
@@ -40,11 +31,6 @@ static ConfigSettings *configSettings;
QAction *ConfigMainWindow::saveAction;
-static inline QString qgettext(const char* str)
-{
- return QString::fromLocal8Bit(str);
-}
-
ConfigSettings::ConfigSettings()
: QSettings("kernel.org", "qconf")
{
@@ -88,6 +74,13 @@ bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value)
return true;
}
+QIcon ConfigItem::symbolYesIcon;
+QIcon ConfigItem::symbolModIcon;
+QIcon ConfigItem::symbolNoIcon;
+QIcon ConfigItem::choiceYesIcon;
+QIcon ConfigItem::choiceNoIcon;
+QIcon ConfigItem::menuIcon;
+QIcon ConfigItem::menubackIcon;
/*
* set the new data
@@ -111,14 +104,14 @@ void ConfigItem::updateMenu(void)
list = listView();
if (goParent) {
- setPixmap(promptColIdx, list->menuBackPix);
+ setIcon(promptColIdx, menubackIcon);
prompt = "..";
goto set_prompt;
}
sym = menu->sym;
prop = menu->prompt;
- prompt = qgettext(menu_get_prompt(menu));
+ prompt = menu_get_prompt(menu);
if (prop) switch (prop->type) {
case P_MENU:
@@ -128,15 +121,15 @@ void ConfigItem::updateMenu(void)
*/
if (sym && list->rootEntry == menu)
break;
- setPixmap(promptColIdx, list->menuPix);
+ setIcon(promptColIdx, menuIcon);
} else {
if (sym)
break;
- setPixmap(promptColIdx, QIcon());
+ setIcon(promptColIdx, QIcon());
}
goto set_prompt;
case P_COMMENT:
- setPixmap(promptColIdx, QIcon());
+ setIcon(promptColIdx, QIcon());
goto set_prompt;
default:
;
@@ -144,7 +137,7 @@ void ConfigItem::updateMenu(void)
if (!sym)
goto set_prompt;
- setText(nameColIdx, QString::fromLocal8Bit(sym->name));
+ setText(nameColIdx, sym->name);
type = sym_get_type(sym);
switch (type) {
@@ -153,7 +146,7 @@ void ConfigItem::updateMenu(void)
char ch;
if (!sym_is_changeable(sym) && list->optMode == normalOpt) {
- setPixmap(promptColIdx, QIcon());
+ setIcon(promptColIdx, QIcon());
setText(noColIdx, QString());
setText(modColIdx, QString());
setText(yesColIdx, QString());
@@ -163,22 +156,22 @@ void ConfigItem::updateMenu(void)
switch (expr) {
case yes:
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
- setPixmap(promptColIdx, list->choiceYesPix);
+ setIcon(promptColIdx, choiceYesIcon);
else
- setPixmap(promptColIdx, list->symbolYesPix);
+ setIcon(promptColIdx, symbolYesIcon);
setText(yesColIdx, "Y");
ch = 'Y';
break;
case mod:
- setPixmap(promptColIdx, list->symbolModPix);
+ setIcon(promptColIdx, symbolModIcon);
setText(modColIdx, "M");
ch = 'M';
break;
default:
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
- setPixmap(promptColIdx, list->choiceNoPix);
+ setIcon(promptColIdx, choiceNoIcon);
else
- setPixmap(promptColIdx, list->symbolNoPix);
+ setIcon(promptColIdx, symbolNoIcon);
setText(noColIdx, "N");
ch = 'N';
break;
@@ -274,7 +267,7 @@ void ConfigLineEdit::show(ConfigItem* i)
{
item = i;
if (sym_get_string_value(item->menu->sym))
- setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym)));
+ setText(sym_get_string_value(item->menu->sym));
else
setText(QString());
Parent::show();
@@ -289,7 +282,7 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
case Qt::Key_Return:
case Qt::Key_Enter:
sym_set_string_value(item->menu->sym, text().toLatin1());
- parent()->updateList(item);
+ parent()->updateList();
break;
default:
Parent::keyPressEvent(e);
@@ -303,9 +296,6 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
ConfigList::ConfigList(ConfigView* p, const char *name)
: Parent(p),
updateAll(false),
- symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
- choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
- menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt),
rootEntry(0), headerPopup(0)
{
@@ -316,10 +306,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
setVerticalScrollMode(ScrollPerPixel);
setHorizontalScrollMode(ScrollPerPixel);
- if (mode == symbolMode)
- setHeaderLabels(QStringList() << "Item" << "Name" << "N" << "M" << "Y" << "Value");
- else
- setHeaderLabels(QStringList() << "Option" << "Name" << "N" << "M" << "Y" << "Value");
+ setHeaderLabels(QStringList() << "Option" << "Name" << "N" << "M" << "Y" << "Value");
connect(this, SIGNAL(itemSelectionChanged(void)),
SLOT(updateSelection(void)));
@@ -334,7 +321,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
}
- addColumn(promptColIdx);
+ showColumn(promptColIdx);
reinit();
}
@@ -352,21 +339,33 @@ bool ConfigList::menuSkip(struct menu *menu)
void ConfigList::reinit(void)
{
- removeColumn(dataColIdx);
- removeColumn(yesColIdx);
- removeColumn(modColIdx);
- removeColumn(noColIdx);
- removeColumn(nameColIdx);
+ hideColumn(dataColIdx);
+ hideColumn(yesColIdx);
+ hideColumn(modColIdx);
+ hideColumn(noColIdx);
+ hideColumn(nameColIdx);
if (showName)
- addColumn(nameColIdx);
+ showColumn(nameColIdx);
if (showRange) {
- addColumn(noColIdx);
- addColumn(modColIdx);
- addColumn(yesColIdx);
+ showColumn(noColIdx);
+ showColumn(modColIdx);
+ showColumn(yesColIdx);
}
if (showData)
- addColumn(dataColIdx);
+ showColumn(dataColIdx);
+
+ updateListAll();
+}
+
+void ConfigList::setOptionMode(QAction *action)
+{
+ if (action == showNormalAction)
+ optMode = normalOpt;
+ else if (action == showAllAction)
+ optMode = allOpt;
+ else
+ optMode = promptOpt;
updateListAll();
}
@@ -400,11 +399,6 @@ void ConfigList::updateSelection(void)
struct menu *menu;
enum prop_type type;
- if (mode == symbolMode)
- setHeaderLabels(QStringList() << "Item" << "Name" << "N" << "M" << "Y" << "Value");
- else
- setHeaderLabels(QStringList() << "Option" << "Name" << "N" << "M" << "Y" << "Value");
-
if (selectedItems().count() == 0)
return;
@@ -421,15 +415,15 @@ void ConfigList::updateSelection(void)
emit menuSelected(menu);
}
-void ConfigList::updateList(ConfigItem* item)
+void ConfigList::updateList()
{
ConfigItem* last = 0;
+ ConfigItem *item;
if (!rootEntry) {
if (mode != listMode)
goto update;
QTreeWidgetItemIterator it(this);
- ConfigItem* item;
while (*it) {
item = (ConfigItem*)(*it);
@@ -451,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item)
}
if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
rootEntry->sym && rootEntry->prompt) {
- item = last ? last->nextSibling() : firstChild();
+ item = last ? last->nextSibling() : nullptr;
if (!item)
item = new ConfigItem(this, last, rootEntry, true);
else
@@ -463,7 +457,7 @@ void ConfigList::updateList(ConfigItem* item)
return;
}
update:
- updateMenuList(this, rootEntry);
+ updateMenuList(rootEntry);
update();
resizeColumnToContents(0);
}
@@ -488,7 +482,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val)
return;
if (oldval == no && item->menu->list)
item->setExpanded(true);
- parent()->updateList(item);
+ parent()->updateList();
break;
}
}
@@ -522,7 +516,7 @@ void ConfigList::changeValue(ConfigItem* item)
item->setExpanded(true);
}
if (oldexpr != newexpr)
- parent()->updateList(item);
+ parent()->updateList();
break;
case S_INT:
case S_HEX:
@@ -541,11 +535,11 @@ void ConfigList::setRootMenu(struct menu *menu)
type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN;
if (type != P_MENU)
return;
- updateMenuList(this, 0);
+ updateMenuList(0);
rootEntry = menu;
updateListAll();
if (currentItem()) {
- currentItem()->setSelected(hasFocus());
+ setSelected(currentItem(), hasFocus());
scrollToItem(currentItem());
}
}
@@ -645,7 +639,7 @@ hide:
}
}
-void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu)
+void ConfigList::updateMenuList(struct menu *menu)
{
struct menu* child;
ConfigItem* item;
@@ -654,19 +648,19 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu)
enum prop_type type;
if (!menu) {
- while (parent->topLevelItemCount() > 0)
+ while (topLevelItemCount() > 0)
{
- delete parent->takeTopLevelItem(0);
+ delete takeTopLevelItem(0);
}
return;
}
- last = (ConfigItem*)parent->topLevelItem(0);
+ last = (ConfigItem *)topLevelItem(0);
if (last && !last->goParent)
last = 0;
for (child = menu->list; child; child = child->next) {
- item = last ? last->nextSibling() : (ConfigItem*)parent->topLevelItem(0);
+ item = last ? last->nextSibling() : (ConfigItem *)topLevelItem(0);
type = child->prompt ? child->prompt->type : P_UNKNOWN;
switch (mode) {
@@ -687,7 +681,7 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu)
if (!child->sym && !child->list && !child->prompt)
continue;
if (!item || item->menu != child)
- item = new ConfigItem(parent, last, child, visible);
+ item = new ConfigItem(this, last, child, visible);
else
item->testUpdateMenu(visible);
@@ -700,7 +694,7 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu)
}
hide:
if (item && item->menu == child) {
- last = (ConfigItem*)parent->topLevelItem(0);
+ last = (ConfigItem *)topLevelItem(0);
if (last == item)
last = 0;
else while (last->nextSibling() != item)
@@ -791,7 +785,7 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e)
idx = header()->logicalIndexAt(x);
switch (idx) {
case promptColIdx:
- icon = item->pixmap(promptColIdx);
+ icon = item->icon(promptColIdx);
if (!icon.isNull()) {
int off = header()->sectionPosition(0) + visualRect(indexAt(p)).x() + 4; // 4 is Hardcoded image offset. There might be a way to do it properly.
if (x >= off && x < off + icon.availableSizes().first().width()) {
@@ -802,7 +796,8 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e)
break;
ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
if (ptype == P_MENU && rootEntry != menu &&
- mode != fullMode && mode != menuMode)
+ mode != fullMode && mode != menuMode &&
+ mode != listMode)
emit menuSelected(menu);
else
changeValue(item);
@@ -852,7 +847,7 @@ void ConfigList::mouseDoubleClickEvent(QMouseEvent* e)
if (!menu)
goto skip;
ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
- if (ptype == P_MENU) {
+ if (ptype == P_MENU && mode != listMode) {
if (mode == singleMode)
emit itemSelected(menu);
else if (mode == symbolMode)
@@ -873,7 +868,7 @@ void ConfigList::focusInEvent(QFocusEvent *e)
ConfigItem* item = (ConfigItem *)currentItem();
if (item) {
- item->setSelected(true);
+ setSelected(item, true);
menu = item->menu;
}
emit gotFocus(menu);
@@ -881,46 +876,46 @@ void ConfigList::focusInEvent(QFocusEvent *e)
void ConfigList::contextMenuEvent(QContextMenuEvent *e)
{
- if (e->y() <= header()->geometry().bottom()) {
- if (!headerPopup) {
- QAction *action;
-
- headerPopup = new QMenu(this);
- action = new QAction("Show Name", this);
- action->setCheckable(true);
- connect(action, SIGNAL(toggled(bool)),
- parent(), SLOT(setShowName(bool)));
- connect(parent(), SIGNAL(showNameChanged(bool)),
- action, SLOT(setOn(bool)));
- action->setChecked(showName);
- headerPopup->addAction(action);
- action = new QAction("Show Range", this);
- action->setCheckable(true);
- connect(action, SIGNAL(toggled(bool)),
- parent(), SLOT(setShowRange(bool)));
- connect(parent(), SIGNAL(showRangeChanged(bool)),
- action, SLOT(setOn(bool)));
- action->setChecked(showRange);
- headerPopup->addAction(action);
- action = new QAction("Show Data", this);
- action->setCheckable(true);
- connect(action, SIGNAL(toggled(bool)),
- parent(), SLOT(setShowData(bool)));
- connect(parent(), SIGNAL(showDataChanged(bool)),
- action, SLOT(setOn(bool)));
- action->setChecked(showData);
- headerPopup->addAction(action);
- }
- headerPopup->exec(e->globalPos());
- e->accept();
- } else
- e->ignore();
+ if (!headerPopup) {
+ QAction *action;
+
+ headerPopup = new QMenu(this);
+ action = new QAction("Show Name", this);
+ action->setCheckable(true);
+ connect(action, SIGNAL(toggled(bool)),
+ parent(), SLOT(setShowName(bool)));
+ connect(parent(), SIGNAL(showNameChanged(bool)),
+ action, SLOT(setChecked(bool)));
+ action->setChecked(showName);
+ headerPopup->addAction(action);
+
+ action = new QAction("Show Range", this);
+ action->setCheckable(true);
+ connect(action, SIGNAL(toggled(bool)),
+ parent(), SLOT(setShowRange(bool)));
+ connect(parent(), SIGNAL(showRangeChanged(bool)),
+ action, SLOT(setChecked(bool)));
+ action->setChecked(showRange);
+ headerPopup->addAction(action);
+
+ action = new QAction("Show Data", this);
+ action->setCheckable(true);
+ connect(action, SIGNAL(toggled(bool)),
+ parent(), SLOT(setShowData(bool)));
+ connect(parent(), SIGNAL(showDataChanged(bool)),
+ action, SLOT(setChecked(bool)));
+ action->setChecked(showData);
+ headerPopup->addAction(action);
+ }
+
+ headerPopup->exec(e->globalPos());
+ e->accept();
}
ConfigView*ConfigView::viewList;
-QAction *ConfigView::showNormalAction;
-QAction *ConfigView::showAllAction;
-QAction *ConfigView::showPromptAction;
+QAction *ConfigList::showNormalAction;
+QAction *ConfigList::showAllAction;
+QAction *ConfigList::showPromptAction;
ConfigView::ConfigView(QWidget* parent, const char *name)
: Parent(parent)
@@ -951,18 +946,6 @@ ConfigView::~ConfigView(void)
}
}
-void ConfigView::setOptionMode(QAction *act)
-{
- if (act == showNormalAction)
- list->optMode = normalOpt;
- else if (act == showAllAction)
- list->optMode = allOpt;
- else
- list->optMode = promptOpt;
-
- list->updateListAll();
-}
-
void ConfigView::setShowName(bool b)
{
if (list->showName != b) {
@@ -1001,12 +984,12 @@ void ConfigList::setAllOpen(bool open)
}
}
-void ConfigView::updateList(ConfigItem* item)
+void ConfigView::updateList()
{
ConfigView* v;
for (v = viewList; v; v = v->nextView)
- v->list->updateList(item);
+ v->list->updateList();
}
void ConfigView::updateListAll(void)
@@ -1021,7 +1004,7 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
: Parent(parent), sym(0), _menu(0)
{
setObjectName(name);
-
+ setOpenLinks(false);
if (!objectName().isEmpty()) {
configSettings->beginGroup(objectName());
@@ -1029,6 +1012,16 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
configSettings->endGroup();
connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
}
+
+ contextMenu = createStandardContextMenu();
+ QAction *action = new QAction("Show Debug Info", contextMenu);
+
+ action->setCheckable(true);
+ connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
+ connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setChecked(bool)));
+ action->setChecked(showDebug());
+ contextMenu->addSeparator();
+ contextMenu->addAction(action);
}
void ConfigInfoView::saveSettings(void)
@@ -1083,108 +1076,114 @@ void ConfigInfoView::symbolInfo(void)
void ConfigInfoView::menuInfo(void)
{
struct symbol* sym;
- QString head, debug, help;
+ QString info;
+ QTextStream stream(&info);
sym = _menu->sym;
if (sym) {
if (_menu->prompt) {
- head += "<big><b>";
- head += print_filter(_menu->prompt->text);
- head += "</b></big>";
+ stream << "<big><b>";
+ stream << print_filter(_menu->prompt->text);
+ stream << "</b></big>";
if (sym->name) {
- head += " (";
+ stream << " (";
if (showDebug())
- head += QString().sprintf("<a href=\"s%p\">", sym);
- head += print_filter(sym->name);
+ stream << "<a href=\"s" << sym->name << "\">";
+ stream << print_filter(sym->name);
if (showDebug())
- head += "</a>";
- head += ")";
+ stream << "</a>";
+ stream << ")";
}
} else if (sym->name) {
- head += "<big><b>";
+ stream << "<big><b>";
if (showDebug())
- head += QString().sprintf("<a href=\"s%p\">", sym);
- head += print_filter(sym->name);
+ stream << "<a href=\"s" << sym->name << "\">";
+ stream << print_filter(sym->name);
if (showDebug())
- head += "</a>";
- head += "</b></big>";
+ stream << "</a>";
+ stream << "</b></big>";
}
- head += "<br><br>";
+ stream << "<br><br>";
if (showDebug())
- debug = debug_info(sym);
+ stream << debug_info(sym);
- struct gstr help_gstr = str_new();
- menu_get_ext_help(_menu, &help_gstr);
- help = print_filter(str_get(&help_gstr));
- str_free(&help_gstr);
} else if (_menu->prompt) {
- head += "<big><b>";
- head += print_filter(_menu->prompt->text);
- head += "</b></big><br><br>";
+ stream << "<big><b>";
+ stream << print_filter(_menu->prompt->text);
+ stream << "</b></big><br><br>";
if (showDebug()) {
if (_menu->prompt->visible.expr) {
- debug += "&nbsp;&nbsp;dep: ";
- expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
- debug += "<br><br>";
+ stream << "&nbsp;&nbsp;dep: ";
+ expr_print(_menu->prompt->visible.expr,
+ expr_print_help, &stream, E_NONE);
+ stream << "<br><br>";
}
}
}
if (showDebug())
- debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
+ stream << "defined at " << _menu->file->name << ":"
+ << _menu->lineno << "<br><br>";
- setText(head + debug + help);
+ setText(info);
}
QString ConfigInfoView::debug_info(struct symbol *sym)
{
QString debug;
+ QTextStream stream(&debug);
- debug += "type: ";
- debug += print_filter(sym_type_name(sym->type));
+ stream << "type: ";
+ stream << print_filter(sym_type_name(sym->type));
if (sym_is_choice(sym))
- debug += " (choice)";
+ stream << " (choice)";
debug += "<br>";
if (sym->rev_dep.expr) {
- debug += "reverse dep: ";
- expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE);
- debug += "<br>";
+ stream << "reverse dep: ";
+ expr_print(sym->rev_dep.expr, expr_print_help, &stream, E_NONE);
+ stream << "<br>";
}
for (struct property *prop = sym->prop; prop; prop = prop->next) {
switch (prop->type) {
case P_PROMPT:
case P_MENU:
- debug += QString().sprintf("prompt: <a href=\"m%p\">", prop->menu);
- debug += print_filter(prop->text);
- debug += "</a><br>";
+ stream << "prompt: <a href=\"m" << sym->name << "\">";
+ stream << print_filter(prop->text);
+ stream << "</a><br>";
break;
case P_DEFAULT:
case P_SELECT:
case P_RANGE:
- debug += prop_get_type_name(prop->type);
- debug += ": ";
- expr_print(prop->expr, expr_print_help, &debug, E_NONE);
- debug += "<br>";
+ case P_COMMENT:
+ case P_IMPLY:
+ case P_SYMBOL:
+ stream << prop_get_type_name(prop->type);
+ stream << ": ";
+ expr_print(prop->expr, expr_print_help,
+ &stream, E_NONE);
+ stream << "<br>";
break;
case P_CHOICE:
if (sym_is_choice(sym)) {
- debug += "choice: ";
- expr_print(prop->expr, expr_print_help, &debug, E_NONE);
- debug += "<br>";
+ stream << "choice: ";
+ expr_print(prop->expr, expr_print_help,
+ &stream, E_NONE);
+ stream << "<br>";
}
break;
default:
- debug += "unknown property: ";
- debug += prop_get_type_name(prop->type);
- debug += "<br>";
+ stream << "unknown property: ";
+ stream << prop_get_type_name(prop->type);
+ stream << "<br>";
}
if (prop->visible.expr) {
- debug += "&nbsp;&nbsp;&nbsp;&nbsp;dep: ";
- expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE);
- debug += "<br>";
+ stream << "&nbsp;&nbsp;&nbsp;&nbsp;dep: ";
+ expr_print(prop->visible.expr, expr_print_help,
+ &stream, E_NONE);
+ stream << "<br>";
}
}
- debug += "<br>";
+ stream << "<br>";
return debug;
}
@@ -1222,46 +1221,81 @@ QString ConfigInfoView::print_filter(const QString &str)
void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *str)
{
- QString* text = reinterpret_cast<QString*>(data);
- QString str2 = print_filter(str);
+ QTextStream *stream = reinterpret_cast<QTextStream *>(data);
if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) {
- *text += QString().sprintf("<a href=\"s%p\">", sym);
- *text += str2;
- *text += "</a>";
- } else
- *text += str2;
+ *stream << "<a href=\"s" << sym->name << "\">";
+ *stream << print_filter(str);
+ *stream << "</a>";
+ } else {
+ *stream << print_filter(str);
+ }
}
-QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos)
+void ConfigInfoView::clicked(const QUrl &url)
{
- QMenu* popup = Parent::createStandardContextMenu(pos);
- QAction* action = new QAction("Show Debug Info", popup);
+ QByteArray str = url.toEncoded();
+ const std::size_t count = str.size();
+ char *data = new char[count + 1];
+ struct symbol **result;
+ struct menu *m = NULL;
- action->setCheckable(true);
- connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
- connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
- action->setChecked(showDebug());
- popup->addSeparator();
- popup->addAction(action);
- return popup;
+ if (count < 1) {
+ delete[] data;
+ return;
+ }
+
+ memcpy(data, str.constData(), count);
+ data[count] = '\0';
+
+ /* Seek for exact match */
+ data[0] = '^';
+ strcat(data, "$");
+ result = sym_re_search(data);
+ if (!result) {
+ delete[] data;
+ return;
+ }
+
+ sym = *result;
+
+ /* Seek for the menu which holds the symbol */
+ for (struct property *prop = sym->prop; prop; prop = prop->next) {
+ if (prop->type != P_PROMPT && prop->type != P_MENU)
+ continue;
+ m = prop->menu;
+ break;
+ }
+
+ if (!m) {
+ /* Symbol is not visible as a menu */
+ symbolInfo();
+ emit showDebugChanged(true);
+ } else {
+ emit menuSelected(m);
+ }
+
+ free(result);
+ delete data;
}
-void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e)
+void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
{
- Parent::contextMenuEvent(e);
+ contextMenu->popup(event->globalPos());
+ event->accept();
}
-ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name)
+ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
: Parent(parent), result(NULL)
{
- setObjectName(name);
+ setObjectName("search");
setWindowTitle("Search Config");
QVBoxLayout* layout1 = new QVBoxLayout(this);
layout1->setContentsMargins(11, 11, 11, 11);
layout1->setSpacing(6);
- QHBoxLayout* layout2 = new QHBoxLayout(0);
+
+ QHBoxLayout* layout2 = new QHBoxLayout();
layout2->setContentsMargins(0, 0, 0, 0);
layout2->setSpacing(6);
layout2->addWidget(new QLabel("Find:", this));
@@ -1276,9 +1310,9 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
split = new QSplitter(this);
split->setOrientation(Qt::Vertical);
- list = new ConfigView(split, name);
+ list = new ConfigView(split, "search");
list->list->mode = listMode;
- info = new ConfigInfoView(split, name);
+ info = new ConfigInfoView(split, "search");
connect(list->list, SIGNAL(menuChanged(struct menu *)),
info, SLOT(setInfo(struct menu *)));
connect(list->list, SIGNAL(menuChanged(struct menu *)),
@@ -1286,25 +1320,23 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
layout1->addWidget(split);
- if (name) {
- QVariant x, y;
- int width, height;
- bool ok;
+ QVariant x, y;
+ int width, height;
+ bool ok;
- configSettings->beginGroup(name);
- width = configSettings->value("/window width", parent->width() / 2).toInt();
- height = configSettings->value("/window height", parent->height() / 2).toInt();
- resize(width, height);
- x = configSettings->value("/window x");
- y = configSettings->value("/window y");
- if ((x.isValid())&&(y.isValid()))
- move(x.toInt(), y.toInt());
- QList<int> sizes = configSettings->readSizes("/split", &ok);
- if (ok)
- split->setSizes(sizes);
- configSettings->endGroup();
- connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
- }
+ configSettings->beginGroup("search");
+ width = configSettings->value("/window width", parent->width() / 2).toInt();
+ height = configSettings->value("/window height", parent->height() / 2).toInt();
+ resize(width, height);
+ x = configSettings->value("/window x");
+ y = configSettings->value("/window y");
+ if (x.isValid() && y.isValid())
+ move(x.toInt(), y.toInt());
+ QList<int> sizes = configSettings->readSizes("/split", &ok);
+ if (ok)
+ split->setSizes(sizes);
+ configSettings->endGroup();
+ connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
}
void ConfigSearchWindow::saveSettings(void)
@@ -1346,7 +1378,6 @@ void ConfigSearchWindow::search(void)
ConfigMainWindow::ConfigMainWindow(void)
: searchWindow(0)
{
- QMenuBar* menu;
bool ok = true;
QVariant x, y;
int width, height;
@@ -1367,6 +1398,15 @@ ConfigMainWindow::ConfigMainWindow(void)
if ((x.isValid())&&(y.isValid()))
move(x.toInt(), y.toInt());
+ // set up icons
+ ConfigItem::symbolYesIcon = QIcon(QPixmap(xpm_symbol_yes));
+ ConfigItem::symbolModIcon = QIcon(QPixmap(xpm_symbol_mod));
+ ConfigItem::symbolNoIcon = QIcon(QPixmap(xpm_symbol_no));
+ ConfigItem::choiceYesIcon = QIcon(QPixmap(xpm_choice_yes));
+ ConfigItem::choiceNoIcon = QIcon(QPixmap(xpm_choice_no));
+ ConfigItem::menuIcon = QIcon(QPixmap(xpm_menu));
+ ConfigItem::menubackIcon = QIcon(QPixmap(xpm_menuback));
+
QWidget *widget = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(widget);
setCentralWidget(widget);
@@ -1397,23 +1437,23 @@ ConfigMainWindow::ConfigMainWindow(void)
setTabOrder(configList, helpText);
configList->setFocus();
- menu = menuBar();
- toolBar = new QToolBar("Tools", this);
- addToolBar(toolBar);
-
backAction = new QAction(QPixmap(xpm_back), "Back", this);
- connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack()));
- backAction->setEnabled(false);
+ connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack()));
+
QAction *quitAction = new QAction("&Quit", this);
quitAction->setShortcut(Qt::CTRL + Qt::Key_Q);
- connect(quitAction, SIGNAL(triggered(bool)), SLOT(close()));
+ connect(quitAction, SIGNAL(triggered(bool)), SLOT(close()));
+
QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this);
loadAction->setShortcut(Qt::CTRL + Qt::Key_L);
- connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig()));
+ connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig()));
+
saveAction = new QAction(QPixmap(xpm_save), "&Save", this);
saveAction->setShortcut(Qt::CTRL + Qt::Key_S);
- connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig()));
+ connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig()));
+
conf_set_changed_callback(conf_changed);
+
// Set saveAction's initial state
conf_changed();
configname = xstrdup(conf_get_configname());
@@ -1446,17 +1486,17 @@ ConfigMainWindow::ConfigMainWindow(void)
QActionGroup *optGroup = new QActionGroup(this);
optGroup->setExclusive(true);
- connect(optGroup, SIGNAL(triggered(QAction*)), configView,
+ connect(optGroup, SIGNAL(triggered(QAction*)), configList,
SLOT(setOptionMode(QAction *)));
- connect(optGroup, SIGNAL(triggered(QAction *)), menuView,
+ connect(optGroup, SIGNAL(triggered(QAction *)), menuList,
SLOT(setOptionMode(QAction *)));
- configView->showNormalAction = new QAction("Show Normal Options", optGroup);
- configView->showAllAction = new QAction("Show All Options", optGroup);
- configView->showPromptAction = new QAction("Show Prompt Options", optGroup);
- configView->showNormalAction->setCheckable(true);
- configView->showAllAction->setCheckable(true);
- configView->showPromptAction->setCheckable(true);
+ ConfigList::showNormalAction = new QAction("Show Normal Options", optGroup);
+ ConfigList::showNormalAction->setCheckable(true);
+ ConfigList::showAllAction = new QAction("Show All Options", optGroup);
+ ConfigList::showAllAction->setCheckable(true);
+ ConfigList::showPromptAction = new QAction("Show Prompt Options", optGroup);
+ ConfigList::showPromptAction->setCheckable(true);
QAction *showDebugAction = new QAction("Show Debug Info", this);
showDebugAction->setCheckable(true);
@@ -1469,6 +1509,7 @@ ConfigMainWindow::ConfigMainWindow(void)
connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout()));
// init tool bar
+ QToolBar *toolBar = addToolBar("Tools");
toolBar->addAction(backAction);
toolBar->addSeparator();
toolBar->addAction(loadAction);
@@ -1478,33 +1519,35 @@ ConfigMainWindow::ConfigMainWindow(void)
toolBar->addAction(splitViewAction);
toolBar->addAction(fullViewAction);
- // create config menu
- QMenu* config = menu->addMenu("&File");
- config->addAction(loadAction);
- config->addAction(saveAction);
- config->addAction(saveAsAction);
- config->addSeparator();
- config->addAction(quitAction);
+ // create file menu
+ QMenu *menu = menuBar()->addMenu("&File");
+ menu->addAction(loadAction);
+ menu->addAction(saveAction);
+ menu->addAction(saveAsAction);
+ menu->addSeparator();
+ menu->addAction(quitAction);
// create edit menu
- QMenu* editMenu = menu->addMenu("&Edit");
- editMenu->addAction(searchAction);
+ menu = menuBar()->addMenu("&Edit");
+ menu->addAction(searchAction);
// create options menu
- QMenu* optionMenu = menu->addMenu("&Option");
- optionMenu->addAction(showNameAction);
- optionMenu->addAction(showRangeAction);
- optionMenu->addAction(showDataAction);
- optionMenu->addSeparator();
- optionMenu->addActions(optGroup->actions());
- optionMenu->addSeparator();
- optionMenu->addAction(showDebugAction);
+ menu = menuBar()->addMenu("&Option");
+ menu->addAction(showNameAction);
+ menu->addAction(showRangeAction);
+ menu->addAction(showDataAction);
+ menu->addSeparator();
+ menu->addActions(optGroup->actions());
+ menu->addSeparator();
+ menu->addAction(showDebugAction);
// create help menu
- menu->addSeparator();
- QMenu* helpMenu = menu->addMenu("&Help");
- helpMenu->addAction(showIntroAction);
- helpMenu->addAction(showAboutAction);
+ menu = menuBar()->addMenu("&Help");
+ menu->addAction(showIntroAction);
+ menu->addAction(showAboutAction);
+
+ connect (helpText, SIGNAL (anchorClicked (const QUrl &)),
+ helpText, SLOT (clicked (const QUrl &)) );
connect(configList, SIGNAL(menuChanged(struct menu *)),
helpText, SLOT(setInfo(struct menu *)));
@@ -1604,28 +1647,18 @@ void ConfigMainWindow::saveConfigAs(void)
void ConfigMainWindow::searchConfig(void)
{
if (!searchWindow)
- searchWindow = new ConfigSearchWindow(this, "search");
+ searchWindow = new ConfigSearchWindow(this);
searchWindow->show();
}
void ConfigMainWindow::changeItens(struct menu *menu)
{
configList->setRootMenu(menu);
-
- if (configList->rootEntry->parent == &rootmenu)
- backAction->setEnabled(false);
- else
- backAction->setEnabled(true);
}
void ConfigMainWindow::changeMenu(struct menu *menu)
{
menuList->setRootMenu(menu);
-
- if (menuList->rootEntry->parent == &rootmenu)
- backAction->setEnabled(false);
- else
- backAction->setEnabled(true);
}
void ConfigMainWindow::setMenuLink(struct menu *menu)
@@ -1645,22 +1678,26 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
return;
list->setRootMenu(parent);
break;
- case symbolMode:
+ case menuMode:
if (menu->flags & MENU_ROOT) {
- configList->setRootMenu(menu);
+ menuList->setRootMenu(menu);
configList->clearSelection();
- list = menuList;
- } else {
list = configList;
+ } else {
parent = menu_get_parent_menu(menu->parent);
if (!parent)
return;
- item = menuList->findConfigItem(parent);
+
+ /* Select the config view */
+ item = configList->findConfigItem(parent);
if (item) {
- item->setSelected(true);
- menuList->scrollToItem(item);
+ configList->setSelected(item, true);
+ configList->scrollToItem(item);
}
- list->setRootMenu(parent);
+
+ menuList->setRootMenu(parent);
+ menuList->clearSelection();
+ list = menuList;
}
break;
case fullMode:
@@ -1673,9 +1710,10 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
if (list) {
item = list->findConfigItem(menu);
if (item) {
- item->setSelected(true);
+ list->setSelected(item, true);
list->scrollToItem(item);
list->setFocus();
+ helpText->setInfo(menu);
}
}
}
@@ -1688,25 +1726,10 @@ void ConfigMainWindow::listFocusChanged(void)
void ConfigMainWindow::goBack(void)
{
- ConfigItem* item, *oldSelection;
-
- configList->setParentMenu();
if (configList->rootEntry == &rootmenu)
- backAction->setEnabled(false);
-
- if (menuList->selectedItems().count() == 0)
return;
- item = (ConfigItem*)menuList->selectedItems().first();
- oldSelection = item;
- while (item) {
- if (item->menu == configList->rootEntry) {
- oldSelection->setSelected(false);
- item->setSelected(true);
- break;
- }
- item = (ConfigItem*)item->parent();
- }
+ configList->setParentMenu();
}
void ConfigMainWindow::showSingleView(void)
@@ -1718,6 +1741,8 @@ void ConfigMainWindow::showSingleView(void)
fullViewAction->setEnabled(true);
fullViewAction->setChecked(false);
+ backAction->setEnabled(true);
+
menuView->hide();
menuList->setRootMenu(0);
configList->mode = singleMode;
@@ -1737,6 +1762,8 @@ void ConfigMainWindow::showSplitView(void)
fullViewAction->setEnabled(true);
fullViewAction->setChecked(false);
+ backAction->setEnabled(false);
+
configList->mode = menuMode;
if (configList->rootEntry == &rootmenu)
configList->updateListAll();
@@ -1760,6 +1787,8 @@ void ConfigMainWindow::showFullView(void)
fullViewAction->setEnabled(false);
fullViewAction->setChecked(true);
+ backAction->setEnabled(false);
+
menuView->hide();
menuList->setRootMenu(0);
configList->mode = fullMode;
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index c879d79ce8..f97376a812 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,17 +3,17 @@
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
-#include <QTextBrowser>
-#include <QTreeWidget>
-#include <QMainWindow>
+#include <QCheckBox>
+#include <QDialog>
#include <QHeaderView>
-#include <qsettings.h>
+#include <QLineEdit>
+#include <QMainWindow>
#include <QPushButton>
#include <QSettings>
-#include <QLineEdit>
#include <QSplitter>
-#include <QCheckBox>
-#include <QDialog>
+#include <QTextBrowser>
+#include <QTreeWidget>
+
#include "expr.h"
class ConfigView;
@@ -30,7 +30,7 @@ public:
};
enum colIdx {
- promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
+ promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx
};
enum listMode {
singleMode, menuMode, symbolMode, fullMode, listMode
@@ -45,11 +45,17 @@ class ConfigList : public QTreeWidget {
public:
ConfigList(ConfigView* p, const char *name = 0);
void reinit(void);
+ ConfigItem* findConfigItem(struct menu *);
ConfigView* parent(void) const
{
return (ConfigView*)Parent::parent();
}
- ConfigItem* findConfigItem(struct menu *);
+ void setSelected(QTreeWidgetItem *item, bool enable) {
+ for (int i = 0; i < selectedItems().size(); i++)
+ selectedItems().at(i)->setSelected(false);
+
+ item->setSelected(enable);
+ }
protected:
void keyPressEvent(QKeyEvent *e);
@@ -63,11 +69,13 @@ protected:
public slots:
void setRootMenu(struct menu *menu);
- void updateList(ConfigItem *item);
+ void updateList();
void setValue(ConfigItem* item, tristate val);
void changeValue(ConfigItem* item);
void updateSelection(void);
void saveSettings(void);
+ void setOptionMode(QAction *action);
+
signals:
void menuChanged(struct menu *menu);
void menuSelected(struct menu *menu);
@@ -79,39 +87,19 @@ public:
void updateListAll(void)
{
updateAll = true;
- updateList(NULL);
+ updateList();
updateAll = false;
}
- ConfigList* listView()
- {
- return this;
- }
- ConfigItem* firstChild() const
- {
- return (ConfigItem *)children().first();
- }
- void addColumn(colIdx idx)
- {
- showColumn(idx);
- }
- void removeColumn(colIdx idx)
- {
- hideColumn(idx);
- }
void setAllOpen(bool open);
void setParentMenu(void);
bool menuSkip(struct menu *);
void updateMenuList(ConfigItem *parent, struct menu*);
- void updateMenuList(ConfigList *parent, struct menu*);
+ void updateMenuList(struct menu *menu);
bool updateAll;
- QPixmap symbolYesPix, symbolModPix, symbolNoPix;
- QPixmap choiceYesPix, choiceNoPix;
- QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
-
bool showName, showRange, showData;
enum listMode mode;
enum optionMode optMode;
@@ -119,6 +107,8 @@ public:
QPalette disabledColorGroup;
QPalette inactivedColorGroup;
QMenu* headerPopup;
+
+ static QAction *showNormalAction, *showAllAction, *showPromptAction;
};
class ConfigItem : public QTreeWidgetItem {
@@ -166,28 +156,16 @@ public:
return ret;
}
- void setText(colIdx idx, const QString& text)
- {
- Parent::setText(idx, text);
- }
- QString text(colIdx idx) const
- {
- return Parent::text(idx);
- }
- void setPixmap(colIdx idx, const QIcon &icon)
- {
- Parent::setIcon(idx, icon);
- }
- const QIcon pixmap(colIdx idx) const
- {
- return icon(idx);
- }
// TODO: Implement paintCell
ConfigItem* nextItem;
struct menu *menu;
bool visible;
bool goParent;
+
+ static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon;
+ static QIcon choiceYesIcon, choiceNoIcon;
+ static QIcon menuIcon, menubackIcon;
};
class ConfigLineEdit : public QLineEdit {
@@ -212,7 +190,7 @@ class ConfigView : public QWidget {
public:
ConfigView(QWidget* parent, const char *name = 0);
~ConfigView(void);
- static void updateList(ConfigItem* item);
+ static void updateList();
static void updateListAll(void);
bool showName(void) const { return list->showName; }
@@ -222,7 +200,6 @@ public slots:
void setShowName(bool);
void setShowRange(bool);
void setShowData(bool);
- void setOptionMode(QAction *);
signals:
void showNameChanged(bool);
void showRangeChanged(bool);
@@ -233,15 +210,12 @@ public:
static ConfigView* viewList;
ConfigView* nextView;
-
- static QAction *showNormalAction;
- static QAction *showAllAction;
- static QAction *showPromptAction;
};
class ConfigInfoView : public QTextBrowser {
Q_OBJECT
typedef class QTextBrowser Parent;
+ QMenu *contextMenu;
public:
ConfigInfoView(QWidget* parent, const char *name = 0);
bool showDebug(void) const { return _showDebug; }
@@ -250,6 +224,7 @@ public slots:
void setInfo(struct menu *menu);
void saveSettings(void);
void setShowDebug(bool);
+ void clicked (const QUrl &url);
signals:
void showDebugChanged(bool);
@@ -261,8 +236,7 @@ protected:
QString debug_info(struct symbol *sym);
static QString print_filter(const QString &str);
static void expr_print_help(void *data, struct symbol *sym, const char *str);
- QMenu *createStandardContextMenu(const QPoint & pos);
- void contextMenuEvent(QContextMenuEvent *e);
+ void contextMenuEvent(QContextMenuEvent *event);
struct symbol *sym;
struct menu *_menu;
@@ -273,7 +247,7 @@ class ConfigSearchWindow : public QDialog {
Q_OBJECT
typedef class QDialog Parent;
public:
- ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
+ ConfigSearchWindow(ConfigMainWindow *parent);
public slots:
void saveSettings(void);
@@ -323,7 +297,6 @@ protected:
ConfigView *configView;
ConfigList *configList;
ConfigInfoView *helpText;
- QToolBar *toolBar;
QAction *backAction;
QAction *singleViewAction;
QAction *splitViewAction;
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index e2f8504f5a..19857d18d8 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -143,6 +143,7 @@ my %depends;
my %selects;
my %prompts;
my %objects;
+my %config2kfile;
my $var;
my $iflevel = 0;
my @ifdeps;
@@ -201,6 +202,7 @@ sub read_kconfig {
if (/^\s*(menu)?config\s+(\S+)\s*$/) {
$state = "NEW";
$config = $2;
+ $config2kfile{"CONFIG_$config"} = $kconfig;
# Add depends for 'if' nesting
for (my $i = 0; $i < $iflevel; $i++) {
@@ -591,6 +593,20 @@ while ($repeat) {
}
my %setconfigs;
+my @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP});
+
+sub in_preserved_kconfigs {
+ my $kconfig = $config2kfile{$_[0]};
+ if (!defined($kconfig)) {
+ return 0;
+ }
+ foreach my $excl (@preserved_kconfigs) {
+ if($kconfig =~ /^$excl/) {
+ return 1;
+ }
+ }
+ return 0;
+}
# Finally, read the .config file and turn off any module enabled that
# we could not find a reason to keep enabled.
@@ -644,6 +660,11 @@ foreach my $line (@config_file) {
}
if (/^(CONFIG.*)=(m|y)/) {
+ if (in_preserved_kconfigs($1)) {
+ dprint "Preserve config $1";
+ print;
+ next;
+ }
if (defined($configs{$1})) {
if ($localyesconfig) {
$setconfigs{$1} = 'y';
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 3dc81397d0..ffa3ec65cc 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -15,15 +15,21 @@ struct symbol symbol_yes = {
.name = "y",
.curr = { "y", yes },
.flags = SYMBOL_CONST|SYMBOL_VALID,
-}, symbol_mod = {
+};
+
+struct symbol symbol_mod = {
.name = "m",
.curr = { "m", mod },
.flags = SYMBOL_CONST|SYMBOL_VALID,
-}, symbol_no = {
+};
+
+struct symbol symbol_no = {
.name = "n",
.curr = { "n", no },
.flags = SYMBOL_CONST|SYMBOL_VALID,
-}, symbol_empty = {
+};
+
+static struct symbol symbol_empty = {
.name = "",
.curr = { "", no },
.flags = SYMBOL_VALID,
@@ -31,7 +37,7 @@ struct symbol symbol_yes = {
struct symbol *sym_defconfig_list;
struct symbol *modules_sym;
-tristate modules_val;
+static tristate modules_val;
enum symbol_type sym_get_type(struct symbol *sym)
{
@@ -831,7 +837,7 @@ struct symbol *sym_lookup(const char *name, int flags)
memset(symbol, 0, sizeof(*symbol));
symbol->name = new_name;
symbol->type = S_UNKNOWN;
- symbol->flags |= flags;
+ symbol->flags = flags;
symbol->next = symbol_hash[hash];
symbol_hash[hash] = symbol;
diff --git a/scripts/kconfig/tests/rand_nested_choice/Kconfig b/scripts/kconfig/tests/rand_nested_choice/Kconfig
deleted file mode 100644
index 8350de7f73..0000000000
--- a/scripts/kconfig/tests/rand_nested_choice/Kconfig
+++ /dev/null
@@ -1,35 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-
-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
deleted file mode 100644
index 9e4b2db535..0000000000
--- a/scripts/kconfig/tests/rand_nested_choice/__init__.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-"""
-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
deleted file mode 100644
index 05450f3d4e..0000000000
--- a/scripts/kconfig/tests/rand_nested_choice/expected_stdout0
+++ /dev/null
@@ -1,2 +0,0 @@
-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
deleted file mode 100644
index 37ab295841..0000000000
--- a/scripts/kconfig/tests/rand_nested_choice/expected_stdout1
+++ /dev/null
@@ -1,4 +0,0 @@
-# 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
deleted file mode 100644
index 849ff47e98..0000000000
--- a/scripts/kconfig/tests/rand_nested_choice/expected_stdout2
+++ /dev/null
@@ -1,5 +0,0 @@
-# CONFIG_A is not set
-CONFIG_B=y
-# CONFIG_C is not set
-CONFIG_D=y
-CONFIG_E=y
diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 6ba4abaa30..26eb07fa81 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -231,7 +231,7 @@ static const char *image_boot_mode_name(unsigned int id)
return NULL;
}
-int image_boot_mode_id(const char *boot_mode_name)
+static int image_boot_mode_id(const char *boot_mode_name)
{
int i;
for (i = 0; boot_modes[i].name; i++)
@@ -250,7 +250,7 @@ static const char *image_nand_ecc_mode_name(unsigned int id)
return NULL;
}
-int image_nand_ecc_mode_id(const char *nand_ecc_mode_name)
+static int image_nand_ecc_mode_id(const char *nand_ecc_mode_name)
{
int i;
for (i = 0; nand_ecc_modes[i].name; i++)
diff --git a/scripts/mkublheader.c b/scripts/mkublheader.c
index 5464a80611..496ba0b500 100644
--- a/scripts/mkublheader.c
+++ b/scripts/mkublheader.c
@@ -45,7 +45,7 @@ struct ubl_header
uint32_t ldAddr; /* Address where image is copied to */
};
-void usage(char *prgname)
+static void usage(char *prgname)
{
printf( "Usage : %s [OPTION] FILE > HEADER\n"
"\n"
diff --git a/scripts/mxsimage.c b/scripts/mxsimage.c
index 81507d1924..d33c4c8a0a 100644
--- a/scripts/mxsimage.c
+++ b/scripts/mxsimage.c
@@ -439,7 +439,7 @@ int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx)
}
#endif
-uint32_t pbl_crc32(uint32_t in_crc, const char *buf, uint32_t len)
+static uint32_t pbl_crc32(uint32_t in_crc, const char *buf, uint32_t len)
{
uint32_t crc32_val;
int i;
diff --git a/scripts/omap4_usbboot.c b/scripts/omap4_usbboot.c
index 329668d1dd..44236259dc 100644
--- a/scripts/omap4_usbboot.c
+++ b/scripts/omap4_usbboot.c
@@ -43,21 +43,21 @@
#define host_print(fmt, arg...) printf(HFORMAT fmt TFORMAT, \
HOST_FORMAT, ##arg, TARGET_FORMAT)
-int usb_write(void *h, void const *data, int len)
+static int usb_write(void *h, void const *data, int len)
{
int actual;
return libusb_bulk_transfer(h, 0x01, (void *)data, len, &actual, 5000) ?
0 : actual;
}
-int usb_read(void *h, void *data, int len)
+static int usb_read(void *h, void *data, int len)
{
int actual;
return libusb_bulk_transfer(h, 0x81, data, len, &actual, 5000) ?
0 : actual;
}
-void panic(struct termios *t_restore)
+static void panic(struct termios *t_restore)
{
tcsetattr(STDIN_FILENO, TCSANOW, t_restore);
printf(HFORMAT, HOST_FORMAT);
@@ -70,7 +70,7 @@ struct thread_vars {
struct termios t_restore;
};
-void *listenerTask(void *argument)
+static void *listenerTask(void *argument)
{
struct thread_vars *vars = argument;
int c;
@@ -88,7 +88,7 @@ void *listenerTask(void *argument)
return NULL;
}
-int read_asic_id(struct libusb_device_handle *usb)
+static int read_asic_id(struct libusb_device_handle *usb)
{
#define LINEWIDTH 16
const uint32_t msg_getid = 0xF0030003;
@@ -189,7 +189,7 @@ struct file_data {
void *data;
};
-int process_file(struct libusb_device_handle *usb, const char *rootfs,
+static int process_file(struct libusb_device_handle *usb, const char *rootfs,
struct file_data *fd_vector, struct termios *t_restore)
{
uint32_t i, j, pos, size;
@@ -339,7 +339,7 @@ open_ok:
return ret;
}
-int usb_boot(struct libusb_device_handle *usb,
+static int usb_boot(struct libusb_device_handle *usb,
void *data, unsigned sz, const char *rootfs)
{
const uint32_t msg_boot = 0xF0030002;
diff --git a/scripts/pblimage.c b/scripts/pblimage.c
index 235af8aa11..3c3625cdd5 100644
--- a/scripts/pblimage.c
+++ b/scripts/pblimage.c
@@ -100,7 +100,7 @@ static void make_crc_table(void)
crc_table_valid = 1;
}
-uint32_t pbl_crc32(uint32_t in_crc, const char *buf, uint32_t len)
+static uint32_t pbl_crc32(uint32_t in_crc, const char *buf, uint32_t len)
{
uint32_t crc32_val;
int i;
diff --git a/scripts/socfpga_mkimage.c b/scripts/socfpga_mkimage.c
index 03150cce8d..73dfbeae3a 100644
--- a/scripts/socfpga_mkimage.c
+++ b/scripts/socfpga_mkimage.c
@@ -147,7 +147,7 @@ static const uint32_t crc_table[256] = {
0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
};
-uint32_t crc32(uint32_t crc, void *_buf, int length)
+static uint32_t crc32(uint32_t crc, void *_buf, int length)
{
uint8_t *buf = _buf;
diff --git a/scripts/tegra/context.c b/scripts/tegra/context.c
index 9d2fb27dc9..47e65d570b 100644
--- a/scripts/tegra/context.c
+++ b/scripts/tegra/context.c
@@ -17,6 +17,7 @@
#include "cbootimage.h"
#include "data_layout.h"
#include "set.h"
+#include "context.h"
void
cleanup_context(build_image_context *context)
diff --git a/scripts/tegra/t114/nvbctlib_t114.c b/scripts/tegra/t114/nvbctlib_t114.c
index 063882a905..3bda785f57 100644
--- a/scripts/tegra/t114/nvbctlib_t114.c
+++ b/scripts/tegra/t114/nvbctlib_t114.c
@@ -827,7 +827,7 @@ t114_set_sdram_param(build_image_context *context,
return 0;
}
-int
+static int
t114_getbl_param(u_int32_t set,
parse_token id,
u_int32_t *data,
@@ -862,7 +862,7 @@ t114_getbl_param(u_int32_t set,
return 0;
}
-int
+static int
t114_setbl_param(u_int32_t set,
parse_token id,
u_int32_t *data,
@@ -897,7 +897,7 @@ t114_setbl_param(u_int32_t set,
return 0;
}
-int
+static int
t114_bct_get_value(parse_token id, u_int32_t *data, u_int8_t *bct)
{
nvboot_config_table *bct_ptr = (nvboot_config_table *)bct;
@@ -981,7 +981,7 @@ t114_bct_get_value(parse_token id, u_int32_t *data, u_int8_t *bct)
return 0;
}
-int
+static int
t114_bct_set_value(parse_token id, u_int32_t data, u_int8_t *bct)
{
nvboot_config_table *bct_ptr = (nvboot_config_table *)bct;
@@ -1009,7 +1009,7 @@ t114_bct_set_value(parse_token id, u_int32_t data, u_int8_t *bct)
return 0;
}
-int
+static int
t114_bct_set_data(parse_token id,
u_int8_t *data,
u_int32_t length,
@@ -1034,7 +1034,7 @@ t114_bct_set_data(parse_token id,
return 0;
}
-void t114_init_bad_block_table(build_image_context *context)
+static void t114_init_bad_block_table(build_image_context *context)
{
u_int32_t bytes_per_entry;
nvboot_badblock_table *table;
diff --git a/scripts/tegra/t124/nvbctlib_t124.c b/scripts/tegra/t124/nvbctlib_t124.c
index ab2d925570..55b840926e 100644
--- a/scripts/tegra/t124/nvbctlib_t124.c
+++ b/scripts/tegra/t124/nvbctlib_t124.c
@@ -828,7 +828,7 @@ t124_set_sdram_param(build_image_context *context,
return 0;
}
-int
+static int
t124_getbl_param(u_int32_t set,
parse_token id,
u_int32_t *data,
@@ -863,7 +863,7 @@ t124_getbl_param(u_int32_t set,
return 0;
}
-int
+static int
t124_setbl_param(u_int32_t set,
parse_token id,
u_int32_t *data,
@@ -898,7 +898,7 @@ t124_setbl_param(u_int32_t set,
return 0;
}
-int
+static int
t124_bct_get_value(parse_token id, u_int32_t *data, u_int8_t *bct)
{
nvboot_config_table *bct_ptr = (nvboot_config_table *)bct;
@@ -982,7 +982,7 @@ t124_bct_get_value(parse_token id, u_int32_t *data, u_int8_t *bct)
return 0;
}
-int
+static int
t124_bct_set_value(parse_token id, u_int32_t data, u_int8_t *bct)
{
nvboot_config_table *bct_ptr = (nvboot_config_table *)bct;
@@ -1010,7 +1010,7 @@ t124_bct_set_value(parse_token id, u_int32_t data, u_int8_t *bct)
return 0;
}
-int
+static int
t124_bct_set_data(parse_token id,
u_int8_t *data,
u_int32_t length,
@@ -1036,7 +1036,7 @@ t124_bct_set_data(parse_token id,
return 0;
}
-void t124_init_bad_block_table(build_image_context *context)
+static void t124_init_bad_block_table(build_image_context *context)
{
u_int32_t bytes_per_entry;
nvboot_badblock_table *table;
diff --git a/scripts/tegra/t20/nvbctlib_t20.c b/scripts/tegra/t20/nvbctlib_t20.c
index 5386b285d6..42ad146755 100644
--- a/scripts/tegra/t20/nvbctlib_t20.c
+++ b/scripts/tegra/t20/nvbctlib_t20.c
@@ -416,7 +416,7 @@ t20_get_sdram_param(build_image_context *context,
return 0;
}
-int
+static int
t20_getbl_param(u_int32_t set,
parse_token id,
u_int32_t *data,
@@ -451,7 +451,7 @@ t20_getbl_param(u_int32_t set,
return 0;
}
-int
+static int
t20_setbl_param(u_int32_t set,
parse_token id,
u_int32_t *data,
@@ -486,7 +486,7 @@ t20_setbl_param(u_int32_t set,
return 0;
}
-int
+static int
t20_bct_get_value(parse_token id, u_int32_t *data, u_int8_t *bct)
{
nvboot_config_table *bct_ptr = (nvboot_config_table *)bct;
@@ -565,7 +565,7 @@ t20_bct_get_value(parse_token id, u_int32_t *data, u_int8_t *bct)
return 0;
}
-int
+static int
t20_bct_set_value(parse_token id, u_int32_t data, u_int8_t *bct)
{
nvboot_config_table *bct_ptr = (nvboot_config_table *)bct;
@@ -593,7 +593,7 @@ t20_bct_set_value(parse_token id, u_int32_t data, u_int8_t *bct)
return 0;
}
-int
+static int
t20_bct_set_data(parse_token id,
u_int8_t *data,
u_int32_t length,
@@ -615,7 +615,7 @@ t20_bct_set_data(parse_token id,
return 0;
}
-void t20_init_bad_block_table(build_image_context *context)
+static void t20_init_bad_block_table(build_image_context *context)
{
u_int32_t bytes_per_entry;
nvboot_badblock_table *table;
diff --git a/scripts/tegra/t30/nvbctlib_t30.c b/scripts/tegra/t30/nvbctlib_t30.c
index e55b0dfb98..04e8974fbf 100644
--- a/scripts/tegra/t30/nvbctlib_t30.c
+++ b/scripts/tegra/t30/nvbctlib_t30.c
@@ -623,7 +623,7 @@ t30_set_sdram_param(build_image_context *context,
return 0;
}
-int
+static int
t30_getbl_param(u_int32_t set,
parse_token id,
u_int32_t *data,
@@ -658,7 +658,7 @@ t30_getbl_param(u_int32_t set,
return 0;
}
-int
+static int
t30_setbl_param(u_int32_t set,
parse_token id,
u_int32_t *data,
@@ -693,7 +693,7 @@ t30_setbl_param(u_int32_t set,
return 0;
}
-int
+static int
t30_bct_get_value(parse_token id, u_int32_t *data, u_int8_t *bct)
{
nvboot_config_table *bct_ptr = (nvboot_config_table *)bct;
@@ -772,7 +772,7 @@ t30_bct_get_value(parse_token id, u_int32_t *data, u_int8_t *bct)
return 0;
}
-int
+static int
t30_bct_set_value(parse_token id, u_int32_t data, u_int8_t *bct)
{
nvboot_config_table *bct_ptr = (nvboot_config_table *)bct;
@@ -800,7 +800,7 @@ t30_bct_set_value(parse_token id, u_int32_t data, u_int8_t *bct)
return 0;
}
-int
+static int
t30_bct_set_data(parse_token id,
u_int8_t *data,
u_int32_t length,
@@ -822,7 +822,7 @@ t30_bct_set_data(parse_token id,
return 0;
}
-void t30_init_bad_block_table(build_image_context *context)
+static void t30_init_bad_block_table(build_image_context *context)
{
u_int32_t bytes_per_entry;
nvboot_badblock_table *table;