* [PATCH 1/2] efi-gui: add USB IO Protocol GUID definition
@ 2017-10-27 7:05 Jean-Christophe PLAGNIOL-VILLARD
2017-10-27 7:05 ` [PATCH 2/2] efi-block: detect when the block device is a USB Disk Jean-Christophe PLAGNIOL-VILLARD
2017-10-27 8:58 ` [PATCH 1/2] efi-gui: add USB IO Protocol GUID definition Sascha Hauer
0 siblings, 2 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-10-27 7:05 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
common/efi-guid.c | 1 +
include/efi.h | 3 +++
2 files changed, 4 insertions(+)
diff --git a/common/efi-guid.c b/common/efi-guid.c
index 71aa21ddd..1e45ccf4d 100644
--- a/common/efi-guid.c
+++ b/common/efi-guid.c
@@ -35,6 +35,7 @@ const char *efi_guid_string(efi_guid_t *g)
EFI_GUID_STRING(EFI_UGA_PROTOCOL_GUID, "UGA Draw Protocol", "EFI 1.1 UGA Draw Protocol");
EFI_GUID_STRING(EFI_UGA_IO_PROTOCOL_GUID, "UGA Protocol", "EFI 1.1 UGA Protocol");
EFI_GUID_STRING(EFI_PCI_IO_PROTOCOL_GUID, "PCI IO Protocol", "EFI 1.1 PCI IO Protocol");
+ EFI_GUID_STRING(EFI_USB_IO_PROTOCOL_GUID, "USB IO Protocol", "EFI 1.0 USB IO Protocol");
EFI_GUID_STRING(EFI_FILE_INFO_GUID, "File Info", "EFI File Infom");
EFI_GUID_STRING(EFI_SIMPLE_FILE_SYSTEM_GUID, "Filesystem", "EFI 1.0 Simple FileSystem");
EFI_GUID_STRING(EFI_DEVICE_TREE_GUID, "Device Tree", "EFI Device Tree GUID");
diff --git a/include/efi.h b/include/efi.h
index e1fc134ee..7cc5fe05f 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -358,6 +358,9 @@ extern efi_runtime_services_t *RT;
#define EFI_PCI_IO_PROTOCOL_GUID \
EFI_GUID( 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a )
+#define EFI_USB_IO_PROTOCOL_GUID \
+ EFI_GUID(0x2B2F68D6, 0x0CD2, 0x44cf, 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75)
+
#define EFI_FILE_INFO_GUID \
EFI_GUID( 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] efi-block: detect when the block device is a USB Disk
2017-10-27 7:05 [PATCH 1/2] efi-gui: add USB IO Protocol GUID definition Jean-Christophe PLAGNIOL-VILLARD
@ 2017-10-27 7:05 ` Jean-Christophe PLAGNIOL-VILLARD
2017-11-02 11:03 ` Michael Olbrich
2017-10-27 8:58 ` [PATCH 1/2] efi-gui: add USB IO Protocol GUID definition Sascha Hauer
1 sibling, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-10-27 7:05 UTC (permalink / raw)
To: barebox
use usbdisk as a basename
This will be usefull as example when we want to search for a usb disk for
failsafe update or install.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/block/efi-block-io.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/block/efi-block-io.c b/drivers/block/efi-block-io.c
index a4d9d3a95..2bbeb99e6 100644
--- a/drivers/block/efi-block-io.c
+++ b/drivers/block/efi-block-io.c
@@ -130,6 +130,18 @@ static void efi_bio_print_info(struct efi_bio_priv *priv)
media->optimal_transfer_length_granularity);
}
+static int is_bio_usbdev(struct efi_device *efidev)
+{
+ int i;
+
+ for (i = 0; i < efidev->num_guids; i++) {
+ if (!efi_guidcmp(efidev->guids[i], EFI_USB_IO_PROTOCOL_GUID))
+ return 1;
+ }
+
+ return 0;
+}
+
int efi_bio_probe(struct efi_device *efidev)
{
int ret;
@@ -147,7 +159,10 @@ int efi_bio_probe(struct efi_device *efidev)
efi_bio_print_info(priv);
priv->dev = &efidev->dev;
- priv->blk.cdev.name = xasprintf("disk%d", cdev_find_free_index("disk"));
+ if (is_bio_usbdev(efidev))
+ priv->blk.cdev.name = xasprintf("usbdisk%d", cdev_find_free_index("usbdisk"));
+ else
+ priv->blk.cdev.name = xasprintf("disk%d", cdev_find_free_index("disk"));
priv->blk.blockbits = ffs(media->block_size) - 1;
priv->blk.num_blocks = media->last_block + 1;
priv->blk.ops = &efi_bio_ops;
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] efi-block: detect when the block device is a USB Disk
2017-10-27 7:05 ` [PATCH 2/2] efi-block: detect when the block device is a USB Disk Jean-Christophe PLAGNIOL-VILLARD
@ 2017-11-02 11:03 ` Michael Olbrich
2017-11-03 11:27 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Michael Olbrich @ 2017-11-02 11:03 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Fri, Oct 27, 2017 at 09:05:48AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> use usbdisk as a basename
>
> This will be usefull as example when we want to search for a usb disk for
> failsafe update or install.
I understand the use-case, but this breaks a different setup: Until now
'disk0' is usually the 'boot' device (the one barebox was loaded from). So
it was rather simple to create one image with bootloader, kernel and rootfs
that can be booted from USB and SATA.
Regards,
Michael
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> drivers/block/efi-block-io.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/efi-block-io.c b/drivers/block/efi-block-io.c
> index a4d9d3a95..2bbeb99e6 100644
> --- a/drivers/block/efi-block-io.c
> +++ b/drivers/block/efi-block-io.c
> @@ -130,6 +130,18 @@ static void efi_bio_print_info(struct efi_bio_priv *priv)
> media->optimal_transfer_length_granularity);
> }
>
> +static int is_bio_usbdev(struct efi_device *efidev)
> +{
> + int i;
> +
> + for (i = 0; i < efidev->num_guids; i++) {
> + if (!efi_guidcmp(efidev->guids[i], EFI_USB_IO_PROTOCOL_GUID))
> + return 1;
> + }
> +
> + return 0;
> +}
> +
> int efi_bio_probe(struct efi_device *efidev)
> {
> int ret;
> @@ -147,7 +159,10 @@ int efi_bio_probe(struct efi_device *efidev)
> efi_bio_print_info(priv);
> priv->dev = &efidev->dev;
>
> - priv->blk.cdev.name = xasprintf("disk%d", cdev_find_free_index("disk"));
> + if (is_bio_usbdev(efidev))
> + priv->blk.cdev.name = xasprintf("usbdisk%d", cdev_find_free_index("usbdisk"));
> + else
> + priv->blk.cdev.name = xasprintf("disk%d", cdev_find_free_index("disk"));
> priv->blk.blockbits = ffs(media->block_size) - 1;
> priv->blk.num_blocks = media->last_block + 1;
> priv->blk.ops = &efi_bio_ops;
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] efi-block: detect when the block device is a USB Disk
2017-11-02 11:03 ` Michael Olbrich
@ 2017-11-03 11:27 ` Sascha Hauer
0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2017-11-03 11:27 UTC (permalink / raw)
To: Michael Olbrich; +Cc: barebox
On Thu, Nov 02, 2017 at 12:03:03PM +0100, Michael Olbrich wrote:
> On Fri, Oct 27, 2017 at 09:05:48AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > use usbdisk as a basename
> >
> > This will be usefull as example when we want to search for a usb disk for
> > failsafe update or install.
>
> I understand the use-case, but this breaks a different setup: Until now
> 'disk0' is usually the 'boot' device (the one barebox was loaded from). So
> it was rather simple to create one image with bootloader, kernel and rootfs
> that can be booted from USB and SATA.
I just talked to Michael and we agreed that depending on 'disk0' being
the device we have booted from is a bad idea. What we really want is
a pointer to the device we have booted from.
In fact that is on my mental todo list for a long time: Several boards
try to continue booting from the medium the bootloader came from. They
often do this by putting a switch/case around bootsource_get() in C or
around $bootsource in shell and trying to pick the right device for each
bootsource. We should rather directly return the device from which we booted
from.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] efi-gui: add USB IO Protocol GUID definition
2017-10-27 7:05 [PATCH 1/2] efi-gui: add USB IO Protocol GUID definition Jean-Christophe PLAGNIOL-VILLARD
2017-10-27 7:05 ` [PATCH 2/2] efi-block: detect when the block device is a USB Disk Jean-Christophe PLAGNIOL-VILLARD
@ 2017-10-27 8:58 ` Sascha Hauer
1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2017-10-27 8:58 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Fri, Oct 27, 2017 at 09:05:47AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> common/efi-guid.c | 1 +
> include/efi.h | 3 +++
> 2 files changed, 4 insertions(+)
Applied, thanks
Sascha
>
> diff --git a/common/efi-guid.c b/common/efi-guid.c
> index 71aa21ddd..1e45ccf4d 100644
> --- a/common/efi-guid.c
> +++ b/common/efi-guid.c
> @@ -35,6 +35,7 @@ const char *efi_guid_string(efi_guid_t *g)
> EFI_GUID_STRING(EFI_UGA_PROTOCOL_GUID, "UGA Draw Protocol", "EFI 1.1 UGA Draw Protocol");
> EFI_GUID_STRING(EFI_UGA_IO_PROTOCOL_GUID, "UGA Protocol", "EFI 1.1 UGA Protocol");
> EFI_GUID_STRING(EFI_PCI_IO_PROTOCOL_GUID, "PCI IO Protocol", "EFI 1.1 PCI IO Protocol");
> + EFI_GUID_STRING(EFI_USB_IO_PROTOCOL_GUID, "USB IO Protocol", "EFI 1.0 USB IO Protocol");
> EFI_GUID_STRING(EFI_FILE_INFO_GUID, "File Info", "EFI File Infom");
> EFI_GUID_STRING(EFI_SIMPLE_FILE_SYSTEM_GUID, "Filesystem", "EFI 1.0 Simple FileSystem");
> EFI_GUID_STRING(EFI_DEVICE_TREE_GUID, "Device Tree", "EFI Device Tree GUID");
> diff --git a/include/efi.h b/include/efi.h
> index e1fc134ee..7cc5fe05f 100644
> --- a/include/efi.h
> +++ b/include/efi.h
> @@ -358,6 +358,9 @@ extern efi_runtime_services_t *RT;
> #define EFI_PCI_IO_PROTOCOL_GUID \
> EFI_GUID( 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a )
>
> +#define EFI_USB_IO_PROTOCOL_GUID \
> + EFI_GUID(0x2B2F68D6, 0x0CD2, 0x44cf, 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75)
> +
> #define EFI_FILE_INFO_GUID \
> EFI_GUID( 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
>
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-03 11:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-27 7:05 [PATCH 1/2] efi-gui: add USB IO Protocol GUID definition Jean-Christophe PLAGNIOL-VILLARD
2017-10-27 7:05 ` [PATCH 2/2] efi-block: detect when the block device is a USB Disk Jean-Christophe PLAGNIOL-VILLARD
2017-11-02 11:03 ` Michael Olbrich
2017-11-03 11:27 ` Sascha Hauer
2017-10-27 8:58 ` [PATCH 1/2] efi-gui: add USB IO Protocol GUID definition Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox