提交 28a4516c 编写于 作者: T Tom Rini

Merge branch '2019-12-05-master-imports'

- Assorted omapl138_lcdk / da850-evm fixes
- FAT fix, add another pytest as well for FAT.
- Assorted general fixes
......@@ -65,7 +65,7 @@ config ARMV8_SEC_FIRMWARE_SUPPORT
- Address of secure firmware.
- Address to hold the return address from secure firmware.
- Secure firmware FIT image related information.
Such as: SEC_FIRMWARE_FIT_IMAGE and SEC_FIRMEWARE_FIT_CNF_NAME
Such as: SEC_FIRMWARE_FIT_IMAGE and SEC_FIRMWARE_FIT_CNF_NAME
- The target exception level that secure monitor firmware will
return to.
......
......@@ -29,8 +29,8 @@ phys_addr_t sec_firmware_addr;
#ifndef SEC_FIRMWARE_FIT_IMAGE
#define SEC_FIRMWARE_FIT_IMAGE "firmware"
#endif
#ifndef SEC_FIRMEWARE_FIT_CNF_NAME
#define SEC_FIRMEWARE_FIT_CNF_NAME "config-1"
#ifndef SEC_FIRMWARE_FIT_CNF_NAME
#define SEC_FIRMWARE_FIT_CNF_NAME "config-1"
#endif
#ifndef SEC_FIRMWARE_TARGET_EL
#define SEC_FIRMWARE_TARGET_EL 2
......@@ -44,7 +44,7 @@ static int sec_firmware_get_data(const void *sec_firmware_img,
char *desc;
int ret;
conf_node_name = SEC_FIRMEWARE_FIT_CNF_NAME;
conf_node_name = SEC_FIRMWARE_FIT_CNF_NAME;
conf_node_off = fit_conf_get_node(sec_firmware_img, conf_node_name);
if (conf_node_off < 0) {
......@@ -124,7 +124,7 @@ static int sec_firmware_check_copy_loadable(const void *sec_firmware_img,
const char *name, *str, *type;
int len;
conf_node_name = SEC_FIRMEWARE_FIT_CNF_NAME;
conf_node_name = SEC_FIRMWARE_FIT_CNF_NAME;
conf_node_off = fit_conf_get_node(sec_firmware_img, conf_node_name);
if (conf_node_off < 0) {
......
......@@ -19,6 +19,7 @@
#include <linux/ctype.h>
#include <linux/err.h>
#include <u-boot/zlib.h>
#include <mapmem.h>
DECLARE_GLOBAL_DATA_PTR;
......@@ -244,7 +245,7 @@ static int do_iminfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static int image_info(ulong addr)
{
void *hdr = (void *)addr;
void *hdr = (void *)map_sysmem(addr, 0);
printf("\n## Checking Image at %08lx ...\n", addr);
......@@ -254,11 +255,13 @@ static int image_info(ulong addr)
puts(" Legacy image found\n");
if (!image_check_magic(hdr)) {
puts(" Bad Magic Number\n");
unmap_sysmem(hdr);
return 1;
}
if (!image_check_hcrc(hdr)) {
puts(" Bad Header Checksum\n");
unmap_sysmem(hdr);
return 1;
}
......@@ -267,15 +270,18 @@ static int image_info(ulong addr)
puts(" Verifying Checksum ... ");
if (!image_check_dcrc(hdr)) {
puts(" Bad Data CRC\n");
unmap_sysmem(hdr);
return 1;
}
puts("OK\n");
unmap_sysmem(hdr);
return 0;
#endif
#if defined(CONFIG_ANDROID_BOOT_IMAGE)
case IMAGE_FORMAT_ANDROID:
puts(" Android image found\n");
android_print_contents(hdr);
unmap_sysmem(hdr);
return 0;
#endif
#if defined(CONFIG_FIT)
......@@ -284,6 +290,7 @@ static int image_info(ulong addr)
if (!fit_check_format(hdr)) {
puts("Bad FIT image format!\n");
unmap_sysmem(hdr);
return 1;
}
......@@ -291,9 +298,11 @@ static int image_info(ulong addr)
if (!fit_all_image_verify(hdr)) {
puts("Bad hash in FIT image!\n");
unmap_sysmem(hdr);
return 1;
}
unmap_sysmem(hdr);
return 0;
#endif
default:
......@@ -301,6 +310,7 @@ static int image_info(ulong addr)
break;
}
unmap_sysmem(hdr);
return 1;
}
......
......@@ -303,6 +303,7 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
ulong addr, dest, count;
void *src, *dst;
int size;
if (argc != 4)
......@@ -326,25 +327,34 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
}
src = map_sysmem(addr, count * size);
dst = map_sysmem(dest, count * size);
#ifdef CONFIG_MTD_NOR_FLASH
/* check if we are copying to Flash */
if (addr2info(dest) != NULL) {
if (addr2info((ulong)dst)) {
int rc;
puts ("Copy to Flash... ");
rc = flash_write ((char *)addr, dest, count*size);
rc = flash_write((char *)src, (ulong)dst, count * size);
if (rc != 0) {
flash_perror (rc);
unmap_sysmem(src);
unmap_sysmem(dst);
return (1);
}
puts ("done\n");
unmap_sysmem(src);
unmap_sysmem(dst);
return 0;
}
#endif
memcpy((void *)dest, (void *)addr, count * size);
memcpy(dst, src, count * size);
unmap_sysmem(src);
unmap_sysmem(dst);
return 0;
}
......
......@@ -485,6 +485,12 @@ config SPL_DMA_SUPPORT
the CPU moving the data. Enable this option to build the drivers
in drivers/dma as part of an SPL build.
config SPL_DM_GPIO
bool "Support Driver Model GPIO drivers"
depends on SPL_GPIO_SUPPORT && DM_GPIO
help
Enable support for Driver Model based GPIO drivers in SPL.
config SPL_DRIVERS_MISC_SUPPORT
bool "Support misc drivers"
help
......
......@@ -264,9 +264,9 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
spl_image->entry_point = image_get_ep(header);
spl_image->size = image_get_data_size(header);
} else {
spl_image->entry_point = image_get_load(header);
spl_image->entry_point = image_get_ep(header);
/* Load including the header */
spl_image->load_addr = spl_image->entry_point -
spl_image->load_addr = image_get_load(header) -
header_size;
spl_image->size = image_get_data_size(header) +
header_size;
......
......@@ -26,6 +26,7 @@ CONFIG_VERSION_VARIABLE=y
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
CONFIG_SPL_SEPARATE_BSS=y
# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x8000
CONFIG_HUSH_PARSER=y
......
......@@ -23,6 +23,7 @@ CONFIG_VERSION_VARIABLE=y
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
CONFIG_SPL_SEPARATE_BSS=y
# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
CONFIG_SPL_NAND_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x8000
......
CONFIG_ARM=y
CONFIG_SYS_THUMB_BUILD=y
CONFIG_ARCH_DAVINCI=y
CONFIG_SYS_TEXT_BASE=0xc1080000
CONFIG_TARGET_OMAPL138_LCDK=y
......
......@@ -16,7 +16,7 @@
#include <fsl_validate.h>
#endif
#define PFE_FIRMEWARE_FIT_CNF_NAME "config@1"
#define PFE_FIRMWARE_FIT_CNF_NAME "config@1"
static const void *pfe_fit_addr = (void *)CONFIG_SYS_LS_PFE_FW_ADDR;
......@@ -99,7 +99,7 @@ static int pfe_get_fw(const void **data,
char *desc;
int ret = 0;
conf_node_name = PFE_FIRMEWARE_FIT_CNF_NAME;
conf_node_name = PFE_FIRMWARE_FIT_CNF_NAME;
conf_node_off = fit_conf_get_node(pfe_fit_addr, conf_node_name);
if (conf_node_off < 0) {
......
......@@ -677,6 +677,11 @@ static int pci_find_and_bind_driver(struct udevice *parent,
/* Determine optional OF node */
pci_dev_find_ofnode(parent, bdf, &node);
if (ofnode_valid(node) && !ofnode_is_available(node)) {
debug("%s: Ignoring disabled device\n", __func__);
return -EPERM;
}
start = ll_entry_start(struct pci_driver_entry, pci_driver_entry);
n_ents = ll_entry_count(struct pci_driver_entry, pci_driver_entry);
for (entry = start; entry != start + n_ents; entry++) {
......
......@@ -98,6 +98,7 @@ static struct mmc *get_mmc(struct optee_private *priv, int dev_id)
static u32 rpmb_get_dev_info(u16 dev_id, struct rpmb_dev_info *info)
{
struct mmc *mmc = find_mmc_device(dev_id);
int i;
if (!mmc)
return TEE_ERROR_ITEM_NOT_FOUND;
......@@ -105,7 +106,9 @@ static u32 rpmb_get_dev_info(u16 dev_id, struct rpmb_dev_info *info)
if (!mmc->ext_csd)
return TEE_ERROR_GENERIC;
memcpy(info->cid, mmc->cid, sizeof(info->cid));
for (i = 0; i < ARRAY_SIZE(mmc->cid); i++)
((u32 *) info->cid)[i] = cpu_to_be32(mmc->cid[i]);
info->rel_wr_sec_c = mmc->ext_csd[222];
info->rpmb_size_mult = mmc->ext_csd[168];
info->ret_code = RPMB_CMD_GET_DEV_INFO_RET_OK;
......
......@@ -869,6 +869,14 @@ static dir_entry *extract_vfat_name(fat_itr *itr)
return NULL;
}
/*
* We are now at the short file name entry.
* If it is marked as deleted, just skip it.
*/
if (dent->name[0] == DELETED_FLAG ||
dent->name[0] == aRING)
return NULL;
itr->l_name[n] = '\0';
chksum = mkcksum(dent->name, dent->ext);
......@@ -898,6 +906,16 @@ static int fat_itr_next(fat_itr *itr)
itr->name = NULL;
/*
* One logical directory entry consist of following slots:
* name[0] Attributes
* dent[N - N]: LFN[N - 1] N|0x40 ATTR_VFAT
* ...
* dent[N - 2]: LFN[1] 2 ATTR_VFAT
* dent[N - 1]: LFN[0] 1 ATTR_VFAT
* dent[N]: SFN ATTR_ARCH
*/
while (1) {
dent = next_dent(itr);
if (!dent)
......@@ -910,7 +928,17 @@ static int fat_itr_next(fat_itr *itr)
if (dent->attr & ATTR_VOLUME) {
if ((dent->attr & ATTR_VFAT) == ATTR_VFAT &&
(dent->name[0] & LAST_LONG_ENTRY_MASK)) {
/* long file name */
dent = extract_vfat_name(itr);
/*
* If succeeded, dent has a valid short file
* name entry for the current entry.
* If failed, itr points to a current bogus
* entry. So after fetching a next one,
* it may have a short file name entry
* for this bogus entry so that we can still
* check for a short name.
*/
if (!dent)
continue;
itr->name = itr->l_name;
......@@ -919,8 +947,11 @@ static int fat_itr_next(fat_itr *itr)
/* Volume label or VFAT entry, skip */
continue;
}
}
} else if (!(dent->attr & ATTR_ARCH) &&
!(dent->attr & ATTR_DIR))
continue;
/* short file name */
break;
}
......
......@@ -233,3 +233,87 @@ class TestFsExt(object):
% (fs_type, ADDR, MIN_FILE)])
assert('Unable to write "/dir1' in ''.join(output))
assert_fs_integrity(fs_type, fs_img)
def test_fs_ext10(self, u_boot_console, fs_obj_ext):
"""
'Test Case 10 - create/delete as many directories under root directory
as amount of directory entries goes beyond one cluster size)'
"""
fs_type,fs_img,md5val = fs_obj_ext
with u_boot_console.log.section('Test Case 10 - create/delete (many)'):
# Test Case 10a - Create many files
# Please note that the size of directory entry is 32 bytes.
# So one typical cluster may holds 64 (2048/32) entries.
output = u_boot_console.run_command(
'host bind 0 %s' % fs_img)
for i in range(0, 66):
output = u_boot_console.run_command(
'%swrite host 0:0 %x /FILE0123456789_%02x 100'
% (fs_type, ADDR, i))
output = u_boot_console.run_command('%sls host 0:0 /' % fs_type)
assert('FILE0123456789_00' in output)
assert('FILE0123456789_41' in output)
# Test Case 10b - Delete many files
for i in range(0, 66):
output = u_boot_console.run_command(
'%srm host 0:0 /FILE0123456789_%02x'
% (fs_type, i))
output = u_boot_console.run_command('%sls host 0:0 /' % fs_type)
assert(not 'FILE0123456789_00' in output)
assert(not 'FILE0123456789_41' in output)
# Test Case 10c - Create many files again
# Please note no.64 and 65 are intentionally re-created
for i in range(64, 128):
output = u_boot_console.run_command(
'%swrite host 0:0 %x /FILE0123456789_%02x 100'
% (fs_type, ADDR, i))
output = u_boot_console.run_command('%sls host 0:0 /' % fs_type)
assert('FILE0123456789_40' in output)
assert('FILE0123456789_79' in output)
assert_fs_integrity(fs_type, fs_img)
def test_fs_ext11(self, u_boot_console, fs_obj_ext):
"""
'Test Case 11 - create/delete as many directories under non-root
directory as amount of directory entries goes beyond one cluster size)'
"""
fs_type,fs_img,md5val = fs_obj_ext
with u_boot_console.log.section('Test Case 11 - create/delete (many)'):
# Test Case 11a - Create many files
# Please note that the size of directory entry is 32 bytes.
# So one typical cluster may holds 64 (2048/32) entries.
output = u_boot_console.run_command(
'host bind 0 %s' % fs_img)
for i in range(0, 66):
output = u_boot_console.run_command(
'%swrite host 0:0 %x /dir1/FILE0123456789_%02x 100'
% (fs_type, ADDR, i))
output = u_boot_console.run_command('%sls host 0:0 /dir1' % fs_type)
assert('FILE0123456789_00' in output)
assert('FILE0123456789_41' in output)
# Test Case 11b - Delete many files
for i in range(0, 66):
output = u_boot_console.run_command(
'%srm host 0:0 /dir1/FILE0123456789_%02x'
% (fs_type, i))
output = u_boot_console.run_command('%sls host 0:0 /dir1' % fs_type)
assert(not 'FILE0123456789_00' in output)
assert(not 'FILE0123456789_41' in output)
# Test Case 11c - Create many files again
# Please note no.64 and 65 are intentionally re-created
for i in range(64, 128):
output = u_boot_console.run_command(
'%swrite host 0:0 %x /dir1/FILE0123456789_%02x 100'
% (fs_type, ADDR, i))
output = u_boot_console.run_command('%sls host 0:0 /dir1' % fs_type)
assert('FILE0123456789_40' in output)
assert('FILE0123456789_79' in output)
assert_fs_integrity(fs_type, fs_img)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册