mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
Pull request for UEFI sub-system for efi-2020-01-rc1 (2)
Install the simple file protocol only if there is a file system on the partition. Enable CONFIG_CMD_NVEDIT_EFI on QEMU. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAl2p9OcACgkQxIHbvCwF GsRLAg//fmqk3B7FInPfQ6fxfyMx3Ck2EosoePjf0IsMq0nfGIVMigXZwpUtwkwN LBmp/Vf8mkRfFNWk55/qzecdgCoVKx1nN1YoqsGh/ZFsX+1L3Kd01ODJw0in0T8N GwMm0sbSk+EqWp4JMs9seZBL5S1PfCZ59rzRcvgLq+9VgZX9+LxLeIidZ3bh/++w 1fo5jZtWavKNuCqgU9cUlT2FLgE+8q+W1ZAVmD1fDs3ef7Xys8UaTOP3M9jtT9AS ruletzPRmJ1GFe9xC94qIfij4ZXclo2tt7L3c6QeTpiwcav5HFiQIsRvvssnRpma GYZyyu2CNgjChjqOvGMFftWvR3kZWUHCEFFxZzH+0YfdcU1MNfwtQjieviuJGc5S sOK/SWvsdEoHow85NNAmDDJUcR1MfakMjFyM+fcs/YtUoJHoP6LKQwAmJMpMLPq4 6164ymvdoo8YD3cYLP9yvsJ+r9GW3FNUloBwAwz3OMJy1uXoi1igMv60dMBCLJDC cftW48sFivg0oSb+780xiJwyjjreg9dRqmlp0lhsxuGDPA2YqxNiAZs/Q2geEM3+ LJmeB78PvGAuzU1LPW34IsYyplRa21y1y+IbOceRdcbOmY6XT8Zf9eMInKdoE78i gal2rjNdHoGX8v5WchUNNmIVjQQqDMf1jOi/lfkeivKu16/68HY= =X+Tw -----END PGP SIGNATURE----- Merge tag 'efi-2020-01-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2020-01-rc1 (2) Install the simple file protocol only if there is a file system on the partition. Enable CONFIG_CMD_NVEDIT_EFI on QEMU.
This commit is contained in:
commit
4b5c4dd93a
12 changed files with 76 additions and 7 deletions
|
@ -6,5 +6,6 @@ CONFIG_FIT=y
|
|||
CONFIG_DISPLAY_CPUINFO=y
|
||||
CONFIG_DISPLAY_BOARDINFO=y
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_NVEDIT_EFI=y
|
||||
# CONFIG_CMD_MII is not set
|
||||
CONFIG_OF_PRIOR_STAGE=y
|
||||
|
|
|
@ -7,5 +7,6 @@ CONFIG_FIT=y
|
|||
CONFIG_DISPLAY_CPUINFO=y
|
||||
CONFIG_DISPLAY_BOARDINFO=y
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_NVEDIT_EFI=y
|
||||
# CONFIG_CMD_MII is not set
|
||||
CONFIG_OF_PRIOR_STAGE=y
|
||||
|
|
|
@ -7,5 +7,6 @@ CONFIG_FIT=y
|
|||
CONFIG_DISPLAY_CPUINFO=y
|
||||
CONFIG_DISPLAY_BOARDINFO=y
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_NVEDIT_EFI=y
|
||||
# CONFIG_CMD_MII is not set
|
||||
CONFIG_OF_PRIOR_STAGE=y
|
||||
|
|
|
@ -8,5 +8,6 @@ CONFIG_FIT=y
|
|||
CONFIG_DISPLAY_CPUINFO=y
|
||||
CONFIG_DISPLAY_BOARDINFO=y
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_NVEDIT_EFI=y
|
||||
# CONFIG_CMD_MII is not set
|
||||
CONFIG_OF_PRIOR_STAGE=y
|
||||
|
|
|
@ -34,6 +34,7 @@ CONFIG_SPL_PCH_SUPPORT=y
|
|||
CONFIG_SPL_RTC_SUPPORT=y
|
||||
CONFIG_CMD_CPU=y
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_NVEDIT_EFI=y
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
CONFIG_CMD_IDE=y
|
||||
CONFIG_CMD_SPI=y
|
||||
|
|
|
@ -19,6 +19,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
|
|||
CONFIG_LAST_STAGE_INIT=y
|
||||
CONFIG_CMD_CPU=y
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_NVEDIT_EFI=y
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
CONFIG_CMD_IDE=y
|
||||
CONFIG_CMD_SPI=y
|
||||
|
|
|
@ -9,6 +9,7 @@ CONFIG_PREBOOT="pci enum"
|
|||
# CONFIG_DISPLAY_CPUINFO is not set
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_NVEDIT_EFI=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_USB=y
|
||||
CONFIG_OF_BOARD=y
|
||||
|
|
|
@ -10,6 +10,7 @@ CONFIG_PREBOOT="pci enum"
|
|||
# CONFIG_DISPLAY_CPUINFO is not set
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_NVEDIT_EFI=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_USB=y
|
||||
CONFIG_OF_BOARD=y
|
||||
|
|
18
fs/fs.c
18
fs/fs.c
|
@ -307,6 +307,19 @@ static struct fstype_info *fs_get_info(int fstype)
|
|||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* fs_get_type() - Get type of current filesystem
|
||||
*
|
||||
* Return: filesystem type
|
||||
*
|
||||
* Returns filesystem type representing the current filesystem, or
|
||||
* FS_TYPE_ANY for any unrecognised filesystem.
|
||||
*/
|
||||
int fs_get_type(void)
|
||||
{
|
||||
return fs_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* fs_get_type_name() - Get type of current filesystem
|
||||
*
|
||||
|
@ -389,7 +402,7 @@ int fs_set_blk_dev_with_part(struct blk_desc *desc, int part)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void fs_close(void)
|
||||
void fs_close(void)
|
||||
{
|
||||
struct fstype_info *info = fs_get_info(fs_type);
|
||||
|
||||
|
@ -413,7 +426,6 @@ int fs_ls(const char *dirname)
|
|||
|
||||
ret = info->ls(dirname);
|
||||
|
||||
fs_type = FS_TYPE_ANY;
|
||||
fs_close();
|
||||
|
||||
return ret;
|
||||
|
@ -597,7 +609,6 @@ int fs_unlink(const char *filename)
|
|||
|
||||
ret = info->unlink(filename);
|
||||
|
||||
fs_type = FS_TYPE_ANY;
|
||||
fs_close();
|
||||
|
||||
return ret;
|
||||
|
@ -611,7 +622,6 @@ int fs_mkdir(const char *dirname)
|
|||
|
||||
ret = info->mkdir(dirname);
|
||||
|
||||
fs_type = FS_TYPE_ANY;
|
||||
fs_close();
|
||||
|
||||
return ret;
|
||||
|
|
22
include/fs.h
22
include/fs.h
|
@ -37,6 +37,28 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype);
|
|||
*/
|
||||
int fs_set_blk_dev_with_part(struct blk_desc *desc, int part);
|
||||
|
||||
/**
|
||||
* fs_close() - Unset current block device and partition
|
||||
*
|
||||
* fs_close() closes the connection to a file system opened with either
|
||||
* fs_set_blk_dev() or fs_set_dev_with_part().
|
||||
*
|
||||
* Many file functions implicitly call fs_close(), e.g. fs_closedir(),
|
||||
* fs_exist(), fs_ln(), fs_ls(), fs_mkdir(), fs_read(), fs_size(), fs_write(),
|
||||
* fs_unlink().
|
||||
*/
|
||||
void fs_close(void);
|
||||
|
||||
/**
|
||||
* fs_get_type() - Get type of current filesystem
|
||||
*
|
||||
* Return: filesystem type
|
||||
*
|
||||
* Returns filesystem type representing the current filesystem, or
|
||||
* FS_TYPE_ANY for any unrecognised filesystem.
|
||||
*/
|
||||
int fs_get_type(void);
|
||||
|
||||
/**
|
||||
* fs_get_type_name() - Get type of current filesystem
|
||||
*
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <part.h>
|
||||
#include <sandboxblockdev.h>
|
||||
#include <asm-generic/unaligned.h>
|
||||
#include <linux/compat.h> /* U16_MAX */
|
||||
|
||||
#ifdef CONFIG_SANDBOX
|
||||
const efi_guid_t efi_guid_host_dev = U_BOOT_HOST_DEV_GUID;
|
||||
|
@ -888,13 +889,16 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
|
|||
{
|
||||
struct efi_device_path_file_path *fp;
|
||||
void *buf, *start;
|
||||
unsigned dpsize = 0, fpsize;
|
||||
size_t dpsize = 0, fpsize;
|
||||
|
||||
if (desc)
|
||||
dpsize = dp_part_size(desc, part);
|
||||
|
||||
fpsize = sizeof(struct efi_device_path) +
|
||||
2 * (utf8_utf16_strlen(path) + 1);
|
||||
if (fpsize > U16_MAX)
|
||||
return NULL;
|
||||
|
||||
dpsize += fpsize;
|
||||
|
||||
start = buf = dp_alloc(dpsize + sizeof(END));
|
||||
|
@ -908,7 +912,7 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
|
|||
fp = buf;
|
||||
fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
|
||||
fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
|
||||
fp->dp.length = fpsize;
|
||||
fp->dp.length = (u16)fpsize;
|
||||
path_to_uefi(fp->str, path);
|
||||
buf += fpsize;
|
||||
|
||||
|
@ -1070,5 +1074,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
|
|||
*file = efi_dp_from_file(((!is_net && device) ? desc : NULL),
|
||||
part, filename);
|
||||
|
||||
if (!file)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <blk.h>
|
||||
#include <dm.h>
|
||||
#include <efi_loader.h>
|
||||
#include <fs.h>
|
||||
#include <part.h>
|
||||
#include <malloc.h>
|
||||
|
||||
|
@ -262,6 +263,27 @@ efi_fs_from_path(struct efi_device_path *full_path)
|
|||
return handler->protocol_interface;
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_fs_exists() - check if a partition bears a file system
|
||||
*
|
||||
* @desc: block device descriptor
|
||||
* @part: partition number
|
||||
* Return: 1 if a file system exists on the partition
|
||||
* 0 otherwise
|
||||
*/
|
||||
static int efi_fs_exists(struct blk_desc *desc, int part)
|
||||
{
|
||||
if (fs_set_blk_dev_with_part(desc, part))
|
||||
return 0;
|
||||
|
||||
if (fs_get_type() == FS_TYPE_ANY)
|
||||
return 0;
|
||||
|
||||
fs_close();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a handle for a partition or disk
|
||||
*
|
||||
|
@ -315,7 +337,7 @@ static efi_status_t efi_disk_add_dev(
|
|||
diskobj->dp);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return ret;
|
||||
if (part >= 1) {
|
||||
if (part >= 1 && efi_fs_exists(desc, part)) {
|
||||
diskobj->volume = efi_simple_file_system(desc, part,
|
||||
diskobj->dp);
|
||||
ret = efi_add_protocol(&diskobj->header,
|
||||
|
|
Loading…
Reference in a new issue