diff mbox

[05/16] rename __get_map() to efi_get_memory_map(), add parameter to optionally return mmap key. The mmap key is required to exit EFI boot services, and allows efi_get_memory_map() to be used for getting final memory map.

Message ID 1376090777-20090-6-git-send-email-roy.franz@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Roy Franz Aug. 9, 2013, 11:26 p.m. UTC
Signed-off-by: Roy Franz <roy.franz@linaro.org>
---
 drivers/firmware/efi/efi-stub-helper.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

Mark Salter Aug. 13, 2013, 1:57 p.m. UTC | #1
On Fri, 2013-08-09 at 16:26 -0700, Roy Franz wrote:
> Signed-off-by: Roy Franz <roy.franz@linaro.org>
> ---
>  drivers/firmware/efi/efi-stub-helper.c |   17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)

Tested on arm64.

Acked-by: Mark Salter <msalter@redhat.com>
Grant Likely Aug. 30, 2013, 1:06 p.m. UTC | #2
On Fri,  9 Aug 2013 16:26:06 -0700, Roy Franz <roy.franz@linaro.org> wrote:
> Signed-off-by: Roy Franz <roy.franz@linaro.org>

Same issue with the commit message here as for patch 4. Please include a
comment stating what is intended to use this new feature.

> ---
>  drivers/firmware/efi/efi-stub-helper.c |   17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c
> index 40cd16e..1d0a079 100644
> --- a/drivers/firmware/efi/efi-stub-helper.c
> +++ b/drivers/firmware/efi/efi-stub-helper.c
> @@ -46,10 +46,11 @@ static void efi_printk(efi_system_table_t *sys_table_arg, char *str)
>  }
>  
>  
> -static efi_status_t __get_map(efi_system_table_t *sys_table_arg,
> -			      efi_memory_desc_t **map,
> -			      unsigned long *map_size,
> -			      unsigned long *desc_size)
> +static efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
> +				       efi_memory_desc_t **map,
> +				       unsigned long *map_size,
> +				       unsigned long *desc_size,
> +				       unsigned long *key_ptr)
>  {
>  	efi_memory_desc_t *m = NULL;
>  	efi_status_t status;
> @@ -77,6 +78,8 @@ again:
>  
>  	if (status != EFI_SUCCESS)
>  		efi_call_phys1(sys_table_arg->boottime->free_pool, m);
> +	if (key_ptr && status == EFI_SUCCESS)
> +		*key_ptr = key;
>  
>  fail:
>  	*map = m;
> @@ -97,7 +100,8 @@ static efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
>  	u64 max_addr = 0;
>  	int i;
>  
> -	status = __get_map(sys_table_arg, &map, &map_size, &desc_size);
> +	status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size,
> +				    NULL);
>  	if (status != EFI_SUCCESS)
>  		goto fail;
>  
> @@ -175,7 +179,8 @@ static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
>  	unsigned long nr_pages;
>  	int i;
>  
> -	status = __get_map(sys_table_arg, &map, &map_size, &desc_size);
> +	status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size,
> +				    NULL);
>  	if (status != EFI_SUCCESS)
>  		goto fail;
>  
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
diff mbox

Patch

diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c
index 40cd16e..1d0a079 100644
--- a/drivers/firmware/efi/efi-stub-helper.c
+++ b/drivers/firmware/efi/efi-stub-helper.c
@@ -46,10 +46,11 @@  static void efi_printk(efi_system_table_t *sys_table_arg, char *str)
 }
 
 
-static efi_status_t __get_map(efi_system_table_t *sys_table_arg,
-			      efi_memory_desc_t **map,
-			      unsigned long *map_size,
-			      unsigned long *desc_size)
+static efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
+				       efi_memory_desc_t **map,
+				       unsigned long *map_size,
+				       unsigned long *desc_size,
+				       unsigned long *key_ptr)
 {
 	efi_memory_desc_t *m = NULL;
 	efi_status_t status;
@@ -77,6 +78,8 @@  again:
 
 	if (status != EFI_SUCCESS)
 		efi_call_phys1(sys_table_arg->boottime->free_pool, m);
+	if (key_ptr && status == EFI_SUCCESS)
+		*key_ptr = key;
 
 fail:
 	*map = m;
@@ -97,7 +100,8 @@  static efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
 	u64 max_addr = 0;
 	int i;
 
-	status = __get_map(sys_table_arg, &map, &map_size, &desc_size);
+	status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size,
+				    NULL);
 	if (status != EFI_SUCCESS)
 		goto fail;
 
@@ -175,7 +179,8 @@  static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
 	unsigned long nr_pages;
 	int i;
 
-	status = __get_map(sys_table_arg, &map, &map_size, &desc_size);
+	status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size,
+				    NULL);
 	if (status != EFI_SUCCESS)
 		goto fail;