Commit f5a2a93892ff8a8f066bc9f84eb9f0cf35ba0c67

Authored by Heinrich Schuchardt
Committed by Alexander Graf
1 parent 152cade326

efi_loader: consistently use efi_uintn_t in boot services

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>

Showing 9 changed files with 59 additions and 56 deletions Side-by-side Diff

... ... @@ -51,13 +51,15 @@
51 51 efi_status_t (EFIAPI *raise_tpl)(efi_uintn_t new_tpl);
52 52 void (EFIAPI *restore_tpl)(efi_uintn_t old_tpl);
53 53  
54   - efi_status_t (EFIAPI *allocate_pages)(int, int, unsigned long,
  54 + efi_status_t (EFIAPI *allocate_pages)(int, int, efi_uintn_t,
55 55 efi_physical_addr_t *);
56   - efi_status_t (EFIAPI *free_pages)(efi_physical_addr_t, unsigned long);
57   - efi_status_t (EFIAPI *get_memory_map)(unsigned long *memory_map_size,
58   - struct efi_mem_desc *desc, unsigned long *key,
59   - unsigned long *desc_size, u32 *desc_version);
60   - efi_status_t (EFIAPI *allocate_pool)(int, unsigned long, void **);
  56 + efi_status_t (EFIAPI *free_pages)(efi_physical_addr_t, efi_uintn_t);
  57 + efi_status_t (EFIAPI *get_memory_map)(efi_uintn_t *memory_map_size,
  58 + struct efi_mem_desc *desc,
  59 + efi_uintn_t *key,
  60 + efi_uintn_t *desc_size,
  61 + u32 *desc_version);
  62 + efi_status_t (EFIAPI *allocate_pool)(int, efi_uintn_t, void **);
61 63 efi_status_t (EFIAPI *free_pool)(void *);
62 64  
63 65 efi_status_t (EFIAPI *create_event)(uint32_t type,
... ... @@ -69,8 +71,9 @@
69 71 efi_status_t (EFIAPI *set_timer)(struct efi_event *event,
70 72 enum efi_timer_delay type,
71 73 uint64_t trigger_time);
72   - efi_status_t (EFIAPI *wait_for_event)(unsigned long number_of_events,
73   - struct efi_event **event, size_t *index);
  74 + efi_status_t (EFIAPI *wait_for_event)(efi_uintn_t number_of_events,
  75 + struct efi_event **event,
  76 + efi_uintn_t *index);
74 77 efi_status_t (EFIAPI *signal_event)(struct efi_event *event);
75 78 efi_status_t (EFIAPI *close_event)(struct efi_event *event);
76 79 efi_status_t (EFIAPI *check_event)(struct efi_event *event);
... ... @@ -93,7 +96,7 @@
93 96 efi_status_t (EFIAPI *locate_handle)(
94 97 enum efi_locate_search_type search_type,
95 98 const efi_guid_t *protocol, void *search_key,
96   - unsigned long *buffer_size, efi_handle_t *buffer);
  99 + efi_uintn_t *buffer_size, efi_handle_t *buffer);
97 100 efi_status_t (EFIAPI *locate_device_path)(const efi_guid_t *protocol,
98 101 struct efi_device_path **device_path,
99 102 efi_handle_t *device);
100 103  
101 104  
... ... @@ -140,14 +143,14 @@
140 143 efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle,
141 144 const efi_guid_t *protocol,
142 145 struct efi_open_protocol_info_entry **entry_buffer,
143   - unsigned long *entry_count);
  146 + efi_uintn_t *entry_count);
144 147 efi_status_t (EFIAPI *protocols_per_handle)(efi_handle_t handle,
145 148 efi_guid_t ***protocol_buffer,
146   - unsigned long *protocols_buffer_count);
  149 + efi_uintn_t *protocols_buffer_count);
147 150 efi_status_t (EFIAPI *locate_handle_buffer) (
148 151 enum efi_locate_search_type search_type,
149 152 const efi_guid_t *protocol, void *search_key,
150   - unsigned long *no_handles, efi_handle_t **buffer);
  153 + efi_uintn_t *no_handles, efi_handle_t **buffer);
