[PATCH 1/2] dm: blk: assign media ID to block devices

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Fri Sep 16 08:41:13 CEST 2022



On 9/16/22 03:30, Simon Glass wrote:
> Hi Heinrich,
> 
> On Thu, 15 Sept 2022 at 14:02, Heinrich Schuchardt
> <heinrich.schuchardt at canonical.com> wrote:
>>
>> Currently block devices are only identified by uclass_id and device number.
>> When dealing with removable media this is not enough to uniquely identify
>> the medium.
>>
>> E.g. after host unbind, host bind we can have the same device number but a
>> different backing file.
>>
>> The EFI specification uses a 32bit number media ID to identify media. Add a
>> matching field to the block device descriptor.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> ---
>>   drivers/block/blk-uclass.c | 16 +++++++++++++++-
>>   include/blk.h              | 11 +++++++++++
>>   2 files changed, 26 insertions(+), 1 deletion(-)
> 
> Shouldn't this be handled by connecting the  EFI data to its udevice.
> I think Takahiro has been looking at this?
> 
> NAK to any EFI fields in blk_desc, in any case

The information that a medium has changed can only come from the DM 
layer. If for instance the SD-card is swapped, this is indicated by the 
card detector switch. USB also has a signal for media changes.

What are your ideas how the DM layer shall indicate media changes?

Best regards

Heinrich


More information about the U-Boot mailing list