List-Id: U-Boot discussion <u-boot.lists.denx.de> From: sjg at chromium.org (Simon Glass) Date: Mon, 3 Feb 2020 07:35:46 -0700 Subject: [PATCH v2 00/32] sandbox: Move to SDL2 Message-ID: <20200203143618.74619-1-sjg@chromium.org>
This series handles moving sandbox to the latest version of SDL, SDL2. It provides a few more features, better performance and has been around for long enough that it is present in distributions in the last several years. Unfortunately it requires considerable rework of how memory allocation is handled in sandbox. At present sandbox is built such that it uses U-Boot's malloc() instead of the C library's malloc. This mostly works but it is fragile, since any use of libraries can cause strange behaviour. For example SDL ends up calling U-Boot's malloc/free and this can confuse valgrind and even cause a crash in some cases. The simplest solution seems to be to set a prefix for the allocation functions so that U-Boot's functions can co-exist with the C library's. This requires a little bit of fiddling but it guarantees that things work correctly in all circumstances. We have got away with this for a long time partly due to the way that SDL1.2 operates on init. But with SDL2 this does not seem to be possible. As a result of this series, malloc() is #defined to dlmalloc() within U-Boot (for sandbox only). The use of 'free' as a function in U-Boot is thus best avoided, since it is #defined to dlfree. The series updates some APIs to deal with this. Changes in v2: - Update the name of the implementing callback function too - Drop the patch with the Roboto font - Fix 'adress' typo Simon Glass (32): sandbox: Sort the help options video: Support truetype fonts on a 32-bit display video: sandbox: Enable all colour depths mailbox: Rename free() to rfree() power-domain: Rename free() to rfree() reset: Rename free() to rfree() gpio: Rename free() to rfree() clk: Rename free() to rfree() dma: Rename free() to rfree() mtd: Rename free() to rfree() sandbox: Rename 'free' variable sandbox: Use a prefix for all allocation functions exports: Add the malloc.h header string: Allow arch override of strndup() also sandbox: Rename strdup() functions sandbox: Drop use of special os_malloc() where possible sandbox: Drop os_realloc() sandbox: Ensure that long-options array is terminated sandbox: Add a new header for the system malloc() sound: Add a new stop_play() method sandbox: sound: Handle errors better in sound_beep() sandbox: Add comments to the sdl struct sandbox: sdl: Improve error handling sandbox: sdl: Support waiting for audio to complete gitlab: Disable SDL when building sandbox sandbox: sdl: Move to use SDL2 sandbox: sdl: Add an option to double the screen size sandbox: Support changing the LCD colour depth dm: core: Require users of devres to include the header dm: core: Create a new header file for 'compat' features dm: core: Drop the inclusion of linux/compat.h in dm.h sandbox: Complete migration away from os_malloc() .gitlab-ci.yml | 5 +- .travis.yml | 2 +- arch/arm/mach-aspeed/ast2500/clk_ast2500.c | 1 + arch/arm/mach-imx/cmd_nandbcb.c | 2 + arch/arm/mach-imx/imx8/image.c | 1 + arch/arm/mach-meson/board-info.c | 1 + arch/arm/mach-meson/sm.c | 1 + arch/arm/mach-mvebu/mbus.c | 1 + arch/arm/mach-rockchip/px30/clk_px30.c | 1 + arch/arm/mach-rockchip/rk3036/clk_rk3036.c | 1 + arch/arm/mach-rockchip/rk3128/clk_rk3128.c | 1 + arch/arm/mach-rockchip/rk3188/clk_rk3188.c | 1 + arch/arm/mach-rockchip/rk3188/rk3188.c | 1 + arch/arm/mach-rockchip/rk322x/clk_rk322x.c | 1 + arch/arm/mach-rockchip/rk3288/clk_rk3288.c | 1 + arch/arm/mach-rockchip/rk3288/rk3288.c | 2 + arch/arm/mach-rockchip/rk3308/clk_rk3308.c | 1 + arch/arm/mach-rockchip/rk3308/rk3308.c | 1 + arch/arm/mach-rockchip/rk3328/clk_rk3328.c | 1 + arch/arm/mach-rockchip/rk3368/clk_rk3368.c | 1 + arch/arm/mach-rockchip/rk3399/clk_rk3399.c | 1 + arch/arm/mach-rockchip/rv1108/clk_rv1108.c | 1 + arch/arm/mach-socfpga/clock_manager_agilex.c | 1 + arch/arm/mach-socfpga/clock_manager_arria10.c | 1 + arch/arm/mach-stm32mp/pwr_regulator.c | 2 + arch/arm/mach-tegra/cboot.c | 1 + arch/arm/mach-zynq/clk.c | 1 + arch/arm/mach-zynq/timer.c | 1 + arch/mips/mach-mtmips/cpu.c | 1 + arch/mips/mach-pic32/cpu.c | 1 + arch/riscv/lib/andes_plic.c | 1 + arch/riscv/lib/andes_plmt.c | 1 + arch/riscv/lib/sifive_clint.c | 1 + arch/sandbox/config.mk | 2 +- arch/sandbox/cpu/cpu.c | 1 + arch/sandbox/cpu/eth-raw-os.c | 6 +- arch/sandbox/cpu/os.c | 48 +-- arch/sandbox/cpu/sdl.c | 338 +++++++++++------- arch/sandbox/cpu/start.c | 62 +++- arch/sandbox/cpu/state.c | 23 +- arch/sandbox/dts/sandbox.dtsi | 1 + arch/sandbox/include/asm/malloc.h | 26 ++ arch/sandbox/include/asm/sdl.h | 9 +- arch/sandbox/include/asm/state.h | 1 + arch/sandbox/include/asm/test.h | 7 + arch/x86/cpu/apollolake/fsp_s.c | 1 + arch/x86/cpu/apollolake/itss.c | 1 + arch/x86/cpu/apollolake/spl.c | 1 + arch/x86/cpu/apollolake/uart.c | 1 + arch/x86/cpu/qemu/e820.c | 1 + arch/x86/cpu/qfw_cpu.c | 1 + arch/x86/lib/coreboot_table.c | 1 + arch/x86/lib/fsp1/fsp_common.c | 1 + arch/x86/lib/mrccache.c | 1 + arch/x86/lib/tables.c | 1 + board/compulab/common/common.c | 1 + board/corscience/tricorder/tricorder.c | 1 + board/gardena/smart-gateway-mt7688/board.c | 1 + board/ge/common/vpd_reader.c | 1 + board/google/veyron/veyron.c | 1 + board/hisilicon/poplar/poplar.c | 2 +- board/isee/igep003x/board.c | 1 + board/isee/igep00x0/igep00x0.c | 1 + board/menlo/m53menlo/m53menlo.c | 1 + board/microchip/pic32mzda/pic32mzda.c | 1 + board/overo/overo.c | 1 + board/siemens/common/board.c | 1 + board/siemens/pxm2/board.c | 1 + board/siemens/rut/board.c | 1 + board/st/stm32mp1/stm32mp1.c | 2 + board/synopsys/hsdk/clk-lib.c | 1 + board/technexion/tao3530/tao3530.c | 1 + board/ti/am335x/board.c | 1 + board/ti/am57xx/board.c | 1 + board/timll/devkit8000/devkit8000.c | 1 + cmd/bootefi.c | 1 + cmd/gpio.c | 2 + cmd/gpt.c | 1 + cmd/host.c | 1 + cmd/mtd.c | 2 + cmd/rng.c | 1 + cmd/tpm-common.c | 1 + cmd/ubi.c | 2 + cmd/usb_mass_storage.c | 1 + cmd/ximg.c | 1 + common/android_ab.c | 1 + common/autoboot.c | 1 + common/exports.c | 1 + common/image-fdt.c | 1 + common/image.c | 1 + common/usb.c | 1 + common/usb_hub.c | 1 + configs/sandbox64_defconfig | 1 - configs/sandbox_defconfig | 1 - configs/sandbox_flattree_defconfig | 1 - configs/sandbox_spl_defconfig | 1 - doc/arch/sandbox.rst | 2 +- doc/device-tree-bindings/video/sandbox-fb.txt | 6 +- drivers/adc/rockchip-saradc.c | 1 + drivers/adc/stm32-adc-core.c | 1 + drivers/adc/stm32-adc.c | 1 + drivers/axi/sandbox_store.c | 1 + drivers/block/blk-uclass.c | 2 + drivers/block/sandbox.c | 1 + drivers/clk/altera/clk-arria10.c | 3 + drivers/clk/aspeed/clk_ast2500.c | 1 + drivers/clk/at91/clk-generated.c | 2 + drivers/clk/at91/clk-h32mx.c | 1 + drivers/clk/at91/clk-peripheral.c | 1 + drivers/clk/at91/clk-usb.c | 1 + drivers/clk/clk-cdce9xx.c | 1 + drivers/clk/clk-composite.c | 2 + drivers/clk/clk-divider.c | 2 + drivers/clk/clk-fixed-factor.c | 2 + drivers/clk/clk-gate.c | 2 + drivers/clk/clk-mux.c | 2 + drivers/clk/clk-ti-sci.c | 5 +- drivers/clk/clk-uclass.c | 9 +- drivers/clk/clk_fixed_factor.c | 1 + drivers/clk/clk_sandbox.c | 3 +- drivers/clk/clk_sandbox_ccf.c | 3 + drivers/clk/clk_sandbox_test.c | 3 + drivers/clk/clk_versal.c | 2 + drivers/clk/clk_vexpress_osc.c | 1 + drivers/clk/clk_zynq.c | 1 + drivers/clk/clk_zynqmp.c | 3 + drivers/clk/imx/clk-composite-8m.c | 2 + drivers/clk/imx/clk-gate2.c | 2 + drivers/clk/imx/clk-imx8.c | 1 + drivers/clk/imx/clk-pfd.c | 2 + drivers/clk/imx/clk-pll14xx.c | 2 + drivers/clk/imx/clk-pllv3.c | 2 + drivers/clk/meson/axg.c | 1 + drivers/clk/meson/g12a.c | 1 + drivers/clk/meson/gxbb.c | 1 + drivers/clk/mvebu/armada-37xx-periph.c | 1 + drivers/clk/mvebu/armada-37xx-tbg.c | 1 + drivers/clk/rockchip/clk_px30.c | 1 + drivers/clk/rockchip/clk_rk3036.c | 1 + drivers/clk/rockchip/clk_rk3128.c | 1 + drivers/clk/rockchip/clk_rk3188.c | 2 + drivers/clk/rockchip/clk_rk322x.c | 1 + drivers/clk/rockchip/clk_rk3288.c | 2 + drivers/clk/rockchip/clk_rk3308.c | 1 + drivers/clk/rockchip/clk_rk3328.c | 1 + drivers/clk/rockchip/clk_rk3368.c | 1 + drivers/clk/rockchip/clk_rk3399.c | 1 + drivers/clk/rockchip/clk_rv1108.c | 1 + drivers/clk/sifive/fu540-prci.c | 1 + drivers/clk/tegra/tegra-car-clk.c | 3 +- drivers/clk/uniphier/clk-uniphier-core.c | 1 + drivers/core/devres.c | 2 + drivers/core/of_access.c | 1 + drivers/core/ofnode.c | 1 + drivers/core/syscon-uclass.c | 1 + drivers/ddr/altera/sdram_gen5.c | 1 + drivers/ddr/altera/sdram_soc64.c | 1 + drivers/dfu/dfu_mtd.c | 1 + drivers/dma/bcm6348-iudma.c | 1 + drivers/dma/dma-uclass.c | 5 +- drivers/dma/sandbox-dma-test.c | 5 +- drivers/dma/ti/k3-udma.c | 8 +- drivers/firmware/ti_sci.c | 3 + drivers/fpga/fpga.c | 1 + drivers/gpio/74x164_gpio.c | 1 + drivers/gpio/adi_gpio2.c | 1 + drivers/gpio/at91_gpio.c | 1 + drivers/gpio/atmel_pio4.c | 1 + drivers/gpio/da8xx_gpio.c | 1 + drivers/gpio/dwapb_gpio.c | 2 + drivers/gpio/gpio-rcar.c | 4 +- drivers/gpio/gpio-uclass.c | 4 +- drivers/gpio/kona_gpio.c | 1 + drivers/gpio/mpc83xx_gpio.c | 1 + drivers/gpio/mscc_sgpio.c | 2 + drivers/gpio/mvgpio.c | 1 + drivers/gpio/mxs_gpio.c | 1 + drivers/gpio/pca953x_gpio.c | 1 + drivers/gpio/pca9698.c | 1 + drivers/gpio/sh_pfc.c | 1 + drivers/gpio/spear_gpio.c | 1 + drivers/gpio/stm32_gpio.c | 1 + drivers/hwspinlock/hwspinlock-uclass.c | 2 + drivers/hwspinlock/stm32_hwspinlock.c | 1 + drivers/i2c/ast_i2c.c | 1 + drivers/i2c/at91_i2c.c | 1 + drivers/i2c/designware_i2c.c | 3 + drivers/i2c/i2c-uniphier-f.c | 1 + drivers/i2c/i2c-uniphier.c | 1 + drivers/i2c/imx_lpi2c.c | 1 + drivers/i2c/meson_i2c.c | 1 + drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 1 + drivers/i2c/muxes/i2c-mux-gpio.c | 2 + drivers/i2c/muxes/i2c-mux-uclass.c | 1 + drivers/i2c/muxes/pca954x.c | 1 + drivers/i2c/mxc_i2c.c | 1 + drivers/i2c/rcar_i2c.c | 1 + drivers/i2c/stm32f7_i2c.c | 1 + drivers/i2c/tegra_i2c.c | 1 + drivers/i2c/xilinx_xiic.c | 1 + drivers/led/led_gpio.c | 1 + drivers/mailbox/k3-sec-proxy.c | 4 +- drivers/mailbox/mailbox-uclass.c | 5 +- drivers/mailbox/sandbox-mbox-test.c | 1 + drivers/mailbox/sandbox-mbox.c | 3 +- drivers/mailbox/stm32-ipcc.c | 4 +- drivers/mailbox/tegra-hsp.c | 3 +- drivers/mailbox/zynqmp-ipi.c | 1 + drivers/misc/cros_ec_sandbox.c | 8 +- drivers/misc/imx8/scu_api.c | 1 + drivers/misc/k3_avs.c | 1 + drivers/misc/microchip_flexcom.c | 1 + drivers/misc/p2sb-uclass.c | 1 + drivers/misc/stm32_rcc.c | 1 + drivers/misc/tegra186_bpmp.c | 2 + drivers/misc/vexpress_config.c | 1 + drivers/mmc/am654_sdhci.c | 2 + drivers/mmc/arm_pl180_mmci.c | 1 + drivers/mmc/aspeed_sdhci.c | 1 + drivers/mmc/bcm2835_sdhost.c | 1 + drivers/mmc/fsl_esdhc.c | 1 + drivers/mmc/fsl_esdhc_imx.c | 2 + drivers/mmc/jz_mmc.c | 1 + drivers/mmc/mmc-uclass.c | 2 + drivers/mmc/msm_sdhci.c | 1 + drivers/mmc/mtk-sd.c | 1 + drivers/mmc/omap_hsmmc.c | 2 + drivers/mmc/renesas-sdhi.c | 2 + drivers/mmc/rockchip_sdhci.c | 1 + drivers/mmc/sdhci-cadence.c | 1 + drivers/mmc/sh_mmcif.c | 1 + drivers/mmc/sh_sdhi.c | 1 + drivers/mmc/snps_dw_mmc.c | 1 + drivers/mmc/socfpga_dw_mmc.c | 1 + drivers/mmc/stm32_sdmmc2.c | 1 + drivers/mmc/tegra_mmc.c | 1 + drivers/mmc/tmio-common.c | 1 + drivers/mmc/uniphier-sd.c | 2 + drivers/mmc/zynq_sdhci.c | 2 + drivers/mtd/hbmc-am654.c | 1 + drivers/mtd/mtd_uboot.c | 2 + drivers/mtd/mtdconcat.c | 1 + drivers/mtd/mtdcore.c | 5 +- drivers/mtd/mtdpart.c | 1 + drivers/mtd/nand/bbt.c | 1 + drivers/mtd/nand/core.c | 1 + drivers/mtd/nand/raw/atmel_nand.c | 2 + drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c | 1 + drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c | 1 + drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c | 1 + drivers/mtd/nand/raw/brcmnand/brcmnand.c | 3 + .../mtd/nand/raw/brcmnand/brcmnand_compat.c | 2 + drivers/mtd/nand/raw/denali.c | 6 +- drivers/mtd/nand/raw/denali_dt.c | 1 + drivers/mtd/nand/raw/fsl_elbc_nand.c | 1 + drivers/mtd/nand/raw/fsl_ifc_nand.c | 1 + drivers/mtd/nand/raw/mxs_nand_spl.c | 1 + drivers/mtd/nand/raw/nand_base.c | 1 + drivers/mtd/nand/raw/nand_bbt.c | 1 + drivers/mtd/nand/raw/nand_bch.c | 1 + drivers/mtd/nand/raw/nand_timings.c | 1 + drivers/mtd/nand/raw/nand_util.c | 1 + drivers/mtd/nand/raw/pxa3xx_nand.c | 3 + drivers/mtd/nand/raw/stm32_fmc2_nand.c | 1 + drivers/mtd/nand/raw/sunxi_nand.c | 4 + drivers/mtd/nand/raw/tegra_nand.c | 1 + drivers/mtd/nand/raw/vf610_nfc.c | 1 + drivers/mtd/nand/spi/core.c | 4 +- drivers/mtd/nand/spi/gigadevice.c | 3 +- drivers/mtd/nand/spi/macronix.c | 3 +- drivers/mtd/nand/spi/micron.c | 3 +- drivers/mtd/nand/spi/winbond.c | 3 +- drivers/mtd/onenand/onenand_base.c | 1 + drivers/mtd/renesas_rpc_hf.c | 2 + drivers/mtd/spi/sf-uclass.c | 1 + drivers/mtd/spi/spi-nor-core.c | 2 + drivers/mtd/spi/spi-nor-tiny.c | 1 + drivers/mtd/ubi/attach.c | 1 + drivers/mtd/ubi/build.c | 1 + drivers/mtd/ubi/debug.c | 2 + drivers/mtd/ubi/eba.c | 1 + drivers/mtd/ubi/fastmap.c | 2 + drivers/mtd/ubi/io.c | 1 + drivers/mtd/ubi/kapi.c | 1 + drivers/mtd/ubi/misc.c | 1 + drivers/mtd/ubi/upd.c | 1 + drivers/mtd/ubi/vmt.c | 1 + drivers/mtd/ubi/vtbl.c | 1 + drivers/mtd/ubi/wl.c | 1 + drivers/net/bcm6348-eth.c | 1 + drivers/net/bcm6368-eth.c | 2 + drivers/net/designware.c | 2 + drivers/net/dwc_eth_qos.c | 1 + drivers/net/dwmac_socfpga.c | 2 + drivers/net/e1000.c | 1 + drivers/net/e1000_spi.c | 1 + drivers/net/fsl-mc/dpio/qbman_portal.c | 1 + drivers/net/fsl-mc/mc.c | 1 + drivers/net/fsl_enetc.c | 1 + drivers/net/ftgmac100.c | 2 + drivers/net/higmacv300.c | 1 + drivers/net/mscc_eswitch/jr2_switch.c | 1 + drivers/net/mscc_eswitch/luton_switch.c | 1 + drivers/net/mscc_eswitch/ocelot_switch.c | 1 + drivers/net/mscc_eswitch/serval_switch.c | 1 + drivers/net/mscc_eswitch/servalt_switch.c | 1 + drivers/net/mtk_eth.c | 1 + drivers/net/mvneta.c | 2 + drivers/net/mvpp2.c | 3 + drivers/net/pch_gbe.c | 1 + drivers/net/pfe_eth/pfe_driver.c | 1 + drivers/net/pfe_eth/pfe_eth.c | 1 + drivers/net/pfe_eth/pfe_firmware.c | 1 + drivers/net/pfe_eth/pfe_mdio.c | 1 + drivers/net/phy/dp83867.c | 1 + drivers/net/phy/fixed.c | 1 + drivers/net/pic32_eth.c | 1 + drivers/net/sandbox-raw-bus.c | 1 + drivers/net/sni_ave.c | 7 +- drivers/net/sun8i_emac.c | 1 + drivers/net/sunxi_emac.c | 1 + drivers/net/ti/am65-cpsw-nuss.c | 2 + drivers/net/ti/cpsw-common.c | 1 + drivers/net/ti/cpsw.c | 1 + drivers/net/ti/cpsw_mdio.c | 1 + drivers/net/zynq_gem.c | 2 + drivers/nvme/nvme.c | 2 + drivers/pci/pci-aardvark.c | 1 + drivers/pci/pci-uclass.c | 1 + drivers/pci/pci_mvebu.c | 1 + drivers/pci/pcie_dw_ti.c | 2 + drivers/pci/pcie_fsl.c | 1 + drivers/pci/pcie_imx.c | 1 + drivers/pci/pcie_intel_fpga.c | 1 + drivers/pci/pcie_mediatek.c | 2 + drivers/phy/allwinner/phy-sun4i-usb.c | 2 + drivers/phy/bcm6318-usbh-phy.c | 1 + drivers/phy/bcm6348-usbh-phy.c | 1 + drivers/phy/bcm6358-usbh-phy.c | 1 + drivers/phy/bcm6368-usbh-phy.c | 1 + drivers/phy/marvell/comphy_core.c | 2 + drivers/phy/meson-g12a-usb2.c | 1 + drivers/phy/meson-g12a-usb3-pcie.c | 1 + drivers/phy/meson-gxl-usb2.c | 1 + drivers/phy/meson-gxl-usb3.c | 1 + drivers/phy/omap-usb2-phy.c | 1 + drivers/phy/phy-mtk-tphy.c | 3 + drivers/phy/phy-rcar-gen2.c | 2 + drivers/phy/phy-rcar-gen3.c | 1 + drivers/phy/phy-stm32-usbphyc.c | 1 + drivers/phy/phy-ti-am654.c | 2 + drivers/phy/ti-pipe3-phy.c | 1 + drivers/pinctrl/broadcom/pinctrl-bcm6838.c | 1 + drivers/pinctrl/intel/pinctrl.c | 2 + drivers/pinctrl/meson/pinctrl-meson.c | 2 + drivers/pinctrl/mscc/mscc-common.c | 2 + .../pinctrl/mtmips/pinctrl-mtmips-common.c | 1 + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 3 + drivers/pinctrl/nxp/pinctrl-imx.c | 3 + drivers/pinctrl/nxp/pinctrl-mxs.c | 2 + drivers/pinctrl/pinctrl-generic.c | 1 + drivers/pinctrl/pinctrl-single.c | 1 + drivers/pinctrl/pinctrl-stmfx.c | 1 + drivers/pinctrl/pinctrl-uclass.c | 2 + drivers/pinctrl/pinctrl_stm32.c | 3 + drivers/pinctrl/renesas/pfc.c | 2 + .../pinctrl/uniphier/pinctrl-uniphier-core.c | 1 + drivers/power/domain/bcm6328-power-domain.c | 3 +- .../power/domain/imx8-power-domain-legacy.c | 3 +- drivers/power/domain/imx8-power-domain.c | 3 +- drivers/power/domain/imx8m-power-domain.c | 3 +- drivers/power/domain/meson-ee-pwrc.c | 4 +- drivers/power/domain/meson-gx-pwrc-vpu.c | 4 +- drivers/power/domain/mtk-power-domain.c | 4 +- drivers/power/domain/power-domain-uclass.c | 3 +- .../power/domain/sandbox-power-domain-test.c | 1 + drivers/power/domain/sandbox-power-domain.c | 3 +- drivers/power/domain/tegra186-power-domain.c | 3 +- drivers/power/domain/ti-sci-power-domain.c | 5 +- drivers/power/pmic/fan53555.c | 1 + drivers/power/pmic/i2c_pmic_emul.c | 1 + drivers/power/pmic/stpmic1.c | 1 + drivers/power/regulator/pbias_regulator.c | 1 + drivers/power/regulator/pwm_regulator.c | 1 + drivers/power/regulator/stm32-vrefbuf.c | 1 + drivers/power/regulator/tps62360_regulator.c | 1 + drivers/ram/imxrt_sdram.c | 1 + drivers/ram/k3-am654-ddrss.c | 1 + drivers/ram/k3-j721e/k3-j721e-ddrss.c | 1 + drivers/ram/rockchip/dmc-rk3368.c | 1 + drivers/ram/stm32_sdram.c | 1 + drivers/remoteproc/k3_system_controller.c | 1 + drivers/remoteproc/rproc-elf-loader.c | 2 + drivers/remoteproc/stm32_copro.c | 2 + drivers/remoteproc/ti_k3_arm64_rproc.c | 2 + drivers/remoteproc/ti_k3_dsp_rproc.c | 3 + drivers/remoteproc/ti_k3_r5f_rproc.c | 3 + drivers/reset/reset-bcm6345.c | 3 +- drivers/reset/reset-hisilicon.c | 3 +- drivers/reset/reset-hsdk.c | 2 +- drivers/reset/reset-imx7.c | 3 +- drivers/reset/reset-mediatek.c | 4 +- drivers/reset/reset-meson.c | 3 +- drivers/reset/reset-mtmips.c | 3 +- drivers/reset/reset-rockchip.c | 3 +- drivers/reset/reset-socfpga.c | 3 +- drivers/reset/reset-sunxi.c | 3 +- drivers/reset/reset-ti-sci.c | 5 +- drivers/reset/reset-uclass.c | 4 +- drivers/reset/reset-uniphier.c | 4 +- drivers/reset/sandbox-reset-test.c | 1 + drivers/reset/sandbox-reset.c | 3 +- drivers/reset/sti-reset.c | 3 +- drivers/reset/stm32-reset.c | 3 +- drivers/reset/tegra-car-reset.c | 3 +- drivers/reset/tegra186-reset.c | 3 +- drivers/rtc/ds3232.c | 1 + drivers/rtc/rv3029.c | 1 + drivers/rtc/stm32_rtc.c | 2 + drivers/serial/atmel_usart.c | 1 + drivers/serial/ns16550.c | 1 + drivers/serial/serial-uclass.c | 1 + drivers/serial/serial_bcm6345.c | 1 + drivers/serial/serial_lpuart.c | 1 + drivers/serial/serial_msm.c | 1 + drivers/serial/serial_mtk.c | 3 +- drivers/serial/serial_omap.c | 1 + drivers/serial/serial_pic32.c | 1 + drivers/serial/serial_sifive.c | 1 + drivers/serial/serial_stm32.c | 1 + drivers/serial/serial_zynq.c | 2 + drivers/smem/msm_smem.c | 3 + drivers/soc/ti/k3-navss-ringacc.c | 3 + drivers/sound/sandbox.c | 21 +- drivers/sound/sound-uclass.c | 17 +- drivers/spi/atmel-quadspi.c | 3 + drivers/spi/bcm63xx_hsspi.c | 1 + drivers/spi/bcm63xx_spi.c | 1 + drivers/spi/cadence_qspi.c | 2 + drivers/spi/designware_spi.c | 1 + drivers/spi/mvebu_a3700_spi.c | 1 + drivers/spi/mxc_spi.c | 1 + drivers/spi/spi-mem-nodm.c | 1 + drivers/spi/spi-mem.c | 2 + drivers/spi/spi-sunxi.c | 1 + drivers/spi/stm32_qspi.c | 1 + drivers/spi/stm32_spi.c | 2 + drivers/spi/ti_qspi.c | 1 + drivers/spi/uniphier_spi.c | 1 + drivers/spi/zynqmp_gqspi.c | 2 + drivers/spmi/spmi-msm.c | 1 + drivers/sysreset/sysreset-ti-sci.c | 2 + drivers/sysreset/sysreset_syscon.c | 1 + drivers/tee/optee/core.c | 2 + drivers/tee/optee/rpmb.c | 1 + drivers/tee/optee/supplicant.c | 1 + drivers/tee/tee-uclass.c | 3 +- drivers/timer/ast_timer.c | 1 + drivers/timer/cadence-ttc.c | 1 + drivers/timer/dw-apb-timer.c | 2 + drivers/timer/ostm_timer.c | 1 + drivers/timer/stm32_timer.c | 1 + drivers/timer/timer-uclass.c | 1 + drivers/ufs/cdns-platform.c | 2 + drivers/ufs/ti-j721e-ufs.c | 2 + drivers/ufs/ufs.c | 2 + drivers/usb/cdns3/cdns3-ti.c | 1 + drivers/usb/cdns3/core.c | 2 + drivers/usb/cdns3/drd.c | 1 + drivers/usb/cdns3/ep0.c | 1 + drivers/usb/cdns3/gadget.c | 3 + drivers/usb/cdns3/host.c | 1 + drivers/usb/dwc3/core.c | 3 + drivers/usb/dwc3/dwc3-omap.c | 2 + drivers/usb/dwc3/dwc3-uniphier.c | 1 + drivers/usb/dwc3/ep0.c | 1 + drivers/usb/dwc3/gadget.c | 2 + drivers/usb/dwc3/ti_usb_phy.c | 2 + drivers/usb/gadget/at91_udc.c | 2 + drivers/usb/gadget/composite.c | 1 + drivers/usb/gadget/dwc2_udc_otg.c | 2 + drivers/usb/gadget/f_mass_storage.c | 1 + drivers/usb/gadget/pxa25x_udc.c | 1 + drivers/usb/gadget/storage_common.c | 1 + drivers/usb/gadget/udc/udc-core.c | 2 + drivers/usb/host/dwc2.c | 1 + drivers/usb/host/ehci-atmel.c | 1 + drivers/usb/host/ehci-generic.c | 2 + drivers/usb/host/ehci-hcd.c | 1 + drivers/usb/host/ohci-da8xx.c | 3 + drivers/usb/host/ohci-generic.c | 2 + drivers/usb/host/r8a66597-hcd.c | 1 + drivers/usb/host/xhci-rcar.c | 2 + drivers/usb/musb-new/am35x.c | 2 + drivers/usb/musb-new/da8xx.c | 1 + drivers/usb/musb-new/musb_core.c | 2 + drivers/usb/musb-new/musb_dsps.c | 2 + drivers/usb/musb-new/musb_gadget.c | 2 + drivers/usb/musb-new/musb_gadget_ep0.c | 1 + drivers/usb/musb-new/musb_host.c | 2 + drivers/usb/musb-new/musb_uboot.c | 2 + drivers/usb/musb-new/omap2430.c | 2 + drivers/usb/musb-new/pic32.c | 1 + drivers/usb/musb-new/sunxi.c | 2 + drivers/usb/musb-new/ti-musb.c | 1 + drivers/usb/phy/omap_usb_phy.c | 1 + drivers/video/Kconfig | 4 +- drivers/video/atmel_hlcdfb.c | 1 + drivers/video/console_truetype.c | 22 ++ drivers/video/da8xx-fb.c | 1 + drivers/video/dw_mipi_dsi.c | 1 + drivers/video/exynos/exynos_mipi_dsi.c | 1 + drivers/video/hitachi_tx18d42vm_lcd.c | 1 + drivers/video/mali_dp.c | 2 + drivers/video/mipi_dsi.c | 1 + drivers/video/mvebu_lcd.c | 1 + drivers/video/mxsfb.c | 1 + drivers/video/orisetech_otm8009a.c | 1 + drivers/video/pwm_backlight.c | 1 + drivers/video/raydium-rm68200.c | 1 + drivers/video/rockchip/rk3288_hdmi.c | 1 + drivers/video/rockchip/rk3288_mipi.c | 1 + drivers/video/rockchip/rk3399_mipi.c | 1 + drivers/video/rockchip/rk_edp.c | 1 + drivers/video/rockchip/rk_vop.c | 1 + drivers/video/sandbox_osd.c | 1 + drivers/video/sandbox_sdl.c | 13 +- drivers/video/scf0403_lcd.c | 1 + drivers/video/ssd2828.c | 1 + drivers/video/stm32/stm32_dsi.c | 1 + drivers/video/stm32/stm32_ltdc.c | 1 + drivers/video/tegra124/sor.c | 1 + drivers/video/video-uclass.c | 1 + drivers/virtio/virtio-uclass.c | 1 + drivers/virtio/virtio_mmio.c | 1 + drivers/virtio/virtio_pci_legacy.c | 1 + drivers/virtio/virtio_pci_modern.c | 1 + drivers/virtio/virtio_ring.c | 1 + drivers/virtio/virtio_sandbox.c | 1 + drivers/w1-eeprom/ds2502.c | 1 + drivers/w1/mxc_w1.c | 1 + drivers/watchdog/armada-37xx-wdt.c | 1 + drivers/watchdog/ast_wdt.c | 1 + drivers/watchdog/cdns_wdt.c | 2 + drivers/watchdog/sp805_wdt.c | 1 + drivers/watchdog/xilinx_tb_wdt.c | 1 + fs/ext4/ext4_write.c | 1 + fs/ext4/ext4fs.c | 1 + fs/fat/fat_write.c | 1 + fs/sandbox/sandboxfs.c | 1 + fs/ubifs/debug.c | 1 + fs/ubifs/gc.c | 1 + fs/ubifs/io.c | 1 + fs/ubifs/log.c | 1 + fs/ubifs/lprops.c | 1 + fs/ubifs/lpt.c | 1 + fs/ubifs/lpt_commit.c | 1 + fs/ubifs/master.c | 1 + fs/ubifs/orphan.c | 1 + fs/ubifs/recovery.c | 1 + fs/ubifs/replay.c | 1 + fs/ubifs/sb.c | 1 + fs/ubifs/scan.c | 1 + fs/ubifs/super.c | 1 + fs/ubifs/tnc.c | 1 + fs/ubifs/tnc_misc.c | 1 + fs/ubifs/ubifs.c | 2 + fs/yaffs2/yaffs_allocator.c | 1 + fs/yaffs2/yaffs_checkptrw.c | 1 + fs/yaffs2/yaffs_guts.c | 1 + fs/yaffs2/yaffs_nandif.c | 1 + fs/yaffs2/yaffs_summary.c | 1 + fs/yaffs2/yaffs_uboot_glue.c | 1 + fs/yaffs2/yaffs_yaffs1.c | 1 + fs/yaffs2/yaffs_yaffs2.c | 1 + fs/yaffs2/yaffsfs.c | 1 + include/asm-generic/gpio.h | 2 +- include/clk-uclass.h | 4 +- include/dm/device.h | 74 ---- include/dm/device_compat.h | 86 +++++ include/dm/devres.h | 4 + include/dma-uclass.h | 4 +- include/linux/clk-provider.h | 1 + include/linux/compat.h | 3 + include/linux/mtd/mtd.h | 4 +- include/linux/string.h | 7 +- include/mailbox-uclass.h | 4 +- include/malloc.h | 24 +- include/os.h | 22 +- include/phy.h | 1 + include/power-domain-uclass.h | 4 +- include/reset-uclass.h | 4 +- include/sound.h | 12 + lib/bch.c | 2 + lib/binman.c | 1 + lib/bzip2/bzlib.c | 1 + lib/crypto/asymmetric_type.c | 2 + lib/crypto/pkcs7_parser.c | 1 + lib/crypto/public_key.c | 2 + lib/crypto/rsa_helper.c | 1 + lib/crypto/x509_cert_parser.c | 1 + lib/crypto/x509_public_key.c | 2 + lib/efi/efi.c | 1 + lib/efi/efi_app.c | 1 + lib/efi/efi_stub.c | 1 + lib/efi_driver/efi_block_device.c | 1 + lib/efi_driver/efi_uclass.c | 1 + lib/efi_loader/efi_console.c | 1 + lib/efi_loader/efi_runtime.c | 1 + lib/fdtdec.c | 1 + lib/libavb/avb_cmdline.c | 1 + lib/libavb/avb_descriptor.c | 1 + lib/libavb/avb_rsa.c | 1 + lib/libavb/avb_slot_verify.c | 1 + lib/libavb/avb_sysdeps_posix.c | 1 + lib/libavb/avb_util.c | 1 + lib/linux_compat.c | 1 + lib/list_sort.c | 1 + lib/lmb.c | 1 + lib/rsa/rsa-sign.c | 1 + lib/rsa/rsa-verify.c | 1 + lib/string.c | 2 +- lib/zstd/decompress.c | 1 + lib/zstd/zstd_common.c | 1 + net/mdio-uclass.c | 3 + post/post.c | 1 + test/dm/clk.c | 1 + test/dm/devres.c | 1 + test/dm/dma.c | 1 + test/dm/gpio.c | 1 + test/dm/mailbox.c | 1 + test/dm/power-domain.c | 1 + test/dm/regmap.c | 1 + test/dm/reset.c | 1 + test/dm/sound.c | 1 + test/dm/spmi.c | 1 + test/dm/syscon.c | 1 + test/dm/tee.c | 1 + test/dm/test-fdt.c | 1 + test/dm/video.c | 1 + test/lib/lmb.c | 1 + test/unicode_ut.c | 1 + 642 files changed, 1399 insertions(+), 387 deletions(-) create mode 100644 arch/sandbox/include/asm/malloc.h create mode 100644 include/dm/device_compat.h