All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] efi_loader: assign HII protocols to root node
@ 2019-04-07 22:05 Heinrich Schuchardt
  2019-04-12  2:21 ` AKASHI Takahiro
  0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2019-04-07 22:05 UTC (permalink / raw)
  To: u-boot

We should not install the HII protocols on every loaded image. It is
sufficient to install them once on the root node.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/efi_loader/efi_boottime.c  | 20 --------------------
 lib/efi_loader/efi_root_node.c | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index b215bd7723..31d11b8678 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1569,26 +1569,6 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,
 	if (ret != EFI_SUCCESS)
 		goto failure;

-#if CONFIG_IS_ENABLED(EFI_LOADER_HII)
-	ret = efi_add_protocol(&obj->header,
-			       &efi_guid_hii_string_protocol,
-			       (void *)&efi_hii_string);
-	if (ret != EFI_SUCCESS)
-		goto failure;
-
-	ret = efi_add_protocol(&obj->header,
-			       &efi_guid_hii_database_protocol,
-			       (void *)&efi_hii_database);
-	if (ret != EFI_SUCCESS)
-		goto failure;
-
-	ret = efi_add_protocol(&obj->header,
-			       &efi_guid_hii_config_routing_protocol,
-			       (void *)&efi_hii_config_routing);
-	if (ret != EFI_SUCCESS)
-		goto failure;
-#endif
-
 	*info_ptr = info;
 	*handle_ptr = obj;

diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c
index b056ba3ee8..b58d9d8c96 100644
--- a/lib/efi_loader/efi_root_node.c
+++ b/lib/efi_loader/efi_root_node.c
@@ -74,6 +74,26 @@ efi_status_t efi_root_node_register(void)
 	if (ret != EFI_SUCCESS)
 		goto failure;

+#if CONFIG_IS_ENABLED(EFI_LOADER_HII)
+	/* Install HII string protocol */
+	ret = efi_add_protocol(root, &efi_guid_hii_string_protocol,
+			       (void *)&efi_hii_string);
+	if (ret != EFI_SUCCESS)
+		goto failure;
+
+	/* Install HII database protocol */
+	ret = efi_add_protocol(root, &efi_guid_hii_database_protocol,
+			       (void *)&efi_hii_database);
+	if (ret != EFI_SUCCESS)
+		goto failure;
+
+	/* Install HII configuration routing protocol */
+	ret = efi_add_protocol(root, &efi_guid_hii_config_routing_protocol,
+			       (void *)&efi_hii_config_routing);
+	if (ret != EFI_SUCCESS)
+		goto failure;
+#endif
+
 failure:
 	return ret;
 }
--
2.20.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH 1/1] efi_loader: assign HII protocols to root node
  2019-04-07 22:05 [U-Boot] [PATCH 1/1] efi_loader: assign HII protocols to root node Heinrich Schuchardt
@ 2019-04-12  2:21 ` AKASHI Takahiro
  2019-04-12  4:43   ` Heinrich Schuchardt
  0 siblings, 1 reply; 3+ messages in thread
From: AKASHI Takahiro @ 2019-04-12  2:21 UTC (permalink / raw)
  To: u-boot

On Mon, Apr 08, 2019 at 12:05:16AM +0200, Heinrich Schuchardt wrote:
> We should not install the HII protocols on every loaded image. It is
> sufficient to install them once on the root node.

First time I submitted HII patch, we didn't have root node :)
Anyhow, why not use efi_install_multiple_protocol_interfaces()?
It would make the code smart.

Thanks,
-Takahiro Akashi

> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  lib/efi_loader/efi_boottime.c  | 20 --------------------
>  lib/efi_loader/efi_root_node.c | 20 ++++++++++++++++++++
>  2 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index b215bd7723..31d11b8678 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -1569,26 +1569,6 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,
>  	if (ret != EFI_SUCCESS)
>  		goto failure;
> 
> -#if CONFIG_IS_ENABLED(EFI_LOADER_HII)
> -	ret = efi_add_protocol(&obj->header,
> -			       &efi_guid_hii_string_protocol,
> -			       (void *)&efi_hii_string);
> -	if (ret != EFI_SUCCESS)
> -		goto failure;
> -
> -	ret = efi_add_protocol(&obj->header,
> -			       &efi_guid_hii_database_protocol,
> -			       (void *)&efi_hii_database);
> -	if (ret != EFI_SUCCESS)
> -		goto failure;
> -
> -	ret = efi_add_protocol(&obj->header,
> -			       &efi_guid_hii_config_routing_protocol,
> -			       (void *)&efi_hii_config_routing);
> -	if (ret != EFI_SUCCESS)
> -		goto failure;
> -#endif
> -
>  	*info_ptr = info;
>  	*handle_ptr = obj;
> 
> diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c
> index b056ba3ee8..b58d9d8c96 100644
> --- a/lib/efi_loader/efi_root_node.c
> +++ b/lib/efi_loader/efi_root_node.c
> @@ -74,6 +74,26 @@ efi_status_t efi_root_node_register(void)
>  	if (ret != EFI_SUCCESS)
>  		goto failure;
> 
> +#if CONFIG_IS_ENABLED(EFI_LOADER_HII)
> +	/* Install HII string protocol */
> +	ret = efi_add_protocol(root, &efi_guid_hii_string_protocol,
> +			       (void *)&efi_hii_string);
> +	if (ret != EFI_SUCCESS)
> +		goto failure;
> +
> +	/* Install HII database protocol */
> +	ret = efi_add_protocol(root, &efi_guid_hii_database_protocol,
> +			       (void *)&efi_hii_database);
> +	if (ret != EFI_SUCCESS)
> +		goto failure;
> +
> +	/* Install HII configuration routing protocol */
> +	ret = efi_add_protocol(root, &efi_guid_hii_config_routing_protocol,
> +			       (void *)&efi_hii_config_routing);
> +	if (ret != EFI_SUCCESS)
> +		goto failure;
> +#endif
> +
>  failure:
>  	return ret;
>  }
> --
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH 1/1] efi_loader: assign HII protocols to root node
  2019-04-12  2:21 ` AKASHI Takahiro
