[U-Boot] [PATCH v2 3/7] efi_loader: correct size for tpl level

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Jul 18 18:17:19 UTC 2017


The UEFI standard defines the type for the tpl level as EFI_TPL
alias UINTN.

UINTN is an integer is defined as an unsigned integer of native
width. So we can use size_t for the definition.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v2
	new patch
---
 include/efi_api.h             |  8 +++++---
 include/efi_loader.h          |  2 +-
 lib/efi_loader/efi_boottime.c | 12 ++++++------
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index a3b8e04576..8e5342c79c 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -28,6 +28,8 @@ enum efi_event_type {
 	EFI_TIMER_RELATIVE = 2
 };
 
+#define UINTN size_t
+
 #define EVT_TIMER				0x80000000
 #define EVT_RUNTIME				0x40000000
 #define EVT_NOTIFY_WAIT				0x00000100
@@ -45,8 +47,8 @@ struct efi_event;
 /* EFI Boot Services table */
 struct efi_boot_services {
 	struct efi_table_hdr hdr;
-	efi_status_t (EFIAPI *raise_tpl)(unsigned long new_tpl);
-	void (EFIAPI *restore_tpl)(unsigned long old_tpl);
+	efi_status_t (EFIAPI *raise_tpl)(UINTN new_tpl);
+	void (EFIAPI *restore_tpl)(UINTN old_tpl);
 
 	efi_status_t (EFIAPI *allocate_pages)(int, int, unsigned long,
 					      efi_physical_addr_t *);
@@ -58,7 +60,7 @@ struct efi_boot_services {
 	efi_status_t (EFIAPI *free_pool)(void *);
 
 	efi_status_t (EFIAPI *create_event)(enum efi_event_type type,
-			unsigned long notify_tpl,
+			UINTN notify_tpl,
 			void (EFIAPI *notify_function) (
 					struct efi_event *event,
 					void *context),
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 3d18bfbd2e..b922720068 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -77,7 +77,7 @@ struct efi_object {
  */
 struct efi_event {
 	u32 type;
-	unsigned long notify_tpl;
+	UINTN notify_tpl;
 	void (EFIAPI *notify_function)(struct efi_event *event, void *context);
 	void *notify_context;
 	u64 trigger_next;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index a49acc8693..c3c00b7a87 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -105,15 +105,15 @@ static int guidcmp(const efi_guid_t *g1, const efi_guid_t *g2)
 	return memcmp(g1, g2, sizeof(efi_guid_t));
 }
 
-static unsigned long EFIAPI efi_raise_tpl(unsigned long new_tpl)
+static unsigned long EFIAPI efi_raise_tpl(UINTN new_tpl)
 {
-	EFI_ENTRY("0x%lx", new_tpl);
+	EFI_ENTRY("0x%zx", new_tpl);
 	return EFI_EXIT(0);
 }
 
-static void EFIAPI efi_restore_tpl(unsigned long old_tpl)
+static void EFIAPI efi_restore_tpl(UINTN old_tpl)
 {
-	EFI_ENTRY("0x%lx", old_tpl);
+	EFI_ENTRY("0x%zx", old_tpl);
 	EFI_EXIT(efi_unsupported(__func__));
 }
 
@@ -181,7 +181,7 @@ static efi_status_t EFIAPI efi_free_pool_ext(void *buffer)
 static struct efi_event efi_events[16];
 
 static efi_status_t EFIAPI efi_create_event(
-			enum efi_event_type type, ulong notify_tpl,
+			enum efi_event_type type, UINTN notify_tpl,
 			void (EFIAPI *notify_function) (
 					struct efi_event *event,
 					void *context),
@@ -189,7 +189,7 @@ static efi_status_t EFIAPI efi_create_event(
 {
 	int i;
 
-	EFI_ENTRY("%d, 0x%lx, %p, %p", type, notify_tpl, notify_function,
+	EFI_ENTRY("%d, 0x%zx, %p, %p", type, notify_tpl, notify_function,
 		  notify_context);
 	if (event == NULL)
 		return EFI_EXIT(EFI_INVALID_PARAMETER);
-- 
2.13.2



More information about the U-Boot mailing list