Commit 1786e830 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Ingo Molnar

efi/libstub: Extend native protocol definitions with mixed_mode aliases

In preparation of moving to a native vs. mixed mode split rather than a
32 vs. 64 bit split when it comes to invoking EFI firmware services,
update all the native protocol definitions and redefine them as unions
containing an anonymous struct for the native view and a struct called
'mixed_mode' describing the 32-bit view of the protocol when called from
64-bit code.

While at it, flesh out some PCI I/O member definitions that we will be
needing shortly.
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Cc: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Borislav Petkov <bp@alien8.de>
Cc: James Morse <james.morse@arm.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: https://lkml.kernel.org/r/20191224151025.32482-9-ardb@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 2732ea0d
......@@ -24,10 +24,17 @@ typedef struct {
u64 blt;
} efi_uga_draw_protocol_64_t;
typedef struct {
void *get_mode;
void *set_mode;
void *blt;
typedef union {
struct {
void *get_mode;
void *set_mode;
void *blt;
};
struct {
u32 get_mode;
u32 set_mode;
u32 blt;
} mixed_mode;
} efi_uga_draw_protocol_t;
#endif /* BOOT_COMPRESSED_EBOOT_H */
......@@ -40,9 +40,9 @@ static u64 virtmap_base = EFI_RT_VIRTUAL_BASE;
void efi_char16_printk(efi_system_table_t *sys_table_arg,
efi_char16_t *str)
{
struct efi_simple_text_output_protocol *out;
efi_simple_text_output_protocol_t *out;
out = (struct efi_simple_text_output_protocol *)sys_table_arg->con_out;
out = (efi_simple_text_output_protocol_t *)sys_table_arg->con_out;
out->output_string(out, str);
}
......
......@@ -9,7 +9,7 @@
#include "efistub.h"
typedef struct efi_rng_protocol efi_rng_protocol_t;
typedef union efi_rng_protocol efi_rng_protocol_t;
typedef struct {
u32 get_info;
......@@ -21,11 +21,17 @@ typedef struct {
u64 get_rng;
} efi_rng_protocol_64_t;
struct efi_rng_protocol {
efi_status_t (*get_info)(struct efi_rng_protocol *,
unsigned long *, efi_guid_t *);
efi_status_t (*get_rng)(struct efi_rng_protocol *,
efi_guid_t *, unsigned long, u8 *out);
union efi_rng_protocol {
struct {
efi_status_t (*get_info)(efi_rng_protocol_t *,
unsigned long *, efi_guid_t *);
efi_status_t (*get_rng)(efi_rng_protocol_t *,
efi_guid_t *, unsigned long, u8 *out);
};
struct {
u32 get_info;
u32 get_rng;
} mixed_mode;
};
efi_status_t efi_get_random_bytes(efi_system_table_t *sys_table_arg,
......@@ -33,7 +39,7 @@ efi_status_t efi_get_random_bytes(efi_system_table_t *sys_table_arg,
{
efi_guid_t rng_proto = EFI_RNG_PROTOCOL_GUID;
efi_status_t status;
struct efi_rng_protocol *rng = NULL;
efi_rng_protocol_t *rng = NULL;
status = efi_call_early(locate_protocol, &rng_proto, NULL,
(void **)&rng);
......@@ -162,7 +168,7 @@ efi_status_t efi_random_get_seed(efi_system_table_t *sys_table_arg)
efi_guid_t rng_proto = EFI_RNG_PROTOCOL_GUID;
efi_guid_t rng_algo_raw = EFI_RNG_ALGORITHM_RAW;
efi_guid_t rng_table_guid = LINUX_EFI_RANDOM_SEED_TABLE_GUID;
struct efi_rng_protocol *rng = NULL;
efi_rng_protocol_t *rng = NULL;
struct linux_efi_random_seed *seed = NULL;
efi_status_t status;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment