mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
Merge branch '2021-04-22-assorted-updates'
- Move LMB to Kconfig, improve functionality - Add partlabel support to more fs cmds
This commit is contained in:
commit
84baa65dff
29 changed files with 289 additions and 82 deletions
|
@ -26,6 +26,9 @@
|
|||
# addresses are __aligned(2)".
|
||||
--ignore PREFER_ETHER_ADDR_COPY
|
||||
|
||||
# ENOSYS is a conventionally used error, even though U-Boot lacks system calls.
|
||||
--ignore ENOSYS
|
||||
|
||||
# A bit shorter of a description is OK with us.
|
||||
--min-conf-desc-length=2
|
||||
|
||||
|
|
|
@ -8,6 +8,4 @@
|
|||
|
||||
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||
|
||||
#define CONFIG_LMB
|
||||
|
||||
#endif /*__ASM_ARC_CONFIG_H_ */
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#ifndef _ASM_CONFIG_H_
|
||||
#define _ASM_CONFIG_H_
|
||||
|
||||
#define CONFIG_LMB
|
||||
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||
|
||||
#if defined(CONFIG_ARCH_LS1021A) || \
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#ifndef _ASM_CONFIG_H_
|
||||
#define _ASM_CONFIG_H_
|
||||
|
||||
#define CONFIG_LMB
|
||||
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#ifndef _ASM_CONFIG_H_
|
||||
#define _ASM_CONFIG_H_
|
||||
|
||||
#define CONFIG_LMB
|
||||
|
||||
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#ifndef _ASM_CONFIG_H_
|
||||
#define _ASM_CONFIG_H_
|
||||
|
||||
#define CONFIG_LMB
|
||||
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,5 @@
|
|||
|
||||
#ifndef _ASM_CONFIG_H_
|
||||
#define _ASM_CONFIG_H_
|
||||
#define CONFIG_LMB
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#define HWCONFIG_BUFFER_SIZE 256
|
||||
#endif
|
||||
|
||||
#define CONFIG_LMB
|
||||
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||
|
||||
#ifndef CONFIG_MAX_MEM_MAPPED
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _ASM_CONFIG_H_
|
||||
#define _ASM_CONFIG_H_
|
||||
|
||||
#define CONFIG_LMB
|
||||
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
#include <asm/processor.h>
|
||||
|
||||
#define CONFIG_LMB
|
||||
|
||||
/* Timer */
|
||||
#define CONFIG_SYS_TIMER_COUNTS_DOWN
|
||||
#define CONFIG_SYS_TIMER_COUNTER (TMU_BASE + 0xc) /* TCNT0 */
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#ifndef _ASM_CONFIG_H_
|
||||
#define _ASM_CONFIG_H_
|
||||
|
||||
#define CONFIG_LMB
|
||||
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
#include <asm/arch/core.h>
|
||||
|
||||
#define CONFIG_LMB
|
||||
|
||||
/*
|
||||
* Make boot parameters available in the MMUv2 virtual memory layout by
|
||||
* restricting used physical memory to the first 128MB.
|
||||
|
|
|
@ -170,3 +170,6 @@ CONFIG_WDT_STM32MP=y
|
|||
CONFIG_ERRNO_STR=y
|
||||
# CONFIG_HEXDUMP is not set
|
||||
CONFIG_FDT_FIXUP_PARTITIONS=y
|
||||
# CONFIG_LMB_USE_MAX_REGIONS is not set
|
||||
CONFIG_LMB_MEMORY_REGIONS=2
|
||||
CONFIG_LMB_RESERVED_REGIONS=16
|
||||
|
|
|
@ -152,3 +152,6 @@ CONFIG_WDT_STM32MP=y
|
|||
CONFIG_ERRNO_STR=y
|
||||
# CONFIG_HEXDUMP is not set
|
||||
CONFIG_FDT_FIXUP_PARTITIONS=y
|
||||
# CONFIG_LMB_USE_MAX_REGIONS is not set
|
||||
CONFIG_LMB_MEMORY_REGIONS=2
|
||||
CONFIG_LMB_RESERVED_REGIONS=16
|
||||
|
|
|
@ -725,7 +725,7 @@ static int part_get_info_by_dev_and_name(const char *dev_iface,
|
|||
}
|
||||
|
||||
ret = blk_get_device_by_str(dev_iface, dev_str, dev_desc);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = part_get_info_by_name(*dev_desc, part_str, part_info);
|
||||
|
|
4
fs/fs.c
4
fs/fs.c
|
@ -385,8 +385,8 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
|
|||
}
|
||||
#endif
|
||||
|
||||
part = blk_get_device_part_str(ifname, dev_part_str, &fs_dev_desc,
|
||||
&fs_partition, 1);
|
||||
part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str, &fs_dev_desc,
|
||||
&fs_partition, 1);
|
||||
if (part < 0)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -34,11 +34,6 @@
|
|||
*/
|
||||
#define CONFIG_BOOTP_BOOTFILESIZE
|
||||
|
||||
/*
|
||||
* FDT options
|
||||
*/
|
||||
#define CONFIG_LMB
|
||||
|
||||
/*
|
||||
* MEMORY ORGANIZATION
|
||||
* -Monitor at top of sdram.
|
||||
|
|
|
@ -34,11 +34,6 @@
|
|||
*/
|
||||
#define CONFIG_BOOTP_BOOTFILESIZE
|
||||
|
||||
/*
|
||||
* FDT options
|
||||
*/
|
||||
#define CONFIG_LMB
|
||||
|
||||
/*
|
||||
* MEMORY ORGANIZATION
|
||||
* -Monitor at top of sdram.
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#define CONFIG_SYS_TIMER_RATE 1000000
|
||||
#endif
|
||||
|
||||
#define CONFIG_LMB
|
||||
|
||||
#define CONFIG_HOST_MAX_DEVICES 4
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
#define CONFIG_PHYSMEM
|
||||
|
||||
#define CONFIG_LMB
|
||||
|
||||
#define CONFIG_SYS_BOOTM_LEN (16 << 20)
|
||||
|
||||
/* SATA AHCI storage */
|
||||
|
|
|
@ -434,7 +434,7 @@ typedef struct bootm_headers {
|
|||
#define BOOTM_STATE_OS_GO (0x00000400)
|
||||
int state;
|
||||
|
||||
#ifdef CONFIG_LMB
|
||||
#if defined(CONFIG_LMB) && !defined(USE_HOSTCC)
|
||||
struct lmb lmb; /* for memory mgmt */
|
||||
#endif
|
||||
} bootm_headers_t;
|
||||
|
|
|
@ -12,22 +12,54 @@
|
|||
* Copyright (C) 2001 Peter Bergner, IBM Corp.
|
||||
*/
|
||||
|
||||
#define MAX_LMB_REGIONS 8
|
||||
|
||||
/**
|
||||
* struct lmb_property - Description of one region.
|
||||
*
|
||||
* @base: Base address of the region.
|
||||
* @size: Size of the region
|
||||
*/
|
||||
struct lmb_property {
|
||||
phys_addr_t base;
|
||||
phys_size_t size;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct lmb_region - Description of a set of region.
|
||||
*
|
||||
* @cnt: Number of regions.
|
||||
* @max: Size of the region array, max value of cnt.
|
||||
* @region: Array of the region properties
|
||||
*/
|
||||
struct lmb_region {
|
||||
unsigned long cnt;
|
||||
phys_size_t size;
|
||||
struct lmb_property region[MAX_LMB_REGIONS+1];
|
||||
unsigned long max;
|
||||
#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
|
||||
struct lmb_property region[CONFIG_LMB_MAX_REGIONS];
|
||||
#else
|
||||
struct lmb_property *region;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* struct lmb - Logical memory block handle.
|
||||
*
|
||||
* Clients provide storage for Logical memory block (lmb) handles.
|
||||
* The content of the structure is managed by the lmb library.
|
||||
* A lmb struct is initialized by lmb_init() functions.
|
||||
* The lmb struct is passed to all other lmb APIs.
|
||||
*
|
||||
* @memory: Description of memory regions.
|
||||
* @reserved: Description of reserved regions.
|
||||
* @memory_regions: Array of the memory regions (statically allocated)
|
||||
* @reserved_regions: Array of the reserved regions (statically allocated)
|
||||
*/
|
||||
struct lmb {
|
||||
struct lmb_region memory;
|
||||
struct lmb_region reserved;
|
||||
#if !IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
|
||||
struct lmb_property memory_regions[CONFIG_LMB_MEMORY_REGIONS];
|
||||
struct lmb_property reserved_regions[CONFIG_LMB_RESERVED_REGIONS];
|
||||
#endif
|
||||
};
|
||||
|
||||
extern void lmb_init(struct lmb *lmb);
|
||||
|
|
|
@ -230,7 +230,7 @@ int part_get_info_by_name(struct blk_desc *dev_desc,
|
|||
* @param[in] allow_whole_dev true to allow the user to select partition 0
|
||||
* (which means the whole device), false to require a valid
|
||||
* partition number >= 1
|
||||
* @return 0 on success, or a negative on error
|
||||
* @return the partition number on success, or negative errno on error
|
||||
*/
|
||||
int part_get_info_by_dev_and_name_or_num(const char *dev_iface,
|
||||
const char *dev_part_str,
|
||||
|
@ -275,6 +275,16 @@ static inline int blk_get_device_part_str(const char *ifname,
|
|||
struct disk_partition *info,
|
||||
int allow_whole_dev)
|
||||
{ *dev_desc = NULL; return -1; }
|
||||
static inline int
|
||||
part_get_info_by_dev_and_name_or_num(const char *dev_iface,
|
||||
const char *dev_part_str,
|
||||
struct blk_desc **dev_desc,
|
||||
struct disk_partition *part_info,
|
||||
int allow_whole_dev)
|
||||
{
|
||||
*dev_desc = NULL;
|
||||
return -ENOSYS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
44
lib/Kconfig
44
lib/Kconfig
|
@ -439,7 +439,7 @@ config LZ4
|
|||
is included. The LZ4 algorithm can run in-place as long as the
|
||||
compressed image is loaded to the end of the output buffer, and
|
||||
trades lower compression ratios for much faster decompression.
|
||||
|
||||
|
||||
NOTE: This implements the release version of the LZ4 frame
|
||||
format as generated by default by the 'lz4' command line tool.
|
||||
This is not the same as the outdated, less efficient legacy
|
||||
|
@ -700,6 +700,48 @@ config LIB_ELF
|
|||
Support basic elf loading/validating functions.
|
||||
This supports for 32 bit and 64 bit versions.
|
||||
|
||||
config LMB
|
||||
bool "Enable the logical memory blocks library (lmb)"
|
||||
default y if ARC || ARM || M68K || MICROBLAZE || MIPS || NDS32 || \
|
||||
NIOS2 || PPC || RISCV || SANDBOX || SH || X86 || XTENSA
|
||||
help
|
||||
Support the library logical memory blocks.
|
||||
|
||||
config LMB_USE_MAX_REGIONS
|
||||
bool "Use a commun number of memory and reserved regions in lmb lib"
|
||||
depends on LMB
|
||||
default y
|
||||
help
|
||||
Define the number of supported memory regions in the library logical
|
||||
memory blocks.
|
||||
This feature allow to reduce the lmb library size by using compiler
|
||||
optimization when LMB_MEMORY_REGIONS == LMB_RESERVED_REGIONS.
|
||||
|
||||
config LMB_MAX_REGIONS
|
||||
int "Number of memory and reserved regions in lmb lib"
|
||||
depends on LMB && LMB_USE_MAX_REGIONS
|
||||
default 8
|
||||
help
|
||||
Define the number of supported regions, memory and reserved, in the
|
||||
library logical memory blocks.
|
||||
|
||||
config LMB_MEMORY_REGIONS
|
||||
int "Number of memory regions in lmb lib"
|
||||
depends on LMB && !LMB_USE_MAX_REGIONS
|
||||
default 8
|
||||
help
|
||||
Define the number of supported memory regions in the library logical
|
||||
memory blocks.
|
||||
The minimal value is CONFIG_NR_DRAM_BANKS.
|
||||
|
||||
config LMB_RESERVED_REGIONS
|
||||
int "Number of reserved regions in lmb lib"
|
||||
depends on LMB && !LMB_USE_MAX_REGIONS
|
||||
default 8
|
||||
help
|
||||
Define the number of supported reserved regions in the library logical
|
||||
memory blocks.
|
||||
|
||||
endmenu
|
||||
|
||||
config PHANDLE_CHECK_SEQ
|
||||
|
|
17
lib/lmb.c
17
lib/lmb.c
|
@ -20,8 +20,6 @@ void lmb_dump_all_force(struct lmb *lmb)
|
|||
|
||||
printf("lmb_dump_all:\n");
|
||||
printf(" memory.cnt = 0x%lx\n", lmb->memory.cnt);
|
||||
printf(" memory.size = 0x%llx\n",
|
||||
(unsigned long long)lmb->memory.size);
|
||||
for (i = 0; i < lmb->memory.cnt; i++) {
|
||||
printf(" memory.reg[0x%lx].base = 0x%llx\n", i,
|
||||
(unsigned long long)lmb->memory.region[i].base);
|
||||
|
@ -30,8 +28,6 @@ void lmb_dump_all_force(struct lmb *lmb)
|
|||
}
|
||||
|
||||
printf("\n reserved.cnt = 0x%lx\n", lmb->reserved.cnt);
|
||||
printf(" reserved.size = 0x%llx\n",
|
||||
(unsigned long long)lmb->reserved.size);
|
||||
for (i = 0; i < lmb->reserved.cnt; i++) {
|
||||
printf(" reserved.reg[0x%lx].base = 0x%llx\n", i,
|
||||
(unsigned long long)lmb->reserved.region[i].base);
|
||||
|
@ -99,10 +95,17 @@ static void lmb_coalesce_regions(struct lmb_region *rgn, unsigned long r1,
|
|||
|
||||
void lmb_init(struct lmb *lmb)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
|
||||
lmb->memory.max = CONFIG_LMB_MAX_REGIONS;
|
||||
lmb->reserved.max = CONFIG_LMB_MAX_REGIONS;
|
||||
#else
|
||||
lmb->memory.max = CONFIG_LMB_MEMORY_REGIONS;
|
||||
lmb->reserved.max = CONFIG_LMB_RESERVED_REGIONS;
|
||||
lmb->memory.region = lmb->memory_regions;
|
||||
lmb->reserved.region = lmb->reserved_regions;
|
||||
#endif
|
||||
lmb->memory.cnt = 0;
|
||||
lmb->memory.size = 0;
|
||||
lmb->reserved.cnt = 0;
|
||||
lmb->reserved.size = 0;
|
||||
}
|
||||
|
||||
static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
|
||||
|
@ -185,7 +188,7 @@ static long lmb_add_region(struct lmb_region *rgn, phys_addr_t base, phys_size_t
|
|||
|
||||
if (coalesced)
|
||||
return coalesced;
|
||||
if (rgn->cnt >= MAX_LMB_REGIONS)
|
||||
if (rgn->cnt >= rgn->max)
|
||||
return -1;
|
||||
|
||||
/* Couldn't coalesce the LMB, so add it to the sorted table. */
|
||||
|
|
|
@ -948,7 +948,6 @@ CONFIG_LEGACY_BOOTCMD_ENV
|
|||
CONFIG_LINUX
|
||||
CONFIG_LINUX_RESET_VEC
|
||||
CONFIG_LITTLETON_LCD
|
||||
CONFIG_LMB
|
||||
CONFIG_LMS283GF05
|
||||
CONFIG_LOADADDR
|
||||
CONFIG_LOADCMD
|
||||
|
|
|
@ -21,26 +21,39 @@ ifneq ($(CONFIG_SANDBOX),)
|
|||
obj-$(CONFIG_ACPIGEN) += acpi.o
|
||||
obj-$(CONFIG_ACPIGEN) += acpigen.o
|
||||
obj-$(CONFIG_ACPIGEN) += acpi_dp.o
|
||||
obj-$(CONFIG_ADC) += adc.o
|
||||
obj-$(CONFIG_SOUND) += audio.o
|
||||
obj-$(CONFIG_AXI) += axi.o
|
||||
obj-$(CONFIG_BLK) += blk.o
|
||||
obj-$(CONFIG_BUTTON) += button.o
|
||||
obj-$(CONFIG_DM_BOOTCOUNT) += bootcount.o
|
||||
obj-$(CONFIG_CLK) += clk.o clk_ccf.o
|
||||
obj-$(CONFIG_CPU) += cpu.o
|
||||
obj-$(CONFIG_CROS_EC) += cros_ec.o
|
||||
obj-$(CONFIG_DEVRES) += devres.o
|
||||
obj-$(CONFIG_DMA) += dma.o
|
||||
obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi_host.o
|
||||
obj-$(CONFIG_DM_DSA) += dsa.o
|
||||
obj-$(CONFIG_DM_ETH) += eth.o
|
||||
ifneq ($(CONFIG_EFI_PARTITION),)
|
||||
obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
|
||||
endif
|
||||
obj-$(CONFIG_FIRMWARE) += firmware.o
|
||||
obj-$(CONFIG_DM_GPIO) += gpio.o
|
||||
obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o
|
||||
obj-$(CONFIG_DM_I2C) += i2c.o
|
||||
obj-$(CONFIG_SOUND) += i2s.o
|
||||
obj-y += irq.o
|
||||
obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
|
||||
obj-$(CONFIG_LED) += led.o
|
||||
obj-$(CONFIG_DM_MAILBOX) += mailbox.o
|
||||
obj-$(CONFIG_DM_MDIO) += mdio.o
|
||||
obj-$(CONFIG_DM_MDIO_MUX) += mdio_mux.o
|
||||
obj-$(CONFIG_MISC) += misc.o
|
||||
obj-$(CONFIG_DM_MMC) += mmc.o
|
||||
obj-$(CONFIG_CMD_MUX) += mux-cmd.o
|
||||
obj-$(CONFIG_MULTIPLEXER) += mux-emul.o
|
||||
obj-$(CONFIG_MUX_MMIO) += mux-mmio.o
|
||||
obj-y += fdtdec.o
|
||||
obj-$(CONFIG_UT_DM) += nop.o
|
||||
obj-y += ofnode.o
|
||||
|
@ -48,58 +61,46 @@ obj-y += ofread.o
|
|||
obj-y += of_extra.o
|
||||
obj-$(CONFIG_OSD) += osd.o
|
||||
obj-$(CONFIG_DM_VIDEO) += panel.o
|
||||
obj-$(CONFIG_EFI_PARTITION) += part.o
|
||||
obj-$(CONFIG_DM_PCI) += pci.o
|
||||
obj-$(CONFIG_P2SB) += p2sb.o
|
||||
obj-$(CONFIG_PCI_ENDPOINT) += pci_ep.o
|
||||
obj-$(CONFIG_PCH) += pch.o
|
||||
obj-$(CONFIG_PHY) += phy.o
|
||||
ifneq ($(CONFIG_PINMUX),)
|
||||
obj-$(CONFIG_PINCONF) += pinmux.o
|
||||
endif
|
||||
obj-$(CONFIG_POWER_DOMAIN) += power-domain.o
|
||||
obj-$(CONFIG_ACPI_PMC) += pmc.o
|
||||
obj-$(CONFIG_DM_PMIC) += pmic.o
|
||||
obj-$(CONFIG_DM_PWM) += pwm.o
|
||||
obj-$(CONFIG_QFW) += qfw.o
|
||||
obj-$(CONFIG_RAM) += ram.o
|
||||
obj-y += regmap.o
|
||||
obj-$(CONFIG_REMOTEPROC) += remoteproc.o
|
||||
obj-$(CONFIG_DM_RESET) += reset.o
|
||||
obj-$(CONFIG_SYSRESET) += sysreset.o
|
||||
obj-$(CONFIG_DM_RTC) += rtc.o
|
||||
obj-$(CONFIG_DM_SPI_FLASH) += sf.o
|
||||
obj-$(CONFIG_SMEM) += smem.o
|
||||
obj-$(CONFIG_DM_SPI) += spi.o
|
||||
obj-y += syscon.o
|
||||
obj-$(CONFIG_MUX_MMIO) += mux-mmio.o
|
||||
obj-$(CONFIG_MULTIPLEXER) += mux-emul.o
|
||||
obj-$(CONFIG_DM_USB) += usb.o
|
||||
obj-$(CONFIG_DM_PMIC) += pmic.o
|
||||
obj-$(CONFIG_DM_REGULATOR) += regulator.o
|
||||
obj-$(CONFIG_TIMER) += timer.o
|
||||
obj-$(CONFIG_DM_VIDEO) += video.o
|
||||
obj-$(CONFIG_ADC) += adc.o
|
||||
obj-$(CONFIG_SPMI) += spmi.o
|
||||
obj-$(CONFIG_WDT) += wdt.o
|
||||
obj-$(CONFIG_AXI) += axi.o
|
||||
obj-$(CONFIG_MISC) += misc.o
|
||||
obj-$(CONFIG_DM_SERIAL) += serial.o
|
||||
obj-$(CONFIG_CPU) += cpu.o
|
||||
obj-$(CONFIG_SOC_DEVICE) += soc.o
|
||||
obj-$(CONFIG_SOUND) += sound.o
|
||||
obj-$(CONFIG_SYSINFO) += sysinfo.o
|
||||
obj-$(CONFIG_TEE) += tee.o
|
||||
obj-$(CONFIG_VIRTIO_SANDBOX) += virtio.o
|
||||
obj-$(CONFIG_DMA) += dma.o
|
||||
obj-$(CONFIG_DM_MDIO) += mdio.o
|
||||
obj-$(CONFIG_DM_MDIO_MUX) += mdio_mux.o
|
||||
obj-$(CONFIG_DM_RNG) += rng.o
|
||||
obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
|
||||
obj-$(CONFIG_DM_RTC) += rtc.o
|
||||
obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o
|
||||
obj-$(CONFIG_DM_SERIAL) += serial.o
|
||||
obj-$(CONFIG_DM_SPI_FLASH) += sf.o
|
||||
obj-$(CONFIG_SIMPLE_BUS) += simple-bus.o
|
||||
obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o
|
||||
obj-$(CONFIG_SMEM) += smem.o
|
||||
obj-$(CONFIG_SOC_DEVICE) += soc.o
|
||||
obj-$(CONFIG_SOUND) += sound.o
|
||||
obj-$(CONFIG_DM_SPI) += spi.o
|
||||
obj-$(CONFIG_SPMI) += spmi.o
|
||||
obj-y += syscon.o
|
||||
obj-$(CONFIG_RESET_SYSCON) += syscon-reset.o
|
||||
obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o
|
||||
ifneq ($(CONFIG_PINMUX),)
|
||||
obj-$(CONFIG_PINCONF) += pinmux.o
|
||||
endif
|
||||
ifneq ($(CONFIG_EFI_PARTITION),)
|
||||
obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
|
||||
endif
|
||||
obj-$(CONFIG_QFW) += qfw.o
|
||||
obj-$(CONFIG_SYSINFO) += sysinfo.o
|
||||
obj-$(CONFIG_TEE) += tee.o
|
||||
obj-$(CONFIG_TIMER) += timer.o
|
||||
obj-$(CONFIG_DM_USB) += usb.o
|
||||
obj-$(CONFIG_DM_VIDEO) += video.o
|
||||
obj-$(CONFIG_VIRTIO_SANDBOX) += virtio.o
|
||||
obj-$(CONFIG_WDT) += wdt.o
|
||||
endif
|
||||
endif # !SPL
|
||||
|
|
76
test/dm/part.c
Normal file
76
test/dm/part.c
Normal file
|
@ -0,0 +1,76 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2020 Sean Anderson <sean.anderson@seco.com>
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <mmc.h>
|
||||
#include <part.h>
|
||||
#include <part_efi.h>
|
||||
#include <dm/test.h>
|
||||
#include <test/ut.h>
|
||||
|
||||
static int dm_test_part(struct unit_test_state *uts)
|
||||
{
|
||||
char str_disk_guid[UUID_STR_LEN + 1];
|
||||
struct blk_desc *mmc_dev_desc;
|
||||
struct disk_partition part_info;
|
||||
struct disk_partition parts[2] = {
|
||||
{
|
||||
.start = 48, /* GPT data takes up the first 34 blocks or so */
|
||||
.size = 1,
|
||||
.name = "test1",
|
||||
},
|
||||
{
|
||||
.start = 49,
|
||||
.size = 1,
|
||||
.name = "test2",
|
||||
},
|
||||
};
|
||||
|
||||
ut_asserteq(1, blk_get_device_by_str("mmc", "1", &mmc_dev_desc));
|
||||
if (CONFIG_IS_ENABLED(RANDOM_UUID)) {
|
||||
gen_rand_uuid_str(parts[0].uuid, UUID_STR_FORMAT_STD);
|
||||
gen_rand_uuid_str(parts[1].uuid, UUID_STR_FORMAT_STD);
|
||||
gen_rand_uuid_str(str_disk_guid, UUID_STR_FORMAT_STD);
|
||||
}
|
||||
ut_assertok(gpt_restore(mmc_dev_desc, str_disk_guid, parts,
|
||||
ARRAY_SIZE(parts)));
|
||||
|
||||
#define test(expected, part_str, whole) \
|
||||
ut_asserteq(expected, \
|
||||
part_get_info_by_dev_and_name_or_num("mmc", part_str, \
|
||||
&mmc_dev_desc, \
|
||||
&part_info, whole))
|
||||
|
||||
test(-ENODEV, "", true);
|
||||
env_set("bootdevice", "0");
|
||||
test(0, "", true);
|
||||
env_set("bootdevice", "1");
|
||||
test(1, "", false);
|
||||
test(1, "-", false);
|
||||
env_set("bootdevice", "");
|
||||
test(-EPROTONOSUPPORT, "0", false);
|
||||
test(0, "0", true);
|
||||
test(0, ":0", true);
|
||||
test(0, ".0", true);
|
||||
test(0, ".0:0", true);
|
||||
test(-EINVAL, "#test1", true);
|
||||
test(1, "1", false);
|
||||
test(1, "1", true);
|
||||
test(-ENOENT, "1:0", false);
|
||||
test(0, "1:0", true);
|
||||
test(1, "1:1", false);
|
||||
test(2, "1:2", false);
|
||||
test(1, "1.0", false);
|
||||
test(0, "1.0:0", true);
|
||||
test(1, "1.0:1", false);
|
||||
test(2, "1.0:2", false);
|
||||
test(-EINVAL, "1#bogus", false);
|
||||
test(1, "1#test1", false);
|
||||
test(2, "1#test2", false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_part, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
|
@ -659,3 +659,67 @@ static int lib_test_lmb_get_free_size(struct unit_test_state *uts)
|
|||
|
||||
DM_TEST(lib_test_lmb_get_free_size,
|
||||
UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
|
||||
static int lib_test_lmb_max_regions(struct unit_test_state *uts)
|
||||
{
|
||||
const phys_addr_t ram = 0x00000000;
|
||||
const phys_size_t ram_size = 0x8000000;
|
||||
const phys_size_t blk_size = 0x10000;
|
||||
phys_addr_t offset;
|
||||
struct lmb lmb;
|
||||
int ret, i;
|
||||
|
||||
lmb_init(&lmb);
|
||||
|
||||
ut_asserteq(lmb.memory.cnt, 0);
|
||||
ut_asserteq(lmb.memory.max, 8);
|
||||
ut_asserteq(lmb.reserved.cnt, 0);
|
||||
ut_asserteq(lmb.reserved.max, 8);
|
||||
|
||||
/* Add 8 memory regions */
|
||||
for (i = 0; i < 8; i++) {
|
||||
offset = ram + 2 * i * ram_size;
|
||||
ret = lmb_add(&lmb, offset, ram_size);
|
||||
ut_asserteq(ret, 0);
|
||||
}
|
||||
ut_asserteq(lmb.memory.cnt, 8);
|
||||
ut_asserteq(lmb.reserved.cnt, 0);
|
||||
|
||||
/* error for the 9th memory regions */
|
||||
offset = ram + 2 * 8 * ram_size;
|
||||
ret = lmb_add(&lmb, offset, ram_size);
|
||||
ut_asserteq(ret, -1);
|
||||
|
||||
ut_asserteq(lmb.memory.cnt, 8);
|
||||
ut_asserteq(lmb.reserved.cnt, 0);
|
||||
|
||||
/* reserve 8 regions */
|
||||
for (i = 0; i < 8; i++) {
|
||||
offset = ram + 2 * i * blk_size;
|
||||
ret = lmb_reserve(&lmb, offset, blk_size);
|
||||
ut_asserteq(ret, 0);
|
||||
}
|
||||
|
||||
ut_asserteq(lmb.memory.cnt, 8);
|
||||
ut_asserteq(lmb.reserved.cnt, 8);
|
||||
|
||||
/* error for the 9th reserved blocks */
|
||||
offset = ram + 2 * 8 * blk_size;
|
||||
ret = lmb_reserve(&lmb, offset, blk_size);
|
||||
ut_asserteq(ret, -1);
|
||||
|
||||
ut_asserteq(lmb.memory.cnt, 8);
|
||||
ut_asserteq(lmb.reserved.cnt, 8);
|
||||
|
||||
/* check each regions */
|
||||
for (i = 0; i < 8; i++)
|
||||
ut_asserteq(lmb.memory.region[i].base, ram + 2 * i * ram_size);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
ut_asserteq(lmb.reserved.region[i].base, ram + 2 * i * blk_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_max_regions,
|
||||
UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
|
|
Loading…
Add table
Reference in a new issue