mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Merge tag 'efi-2020-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for efi-2020-04-rc1 This pull request provides: * support for FIT images for UEFI binaries * drivers for hardware random number generators * an implementation of the EFI_RNG_PROTOCOL * a sub-command for efidebug to display configuration tables
This commit is contained in:
@@ -88,6 +88,7 @@ enum uclass_id {
|
||||
UCLASS_REGULATOR, /* Regulator device */
|
||||
UCLASS_REMOTEPROC, /* Remote Processor device */
|
||||
UCLASS_RESET, /* Reset controller device */
|
||||
UCLASS_RNG, /* Random Number Generator */
|
||||
UCLASS_RTC, /* Real time clock device */
|
||||
UCLASS_SCSI, /* SCSI device */
|
||||
UCLASS_SERIAL, /* Serial UART */
|
||||
|
||||
@@ -91,7 +91,13 @@ typedef struct {
|
||||
#define EFI_IP_ADDRESS_CONFLICT (EFI_ERROR_MASK | 34)
|
||||
#define EFI_HTTP_ERROR (EFI_ERROR_MASK | 35)
|
||||
|
||||
#define EFI_WARN_DELETE_FAILURE 2
|
||||
#define EFI_WARN_UNKNOWN_GLYPH 1
|
||||
#define EFI_WARN_DELETE_FAILURE 2
|
||||
#define EFI_WARN_WRITE_FAILURE 3
|
||||
#define EFI_WARN_BUFFER_TOO_SMALL 4
|
||||
#define EFI_WARN_STALE_DATA 5
|
||||
#define EFI_WARN_FILE_SYSTEM 6
|
||||
#define EFI_WARN_RESET_REQUIRED 7
|
||||
|
||||
typedef unsigned long efi_status_t;
|
||||
typedef u64 efi_physical_addr_t;
|
||||
|
||||
@@ -17,6 +17,11 @@ static inline int guidcmp(const void *g1, const void *g2)
|
||||
return memcmp(g1, g2, sizeof(efi_guid_t));
|
||||
}
|
||||
|
||||
static inline void *guidcpy(void *dst, const void *src)
|
||||
{
|
||||
return memcpy(dst, src, sizeof(efi_guid_t));
|
||||
}
|
||||
|
||||
/* No need for efi loader support in SPL */
|
||||
#if CONFIG_IS_ENABLED(EFI_LOADER)
|
||||
|
||||
@@ -34,6 +39,9 @@ static inline int guidcmp(const void *g1, const void *g2)
|
||||
EFI_GUID(0xbbe4e671, 0x5773, 0x4ea1, \
|
||||
0x9a, 0xab, 0x3a, 0x7d, 0xbf, 0x40, 0xc4, 0x82)
|
||||
|
||||
/* Use internal device tree when starting UEFI application */
|
||||
#define EFI_FDT_USE_INTERNAL NULL
|
||||
|
||||
/* Root node */
|
||||
extern efi_handle_t efi_root;
|
||||
|
||||
@@ -125,6 +133,7 @@ extern const struct efi_hii_config_routing_protocol efi_hii_config_routing;
|
||||
extern const struct efi_hii_config_access_protocol efi_hii_config_access;
|
||||
extern const struct efi_hii_database_protocol efi_hii_database;
|
||||
extern const struct efi_hii_string_protocol efi_hii_string;
|
||||
extern const struct efi_rng_protocol efi_rng_protocol;
|
||||
|
||||
uint16_t *efi_dp_str(struct efi_device_path *dp);
|
||||
|
||||
@@ -170,6 +179,9 @@ extern const efi_guid_t efi_guid_hii_config_access_protocol;
|
||||
extern const efi_guid_t efi_guid_hii_database_protocol;
|
||||
extern const efi_guid_t efi_guid_hii_string_protocol;
|
||||
|
||||
/* GUID of RNG protocol */
|
||||
extern const efi_guid_t efi_guid_rng_protocol;
|
||||
|
||||
extern unsigned int __efi_runtime_start, __efi_runtime_stop;
|
||||
extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;
|
||||
|
||||
@@ -338,6 +350,10 @@ extern struct list_head efi_register_notify_events;
|
||||
|
||||
/* Initialize efi execution environment */
|
||||
efi_status_t efi_init_obj_list(void);
|
||||
/* Install device tree */
|
||||
efi_status_t efi_install_fdt(void *fdt);
|
||||
/* Run loaded UEFI image */
|
||||
efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size);
|
||||
/* Initialize variable services */
|
||||
efi_status_t efi_init_variables(void);
|
||||
/* Notify ExitBootServices() is called */
|
||||
|
||||
32
include/efi_rng.h
Normal file
32
include/efi_rng.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/*
|
||||
* Copyright (c) 2019, Linaro Limited
|
||||
*/
|
||||
|
||||
#if !defined _EFI_RNG_H_
|
||||
#define _EFI_RNG_H_
|
||||
|
||||
#include <efi.h>
|
||||
#include <efi_api.h>
|
||||
|
||||
/* EFI random number generation protocol related GUID definitions */
|
||||
#define EFI_RNG_PROTOCOL_GUID \
|
||||
EFI_GUID(0x3152bca5, 0xeade, 0x433d, 0x86, 0x2e, \
|
||||
0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44)
|
||||
|
||||
#define EFI_RNG_ALGORITHM_RAW \
|
||||
EFI_GUID(0xe43176d7, 0xb6e8, 0x4827, 0xb7, 0x84, \
|
||||
0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61)
|
||||
|
||||
struct efi_rng_protocol {
|
||||
efi_status_t (EFIAPI *get_info)(struct efi_rng_protocol *protocol,
|
||||
efi_uintn_t *rng_algorithm_list_size,
|
||||
efi_guid_t *rng_algorithm_list);
|
||||
efi_status_t (EFIAPI *get_rng)(struct efi_rng_protocol *protocol,
|
||||
efi_guid_t *rng_algorithm,
|
||||
efi_uintn_t rng_value_length, uint8_t *rng_value);
|
||||
};
|
||||
|
||||
efi_status_t platform_get_rng_device(struct udevice **dev);
|
||||
|
||||
#endif /* _EFI_RNG_H_ */
|
||||
@@ -157,6 +157,7 @@ enum {
|
||||
IH_OS_ARM_TRUSTED_FIRMWARE, /* ARM Trusted Firmware */
|
||||
IH_OS_TEE, /* Trusted Execution Environment */
|
||||
IH_OS_OPENSBI, /* RISC-V OpenSBI */
|
||||
IH_OS_EFI, /* EFI Firmware (e.g. GRUB2) */
|
||||
|
||||
IH_OS_COUNT,
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#define EFI_PMBR_OSTYPE_EFI 0xEF
|
||||
#define EFI_PMBR_OSTYPE_EFI_GPT 0xEE
|
||||
|
||||
#define GPT_HEADER_SIGNATURE_UBOOT 0x5452415020494645ULL
|
||||
#define GPT_HEADER_SIGNATURE_UBOOT 0x5452415020494645ULL // 'EFI PART'
|
||||
#define GPT_HEADER_CHROMEOS_IGNORE 0x454d45524f4e4749ULL // 'IGNOREME'
|
||||
|
||||
#define GPT_HEADER_REVISION_V1 0x00010000
|
||||
|
||||
18
include/pe.h
18
include/pe.h
@@ -155,6 +155,8 @@ typedef struct _IMAGE_SECTION_HEADER {
|
||||
uint32_t Characteristics;
|
||||
} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
|
||||
|
||||
/* Indices for Optional Header Data Directories */
|
||||
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4
|
||||
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
|
||||
|
||||
typedef struct _IMAGE_BASE_RELOCATION
|
||||
@@ -252,4 +254,20 @@ typedef struct _IMAGE_RELOCATION
|
||||
#define IMAGE_REL_AMD64_PAIR 0x000F
|
||||
#define IMAGE_REL_AMD64_SSPAN32 0x0010
|
||||
|
||||
/* certificate appended to PE image */
|
||||
typedef struct _WIN_CERTIFICATE {
|
||||
uint32_t dwLength;
|
||||
uint16_t wRevision;
|
||||
uint16_t wCertificateType;
|
||||
uint8_t bCertificate[];
|
||||
} WIN_CERTIFICATE, *LPWIN_CERTIFICATE;
|
||||
|
||||
/* Definitions for the contents of the certs data block */
|
||||
#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
|
||||
#define WIN_CERT_TYPE_EFI_OKCS115 0x0EF0
|
||||
#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
|
||||
|
||||
#define WIN_CERT_REVISION_1_0 0x0100
|
||||
#define WIN_CERT_REVISION_2_0 0x0200
|
||||
|
||||
#endif /* _PE_H */
|
||||
|
||||
33
include/rng.h
Normal file
33
include/rng.h
Normal file
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (c) 2019, Linaro Limited
|
||||
*/
|
||||
|
||||
#if !defined _RNG_H_
|
||||
#define _RNG_H_
|
||||
|
||||
struct udevice;
|
||||
|
||||
/**
|
||||
* dm_rng_read() - read a random number seed from the rng device
|
||||
* @buffer: input buffer to put the read random seed into
|
||||
* @size: number of bytes of random seed read
|
||||
*
|
||||
* Return: 0 if OK, -ve on error
|
||||
*/
|
||||
int dm_rng_read(struct udevice *dev, void *buffer, size_t size);
|
||||
|
||||
/* struct dm_rng_ops - Operations for the hwrng uclass */
|
||||
struct dm_rng_ops {
|
||||
/**
|
||||
* @read() - read a random number seed
|
||||
*
|
||||
* @data: input buffer to read the random seed
|
||||
* @max: total number of bytes to read
|
||||
*
|
||||
* Return: 0 if OK, -ve on error
|
||||
*/
|
||||
int (*read)(struct udevice *dev, void *data, size_t max);
|
||||
};
|
||||
|
||||
#endif /* _RNG_H_ */
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#define VIRTIO_ID_NET 1 /* virtio net */
|
||||
#define VIRTIO_ID_BLOCK 2 /* virtio block */
|
||||
#define VIRTIO_ID_MAX_NUM 3
|
||||
#define VIRTIO_ID_RNG 4 /* virtio rng */
|
||||
#define VIRTIO_ID_MAX_NUM 5
|
||||
|
||||
#define VIRTIO_NET_DRV_NAME "virtio-net"
|
||||
#define VIRTIO_BLK_DRV_NAME "virtio-blk"
|
||||
#define VIRTIO_RNG_DRV_NAME "virtio-rng"
|
||||
|
||||
/* Status byte for guest to report progress, and synchronize features */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user