Pull request for UEFI sub-system for efi-2021-04-rc1-4

Bug fixes:
 
 * re-read the partition table after writing GPT
 * fix a problem booting ARMv7 boards with PSCI without UEFI
 * make aarch64 UEFI test programs compatible with GRUB linux command
 * correct the alignment check in the EFI_BLOCK_IO_PROTOCOL
 * check EFI_BLOCK_IO_PROTOCOL.Media->LastBlock in unit test
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmAUhPAACgkQxIHbvCwF
 GsQEEA/6A2onIXIcqnl3a0iMXSYy7ByO34jQ8zrFALl6ubrHYDub5/nZavB+knB7
 9kT66Aqaffhhke7LenkvpgSCq2v1Ge6zAPPZLOypJ/fll6QMUPmzY/bMgDz7gg2z
 9mkCwWUjrvEppef0xHJ8mbxqkBrF42w4luOuFZudzsXS5zX8yGwOYJ4Tm46yKkBc
 B6iP0VBQGU9+mOstyrXCGtL8Jgy1lC8Bj2DBbVsoeIuLh45JJzEvJsXXVZlNEMLf
 IAg5lgfERirZpdbogntDb+hxQrhQOs8elDdY/IqmV9svimXq0ONPLPiGbv82ZltR
 Va/H4AF494ZlyV0QRzFj3nBx1jkGNLVCQhCWfDWrCyJDqVR7Vqw8J3ctXJ+3gjWn
 qNRHN/1JDx324FE0DnczDW9vsGkTqod6duU1PS00hYOgowAR9Qt44s6zXQmJwz+x
 R3pNPiC3dreO4dBjFMEKDX5SY/+v2GUf6RyccoEBiIJfpcSvCNg4U8LT1VO4Z5Hx
 szNtT6ANURoguXz1x5Wfo+UAHsf5hm5LpiisHGinuygCkUxlf+kzOuIayMtUoyUB
 ZkKZxCxF9XmnaXY9Uv/A6Y1LQVBXrD5urM1G5YR7TSeIc0DaplcacC5963R9+F04
 2+IZK5etTLu7eT8EFD0myAHyozkX8043R3L0XbKvDEYMsMXnzBQ=
 =bUWI
 -----END PGP SIGNATURE-----

Merge tag 'efi-2021-04-rc1-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-04-rc1-4

Bug fixes:

* re-read the partition table after writing GPT
* fix a problem booting ARMv7 boards with PSCI without UEFI
* make aarch64 UEFI test programs compatible with GRUB linux command
* correct the alignment check in the EFI_BLOCK_IO_PROTOCOL
* check EFI_BLOCK_IO_PROTOCOL.Media->LastBlock in unit test
This commit is contained in:
Tom Rini 2021-01-30 14:49:17 -05:00
commit 76404f86a2
8 changed files with 38 additions and 10 deletions

View File

@ -18,7 +18,8 @@
.globl ImageBase
ImageBase:
.short IMAGE_DOS_SIGNATURE /* 'MZ' */
.skip 58 /* 'MZ' + pad + offset == 64 */
.skip 54 /* 'MZ' + pad + offset == 64 */
.long LINUX_ARM64_MAGIC /* For GRUB's linux command */
.long pe_header - ImageBase /* Offset to the PE header */
pe_header:
.long IMAGE_NT_SIGNATURE /* 'PE' */

View File

@ -8,6 +8,7 @@
#define LOG_CATEGORY LOGC_EFI
#include <common.h>
#include <bootm.h>
#include <charset.h>
#include <command.h>
#include <dm.h>
@ -338,6 +339,9 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
efi_uintn_t exit_data_size = 0;
u16 *exit_data = NULL;
/* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
switch_to_non_secure_mode();
/* Call our payload! */
ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data));
if (ret != EFI_SUCCESS) {

View File

@ -867,6 +867,9 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf)
return 1;
}
/* Update the partition table entries*/
part_init(dev_desc);
return 0;
}
#endif

View File

