diff mbox series

[2/2] efi_loader: fill media_id from block device descriptor

Message ID 20220915200242.18358-3-heinrich.schuchardt@canonical.com
State Changes Requested, archived
Delegated to: Heinrich Schuchardt
Headers show
Series efi_loader: provide media ID | expand

Commit Message

Heinrich Schuchardt Sept. 15, 2022, 8:02 p.m. UTC
Fill the media ID in the block IO protocol from the block device descriptor
of the driver model.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/efi_loader/efi_disk.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Ilias Apalodimas Sept. 23, 2022, 7:07 a.m. UTC | #1
On Thu, 15 Sept 2022 at 23:02, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Fill the media ID in the block IO protocol from the block device descriptor
> of the driver model.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/efi_loader/efi_disk.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index 73745ccaa0..35790aa86d 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -476,11 +476,7 @@ static efi_status_t efi_disk_add_dev(
>         /* Fill in EFI IO Media info (for read/write callbacks) */
>         diskobj->media.removable_media = desc->removable;
>         diskobj->media.media_present = 1;
> -       /*
> -        * MediaID is just an arbitrary counter.
> -        * We have to change it if the medium is removed or changed.
> -        */
> -       diskobj->media.media_id = 1;
> +       diskobj->media.media_id = desc->media_id;
>         diskobj->media.block_size = desc->blksz;
>         diskobj->media.io_align = desc->blksz;
>         if (part)
> --
> 2.37.2
>

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Simon Glass Sept. 25, 2022, 2:15 p.m. UTC | #2
Hi,

On Fri, 23 Sept 2022 at 01:08, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> On Thu, 15 Sept 2022 at 23:02, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
> >
> > Fill the media ID in the block IO protocol from the block device descriptor
> > of the driver model.
> >
> > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> > ---
> >  lib/efi_loader/efi_disk.c | 6 +-----
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> > index 73745ccaa0..35790aa86d 100644
> > --- a/lib/efi_loader/efi_disk.c
> > +++ b/lib/efi_loader/efi_disk.c
> > @@ -476,11 +476,7 @@ static efi_status_t efi_disk_add_dev(
> >         /* Fill in EFI IO Media info (for read/write callbacks) */
> >         diskobj->media.removable_media = desc->removable;
> >         diskobj->media.media_present = 1;
> > -       /*
> > -        * MediaID is just an arbitrary counter.
> > -        * We have to change it if the medium is removed or changed.
> > -        */
> > -       diskobj->media.media_id = 1;
> > +       diskobj->media.media_id = desc->media_id;
> >         diskobj->media.block_size = desc->blksz;
> >         diskobj->media.io_align = desc->blksz;
> >         if (part)
> > --
> > 2.37.2
> >
>
> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

Still a NAK from me as we should not add this to the desc thing.

Ilias, we talked about getting the next step going for integrating EFI
properly with driver model, which should sort this out.

Regards,
SImon
AKASHI Takahiro Sept. 26, 2022, 12:05 a.m. UTC | #3
On Sun, Sep 25, 2022 at 08:15:36AM -0600, Simon Glass wrote:
> Hi,
> 
> On Fri, 23 Sept 2022 at 01:08, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > On Thu, 15 Sept 2022 at 23:02, Heinrich Schuchardt
> > <heinrich.schuchardt@canonical.com> wrote:
> > >
> > > Fill the media ID in the block IO protocol from the block device descriptor
> > > of the driver model.
> > >
> > > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> > > ---
> > >  lib/efi_loader/efi_disk.c | 6 +-----
> > >  1 file changed, 1 insertion(+), 5 deletions(-)
> > >
> > > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> > > index 73745ccaa0..35790aa86d 100644
> > > --- a/lib/efi_loader/efi_disk.c
> > > +++ b/lib/efi_loader/efi_disk.c
> > > @@ -476,11 +476,7 @@ static efi_status_t efi_disk_add_dev(
> > >         /* Fill in EFI IO Media info (for read/write callbacks) */
> > >         diskobj->media.removable_media = desc->removable;
> > >         diskobj->media.media_present = 1;
> > > -       /*
> > > -        * MediaID is just an arbitrary counter.
> > > -        * We have to change it if the medium is removed or changed.
> > > -        */
> > > -       diskobj->media.media_id = 1;
> > > +       diskobj->media.media_id = desc->media_id;
> > >         diskobj->media.block_size = desc->blksz;
> > >         diskobj->media.io_align = desc->blksz;
> > >         if (part)
> > > --
> > > 2.37.2
> > >
> >
> > Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> 
> Still a NAK from me as we should not add this to the desc thing.

In addition, I have already raised my concern about Heinrich's approach:
https://lists.denx.de/pipermail/u-boot/2022-September/494764.html

-Takahiro Akashi


> Ilias, we talked about getting the next step going for integrating EFI
> properly with driver model, which should sort this out.
> 
> Regards,
> SImon
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 73745ccaa0..35790aa86d 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -476,11 +476,7 @@  static efi_status_t efi_disk_add_dev(
 	/* Fill in EFI IO Media info (for read/write callbacks) */
 	diskobj->media.removable_media = desc->removable;
 	diskobj->media.media_present = 1;
-	/*
-	 * MediaID is just an arbitrary counter.
-	 * We have to change it if the medium is removed or changed.
-	 */
-	diskobj->media.media_id = 1;
+	diskobj->media.media_id = desc->media_id;
 	diskobj->media.block_size = desc->blksz;
 	diskobj->media.io_align = desc->blksz;
 	if (part)