[U-Boot] [PATCH v3 14/18] efi_loader: provide link between devices and EFI handles

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Jan 19 20:33:29 UTC 2018


On 01/19/2018 09:20 PM, Alexander Graf wrote:
> 
> 
> On 19.01.18 20:24, Heinrich Schuchardt wrote:
>> U-Boot devices and EFI handles can be related, e.g. an
>> IDE disk relates to a handle with the EFI_BLOCK_IO_PROTOCOL.
>> Provide a pointer to store this link.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>> ---
>> v3
>> 	Don't add an unused handle field to struct udevice.
>> v2
>> 	no change
>> ---
>>   include/efi_loader.h          | 2 ++
>>   lib/efi_loader/efi_boottime.c | 1 +
>>   2 files changed, 3 insertions(+)
>>
>> diff --git a/include/efi_loader.h b/include/efi_loader.h
>> index 188bc06bcc..3579db8b63 100644
>> --- a/include/efi_loader.h
>> +++ b/include/efi_loader.h
>> @@ -139,6 +139,8 @@ struct efi_object {
>>   	struct list_head protocols;
>>   	/* The object spawner can either use this for data or as identifier */
>>   	void *handle;
>> +	/* Device */
>> +	struct udevice *dev;
> 
> I still don't think you need this.

The stop method of the driver binding protocol we will call the unbind 
function of the EFI block driver. In the unbind function we need the the 
reference to delete the driver.

On use case is calling sanunhook for an iSCSI device in the iPXE 
application.

I must admit that I have not yet implemented the unbinding.

Best regards

Heinrich

> 
>>   };
>>   
>>   /**
>> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
>> index 324abe4d48..15baeb275f 100644
>> --- a/lib/efi_loader/efi_boottime.c
>> +++ b/lib/efi_loader/efi_boottime.c
>> @@ -361,6 +361,7 @@ efi_status_t efi_create_handle(void **handle)
>>   			      (void **)&obj);
>>   	if (r != EFI_SUCCESS)
>>   		return r;
>> +	memset(obj, 0, sizeof(struct efi_object));
> 
> And without change you don't need the memset either :)
> 
> 
> Alex
> 
>>   	efi_add_handle(obj);
>>   	*handle = obj->handle;
>>   	return r;
>>
> 



More information about the U-Boot mailing list