151 154 efi_status_t (EFIAPI *locate_protocol)(const efi_guid_t *protocol,
152 155 void *registration, void **protocol_interface);
153 156 efi_status_t (EFIAPI *install_multiple_protocol_interfaces)(
... ... @@ -248,7 +251,7 @@
248 251 struct efi_simple_text_output_protocol *std_err;
249 252 struct efi_runtime_services *runtime;
250 253 struct efi_boot_services *boottime;
251   - unsigned long nr_tables;
  254 + efi_uintn_t nr_tables;
252 255 struct efi_configuration_table *tables;
253 256 };
254 257  
include/efi_loader.h
... ... @@ -215,20 +215,20 @@
215 215 /* Generic EFI memory allocator, call this to get memory */
216 216 void *efi_alloc(uint64_t len, int memory_type);
217 217 /* More specific EFI memory allocator, called by EFI payloads */
218   -efi_status_t efi_allocate_pages(int type, int memory_type, unsigned long pages,
  218 +efi_status_t efi_allocate_pages(int type, int memory_type, efi_uintn_t pages,
219 219 uint64_t *memory);
220 220 /* EFI memory free function. */
221   -efi_status_t efi_free_pages(uint64_t memory, unsigned long pages);
  221 +efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages);
222 222 /* EFI memory allocator for small allocations */
223   -efi_status_t efi_allocate_pool(int pool_type, unsigned long size,
  223 +efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size,
224 224 void **buffer);
225 225 /* EFI pool memory free function. */
226 226 efi_status_t efi_free_pool(void *buffer);
227 227 /* Returns the EFI memory map */
228   -efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
  228 +efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
229 229 struct efi_mem_desc *memory_map,
230   - unsigned long *map_key,
231   - unsigned long *descriptor_size,
  230 + efi_uintn_t *map_key,
  231 + efi_uintn_t *descriptor_size,
232 232 uint32_t *descriptor_version);
233 233 /* Adds a range into the EFI memory map */
234 234 uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
lib/efi_loader/efi_boottime.c
... ... @@ -217,12 +217,12 @@
217 217 * @return status code
218 218 */
219 219 static efi_status_t EFIAPI efi_allocate_pages_ext(int type, int memory_type,
220   - unsigned long pages,
  220 + efi_uintn_t pages,
221 221 uint64_t *memory)
222 222 {
223 223 efi_status_t r;
224 224  
225   - EFI_ENTRY("%d, %d, 0x%lx, %p", type, memory_type, pages, memory);
  225 + EFI_ENTRY("%d, %d, 0x%zx, %p", type, memory_type, pages, memory);
226 226 r = efi_allocate_pages(type, memory_type, pages, memory);
227 227 return EFI_EXIT(r);
228 228 }
229 229  
... ... @@ -239,11 +239,11 @@
239 239 * @return status code
240 240 */
241 241 static efi_status_t EFIAPI efi_free_pages_ext(uint64_t memory,
242   - unsigned long pages)
  242 + efi_uintn_t pages)
