All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] efi_driver: provide driver binding protocol to bind function
@ 2022-10-04 17:21 Heinrich Schuchardt
  2022-10-06  9:29 ` Ilias Apalodimas
  0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2022-10-04 17:21 UTC (permalink / raw)
  To: Ilias Apalodimas; +Cc: u-boot, Heinrich Schuchardt

DisconnectController() is based on the open protocol information created
when the driver opens a protocol with BY_CHILD_CONTROLLER or BY_DRIVER.

To create an open protocol information it is required to supply the handle
of the driver as agent handle. This information is available as field
DriverBindingHandle in the driver binding protocol.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 include/efi_driver.h              | 29 +++++++++++++++--------------
 lib/efi_driver/efi_block_device.c |  5 ++++-
 lib/efi_driver/efi_uclass.c       |  2 +-
 3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/include/efi_driver.h b/include/efi_driver.h
index de38abe83b..71e0d3194e 100644
--- a/include/efi_driver.h
+++ b/include/efi_driver.h
@@ -10,6 +10,19 @@
 
 #include <efi_loader.h>
 
+/**
+ * struct efi_driver_binding_extended_protocol - extended driver binding protocol
+ *
+ * This structure adds internal fields to the driver binding protocol.
+ *
+ * @bp:		driver binding protocol
+ * @ops:	operations supported by the driver
+ */
+struct efi_driver_binding_extended_protocol {
+	struct efi_driver_binding_protocol bp;
+	const struct efi_driver_ops *ops;
+};
+
 /**
  * struct efi_driver_ops - operations support by an EFI driver
  *
@@ -25,20 +38,8 @@
 struct efi_driver_ops {
 	const efi_guid_t *protocol;
 	const efi_guid_t *child_protocol;
-	efi_status_t (*bind)(efi_handle_t handle, void *interface);
-};
-
-/**
- * struct efi_driver_binding_extended_protocol - extended driver binding protocol
- *
- * This structure adds internal fields to the driver binding protocol.
- *
- * @bp:		driver binding protocol
- * @ops:	operations supported by the driver
- */
-struct efi_driver_binding_extended_protocol {
-	struct efi_driver_binding_protocol bp;
-	const struct efi_driver_ops *ops;
+	efi_status_t (*bind)(struct efi_driver_binding_extended_protocol *this,
+			     efi_handle_t handle, void *interface);
 };
 
 #endif /* _EFI_DRIVER_H */
diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
index e9eabbde58..f440067f70 100644
--- a/lib/efi_driver/efi_block_device.c
+++ b/lib/efi_driver/efi_block_device.c
@@ -174,11 +174,14 @@ err:
 /**
  * efi_bl_bind() - bind to a block io protocol
  *
+ * @this:	driver binding protocol
  * @handle:	handle
  * @interface:	block io protocol
  * Return:	status code
  */
-static efi_status_t efi_bl_bind(efi_handle_t handle, void *interface)
+static efi_status_t efi_bl_bind(
+			struct efi_driver_binding_extended_protocol *this,
+			efi_handle_t handle, void *interface)
 {
 	efi_status_t ret = EFI_SUCCESS;
 	struct efi_object *obj = efi_search_obj(handle);
diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c
index aabee0e260..0a16c594e3 100644
--- a/lib/efi_driver/efi_uclass.c
+++ b/lib/efi_driver/efi_uclass.c
@@ -146,7 +146,7 @@ static efi_status_t EFIAPI efi_uc_start(
 	ret = check_node_type(controller_handle);
 	if (ret != EFI_SUCCESS)
 		goto err;
-	ret = bp->ops->bind(controller_handle, interface);
+	ret = bp->ops->bind(bp, controller_handle, interface);
 	if (ret == EFI_SUCCESS)
 		goto out;
 
-- 
2.37.2


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

* Re: [PATCH 1/1] efi_driver: provide driver binding protocol to bind function
  2022-10-04 17:21 [PATCH 1/1] efi_driver: provide driver binding protocol to bind function Heinrich Schuchardt
@ 2022-10-06  9:29 ` Ilias Apalodimas
  2022-10-06 10:56   ` Heinrich Schuchardt
  0 siblings, 1 reply; 3+ messages in thread
From: Ilias Apalodimas @ 2022-10-06  9:29 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: u-boot

Hi Heinrich, 

On Tue, Oct 04, 2022 at 07:21:02PM +0200, Heinrich Schuchardt wrote:
> DisconnectController() is based on the open protocol information created
> when the driver opens a protocol with BY_CHILD_CONTROLLER or BY_DRIVER.
> 
> To create an open protocol information it is required to supply the handle
> of the driver as agent handle. This information is available as field
> DriverBindingHandle in the driver binding protocol.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>


This doesn't seem to apply on current -master.  Is there a patch that needs
to be applied before that?

Thanks
/Ilias
> ---
>  include/efi_driver.h              | 29 +++++++++++++++--------------
>  lib/efi_driver/efi_block_device.c |  5 ++++-
>  lib/efi_driver/efi_uclass.c       |  2 +-
>  3 files changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/include/efi_driver.h b/include/efi_driver.h
> index de38abe83b..71e0d3194e 100644
> --- a/include/efi_driver.h
> +++ b/include/efi_driver.h
> @@ -10,6 +10,19 @@
>  
>  #include <efi_loader.h>
>  
> +/**
> + * struct efi_driver_binding_extended_protocol - extended driver binding protocol
> + *
> + * This structure adds internal fields to the driver binding protocol.
> + *
> + * @bp:		driver binding protocol
> + * @ops:	operations supported by the driver
> + */
> +struct efi_driver_binding_extended_protocol {
> +	struct efi_driver_binding_protocol bp;
> +	const struct efi_driver_ops *ops;
> +};
> +
>  /**
>   * struct efi_driver_ops - operations support by an EFI driver
>   *
> @@ -25,20 +38,8 @@
>  struct efi_driver_ops {
>  	const efi_guid_t *protocol;
>  	const efi_guid_t *child_protocol;
> -	efi_status_t (*bind)(efi_handle_t handle, void *interface);
> -};
> -
> -/**
> - * struct efi_driver_binding_extended_protocol - extended driver binding protocol
> - *
> - * This structure adds internal fields to the driver binding protocol.
> - *
> - * @bp:		driver binding protocol
> - * @ops:	operations supported by the driver
> - */
> -struct efi_driver_binding_extended_protocol {
> -	struct efi_driver_binding_protocol bp;
> -	const struct efi_driver_ops *ops;
> +	efi_status_t (*bind)(struct efi_driver_binding_extended_protocol *this,
> +			     efi_handle_t handle, void *interface);
>  };
>  
>  #endif /* _EFI_DRIVER_H */
> diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
> index e9eabbde58..f440067f70 100644
> --- a/lib/efi_driver/efi_block_device.c
> +++ b/lib/efi_driver/efi_block_device.c
> @@ -174,11 +174,14 @@ err:
>  /**
>   * efi_bl_bind() - bind to a block io protocol
>   *
> + * @this:	driver binding protocol
>   * @handle:	handle
>   * @interface:	block io protocol
>   * Return:	status code
>   */
> -static efi_status_t efi_bl_bind(efi_handle_t handle, void *interface)
> +static efi_status_t efi_bl_bind(
> +			struct efi_driver_binding_extended_protocol *this,
> +			efi_handle_t handle, void *interface)
>  {
>  	efi_status_t ret = EFI_SUCCESS;
>  	struct efi_object *obj = efi_search_obj(handle);
> diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c
> index aabee0e260..0a16c594e3 100644
> --- a/lib/efi_driver/efi_uclass.c
> +++ b/lib/efi_driver/efi_uclass.c
> @@ -146,7 +146,7 @@ static efi_status_t EFIAPI efi_uc_start(
>  	ret = check_node_type(controller_handle);
>  	if (ret != EFI_SUCCESS)
>  		goto err;
> -	ret = bp->ops->bind(controller_handle, interface);
> +	ret = bp->ops->bind(bp, controller_handle, interface);
>  	if (ret == EFI_SUCCESS)
>  		goto out;
>  
> -- 
> 2.37.2
> 

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

* Re: [PATCH 1/1] efi_driver: provide driver binding protocol to bind function
  2022-10-06  9:29 ` Ilias Apalodimas
