efi_loader: Update to use addresses internally
This collects together several v3 patches into one, to avoid any temporary test-breakage which would make future bisecting difficult. For efi_memory, the efi_allocate_pool() call uses a pointer to refer to memory, but efi_allocate_pages() uses an int. This causes quite a bit of confusion, since sandbox has a distinction between pointers and addresses. Adjust efi_allocate/free_pages_ext() to handle the conversions. Update efi_add_memory_map() function and its friend to use an address rather than a pointer cast to an integer. For lmb, now that efi_add_memory_map_pg() uses a address rather than a pointer cast to an int, we can simplify the code here. For efi_reserve_memory(), use addresses rather than pointers, so that it doesn't have to use mapmem. In general this simplifies the code, but the main benefit is that casts are no-longer needed in most places, so the compiler can check that we are doing the right thing. For efi_add_runtime_mmio(), now that efi_add_memory_map() takes an address rather than a pointer, do the mapping in this function. Update the memset() parameter to be a char while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -795,7 +795,7 @@ efi_status_t efi_allocate_pages(enum efi_allocate_type type,
|
||||
/**
|
||||
* efi_free_pages() - free memory pages
|
||||
*
|
||||
* @memory: start of the memory area to be freed
|
||||
* @memory: start-address of the memory area to be freed
|
||||
* @pages: number of pages to be freed
|
||||
* Return: status code
|
||||
*/
|
||||
@@ -833,9 +833,9 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
|
||||
/**
|
||||
* efi_add_memory_map() - add memory area to the memory map
|
||||
*
|
||||
* @start: start address of the memory area. Note that this is
|
||||
* actually a pointer provided as an integer. To pass in
|
||||
* an address, pass in (ulong)map_to_sysmem(addr)
|
||||
* @start: start address, must be a multiple of EFI_PAGE_SIZE. Note
|
||||
* that this is an address, not a pointer. Use
|
||||
* map_to_sysmem(ptr) if you need to pass in a pointer
|
||||
* @size: length in bytes of the memory area
|
||||
* @memory_type: type of memory added
|
||||
*
|
||||
@@ -850,9 +850,8 @@ efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type);
|
||||
* efi_add_memory_map_pg() - add pages to the memory map
|
||||
*
|
||||
* @start: start address, must be a multiple of EFI_PAGE_SIZE. Note that this
|
||||
* is actually a pointer provided as an integer. To pass in an address, pass
|
||||
* in (ulong)map_to_sysmem(addr)
|
||||
*
|
||||
* is an address, not a pointer. Use map_to_sysmem(ptr) if you need to pass
|
||||
* in a pointer
|
||||
* @pages: number of pages to add
|
||||
* @memory_type: EFI type of memory added
|
||||
* @overlap_conventional: region may only overlap free(conventional)
|
||||
|
||||
Reference in New Issue
Block a user