243 243 {
244 244 efi_status_t r;
245 245  
246   - EFI_ENTRY("%"PRIx64", 0x%lx", memory, pages);
  246 + EFI_ENTRY("%"PRIx64", 0x%zx", memory, pages);
247 247 r = efi_free_pages(memory, pages);
248 248 return EFI_EXIT(r);
249 249 }
250 250  
... ... @@ -264,10 +264,10 @@
264 264 * @return status code
265 265 */
266 266 static efi_status_t EFIAPI efi_get_memory_map_ext(
267   - unsigned long *memory_map_size,
  267 + efi_uintn_t *memory_map_size,
268 268 struct efi_mem_desc *memory_map,
269   - unsigned long *map_key,
270   - unsigned long *descriptor_size,
  269 + efi_uintn_t *map_key,
  270 + efi_uintn_t *descriptor_size,
271 271 uint32_t *descriptor_version)
272 272 {
273 273 efi_status_t r;
274 274  
... ... @@ -292,12 +292,12 @@
292 292 * @return status code
293 293 */
294 294 static efi_status_t EFIAPI efi_allocate_pool_ext(int pool_type,
295   - unsigned long size,
  295 + efi_uintn_t size,
296 296 void **buffer)
297 297 {
298 298 efi_status_t r;
299 299  
300   - EFI_ENTRY("%d, %ld, %p", pool_type, size, buffer);
  300 + EFI_ENTRY("%d, %zd, %p", pool_type, size, buffer);
301 301 r = efi_allocate_pool(pool_type, size, buffer);
302 302 return EFI_EXIT(r);
303 303 }
304 304  
305 305  
... ... @@ -539,13 +539,13 @@
539 539 * @index index of the event that was signaled
540 540 * @return status code
541 541 */
542   -static efi_status_t EFIAPI efi_wait_for_event(unsigned long num_events,
  542 +static efi_status_t EFIAPI efi_wait_for_event(efi_uintn_t num_events,
543 543 struct efi_event **event,
544   - size_t *index)
  544 + efi_uintn_t *index)
545 545 {
546 546 int i, j;
547 547  
548   - EFI_ENTRY("%ld, %p, %p", num_events, event, index);
  548 + EFI_ENTRY("%zd, %p, %p", num_events, event, index);
549 549  
550 550 /* Check parameters */
551 551 if (!num_events || !event)
552 552  
... ... @@ -925,10 +925,10 @@
925 925 static efi_status_t efi_locate_handle(
926 926 enum efi_locate_search_type search_type,
927 927 const efi_guid_t *protocol, void *search_key,
928   - unsigned long *buffer_size, efi_handle_t *buffer)
  928 + efi_uintn_t *buffer_size, efi_handle_t *buffer)
929 929 {
930 930 struct list_head *lhandle;
931   - unsigned long size = 0;
  931 + efi_uintn_t size = 0;
932 932  
933 933 /* Count how much space we need */
934 934 list_for_each(lhandle, &efi_obj_list) {
... ... @@ -977,7 +977,7 @@
977 977 static efi_status_t EFIAPI efi_locate_handle_ext(
978 978 enum efi_locate_search_type search_type,
979 979 const efi_guid_t *protocol, void *search_key,
980   - unsigned long *buffer_size, efi_handle_t *buffer)
  980 + efi_uintn_t *buffer_size, efi_handle_t *buffer)
981 981 {
982 982 EFI_ENTRY("%d, %pUl, %p, %p, %p", search_type, protocol, search_key,
983 983 buffer_size, buffer);
... ... @@ -1548,7 +1548,7 @@
1548 1548 static efi_status_t EFIAPI efi_open_protocol_information(efi_handle_t handle,
1549 1549 const efi_guid_t *protocol,
1550 1550 struct efi_open_protocol_info_entry **entry_buffer,
1551   - unsigned long *entry_count)
  1551 + efi_uintn_t *entry_count)
1552 1552 {
1553 1553 EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, entry_buffer,
1554 1554 entry_count);
... ... @@ -1569,7 +1569,7 @@
1569 1569 */
1570 1570 static efi_status_t EFIAPI efi_protocols_per_handle(void *handle,
1571 1571 efi_guid_t ***protocol_buffer,
1572   - unsigned long *protocol_buffer_count)
  1572 + efi_uintn_t *protocol_buffer_count)
1573 1573 {
1574 1574 unsigned long buffer_size;
1575 1575 struct efi_object *efiobj;
1576 1576  
... ... @@ -1637,10 +1637,10 @@
1637 1637 static efi_status_t EFIAPI efi_locate_handle_buffer(
1638 1638 enum efi_locate_search_type search_type,
1639 1639 const efi_guid_t *protocol, void *search_key,
1640   - unsigned long *no_handles, efi_handle_t **buffer)
  1640 + efi_uintn_t *no_handles, efi_handle_t **buffer)
1641 1641 {
1642 1642 efi_status_t r;
1643   - unsigned long buffer_size = 0;
  1643 + efi_uintn_t buffer_size = 0;
1644 1644  
1645 1645 EFI_ENTRY("%d, %pUl, %p, %p, %p", search_type, protocol, search_key,
1646 1646 no_handles, buffer);
lib/efi_loader/efi_memory.c
... ... @@ -276,7 +276,7 @@
276 276 }
277 277  
278 278 efi_status_t efi_allocate_pages(int type, int memory_type,
279   - unsigned long pages, uint64_t *memory)
  279 + efi_uintn_t pages, uint64_t *memory)