@ 2022-10-06 10:56   ` Heinrich Schuchardt
  0 siblings, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2022-10-06 10:56 UTC (permalink / raw)
  To: Ilias Apalodimas; +Cc: u-boot



On 10/6/22 11:29, Ilias Apalodimas wrote:
> Hi Heinrich,
> 
> On Tue, Oct 04, 2022 at 07:21:02PM +0200, Heinrich Schuchardt wrote:
>> DisconnectController() is based on the open protocol information created
>> when the driver opens a protocol with BY_CHILD_CONTROLLER or BY_DRIVER.
>>
>> To create an open protocol information it is required to supply the handle
>> of the driver as agent handle. This information is available as field
>> DriverBindingHandle in the driver binding protocol.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> 
> 
> This doesn't seem to apply on current -master.  Is there a patch that needs
> to be applied before that?

I guess you miss: efi_driver: reformat efi_block_device.c

Cf. 
https://source.denx.de/u-boot/custodians/u-boot-efi/-/commits/efi-2023-01

Best regards

Heinrich

> 
> Thanks
> /Ilias
>> ---
>>   include/efi_driver.h              | 29 +++++++++++++++--------------
>>   lib/efi_driver/efi_block_device.c |  5 ++++-
>>   lib/efi_driver/efi_uclass.c       |  2 +-
>>   3 files changed, 20 insertions(+), 16 deletions(-)
>>
>> diff --git a/include/efi_driver.h b/include/efi_driver.h
>> index de38abe83b..71e0d3194e 100644
>> --- a/include/efi_driver.h
>> +++ b/include/efi_driver.h
>> @@ -10,6 +10,19 @@
>>   
>>   #include <efi_loader.h>
>>   
>> +/**
>> + * struct efi_driver_binding_extended_protocol - extended driver binding protocol
>> + *
>> + * This structure adds internal fields to the driver binding protocol.
>> + *
>> + * @bp:		driver binding protocol
>> + * @ops:	operations supported by the driver
>> + */
>> +struct efi_driver_binding_extended_protocol {
>> +	struct efi_driver_binding_protocol bp;
>> +	const struct efi_driver_ops *ops;
>> +};
>> +
>>   /**
>>    * struct efi_driver_ops - operations support by an EFI driver
>>    *
>> @@ -25,20 +38,8 @@
>>   struct efi_driver_ops {
>>   	const efi_guid_t *protocol;
>>   	const efi_guid_t *child_protocol;
>> -	efi_status_t (*bind)(efi_handle_t handle, void *interface);
>> -};
>> -
>> -/**
>> - * struct efi_driver_binding_extended_protocol - extended driver binding protocol
>> - *
>> - * This structure adds internal fields to the driver binding protocol.
>> - *
>> - * @bp:		driver binding protocol
>> - * @ops:	operations supported by the driver
>> - */
>> -struct efi_driver_binding_extended_protocol {
>> -	struct efi_driver_binding_protocol bp;
>> -	const struct efi_driver_ops *ops;
>> +	efi_status_t (*bind)(struct efi_driver_binding_extended_protocol *this,
>> +			     efi_handle_t handle, void *interface);
>>   };
>>   
>>   #endif /* _EFI_DRIVER_H */
>> diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
>> index e9eabbde58..f440067f70 100644
>> --- a/lib/efi_driver/efi_block_device.c
>> +++ b/lib/efi_driver/efi_block_device.c
>> @@ -174,11 +174,14 @@ err:
>>   /**
>>    * efi_bl_bind() - bind to a block io protocol
>>    *
>> + * @this:	driver binding protocol
>>    * @handle:	handle
>>    * @interface:	block io protocol
>>    * Return:	status code
>>    */
>> -static efi_status_t efi_bl_bind(efi_handle_t handle, void *interface)
>> +static efi_status_t efi_bl_bind(
>> +			struct efi_driver_binding_extended_protocol *this,
>> +			efi_handle_t handle, void *interface)
>>   {
>>   	efi_status_t ret = EFI_SUCCESS;
>>   	struct efi_object *obj = efi_search_obj(handle);
>> diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c
>> index aabee0e260..0a16c594e3 100644
>> --- a/lib/efi_driver/efi_uclass.c
>> +++ b/lib/efi_driver/efi_uclass.c
>> @@ -146,7 +146,7 @@ static efi_status_t EFIAPI efi_uc_start(
>>   	ret = check_node_type(controller_handle);
>>   	if (ret != EFI_SUCCESS)
>>   		goto err;
>> -	ret = bp->ops->bind(controller_handle, interface);
>> +	ret = bp->ops->bind(bp, controller_handle, interface);
>>   	if (ret == EFI_SUCCESS)
>>   		goto out;
>>   
>> -- 
>> 2.37.2
>>

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

end of thread, other threads:[~2022-10-06 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04 17:21 [PATCH 1/1] efi_driver: provide driver binding protocol to bind function Heinrich Schuchardt
2022-10-06  9:29 ` Ilias Apalodimas
2022-10-06 10:56   ` 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.