]> git.sur5r.net Git - u-boot/commitdiff
efi_loader: consistently use efi_uintn_t in boot services
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 6 Nov 2017 20:17:48 +0000 (21:17 +0100)
committerAlexander Graf <agraf@suse.de>
Fri, 1 Dec 2017 12:22:56 +0000 (13:22 +0100)
Consistenly use efi_uintn_t wherever the UEFI spec uses
UINTN in boot services interfaces.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
include/efi_api.h
include/efi_loader.h
lib/efi_loader/efi_boottime.c
lib/efi_loader/efi_memory.c
lib/efi_selftest/efi_selftest.c
lib/efi_selftest/efi_selftest_events.c
lib/efi_selftest/efi_selftest_manageprotocols.c
lib/efi_selftest/efi_selftest_snp.c
lib/efi_selftest/efi_selftest_tpl.c

index 5ab78baeea0e970a75287238b15cccc7a22b3726..e0991b6eca5d215cbafe8c8757ead55dacca962f 100644 (file)
@@ -51,13 +51,15 @@ struct efi_boot_services {
        efi_status_t (EFIAPI *raise_tpl)(efi_uintn_t new_tpl);
        void (EFIAPI *restore_tpl)(efi_uintn_t old_tpl);
 
-       efi_status_t (EFIAPI *allocate_pages)(int, int, unsigned long,
+       efi_status_t (EFIAPI *allocate_pages)(int, int, efi_uintn_t,
                                              efi_physical_addr_t *);
-       efi_status_t (EFIAPI *free_pages)(efi_physical_addr_t, unsigned long);
-       efi_status_t (EFIAPI *get_memory_map)(unsigned long *memory_map_size,
-                       struct efi_mem_desc *desc, unsigned long *key,
-                       unsigned long *desc_size, u32 *desc_version);
-       efi_status_t (EFIAPI *allocate_pool)(int, unsigned long, void **);
+       efi_status_t (EFIAPI *free_pages)(efi_physical_addr_t, efi_uintn_t);
+       efi_status_t (EFIAPI *get_memory_map)(efi_uintn_t *memory_map_size,
+                                             struct efi_mem_desc *desc,
+                                             efi_uintn_t *key,
+                                             efi_uintn_t *desc_size,
+                                             u32 *desc_version);
+       efi_status_t (EFIAPI *allocate_pool)(int, efi_uintn_t, void **);
        efi_status_t (EFIAPI *free_pool)(void *);
 
        efi_status_t (EFIAPI *create_event)(uint32_t type,
@@ -69,8 +71,9 @@ struct efi_boot_services {
        efi_status_t (EFIAPI *set_timer)(struct efi_event *event,
                                         enum efi_timer_delay type,
                                         uint64_t trigger_time);
-       efi_status_t (EFIAPI *wait_for_event)(unsigned long number_of_events,
-                       struct efi_event **event, size_t *index);
+       efi_status_t (EFIAPI *wait_for_event)(efi_uintn_t number_of_events,
+                                             struct efi_event **event,
+                                             efi_uintn_t *index);
        efi_status_t (EFIAPI *signal_event)(struct efi_event *event);
        efi_status_t (EFIAPI *close_event)(struct efi_event *event);
        efi_status_t (EFIAPI *check_event)(struct efi_event *event);
@@ -93,7 +96,7 @@ struct efi_boot_services {
        efi_status_t (EFIAPI *locate_handle)(
                        enum efi_locate_search_type search_type,
                        const efi_guid_t *protocol, void *search_key,
-                       unsigned long *buffer_size, efi_handle_t *buffer);
+                       efi_uintn_t *buffer_size, efi_handle_t *buffer);
        efi_status_t (EFIAPI *locate_device_path)(const efi_guid_t *protocol,
                        struct efi_device_path **device_path,
                        efi_handle_t *device);
@@ -140,14 +143,14 @@ struct efi_boot_services {
        efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle,
                        const efi_guid_t *protocol,
                        struct efi_open_protocol_info_entry **entry_buffer,
-                       unsigned long *entry_count);
+                       efi_uintn_t *entry_count);
        efi_status_t (EFIAPI *protocols_per_handle)(efi_handle_t handle,
                        efi_guid_t ***protocol_buffer,
-                       unsigned long *protocols_buffer_count);
+                       efi_uintn_t *protocols_buffer_count);
        efi_status_t (EFIAPI *locate_handle_buffer) (
                        enum efi_locate_search_type search_type,
                        const efi_guid_t *protocol, void *search_key,
-                       unsigned long *no_handles, efi_handle_t **buffer);
+                       efi_uintn_t *no_handles, efi_handle_t **buffer);
        efi_status_t (EFIAPI *locate_protocol)(const efi_guid_t *protocol,
                        void *registration, void **protocol_interface);
        efi_status_t (EFIAPI *install_multiple_protocol_interfaces)(
@@ -248,7 +251,7 @@ struct efi_system_table {
        struct efi_simple_text_output_protocol *std_err;
        struct efi_runtime_services *runtime;
        struct efi_boot_services *boottime;
-       unsigned long nr_tables;
+       efi_uintn_t nr_tables;
        struct efi_configuration_table *tables;
 };
 
index 83b27d04490c120f56cebc483081aeb20ad98247..e3d1c359301a6942be1765267fb9386efdfa88c4 100644 (file)
@@ -215,20 +215,20 @@ struct efi_file_handle *efi_file_from_path(struct efi_device_path *fp);
 /* Generic EFI memory allocator, call this to get memory */
 void *efi_alloc(uint64_t len, int memory_type);
 /* More specific EFI memory allocator, called by EFI payloads */
-efi_status_t efi_allocate_pages(int type, int memory_type, unsigned long pages,
+efi_status_t efi_allocate_pages(int type, int memory_type, efi_uintn_t pages,
                                uint64_t *memory);
 /* EFI memory free function. */
-efi_status_t efi_free_pages(uint64_t memory, unsigned long pages);
+efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages);
 /* EFI memory allocator for small allocations */
-efi_status_t efi_allocate_pool(int pool_type, unsigned long size,
+efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size,
                               void **buffer);
 /* EFI pool memory free function. */
 efi_status_t efi_free_pool(void *buffer);
 /* Returns the EFI memory map */
-efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
+efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
                                struct efi_mem_desc *memory_map,
-                               unsigned long *map_key,
-                               unsigned long *descriptor_size,
+                               efi_uintn_t *map_key,
+                               efi_uintn_t *descriptor_size,
                                uint32_t *descriptor_version);
 /* Adds a range into the EFI memory map */
 uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
index 9523267156c7cc78c840792287db22c1e61370ac..5bf26114a1bc6e4b37b2c61e37c6490471ed192a 100644 (file)
@@ -217,12 +217,12 @@ static void EFIAPI efi_restore_tpl(efi_uintn_t old_tpl)
  * @return             status code
  */
 static efi_status_t EFIAPI efi_allocate_pages_ext(int type, int memory_type,
-                                                 unsigned long pages,
+                                                 efi_uintn_t pages,
                                                  uint64_t *memory)
 {
        efi_status_t r;
 
-       EFI_ENTRY("%d, %d, 0x%lx, %p", type, memory_type, pages, memory);
+       EFI_ENTRY("%d, %d, 0x%zx, %p", type, memory_type, pages, memory);
        r = efi_allocate_pages(type, memory_type, pages, memory);
        return EFI_EXIT(r);
 }
@@ -239,11 +239,11 @@ static efi_status_t EFIAPI efi_allocate_pages_ext(int type, int memory_type,
  * @return     status code
  */
 static efi_status_t EFIAPI efi_free_pages_ext(uint64_t memory,
-                                             unsigned long pages)
+                                             efi_uintn_t pages)
 {
        efi_status_t r;
 
-       EFI_ENTRY("%"PRIx64", 0x%lx", memory, pages);
+       EFI_ENTRY("%"PRIx64", 0x%zx", memory, pages);
        r = efi_free_pages(memory, pages);
        return EFI_EXIT(r);
 }
@@ -264,10 +264,10 @@ static efi_status_t EFIAPI efi_free_pages_ext(uint64_t memory,
  * @return             status code
  */
 static efi_status_t EFIAPI efi_get_memory_map_ext(
-                                       unsigned long *memory_map_size,
+                                       efi_uintn_t *memory_map_size,
                                        struct efi_mem_desc *memory_map,
-                                       unsigned long *map_key,
-                                       unsigned long *descriptor_size,
+                                       efi_uintn_t *map_key,
+                                       efi_uintn_t *descriptor_size,
                                        uint32_t *descriptor_version)
 {
        efi_status_t r;
@@ -292,12 +292,12 @@ static efi_status_t EFIAPI efi_get_memory_map_ext(
  * @return     status code
  */
 static efi_status_t EFIAPI efi_allocate_pool_ext(int pool_type,
-                                                unsigned long size,
+                                                efi_uintn_t size,
                                                 void **buffer)
 {
        efi_status_t r;
 
-       EFI_ENTRY("%d, %ld, %p", pool_type, size, buffer);
+       EFI_ENTRY("%d, %zd, %p", pool_type, size, buffer);
        r = efi_allocate_pool(pool_type, size, buffer);
        return EFI_EXIT(r);
 }
@@ -539,13 +539,13 @@ static efi_status_t EFIAPI efi_set_timer_ext(struct efi_event *event,
  * @index      index of the event that was signaled
  * @return     status code
  */
-static efi_status_t EFIAPI efi_wait_for_event(unsigned long num_events,
+static efi_status_t EFIAPI efi_wait_for_event(efi_uintn_t num_events,
                                              struct efi_event **event,
-                                             size_t *index)
+                                             efi_uintn_t *index)
 {
        int i, j;
 
-       EFI_ENTRY("%ld, %p, %p", num_events, event, index);
+       EFI_ENTRY("%zd, %p, %p", num_events, event, index);
 
        /* Check parameters */
        if (!num_events || !event)
@@ -925,10 +925,10 @@ static int efi_search(enum efi_locate_search_type search_type,
 static efi_status_t efi_locate_handle(
                        enum efi_locate_search_type search_type,
                        const efi_guid_t *protocol, void *search_key,
-                       unsigned long *buffer_size, efi_handle_t *buffer)
+                       efi_uintn_t *buffer_size, efi_handle_t *buffer)
 {
        struct list_head *lhandle;
-       unsigned long size = 0;
+       efi_uintn_t size = 0;
 
        /* Count how much space we need */
        list_for_each(lhandle, &efi_obj_list) {
@@ -977,7 +977,7 @@ static efi_status_t efi_locate_handle(
 static efi_status_t EFIAPI efi_locate_handle_ext(
                        enum efi_locate_search_type search_type,
                        const efi_guid_t *protocol, void *search_key,
-                       unsigned long *buffer_size, efi_handle_t *buffer)
+                       efi_uintn_t *buffer_size, efi_handle_t *buffer)
 {
        EFI_ENTRY("%d, %pUl, %p, %p, %p", search_type, protocol, search_key,
                  buffer_size, buffer);
@@ -1548,7 +1548,7 @@ static efi_status_t EFIAPI efi_close_protocol(void *handle,
 static efi_status_t EFIAPI efi_open_protocol_information(efi_handle_t handle,
                        const efi_guid_t *protocol,
                        struct efi_open_protocol_info_entry **entry_buffer,
-                       unsigned long *entry_count)
+                       efi_uintn_t *entry_count)
 {
        EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, entry_buffer,
                  entry_count);
@@ -1569,7 +1569,7 @@ static efi_status_t EFIAPI efi_open_protocol_information(efi_handle_t handle,
  */
 static efi_status_t EFIAPI efi_protocols_per_handle(void *handle,
                        efi_guid_t ***protocol_buffer,
-                       unsigned long *protocol_buffer_count)
+                       efi_uintn_t *protocol_buffer_count)
 {
        unsigned long buffer_size;
        struct efi_object *efiobj;
@@ -1637,10 +1637,10 @@ static efi_status_t EFIAPI efi_protocols_per_handle(void *handle,
 static efi_status_t EFIAPI efi_locate_handle_buffer(
                        enum efi_locate_search_type search_type,
                        const efi_guid_t *protocol, void *search_key,
-                       unsigned long *no_handles, efi_handle_t **buffer)
+                       efi_uintn_t *no_handles, efi_handle_t **buffer)
 {
        efi_status_t r;
-       unsigned long buffer_size = 0;
+       efi_uintn_t buffer_size = 0;
 
        EFI_ENTRY("%d, %pUl, %p, %p, %p", search_type, protocol, search_key,
                  no_handles, buffer);
index d47759e08edc62104db13b0c4cef4ae9234abf82..0aa3e0881d43ec1d451897ab76ffdbd673d49f82 100644 (file)
@@ -276,7 +276,7 @@ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr)
 }
 
 efi_status_t efi_allocate_pages(int type, int memory_type,
-                               unsigned long pages, uint64_t *memory)
+                               efi_uintn_t pages, uint64_t *memory)
 {
        u64 len = pages << EFI_PAGE_SHIFT;
        efi_status_t r = EFI_SUCCESS;
@@ -338,7 +338,7 @@ void *efi_alloc(uint64_t len, int memory_type)
        return NULL;
 }
 
-efi_status_t efi_free_pages(uint64_t memory, unsigned long pages)
+efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages)
 {
        uint64_t r = 0;
 
@@ -351,7 +351,7 @@ efi_status_t efi_free_pages(uint64_t memory, unsigned long pages)
        return EFI_NOT_FOUND;
 }
 
-efi_status_t efi_allocate_pool(int pool_type, unsigned long size,
+efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size,
                               void **buffer)
 {
        efi_status_t r;
@@ -392,16 +392,16 @@ efi_status_t efi_free_pool(void *buffer)
        return r;
 }
 
-efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
-                              struct efi_mem_desc *memory_map,
-                              unsigned long *map_key,
-                              unsigned long *descriptor_size,
-                              uint32_t *descriptor_version)
+efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
+                               struct efi_mem_desc *memory_map,
+                               efi_uintn_t *map_key,
+                               efi_uintn_t *descriptor_size,
+                               uint32_t *descriptor_version)
 {
-       ulong map_size = 0;
+       efi_uintn_t map_size = 0;
        int map_entries = 0;
        struct list_head *lhandle;
-       unsigned long provided_map_size = *memory_map_size;
+       efi_uintn_t provided_map_size = *memory_map_size;
 
        list_for_each(lhandle, &efi_mem)
                map_entries++;
index b6bc4dd5c073067cca50be2070f0fdd9403eaf45..263b53f6724b23e443f34c801a09bd018f7a6365 100644 (file)
@@ -32,9 +32,9 @@ static u16 reset_message[] = L"Selftest completed";
  */
 void efi_st_exit_boot_services(void)
 {
-       unsigned long map_size = 0;
-       unsigned long map_key;
-       unsigned long desc_size;
+       efi_uintn_t map_size = 0;
+       efi_uintn_t map_key;
+       efi_uintn_t desc_size;
        u32 desc_version;
        efi_status_t ret;
        struct efi_mem_desc *memory_map;
index 081f31257fbd60f66f1eff515fdeacdd39b7ffd9..ad9490bd250ca5e2a4ada2e1c0214331aeb59059 100644 (file)
@@ -108,7 +108,7 @@ static int teardown(void)
  */
 static int execute(void)
 {
-       size_t index;
+       efi_uintn_t index;
        efi_status_t ret;
 
        /* Set 10 ms timer */
index e978dd7f2fd93f41124ac37bd1eb96128458e5c6..f20f1528d471e9989e556d26e010cfaea0eee6f3 100644 (file)
@@ -138,9 +138,9 @@ static int execute(void)
        efi_status_t ret;
        efi_handle_t *buffer;
        size_t buffer_size;
-       unsigned long int count = 0;
+       efi_uintn_t count = 0;
        efi_guid_t **prot_buffer;
-       unsigned long int prot_count;
+       efi_uintn_t prot_count;
 
        /*
         * Test HandleProtocol
index bdd6ce20da61245eaaacf79498dd03ea1a463cc3..cc0705fb59fbab3ad14c664ebaacc5cab4efcaa0 100644 (file)
@@ -260,7 +260,7 @@ static int execute(void)
 {
        efi_status_t ret;
        struct efi_event *events[2];
-       size_t index;
+       efi_uintn_t index;
        union {
                struct dhcp p;
                u8 b[PKTSIZE];
index 15d62903c03cbd13033dba6038357bb261b6804b..6ea0bb7177f402e0fde6766d7e45a596ac07dc87 100644 (file)
@@ -111,7 +111,7 @@ static int teardown(void)
  */
 static int execute(void)
 {
-       size_t index;
+       efi_uintn_t index;
        efi_status_t ret;
        efi_uintn_t old_tpl;