280 280 {
281 281 u64 len = pages << EFI_PAGE_SHIFT;
282 282 efi_status_t r = EFI_SUCCESS;
... ... @@ -338,7 +338,7 @@
338 338 return NULL;
339 339 }
340 340  
341   -efi_status_t efi_free_pages(uint64_t memory, unsigned long pages)
  341 +efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages)
342 342 {
343 343 uint64_t r = 0;
344 344  
... ... @@ -351,7 +351,7 @@
351 351 return EFI_NOT_FOUND;
352 352 }
353 353  
354   -efi_status_t efi_allocate_pool(int pool_type, unsigned long size,
  354 +efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size,
355 355 void **buffer)
356 356 {
357 357 efi_status_t r;
358 358  
359 359  
... ... @@ -392,16 +392,16 @@
392 392 return r;
393 393 }
394 394  
395   -efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
396   - struct efi_mem_desc *memory_map,
397   - unsigned long *map_key,
398   - unsigned long *descriptor_size,
399   - uint32_t *descriptor_version)
  395 +efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
  396 + struct efi_mem_desc *memory_map,
  397 + efi_uintn_t *map_key,
  398 + efi_uintn_t *descriptor_size,
  399 + uint32_t *descriptor_version)
400 400 {
401   - ulong map_size = 0;
  401 + efi_uintn_t map_size = 0;
402 402 int map_entries = 0;
403 403 struct list_head *lhandle;
404   - unsigned long provided_map_size = *memory_map_size;
  404 + efi_uintn_t provided_map_size = *memory_map_size;
405 405  
406 406 list_for_each(lhandle, &efi_mem)
407 407 map_entries++;
lib/efi_selftest/efi_selftest.c
... ... @@ -32,9 +32,9 @@
32 32 */
33 33 void efi_st_exit_boot_services(void)
34 34 {
35   - unsigned long map_size = 0;
36   - unsigned long map_key;
37   - unsigned long desc_size;
  35 + efi_uintn_t map_size = 0;
  36 + efi_uintn_t map_key;
  37 + efi_uintn_t desc_size;
38 38 u32 desc_version;
39 39 efi_status_t ret;
40 40 struct efi_mem_desc *memory_map;
lib/efi_selftest/efi_selftest_events.c
... ... @@ -108,7 +108,7 @@
108 108 */
109 109 static int execute(void)
110 110 {
111   - size_t index;
  111 + efi_uintn_t index;
112 112 efi_status_t ret;
113 113  
114 114 /* Set 10 ms timer */
lib/efi_selftest/efi_selftest_manageprotocols.c
... ... @@ -138,9 +138,9 @@
138 138 efi_status_t ret;
139 139 efi_handle_t *buffer;
140 140 size_t buffer_size;
141   - unsigned long int count = 0;
  141 + efi_uintn_t count = 0;
142 142 efi_guid_t **prot_buffer;
143   - unsigned long int prot_count;
  143 + efi_uintn_t prot_count;
144 144  
145 145 /*
146 146 * Test HandleProtocol
lib/efi_selftest/efi_selftest_snp.c
... ... @@ -260,7 +260,7 @@
260 260 {
261 261 efi_status_t ret;
262 262 struct efi_event *events[2];
263   - size_t index;
  263 + efi_uintn_t index;
264 264 union {
265 265 struct dhcp p;
266 266 u8 b[PKTSIZE];
lib/efi_selftest/efi_selftest_tpl.c
... ... @@ -111,7 +111,7 @@
111 111 */
112 112 static int execute(void)
113 113 {
114   - size_t index;
  114 + efi_uintn_t index;
115 115 efi_status_t ret;
116 116 efi_uintn_t old_tpl;
117 117