@ 2019-04-12  4:43   ` Heinrich Schuchardt
  0 siblings, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2019-04-12  4:43 UTC (permalink / raw)
  To: u-boot

On 4/12/19 4:21 AM, AKASHI Takahiro wrote:
> On Mon, Apr 08, 2019 at 12:05:16AM +0200, Heinrich Schuchardt wrote:
>> We should not install the HII protocols on every loaded image. It is
>> sufficient to install them once on the root node.
>
> First time I submitted HII patch, we didn't have root node :)
> Anyhow, why not use efi_install_multiple_protocol_interfaces()?
> It would make the code smart.

I fully agree. This should also involve other protocols. I suggest to do
such a change in a follow up patch. This makes reviewing much easier.

We also should think about moving the console IO protocols and the GOP
protocol to the root node and using the root device path to initialize
the ConIn, ConInDev, ConOut, ConOutDev variables. Currently the console
IO protocols and the GOP protocol are installed on handles without
device path.

Best regards

Heinrich

>
> Thanks,
> -Takahiro Akashi
>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>> ---
>>   lib/efi_loader/efi_boottime.c  | 20 --------------------
>>   lib/efi_loader/efi_root_node.c | 20 ++++++++++++++++++++
>>   2 files changed, 20 insertions(+), 20 deletions(-)
>>
>> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
>> index b215bd7723..31d11b8678 100644
>> --- a/lib/efi_loader/efi_boottime.c
>> +++ b/lib/efi_loader/efi_boottime.c
>> @@ -1569,26 +1569,6 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,
>>   	if (ret != EFI_SUCCESS)
>>   		goto failure;
>>
>> -#if CONFIG_IS_ENABLED(EFI_LOADER_HII)
>> -	ret = efi_add_protocol(&obj->header,
>> -			       &efi_guid_hii_string_protocol,
>> -			       (void *)&efi_hii_string);
>> -	if (ret != EFI_SUCCESS)
>> -		goto failure;
>> -
>> -	ret = efi_add_protocol(&obj->header,
>> -			       &efi_guid_hii_database_protocol,
>> -			       (void *)&efi_hii_database);
>> -	if (ret != EFI_SUCCESS)
>> -		goto failure;
>> -
>> -	ret = efi_add_protocol(&obj->header,
>> -			       &efi_guid_hii_config_routing_protocol,
>> -			       (void *)&efi_hii_config_routing);
>> -	if (ret != EFI_SUCCESS)
>> -		goto failure;
>> -#endif
>> -
>>   	*info_ptr = info;
>>   	*handle_ptr = obj;
>>
>> diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c
>> index b056ba3ee8..b58d9d8c96 100644
>> --- a/lib/efi_loader/efi_root_node.c
>> +++ b/lib/efi_loader/efi_root_node.c
>> @@ -74,6 +74,26 @@ efi_status_t efi_root_node_register(void)
>>   	if (ret != EFI_SUCCESS)
>>   		goto failure;
>>
>> +#if CONFIG_IS_ENABLED(EFI_LOADER_HII)
>> +	/* Install HII string protocol */
>> +	ret = efi_add_protocol(root, &efi_guid_hii_string_protocol,
>> +			       (void *)&efi_hii_string);
>> +	if (ret != EFI_SUCCESS)
>> +		goto failure;
>> +
>> +	/* Install HII database protocol */
>> +	ret = efi_add_protocol(root, &efi_guid_hii_database_protocol,
>> +			       (void *)&efi_hii_database);
>> +	if (ret != EFI_SUCCESS)
>> +		goto failure;
>> +
>> +	/* Install HII configuration routing protocol */
>> +	ret = efi_add_protocol(root, &efi_guid_hii_config_routing_protocol,
>> +			       (void *)&efi_hii_config_routing);
>> +	if (ret != EFI_SUCCESS)
>> +		goto failure;
>> +#endif
>> +
>>   failure:
>>   	return ret;
>>   }
>> --
>> 2.20.1
>>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-12  4:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-07 22:05 [U-Boot] [PATCH 1/1] efi_loader: assign HII protocols to root node Heinrich Schuchardt
2019-04-12  2:21 ` AKASHI Takahiro
2019-04-12  4:43   ` Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.