summaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-02-10 13:45:15 -0500
committerTom Rini <trini@konsulko.com>2023-02-10 13:45:15 -0500
commitc34009d5a9a570355bd9efa0853e408ef8c210f3 (patch)
tree98c945c6e428d0e3e6cf05a951bb649358e51efd /lib/efi_loader
parenta1e6b529e57c622e862e93fa6da03d9504565089 (diff)
parent124725732fdfd63ebb2f6514c690181ccbe13444 (diff)
downloadu-boot-c34009d5a9a570355bd9efa0853e408ef8c210f3.tar.gz
u-boot-c34009d5a9a570355bd9efa0853e408ef8c210f3.tar.bz2
u-boot-c34009d5a9a570355bd9efa0853e408ef8c210f3.zip
Merge tag 'efi-2023-04-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2023-04-rc2 Documentation: * Provide page with links to talks on U-Boot UEFI: * Enable CTRL+S to save the boot order in eficonfig command * Run attribute check for QueryVariableInfo() only for the file store * Bug fixes Others: * Improve output formatting of the coninfo command # -----END PGP SIGNATURE----- # gpg: Signature made Fri 10 Feb 2023 12:15:45 PM EST # gpg: using RSA key 6DC4F9C71F29A6FA06B76D33C481DBBC2C051AC4 # gpg: Good signature from "Heinrich Schuchardt <xypron.glpk@gmx.de>" [unknown] # gpg: aka "[jpeg image of size 1389]" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6DC4 F9C7 1F29 A6FA 06B7 6D33 C481 DBBC 2C05 1AC4
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_boottime.c6
-rw-r--r--lib/efi_loader/efi_conformance.c2
-rw-r--r--lib/efi_loader/efi_console.c2
-rw-r--r--lib/efi_loader/efi_gop.c11
-rw-r--r--lib/efi_loader/efi_runtime.c4
-rw-r--r--lib/efi_loader/efi_setup.c1
-rw-r--r--lib/efi_loader/efi_var_common.c10
-rw-r--r--lib/efi_loader/efi_variable.c25
-rw-r--r--lib/efi_loader/helloworld.c3
-rw-r--r--lib/efi_loader/initrddump.c2
10 files changed, 43 insertions, 23 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index ba28989f36..caaab685ee 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -264,7 +264,7 @@ static void efi_queue_event(struct efi_event *event)
* @tpl: TPL level to check
* Return: status code
*/
-efi_status_t is_valid_tpl(efi_uintn_t tpl)
+static efi_status_t is_valid_tpl(efi_uintn_t tpl)
{
switch (tpl) {
case TPL_APPLICATION:
@@ -592,7 +592,7 @@ efi_status_t efi_remove_protocol(const efi_handle_t handle,
*
* Return: status code
*/
-efi_status_t efi_remove_all_protocols(const efi_handle_t handle)
+static efi_status_t efi_remove_all_protocols(const efi_handle_t handle)
{
struct efi_object *efiobj;
struct efi_handler *protocol;
@@ -728,6 +728,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
/*
* efi_create_event_ex() - create an event in a group
+ *
* @type: type of the event to create
* @notify_tpl: task priority level of the event
* @notify_function: notification function of the event
@@ -742,6 +743,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
*
* Return: status code
*/
+static
efi_status_t EFIAPI efi_create_event_ex(uint32_t type, efi_uintn_t notify_tpl,
void (EFIAPI *notify_function) (
struct efi_event *event,
diff --git a/lib/efi_loader/efi_conformance.c b/lib/efi_loader/efi_conformance.c
index 3036d46349..0ca26f57a7 100644
--- a/lib/efi_loader/efi_conformance.c
+++ b/lib/efi_loader/efi_conformance.c
@@ -22,7 +22,7 @@ static const efi_guid_t efi_ebbr_2_1_guid =
*/
efi_status_t efi_ecpt_register(void)
{
- int num_entries = 0;
+ u16 num_entries = 0;
struct efi_conformance_profiles_table *ecpt;
efi_status_t ret;
size_t ecpt_size;
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 1ed8c7aa36..4317630907 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -669,7 +669,7 @@ static LIST_HEAD(cin_notify_functions);
* @mod: Xterm shift mask
* @key_state: receives the state of the shift, alt, control, and logo keys
*/
-void set_shift_mask(int mod, struct efi_key_state *key_state)
+static void set_shift_mask(int mod, struct efi_key_state *key_state)
{
key_state->key_shift_state = EFI_SHIFT_STATE_VALID;
if (mod) {
diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index d1dc2f22d0..778b693f98 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -400,11 +400,12 @@ out:
* @delta: length in bytes of a line in the pixel buffer (optional)
* Return: status code
*/
-efi_status_t EFIAPI gop_blt(struct efi_gop *this, struct efi_gop_pixel *buffer,
- u32 operation, efi_uintn_t sx,
- efi_uintn_t sy, efi_uintn_t dx,
- efi_uintn_t dy, efi_uintn_t width,
- efi_uintn_t height, efi_uintn_t delta)
+static efi_status_t EFIAPI gop_blt(struct efi_gop *this,
+ struct efi_gop_pixel *buffer,
+ u32 operation, efi_uintn_t sx,
+ efi_uintn_t sy, efi_uintn_t dx,
+ efi_uintn_t dy, efi_uintn_t width,
+ efi_uintn_t height, efi_uintn_t delta)
{
efi_status_t ret = EFI_INVALID_PARAMETER;
efi_uintn_t vid_bpp;
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index ad2ab825d1..cee96bfc7f 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -462,7 +462,7 @@ efi_status_t __weak __efi_runtime EFIAPI efi_set_time(struct efi_time *time)
* @scatter_gather_list: pointer to array of physical pointers
* Returns: status code
*/
-efi_status_t __efi_runtime EFIAPI efi_update_capsule_unsupported(
+static efi_status_t __efi_runtime EFIAPI efi_update_capsule_unsupported(
struct efi_capsule_header **capsule_header_array,
efi_uintn_t capsule_count,
u64 scatter_gather_list)
@@ -484,7 +484,7 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule_unsupported(
* @reset_type: type of reset needed for capsule update
* Returns: status code
*/
-efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps_unsupported(
+static efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps_unsupported(
struct efi_capsule_header **capsule_header_array,
efi_uintn_t capsule_count,
u64 *maximum_capsule_size,
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index f0f01d3b1d..69aaefab63 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -11,6 +11,7 @@
#include <efi_loader.h>
#include <efi_variable.h>
#include <log.h>
+#include <asm-generic/unaligned.h>
#define OBJ_LIST_NOT_INITIALIZED 1
diff --git a/lib/efi_loader/efi_var_common.c b/lib/efi_loader/efi_var_common.c
index eb83702781..ad50bffd2b 100644
--- a/lib/efi_loader/efi_var_common.c
+++ b/lib/efi_loader/efi_var_common.c
@@ -165,17 +165,9 @@ efi_status_t EFIAPI efi_query_variable_info(
if (!maximum_variable_storage_size ||
!remaining_variable_storage_size ||
- !maximum_variable_size ||
- !(attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS))
+ !maximum_variable_size)
return EFI_EXIT(EFI_INVALID_PARAMETER);
- if ((attributes & ~(u32)EFI_VARIABLE_MASK) ||
- (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) ||
- (attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) ||
- (!IS_ENABLED(CONFIG_EFI_SECURE_BOOT) &&
- (attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)))
- return EFI_EXIT(EFI_UNSUPPORTED);
-
ret = efi_query_variable_info_int(attributes,
maximum_variable_storage_size,
remaining_variable_storage_size,
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 7c32adf6e5..4c85cfa607 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -349,6 +349,29 @@ efi_status_t efi_query_variable_info_int(u32 attributes,
u64 *remaining_variable_storage_size,
u64 *maximum_variable_size)
{
+ if (attributes == 0)
+ return EFI_INVALID_PARAMETER;
+
+ /* EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated */
+ if ((attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) ||
+ ((attributes & EFI_VARIABLE_MASK) == 0))
+ return EFI_UNSUPPORTED;
+
+ if ((attributes & EFI_VARIABLE_MASK) == EFI_VARIABLE_NON_VOLATILE)
+ return EFI_INVALID_PARAMETER;
+
+ /* Make sure if runtime bit is set, boot service bit is set also. */
+ if ((attributes &
+ (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) ==
+ EFI_VARIABLE_RUNTIME_ACCESS)
+ return EFI_INVALID_PARAMETER;
+
+ if (attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD)
+ return EFI_UNSUPPORTED;
+
+ if (attributes & ~(u32)EFI_VARIABLE_MASK)
+ return EFI_INVALID_PARAMETER;
+
*maximum_variable_storage_size = EFI_VAR_BUF_SIZE -
sizeof(struct efi_var_file);
*remaining_variable_storage_size = efi_var_mem_free();
@@ -372,7 +395,7 @@ efi_status_t efi_query_variable_info_int(u32 attributes,
* selected type
* Returns: status code
*/
-efi_status_t __efi_runtime EFIAPI efi_query_variable_info_runtime(
+static efi_status_t __efi_runtime EFIAPI efi_query_variable_info_runtime(
u32 attributes,
u64 *maximum_variable_storage_size,
u64 *remaining_variable_storage_size,
diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c
index d565f32745..49fa8cc2f0 100644
--- a/lib/efi_loader/helloworld.c
+++ b/lib/efi_loader/helloworld.c
@@ -125,7 +125,7 @@ static void print_config_tables(void)
* @systable: system table
* @con_out: simple text output protocol
*/
-void print_load_options(struct efi_loaded_image *loaded_image)
+static void print_load_options(struct efi_loaded_image *loaded_image)
{
/* Output the load options */
con_out->output_string(con_out, u"Load options: ");
@@ -143,6 +143,7 @@ void print_load_options(struct efi_loaded_image *loaded_image)
* @device_path: device path to print
* @dp2txt: device path to text protocol
*/
+static
efi_status_t print_device_path(struct efi_device_path *device_path,
struct efi_device_path_to_text_protocol *dp2txt)
{
diff --git a/lib/efi_loader/initrddump.c b/lib/efi_loader/initrddump.c
index 9872106981..971a3b6236 100644
--- a/lib/efi_loader/initrddump.c
+++ b/lib/efi_loader/initrddump.c
@@ -439,7 +439,7 @@ out:
*
* Return: load options or NULL
*/
-u16 *get_load_options(void)
+static u16 *get_load_options(void)
{
efi_status_t ret;
struct efi_loaded_image *loaded_image;