@ -51,4 +51,6 @@
#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
#define IMAGE_SUBSYSTEM_EFI_ROM 13
#define LINUX_ARM64_MAGIC 0x644d5241
#endif /* _ASM_PE_H */

View File

@ -142,8 +142,9 @@ static efi_status_t EFIAPI efi_disk_read_blocks(struct efi_block_io *this,
return EFI_MEDIA_CHANGED;
if (!this->media->media_present)
return EFI_NO_MEDIA;
/* media->io_align is a power of 2 */
if ((uintptr_t)buffer & (this->media->io_align - 1))
/* media->io_align is a power of 2 or 0 */
if (this->media->io_align &&
(uintptr_t)buffer & (this->media->io_align - 1))
return EFI_INVALID_PARAMETER;
if (lba * this->media->block_size + buffer_size >
this->media->last_block * this->media->block_size)
@ -209,8 +210,9 @@ static efi_status_t EFIAPI efi_disk_write_blocks(struct efi_block_io *this,
return EFI_MEDIA_CHANGED;
if (!this->media->media_present)
return EFI_NO_MEDIA;
/* media->io_align is a power of 2 */
if ((uintptr_t)buffer & (this->media->io_align - 1))
/* media->io_align is a power of 2 or 0 */
if (this->media->io_align &&
(uintptr_t)buffer & (this->media->io_align - 1))
return EFI_INVALID_PARAMETER;
if (lba * this->media->block_size + buffer_size >
this->media->last_block * this->media->block_size)

View File

@ -6,7 +6,6 @@
*/
#include <common.h>
#include <bootm.h>
#include <efi_loader.h>
#include <efi_variable.h>
@ -188,9 +187,6 @@ efi_status_t efi_init_obj_list(void)
/* Allow unaligned memory access */
allow_unaligned();
/* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
switch_to_non_secure_mode();
/* Initialize root node */
ret = efi_root_node_register();
if (ret != EFI_SUCCESS)

View File

@ -194,7 +194,7 @@ static int setup(const efi_handle_t handle,
decompress(&image);
block_io.media->block_size = 1 << LB_BLOCK_SIZE;
block_io.media->last_block = img.length >> LB_BLOCK_SIZE;
block_io.media->last_block = (img.length >> LB_BLOCK_SIZE) - 1;
ret = boottime->install_protocol_interface(
&disk_handle, &block_io_protocol_guid,
@ -301,6 +301,7 @@ static int execute(void)
efi_handle_t *handles;
efi_handle_t handle_partition = NULL;
struct efi_device_path *dp_partition;
struct efi_block_io *block_io_protocol;
struct efi_simple_file_system_protocol *file_system;
struct efi_file_handle *root, *file;
struct {
@ -309,6 +310,7 @@ static int execute(void)
} system_info;
efi_uintn_t buf_size;
char buf[16] __aligned(ARCH_DMA_MINALIGN);
u32 part1_size;
u64 pos;
/* Connect controller to virtual disk */
@ -353,6 +355,23 @@ static int execute(void)
return EFI_ST_FAILURE;
}
/* Open the block_io_protocol */
ret = boottime->open_protocol(handle_partition,
&block_io_protocol_guid,
(void **)&block_io_protocol, NULL, NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (ret != EFI_SUCCESS) {
efi_st_error("Failed to open block IO protocol\n");
return EFI_ST_FAILURE;
}
/* Get size of first MBR partition */
memcpy(&part1_size, image + 0x1ca, sizeof(u32));
if (block_io_protocol->media->last_block != part1_size - 1) {
efi_st_error("Last LBA of partition %x, expected %x\n",
(unsigned int)block_io_protocol->media->last_block,
part1_size - 1);
return EFI_ST_FAILURE;
}
/* Open the simple file system protocol */
ret = boottime->open_protocol(handle_partition,
&guid_simple_file_system_protocol,

1
tools/.gitignore vendored
View File

@ -20,6 +20,7 @@
/kwboot
/lib/
/mips-relocs
/mkeficapsule
/mkenvimage
/mkexynosspl
/mkimage