public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 0/8] x86: Improve bootstd support
@ 2023-07-28  2:37 Simon Glass
  2023-07-28  2:37 ` [PATCH 1/8] usb: Return -ENOENT when no devices are found Simon Glass
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Simon Glass @ 2023-07-28  2:37 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Bin Meng, Simon Glass, Fabrice Gasnier, Heinrich Schuchardt,
	Jaehoon Chung, Marek Vasut, Mattijs Korpershoek, Patrice Chotard,
	Patrick Delaunay, Peng Fan, Ramon Fried, Viacheslav Mitrofanov

This series provides some bootstd fixes so that IDE can be used reliably
for booting a distro. It also includes some documentation on how to boot
from coreboot in various scenarios, using QEMU.

With this it is possible to boot Ubuntu 2023.04 from coreboot64, for
example.


Simon Glass (8):
  usb: Return -ENOENT when no devices are found
  lib: Suppress E when writing error-string output
  bootstd: Rename bootdev_setup_sibling_blk()
  bootstd: Correct creating of bootdev sibling
  bootstd: Add some more debugging in the bootdev uclass
  x86: coreboot: Add IDE and SATA
  x86: coreboot: Enable standard boot
  x86: coreboot: Enable support for CBFS

 boot/bootdev-uclass.c           | 17 ++++++--
 common/usb_storage.c            |  2 +-
 configs/coreboot64_defconfig    | 16 ++-----
 configs/coreboot_defconfig      | 11 +++++
 doc/board/coreboot/coreboot.rst | 74 +++++++++++++++++++++++++++++++--
 doc/develop/bootstd.rst         |  4 +-
 drivers/block/ide.c             |  4 +-
 drivers/mmc/mmc-uclass.c        |  2 +-
 drivers/nvme/nvme.c             |  2 +-
 drivers/scsi/scsi.c             |  2 +-
 drivers/usb/host/usb-uclass.c   |  2 +-
 drivers/virtio/virtio-uclass.c  |  2 +-
 include/bootdev.h               |  8 ++--
 include/usb.h                   |  9 +++-
 lib/vsprintf.c                  |  5 ++-
 15 files changed, 123 insertions(+), 37 deletions(-)

-- 
2.41.0.487.g6d72f3e995-goog


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

* [PATCH 1/8] usb: Return -ENOENT when no devices are found
  2023-07-28  2:37 [PATCH 0/8] x86: Improve bootstd support Simon Glass
@ 2023-07-28  2:37 ` Simon Glass
  2023-07-28  2:37 ` [PATCH 2/8] lib: Suppress E when writing error-string output Simon Glass
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-07-28  2:37 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Bin Meng, Simon Glass, Fabrice Gasnier, Marek Vasut,
	Patrice Chotard, Patrick Delaunay

When USB finds no devices it currently returns -EPERM which bootstd does
not understand. This causes other bootdevs of the same priority to be
skipped.

Fix this by returning the correct error code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/usb/host/usb-uclass.c | 2 +-
 include/usb.h                 | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 02c0138a2065..7a03435ba773 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -346,7 +346,7 @@ int usb_init(void)
 	if (controllers_initialized == 0)
 		printf("No working controllers found\n");
 
-	return usb_started ? 0 : -1;
+	return usb_started ? 0 : -ENOENT;
 }
 
 int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp)
diff --git a/include/usb.h b/include/usb.h
index 42b001c3dd5e..09e3f0cb309c 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -257,7 +257,14 @@ int usb_kbd_deregister(int force);
 
 #endif
 /* routines */
-int usb_init(void); /* initialize the USB Controller */
+
+/*
+ * usb_init() - initialize the USB Controllers
+ *
+ * Returns: 0 if OK, -ENOENT if there are no USB devices
+ */
+int usb_init(void);
+
 int usb_stop(void); /* stop the USB Controller */
 int usb_detect_change(void); /* detect if a USB device has been (un)plugged */
 
-- 
2.41.0.487.g6d72f3e995-goog


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

* [PATCH 2/8] lib: Suppress E when writing error-string output
  2023-07-28  2:37 [PATCH 0/8] x86: Improve bootstd support Simon Glass
  2023-07-28  2:37 ` [PATCH 1/8] usb: Return -ENOENT when no devices are found Simon Glass
@ 2023-07-28  2:37 ` Simon Glass
  2023-07-28  2:37 ` [PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk() Simon Glass
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-07-28  2:37 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Bin Meng, Simon Glass, Heinrich Schuchardt, Ramon Fried,
	Viacheslav Mitrofanov

When CONFIG_ERRNO_STR is not enabled this shows a spurious 'E' from the
format string. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 7f331941321 ("lib: Support printing an error string")
---

 lib/vsprintf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index e87503e41ada..e14c6ca9f966 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -680,8 +680,10 @@ repeat:
 			break;
 
 		case 'd':
-			if (fmt[1] == 'E')
+			if (fmt[1] == 'E') {
 				flags |= ERRSTR;
+				fmt++;
+			}
 		/* fallthrough */
 		case 'i':
 			flags |= SIGN;
@@ -725,7 +727,6 @@ repeat:
 			ADDCH(str, ' ');
 			for (p = errno_str(num); *p; p++)
 				ADDCH(str, *p);
-			fmt++;
 		}
 	}
 
-- 
2.41.0.487.g6d72f3e995-goog


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

* [PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk()
  2023-07-28  2:37 [PATCH 0/8] x86: Improve bootstd support Simon Glass
  2023-07-28  2:37 ` [PATCH 1/8] usb: Return -ENOENT when no devices are found Simon Glass
  2023-07-28  2:37 ` [PATCH 2/8] lib: Suppress E when writing error-string output Simon Glass
@ 2023-07-28  2:37 ` Simon Glass
  2023-07-28  8:00   ` Mattijs Korpershoek
  2023-07-28  2:37 ` [PATCH 4/8] bootstd: Correct creating of bootdev sibling Simon Glass
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2023-07-28  2:37 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Bin Meng, Simon Glass, Jaehoon Chung, Marek Vasut, Peng Fan

This name is a little confusing since it suggests that it sets up the
sibling block device. In fact it sets up a bootdev for it. Rename the
function to make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 boot/bootdev-uclass.c          | 8 +++++---
 common/usb_storage.c           | 2 +-
 doc/develop/bootstd.rst        | 4 ++--
 drivers/mmc/mmc-uclass.c       | 2 +-
 drivers/nvme/nvme.c            | 2 +-
 drivers/scsi/scsi.c            | 2 +-
 drivers/virtio/virtio-uclass.c | 2 +-
 include/bootdev.h              | 8 ++++----
 8 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index 9660ff75676d..114853ffb72a 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -262,7 +262,7 @@ static int bootdev_get_suffix_start(struct udevice *dev, const char *suffix)
 	return len;
 }
 
-int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name)
+int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name)
 {
 	struct udevice *parent, *dev;
 	char dev_name[50];
@@ -305,7 +305,9 @@ int bootdev_get_sibling_blk(struct udevice *dev, struct udevice **blkp)
 	if (device_get_uclass_id(dev) != UCLASS_BOOTDEV)
 		return -EINVAL;
 
-	/* This should always work if bootdev_setup_sibling_blk() was used */
+	/*
+	 * This should always work if bootdev_setup_for_sibling_blk() was used
+	 */
 	len = bootdev_get_suffix_start(dev, ".bootdev");
 	ret = device_find_child_by_namelen(parent, dev->name, len, &blk);
 	if (ret) {
@@ -335,7 +337,7 @@ static int bootdev_get_from_blk(struct udevice *blk, struct udevice **bootdevp)
 	if (device_get_uclass_id(blk) != UCLASS_BLK)
 		return -EINVAL;
 
-	/* This should always work if bootdev_setup_sibling_blk() was used */
+	/* This should always work if bootdev_setup_for_sibling_blk() was used */
 	len = bootdev_get_suffix_start(blk, ".blk");
 	snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name,
 		 "bootdev");
diff --git a/common/usb_storage.c b/common/usb_storage.c
index ac6427577379..85774220ef2a 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -246,7 +246,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
 		if (ret)
 			return ret;
 
-		ret = bootdev_setup_sibling_blk(dev, "usb_bootdev");
+		ret = bootdev_setup_for_sibling_blk(dev, "usb_bootdev");
 		if (ret) {
 			int ret2;
 
diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst
index 7a2a69fdfcec..ec3136535783 100644
--- a/doc/develop/bootstd.rst
+++ b/doc/develop/bootstd.rst
@@ -306,7 +306,7 @@ media device::
 
 The bootdev device is typically created automatically in the media uclass'
 `post_bind()` method by calling `bootdev_setup_for_dev()` or
-`bootdev_setup_sibling_blk()`. The code typically something like this::
+`bootdev_setup_for_sibling_blk()`. The code typically something like this::
 
     /* dev is the Ethernet device */
     ret = bootdev_setup_for_dev(dev, "eth_bootdev");
@@ -316,7 +316,7 @@ The bootdev device is typically created automatically in the media uclass'
 or::
 
     /* blk is the block device (child of MMC device)
-    ret = bootdev_setup_sibling_blk(blk, "mmc_bootdev");
+    ret = bootdev_setup_for_sibling_blk(blk, "mmc_bootdev");
     if (ret)
         return log_msg_ret("bootdev", ret);
 
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 01d9b0201f2c..0e157672eae0 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -421,7 +421,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
 	mmc->cfg = cfg;
 	mmc->priv = dev;
 
-	ret = bootdev_setup_sibling_blk(bdev, "mmc_bootdev");
+	ret = bootdev_setup_for_sibling_blk(bdev, "mmc_bootdev");
 	if (ret)
 		return log_msg_ret("bootdev", ret);
 
diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index a7add66ab4d1..20dc910d8a33 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -910,7 +910,7 @@ int nvme_init(struct udevice *udev)
 		if (ret)
 			goto free_id;
 
-		ret = bootdev_setup_sibling_blk(ns_udev, "nvme_bootdev");
+		ret = bootdev_setup_for_sibling_blk(ns_udev, "nvme_bootdev");
 		if (ret)
 			return log_msg_ret("bootdev", ret);
 
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 6caeb3fcdd0d..0a3420b7fbc2 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -607,7 +607,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
 		/* TODO: undo create */
 		return log_msg_ret("pro", ret);
 
-	ret = bootdev_setup_sibling_blk(bdev, "scsi_bootdev");
+	ret = bootdev_setup_for_sibling_blk(bdev, "scsi_bootdev");
 	if (ret)
 		return log_msg_ret("bd", ret);
 
diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c
index 31bb21c534e5..87323ab6d193 100644
--- a/drivers/virtio/virtio-uclass.c
+++ b/drivers/virtio/virtio-uclass.c
@@ -248,7 +248,7 @@ static int virtio_uclass_post_probe(struct udevice *udev)
 	device_set_name_alloced(vdev);
 
 	if (uc_priv->device == VIRTIO_ID_BLOCK && !IS_ENABLED(CONFIG_SANDBOX)) {
-		ret = bootdev_setup_sibling_blk(vdev, "virtio_bootdev");
+		ret = bootdev_setup_for_sibling_blk(vdev, "virtio_bootdev");
 		if (ret)
 			return log_msg_ret("bootdev", ret);
 	}
diff --git a/include/bootdev.h b/include/bootdev.h
index 1533adfe5065..0abc56cab9c8 100644
--- a/include/bootdev.h
+++ b/include/bootdev.h
@@ -371,7 +371,7 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp);
 /**
  * bootdev_setup_for_dev() - Bind a new bootdev device (deprecated)
  *
- * Please use bootdev_setup_sibling_blk() instead since it supports multiple
+ * Please use bootdev_setup_for_sibling_blk() instead since it supports multiple
  * (child) block devices for each media device.
  *
  * Creates a bootdev device as a child of @parent. This should be called from
@@ -398,7 +398,7 @@ int bootdev_setup_for_dev(struct udevice *parent, const char *drv_name);
  * @drv_name: Name of bootdev driver to bind
  * Return: 0 if OK, -ve on error
  */
-int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name);
+int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name);
 
 /**
  * bootdev_get_sibling_blk() - Locate the block device for a bootdev
@@ -428,8 +428,8 @@ static inline int bootdev_setup_for_dev(struct udevice *parent,
 	return 0;
 }
 
-static inline int bootdev_setup_sibling_blk(struct udevice *blk,
-					    const char *drv_name)
+static inline int bootdev_setup_for_sibling_blk(struct udevice *blk,
+						const char *drv_name)
 {
 	return 0;
 }
-- 
2.41.0.487.g6d72f3e995-goog


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

* [PATCH 4/8] bootstd: Correct creating of bootdev sibling
  2023-07-28  2:37 [PATCH 0/8] x86: Improve bootstd support Simon Glass
                   ` (2 preceding siblings ...)
  2023-07-28  2:37 ` [PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk() Simon Glass
@ 2023-07-28  2:37 ` Simon Glass
  2023-07-28  7:56   ` Mattijs Korpershoek
  2023-07-28  2:37 ` [PATCH 5/8] bootstd: Add some more debugging in the bootdev uclass Simon Glass
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2023-07-28  2:37 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Bin Meng, Simon Glass, Mattijs Korpershoek

Use the correct function here, since there may be multiple IDE devices
available.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/block/ide.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ide.c b/drivers/block/ide.c
index 89201dd4d229..c698f9cbd558 100644
--- a/drivers/block/ide.c
+++ b/drivers/block/ide.c
@@ -1059,9 +1059,9 @@ static int ide_probe(struct udevice *udev)
 		desc->lba48 = pdesc.lba48;
 		desc->type = pdesc.type;
 
-		ret = bootdev_setup_for_dev(udev, "ide_bootdev");
+		ret = bootdev_setup_for_sibling_blk(blk, "ide_bootdev");
 		if (ret)
-			return log_msg_ret("bootdev", ret);
+			return log_msg_ret("bd", ret);
 	}
 
 	return 0;
-- 
2.41.0.487.g6d72f3e995-goog


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

* [PATCH 5/8] bootstd: Add some more debugging in the bootdev uclass
  2023-07-28  2:37 [PATCH 0/8] x86: Improve bootstd support Simon Glass
                   ` (3 preceding siblings ...)
  2023-07-28  2:37 ` [PATCH 4/8] bootstd: Correct creating of bootdev sibling Simon Glass
@ 2023-07-28  2:37 ` Simon Glass
  2023-07-28  2:37 ` [PATCH 6/8] x86: coreboot: Add IDE and SATA Simon Glass
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-07-28  2:37 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Bin Meng, Simon Glass

Add some more output to make it easier to see what is going wrong when
a bootdev hunter fails.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 boot/bootdev-uclass.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index 114853ffb72a..a3661b18e28d 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -537,6 +537,8 @@ static int default_get_bootflow(struct udevice *dev, struct bootflow_iter *iter,
 	int ret;
 
 	ret = bootdev_get_sibling_blk(dev, &blk);
+	log_debug("sibling_blk ret=%d, blk=%s\n", ret,
+		  ret ? "(none)" : blk->name);
 	/*
 	 * If there is no media, indicate that no more partitions should be
 	 * checked
@@ -662,7 +664,8 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp)
 				ret = bootdev_hunt_prio(iter->cur_prio,
 							iter->flags &
 							BOOTFLOWIF_SHOW);
-				log_debug("- hunt ret %d\n", ret);
+				log_debug("- bootdev_hunt_prio() ret %d\n",
+					  ret);
 				if (ret)
 					return log_msg_ret("hun", ret);
 			}
@@ -698,6 +701,7 @@ int bootdev_setup_iter(struct bootflow_iter *iter, const char *label,
 	/* hunt for any pre-scan devices */
 	if (iter->flags & BOOTFLOWIF_HUNT) {
 		ret = bootdev_hunt_prio(BOOTDEVP_1_PRE_SCAN, show);
+		log_debug("- bootdev_hunt_prio() ret %d\n", ret);
 		if (ret)
 			return log_msg_ret("pre", ret);
 	}
@@ -768,6 +772,7 @@ static int bootdev_hunt_drv(struct bootdev_hunter *info, uint seq, bool show)
 		log_debug("Hunting with: %s\n", name);
 		if (info->hunt) {
 			ret = info->hunt(info, show);
+			log_debug("  - hunt result %d\n", ret);
 			if (ret)
 				return ret;
 		}
@@ -833,9 +838,11 @@ int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show)
 		if (prio != info->prio)
 			continue;
 		ret = bootdev_hunt_drv(info, i, show);
+		log_debug("bootdev_hunt_drv() return %d\n", ret);
 		if (ret && ret != -ENOENT)
 			result = ret;
 	}
+	log_debug("exit %d\n", result);
 
 	return result;
 }
-- 
2.41.0.487.g6d72f3e995-goog


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

* [PATCH 6/8] x86: coreboot: Add IDE and SATA
  2023-07-28  2:37 [PATCH 0/8] x86: Improve bootstd support Simon Glass
                   ` (4 preceding siblings ...)
  2023-07-28  2:37 ` [PATCH 5/8] bootstd: Add some more debugging in the bootdev uclass Simon Glass
@ 2023-07-28  2:37 ` Simon Glass
  2023-07-28  2:37 ` [PATCH 7/8] x86: coreboot: Enable standard boot Simon Glass
  2023-07-28  2:37 ` [PATCH 8/8] x86: coreboot: Enable support for CBFS Simon Glass
  7 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-07-28  2:37 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Bin Meng, Simon Glass

Add these options to permit access to more disk types.

Add some documentation as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 configs/coreboot64_defconfig    |  1 +
 configs/coreboot_defconfig      |  9 +++++++++
 doc/board/coreboot/coreboot.rst | 20 ++++++++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig
index 8aadaa68c279..ded0e6f2422d 100644
--- a/configs/coreboot64_defconfig
+++ b/configs/coreboot64_defconfig
@@ -26,6 +26,7 @@ CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_IDE=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
+CONFIG_CMD_SATA=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig
index 8e11de663819..56cc542df6c6 100644
--- a/configs/coreboot_defconfig
+++ b/configs/coreboot_defconfig
@@ -22,8 +22,10 @@ CONFIG_LOGF_FUNC=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_LAST_STAGE_INIT=y
 CONFIG_PCI_INIT_R=y
+CONFIG_CMD_IDE=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
+CONFIG_CMD_SATA=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
@@ -48,6 +50,13 @@ CONFIG_USE_ROOTPATH=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 # CONFIG_ACPIGEN is not set
+CONFIG_SYS_IDE_MAXDEVICE=4
+CONFIG_SYS_ATA_DATA_OFFSET=0
+CONFIG_SYS_ATA_REG_OFFSET=0
+CONFIG_SYS_ATA_ALT_OFFSET=0
+CONFIG_ATAPI=y
+CONFIG_LBA48=y
+CONFIG_SYS_64BIT_LBA=y
 CONFIG_NVME_PCI=y
 # CONFIG_PCI_PNP is not set
 CONFIG_SOUND=y
diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst
index 0fe95af56d2d..8e638a3c74cf 100644
--- a/doc/board/coreboot/coreboot.rst
+++ b/doc/board/coreboot/coreboot.rst
@@ -41,6 +41,26 @@ At present it seems that for Minnowboard Max, coreboot does not pass through
 the video information correctly (it always says the resolution is 0x0). This
 works correctly for link though.
 
+You can run via QEMU using::
+
+  qemu-system-x86_64 -bios build/coreboot.rom -serial mon:stdio
+
+The `-serial mon:stdio` part shows both output in the display and on the
+console. It is optional. You can add `nographic` as well to *only* get console
+output.
+
+To run with a SATA drive called `$DISK`::
+
+  qemu-system-x86_64 -bios build/coreboot.rom -serial mon:stdio \
+	-drive id=disk,file=$DISK,if=none \
+	-device ahci,id=ahci \
+	-device ide-hd,drive=disk,bus=ahci.0
+
+Then you can scan it with `scsi scan` and access it normally.
+
+To use 4GB of memory, typically necessary for booting Linux distros, add
+`-m 4GB`.
+
 64-bit U-Boot
 -------------
 
-- 
2.41.0.487.g6d72f3e995-goog


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

* [PATCH 7/8] x86: coreboot: Enable standard boot
  2023-07-28  2:37 [PATCH 0/8] x86: Improve bootstd support Simon Glass
                   ` (5 preceding siblings ...)
  2023-07-28  2:37 ` [PATCH 6/8] x86: coreboot: Add IDE and SATA Simon Glass
@ 2023-07-28  2:37 ` Simon Glass
  2023-07-28  2:37 ` [PATCH 8/8] x86: coreboot: Enable support for CBFS Simon Glass
  7 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-07-28  2:37 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Bin Meng, Simon Glass

Enable bootstd options and provide instructions on how to boot a linux
distro using coreboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 configs/coreboot64_defconfig    | 14 ++------------
 configs/coreboot_defconfig      |  1 +
 doc/board/coreboot/coreboot.rst | 16 ++++++++++++++--
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig
index ded0e6f2422d..602465175d20 100644
--- a/configs/coreboot64_defconfig
+++ b/configs/coreboot64_defconfig
@@ -10,40 +10,30 @@ CONFIG_VENDOR_COREBOOT=y
 CONFIG_TARGET_COREBOOT=y
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
+CONFIG_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_SYS_MONITOR_BASE=0x01120000
 CONFIG_SHOW_BOOT_PROGRESS=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
-CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_PRE_CONSOLE_BUFFER=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_LAST_STAGE_INIT=y
 CONFIG_SPL_NO_BSS_LIMIT=y
-CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_IDE=y
 CONFIG_CMD_MMC=y
-CONFIG_CMD_PART=y
 CONFIG_CMD_SATA=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_DHCP=y
 CONFIG_BOOTP_BOOTFILESIZE=y
-CONFIG_CMD_PING=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_SOUND=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
 CONFIG_MAC_PARTITION=y
 # CONFIG_SPL_MAC_PARTITION is not set
 # CONFIG_SPL_DOS_PARTITION is not set
-CONFIG_ISO_PARTITION=y
-CONFIG_EFI_PARTITION=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_ENV_OVERWRITE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig
index 56cc542df6c6..735cd6eb4c22 100644
--- a/configs/coreboot_defconfig
+++ b/configs/coreboot_defconfig
@@ -10,6 +10,7 @@ CONFIG_TARGET_COREBOOT=y
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_SYS_MONITOR_BASE=0x01110000
 CONFIG_SHOW_BOOT_PROGRESS=y
 CONFIG_USE_BOOTARGS=y
diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst
index 8e638a3c74cf..d09dfc553c87 100644
--- a/doc/board/coreboot/coreboot.rst
+++ b/doc/board/coreboot/coreboot.rst
@@ -67,9 +67,21 @@ To use 4GB of memory, typically necessary for booting Linux distros, add
 In addition to the 32-bit 'coreboot' build there is a 'coreboot64' build. This
 produces an image which can be booted from coreboot (32-bit). Internally it
 works by using a 32-bit SPL binary to switch to 64-bit for running U-Boot. It
-can be useful for running UEFI applications, for example.
+can be useful for running UEFI applications, for example with the coreboot
+build in `$CBDIR`::
+
+   DISK=ubuntu-23.04-desktop-amd64.iso
+   CBDIR=~/coreboot/build
+
+   cp $CBDIR/coreboot.rom.in coreboot.rom
+   cbfstool coreboot.rom add-flat-binary -f u-boot-x86-with-spl.bin \
+      -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000
+
+   qemu-system-x86_64 -m 2G -smp 4 -bios coreboot.rom \
+      -drive id=disk,file=$DISK,if=none \
+      -device ahci,id=ahci \
+      -device ide-hd,drive=disk,bus=ahci.0 \
 
-This has only been lightly tested.
 
 
 Memory map
-- 
2.41.0.487.g6d72f3e995-goog


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

* [PATCH 8/8] x86: coreboot: Enable support for CBFS
  2023-07-28  2:37 [PATCH 0/8] x86: Improve bootstd support Simon Glass
                   ` (6 preceding siblings ...)
  2023-07-28  2:37 ` [PATCH 7/8] x86: coreboot: Enable standard boot Simon Glass
@ 2023-07-28  2:37 ` Simon Glass
  7 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-07-28  2:37 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Bin Meng, Simon Glass

This is normally used with coreboot, so enable support for it in the
coreboot builds.

Add an example to show how it is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 configs/coreboot64_defconfig    |  1 +
 configs/coreboot_defconfig      |  1 +
 doc/board/coreboot/coreboot.rst | 34 +++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig
index 602465175d20..55064d1ce66f 100644
--- a/configs/coreboot64_defconfig
+++ b/configs/coreboot64_defconfig
@@ -56,3 +56,4 @@ CONFIG_SOUND=y
 CONFIG_SOUND_I8254=y
 CONFIG_CONSOLE_SCROLL_LINES=5
 # CONFIG_GZIP is not set
+CONFIG_CMD_CBFS=y
diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig
index 735cd6eb4c22..77214f1b4c06 100644
--- a/configs/coreboot_defconfig
+++ b/configs/coreboot_defconfig
@@ -66,3 +66,4 @@ CONFIG_CONSOLE_SCROLL_LINES=5
 CONFIG_CMD_DHRYSTONE=y
 # CONFIG_GZIP is not set
 CONFIG_SMBIOS_PARSER=y
+CONFIG_CMD_CBFS=y
diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst
index d09dfc553c87..11e461a2ae0b 100644
--- a/doc/board/coreboot/coreboot.rst
+++ b/doc/board/coreboot/coreboot.rst
@@ -83,6 +83,40 @@ build in `$CBDIR`::
       -device ide-hd,drive=disk,bus=ahci.0 \
 
 
+CBFS access
+-----------
+
+You can use the 'cbfs' commands to access the Coreboot filesystem::
+
+   => cbfsinit
+   => cbfsinfo
+
+   CBFS version: 0x31313132
+   ROM size: 0x100000
+   Boot block size: 0x4
+   CBFS size: 0xffdfc
+   Alignment: 64
+   Offset: 0x200
+
+   => cbfsls
+        size              type  name
+   ------------------------------------------
+          32       cbfs header  cbfs master header
+       16720                17  fallback/romstage
+       53052                17  fallback/ramstage
+         398               raw  config
+         715               raw  revision
+         117               raw  build_info
+        4044               raw  fallback/dsdt.aml
+         640       cmos layout  cmos_layout.bin
+       17804                17  fallback/postcar
+      335797           payload  fallback/payload
+      607000              null  (empty)
+       10752         bootblock  bootblock
+
+   12 file(s)
+
+   =>
 
 Memory map
 ----------
-- 
2.41.0.487.g6d72f3e995-goog


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

* Re: [PATCH 4/8] bootstd: Correct creating of bootdev sibling
  2023-07-28  2:37 ` [PATCH 4/8] bootstd: Correct creating of bootdev sibling Simon Glass
@ 2023-07-28  7:56   ` Mattijs Korpershoek
  0 siblings, 0 replies; 12+ messages in thread
From: Mattijs Korpershoek @ 2023-07-28  7:56 UTC (permalink / raw)
  To: Simon Glass, U-Boot Mailing List; +Cc: Bin Meng, Simon Glass

On jeu., juil. 27, 2023 at 20:37, Simon Glass <sjg@chromium.org> wrote:

> Use the correct function here, since there may be multiple IDE devices
> available.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>
>  drivers/block/ide.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/ide.c b/drivers/block/ide.c
> index 89201dd4d229..c698f9cbd558 100644
> --- a/drivers/block/ide.c
> +++ b/drivers/block/ide.c
> @@ -1059,9 +1059,9 @@ static int ide_probe(struct udevice *udev)
>  		desc->lba48 = pdesc.lba48;
>  		desc->type = pdesc.type;
>  
> -		ret = bootdev_setup_for_dev(udev, "ide_bootdev");
> +		ret = bootdev_setup_for_sibling_blk(blk, "ide_bootdev");
>  		if (ret)
> -			return log_msg_ret("bootdev", ret);
> +			return log_msg_ret("bd", ret);
>  	}
>  
>  	return 0;
> -- 
> 2.41.0.487.g6d72f3e995-goog

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

* Re: [PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk()
  2023-07-28  2:37 ` [PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk() Simon Glass
@ 2023-07-28  8:00   ` Mattijs Korpershoek
  2023-07-31 17:08     ` Simon Glass
  0 siblings, 1 reply; 12+ messages in thread
From: Mattijs Korpershoek @ 2023-07-28  8:00 UTC (permalink / raw)
  To: Simon Glass, U-Boot Mailing List
  Cc: Bin Meng, Simon Glass, Jaehoon Chung, Marek Vasut, Peng Fan

On jeu., juil. 27, 2023 at 20:37, Simon Glass <sjg@chromium.org> wrote:

> This name is a little confusing since it suggests that it sets up the
> sibling block device. In fact it sets up a bootdev for it. Rename the
> function to make this clearer.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  boot/bootdev-uclass.c          | 8 +++++---
>  common/usb_storage.c           | 2 +-
>  doc/develop/bootstd.rst        | 4 ++--
>  drivers/mmc/mmc-uclass.c       | 2 +-
>  drivers/nvme/nvme.c            | 2 +-
>  drivers/scsi/scsi.c            | 2 +-
>  drivers/virtio/virtio-uclass.c | 2 +-
>  include/bootdev.h              | 8 ++++----
>  8 files changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
> index 9660ff75676d..114853ffb72a 100644
> --- a/boot/bootdev-uclass.c
> +++ b/boot/bootdev-uclass.c
> @@ -262,7 +262,7 @@ static int bootdev_get_suffix_start(struct udevice *dev, const char *suffix)
>  	return len;
>  }
>  
> -int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name)
> +int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name)
>  {
>  	struct udevice *parent, *dev;
>  	char dev_name[50];
> @@ -305,7 +305,9 @@ int bootdev_get_sibling_blk(struct udevice *dev, struct udevice **blkp)
>  	if (device_get_uclass_id(dev) != UCLASS_BOOTDEV)
>  		return -EINVAL;
>  
> -	/* This should always work if bootdev_setup_sibling_blk() was used */
> +	/*
> +	 * This should always work if bootdev_setup_for_sibling_blk() was used
> +	 */
>  	len = bootdev_get_suffix_start(dev, ".bootdev");
>  	ret = device_find_child_by_namelen(parent, dev->name, len, &blk);
>  	if (ret) {
> @@ -335,7 +337,7 @@ static int bootdev_get_from_blk(struct udevice *blk, struct udevice **bootdevp)
>  	if (device_get_uclass_id(blk) != UCLASS_BLK)
>  		return -EINVAL;
>  
> -	/* This should always work if bootdev_setup_sibling_blk() was used */
> +	/* This should always work if bootdev_setup_for_sibling_blk() was used */
>  	len = bootdev_get_suffix_start(blk, ".blk");
>  	snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name,
>  		 "bootdev");
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index ac6427577379..85774220ef2a 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -246,7 +246,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
>  		if (ret)
>  			return ret;
>  
> -		ret = bootdev_setup_sibling_blk(dev, "usb_bootdev");
> +		ret = bootdev_setup_for_sibling_blk(dev, "usb_bootdev");
>  		if (ret) {
>  			int ret2;
>  
> diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst
> index 7a2a69fdfcec..ec3136535783 100644
> --- a/doc/develop/bootstd.rst
> +++ b/doc/develop/bootstd.rst
> @@ -306,7 +306,7 @@ media device::
>  
>  The bootdev device is typically created automatically in the media uclass'
>  `post_bind()` method by calling `bootdev_setup_for_dev()` or
> -`bootdev_setup_sibling_blk()`. The code typically something like this::
> +`bootdev_setup_for_sibling_blk()`. The code typically something like this::
>  
>      /* dev is the Ethernet device */
>      ret = bootdev_setup_for_dev(dev, "eth_bootdev");
> @@ -316,7 +316,7 @@ The bootdev device is typically created automatically in the media uclass'
>  or::
>  
>      /* blk is the block device (child of MMC device)
> -    ret = bootdev_setup_sibling_blk(blk, "mmc_bootdev");
> +    ret = bootdev_setup_for_sibling_blk(blk, "mmc_bootdev");
>      if (ret)
>          return log_msg_ret("bootdev", ret);
>  
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 01d9b0201f2c..0e157672eae0 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -421,7 +421,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
>  	mmc->cfg = cfg;
>  	mmc->priv = dev;
>  
> -	ret = bootdev_setup_sibling_blk(bdev, "mmc_bootdev");
> +	ret = bootdev_setup_for_sibling_blk(bdev, "mmc_bootdev");
>  	if (ret)
>  		return log_msg_ret("bootdev", ret);
>  
> diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
> index a7add66ab4d1..20dc910d8a33 100644
> --- a/drivers/nvme/nvme.c
> +++ b/drivers/nvme/nvme.c
> @@ -910,7 +910,7 @@ int nvme_init(struct udevice *udev)
>  		if (ret)
>  			goto free_id;
>  
> -		ret = bootdev_setup_sibling_blk(ns_udev, "nvme_bootdev");
> +		ret = bootdev_setup_for_sibling_blk(ns_udev, "nvme_bootdev");
>  		if (ret)
>  			return log_msg_ret("bootdev", ret);
>  
> diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
> index 6caeb3fcdd0d..0a3420b7fbc2 100644
> --- a/drivers/scsi/scsi.c
> +++ b/drivers/scsi/scsi.c
> @@ -607,7 +607,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
>  		/* TODO: undo create */
>  		return log_msg_ret("pro", ret);
>  
> -	ret = bootdev_setup_sibling_blk(bdev, "scsi_bootdev");
> +	ret = bootdev_setup_for_sibling_blk(bdev, "scsi_bootdev");
>  	if (ret)
>  		return log_msg_ret("bd", ret);
>  
> diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c
> index 31bb21c534e5..87323ab6d193 100644
> --- a/drivers/virtio/virtio-uclass.c
> +++ b/drivers/virtio/virtio-uclass.c
> @@ -248,7 +248,7 @@ static int virtio_uclass_post_probe(struct udevice *udev)
>  	device_set_name_alloced(vdev);
>  
>  	if (uc_priv->device == VIRTIO_ID_BLOCK && !IS_ENABLED(CONFIG_SANDBOX)) {
> -		ret = bootdev_setup_sibling_blk(vdev, "virtio_bootdev");
> +		ret = bootdev_setup_for_sibling_blk(vdev, "virtio_bootdev");
>  		if (ret)
>  			return log_msg_ret("bootdev", ret);
>  	}
> diff --git a/include/bootdev.h b/include/bootdev.h
> index 1533adfe5065..0abc56cab9c8 100644
> --- a/include/bootdev.h
> +++ b/include/bootdev.h
> @@ -371,7 +371,7 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp);
>  /**
>   * bootdev_setup_for_dev() - Bind a new bootdev device (deprecated)
>   *
> - * Please use bootdev_setup_sibling_blk() instead since it supports multiple
> + * Please use bootdev_setup_for_sibling_blk() instead since it supports multiple
>   * (child) block devices for each media device.
>   *
>   * Creates a bootdev device as a child of @parent. This should be called from
> @@ -398,7 +398,7 @@ int bootdev_setup_for_dev(struct udevice *parent, const char *drv_name);
>   * @drv_name: Name of bootdev driver to bind
>   * Return: 0 if OK, -ve on error
>   */
> -int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name);
> +int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name);

Can we also fix the documentation string?

Right now, on master (c98c401dfb48), the documentation strings states:

 * bootdev_setup_for_blk() - Bind a new bootdev device for a blk device

This should be renamed to:

 * bootdev_setup_for_sibling_blk() - Bind a new bootdev device for a blk device



>  
>  /**
>   * bootdev_get_sibling_blk() - Locate the block device for a bootdev
> @@ -428,8 +428,8 @@ static inline int bootdev_setup_for_dev(struct udevice *parent,
>  	return 0;
>  }
>  
> -static inline int bootdev_setup_sibling_blk(struct udevice *blk,
> -					    const char *drv_name)
> +static inline int bootdev_setup_for_sibling_blk(struct udevice *blk,
> +						const char *drv_name)
>  {
>  	return 0;
>  }
> -- 
> 2.41.0.487.g6d72f3e995-goog

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

* Re: [PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk()
  2023-07-28  8:00   ` Mattijs Korpershoek
@ 2023-07-31 17:08     ` Simon Glass
  0 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-07-31 17:08 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: U-Boot Mailing List, Bin Meng, Jaehoon Chung, Marek Vasut,
	Peng Fan

Hi Mattijs,

On Fri, 28 Jul 2023 at 02:00, Mattijs Korpershoek
<mkorpershoek@baylibre.com> wrote:
>
> On jeu., juil. 27, 2023 at 20:37, Simon Glass <sjg@chromium.org> wrote:
>
> > This name is a little confusing since it suggests that it sets up the
> > sibling block device. In fact it sets up a bootdev for it. Rename the
> > function to make this clearer.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  boot/bootdev-uclass.c          | 8 +++++---
> >  common/usb_storage.c           | 2 +-
> >  doc/develop/bootstd.rst        | 4 ++--
> >  drivers/mmc/mmc-uclass.c       | 2 +-
> >  drivers/nvme/nvme.c            | 2 +-
> >  drivers/scsi/scsi.c            | 2 +-
> >  drivers/virtio/virtio-uclass.c | 2 +-
> >  include/bootdev.h              | 8 ++++----
> >  8 files changed, 16 insertions(+), 14 deletions(-)
> >
> > diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
> > index 9660ff75676d..114853ffb72a 100644
> > --- a/boot/bootdev-uclass.c
> > +++ b/boot/bootdev-uclass.c
> > @@ -262,7 +262,7 @@ static int bootdev_get_suffix_start(struct udevice *dev, const char *suffix)
> >       return len;
> >  }
> >
> > -int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name)
> > +int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name)
> >  {
> >       struct udevice *parent, *dev;
> >       char dev_name[50];
> > @@ -305,7 +305,9 @@ int bootdev_get_sibling_blk(struct udevice *dev, struct udevice **blkp)
> >       if (device_get_uclass_id(dev) != UCLASS_BOOTDEV)
> >               return -EINVAL;
> >
> > -     /* This should always work if bootdev_setup_sibling_blk() was used */
> > +     /*
> > +      * This should always work if bootdev_setup_for_sibling_blk() was used
> > +      */
> >       len = bootdev_get_suffix_start(dev, ".bootdev");
> >       ret = device_find_child_by_namelen(parent, dev->name, len, &blk);
> >       if (ret) {
> > @@ -335,7 +337,7 @@ static int bootdev_get_from_blk(struct udevice *blk, struct udevice **bootdevp)
> >       if (device_get_uclass_id(blk) != UCLASS_BLK)
> >               return -EINVAL;
> >
> > -     /* This should always work if bootdev_setup_sibling_blk() was used */
> > +     /* This should always work if bootdev_setup_for_sibling_blk() was used */
> >       len = bootdev_get_suffix_start(blk, ".blk");
> >       snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name,
> >                "bootdev");
> > diff --git a/common/usb_storage.c b/common/usb_storage.c
> > index ac6427577379..85774220ef2a 100644
> > --- a/common/usb_storage.c
> > +++ b/common/usb_storage.c
> > @@ -246,7 +246,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
> >               if (ret)
> >                       return ret;
> >
> > -             ret = bootdev_setup_sibling_blk(dev, "usb_bootdev");
> > +             ret = bootdev_setup_for_sibling_blk(dev, "usb_bootdev");
> >               if (ret) {
> >                       int ret2;
> >
> > diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst
> > index 7a2a69fdfcec..ec3136535783 100644
> > --- a/doc/develop/bootstd.rst
> > +++ b/doc/develop/bootstd.rst
> > @@ -306,7 +306,7 @@ media device::
> >
> >  The bootdev device is typically created automatically in the media uclass'
> >  `post_bind()` method by calling `bootdev_setup_for_dev()` or
> > -`bootdev_setup_sibling_blk()`. The code typically something like this::
> > +`bootdev_setup_for_sibling_blk()`. The code typically something like this::
> >
> >      /* dev is the Ethernet device */
> >      ret = bootdev_setup_for_dev(dev, "eth_bootdev");
> > @@ -316,7 +316,7 @@ The bootdev device is typically created automatically in the media uclass'
> >  or::
> >
> >      /* blk is the block device (child of MMC device)
> > -    ret = bootdev_setup_sibling_blk(blk, "mmc_bootdev");
> > +    ret = bootdev_setup_for_sibling_blk(blk, "mmc_bootdev");
> >      if (ret)
> >          return log_msg_ret("bootdev", ret);
> >
> > diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> > index 01d9b0201f2c..0e157672eae0 100644
> > --- a/drivers/mmc/mmc-uclass.c
> > +++ b/drivers/mmc/mmc-uclass.c
> > @@ -421,7 +421,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
> >       mmc->cfg = cfg;
> >       mmc->priv = dev;
> >
> > -     ret = bootdev_setup_sibling_blk(bdev, "mmc_bootdev");
> > +     ret = bootdev_setup_for_sibling_blk(bdev, "mmc_bootdev");
> >       if (ret)
> >               return log_msg_ret("bootdev", ret);
> >
> > diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
> > index a7add66ab4d1..20dc910d8a33 100644
> > --- a/drivers/nvme/nvme.c
> > +++ b/drivers/nvme/nvme.c
> > @@ -910,7 +910,7 @@ int nvme_init(struct udevice *udev)
> >               if (ret)
> >                       goto free_id;
> >
> > -             ret = bootdev_setup_sibling_blk(ns_udev, "nvme_bootdev");
> > +             ret = bootdev_setup_for_sibling_blk(ns_udev, "nvme_bootdev");
> >               if (ret)
> >                       return log_msg_ret("bootdev", ret);
> >
> > diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
> > index 6caeb3fcdd0d..0a3420b7fbc2 100644
> > --- a/drivers/scsi/scsi.c
> > +++ b/drivers/scsi/scsi.c
> > @@ -607,7 +607,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
> >               /* TODO: undo create */
> >               return log_msg_ret("pro", ret);
> >
> > -     ret = bootdev_setup_sibling_blk(bdev, "scsi_bootdev");
> > +     ret = bootdev_setup_for_sibling_blk(bdev, "scsi_bootdev");
> >       if (ret)
> >               return log_msg_ret("bd", ret);
> >
> > diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c
> > index 31bb21c534e5..87323ab6d193 100644
> > --- a/drivers/virtio/virtio-uclass.c
> > +++ b/drivers/virtio/virtio-uclass.c
> > @@ -248,7 +248,7 @@ static int virtio_uclass_post_probe(struct udevice *udev)
> >       device_set_name_alloced(vdev);
> >
> >       if (uc_priv->device == VIRTIO_ID_BLOCK && !IS_ENABLED(CONFIG_SANDBOX)) {
> > -             ret = bootdev_setup_sibling_blk(vdev, "virtio_bootdev");
> > +             ret = bootdev_setup_for_sibling_blk(vdev, "virtio_bootdev");
> >               if (ret)
> >                       return log_msg_ret("bootdev", ret);
> >       }
> > diff --git a/include/bootdev.h b/include/bootdev.h
> > index 1533adfe5065..0abc56cab9c8 100644
> > --- a/include/bootdev.h
> > +++ b/include/bootdev.h
> > @@ -371,7 +371,7 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp);
> >  /**
> >   * bootdev_setup_for_dev() - Bind a new bootdev device (deprecated)
> >   *
> > - * Please use bootdev_setup_sibling_blk() instead since it supports multiple
> > + * Please use bootdev_setup_for_sibling_blk() instead since it supports multiple
> >   * (child) block devices for each media device.
> >   *
> >   * Creates a bootdev device as a child of @parent. This should be called from
> > @@ -398,7 +398,7 @@ int bootdev_setup_for_dev(struct udevice *parent, const char *drv_name);
> >   * @drv_name: Name of bootdev driver to bind
> >   * Return: 0 if OK, -ve on error
> >   */
> > -int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name);
> > +int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name);
>
> Can we also fix the documentation string?
>
> Right now, on master (c98c401dfb48), the documentation strings states:
>
>  * bootdev_setup_for_blk() - Bind a new bootdev device for a blk device
>
> This should be renamed to:
>
>  * bootdev_setup_for_sibling_blk() - Bind a new bootdev device for a blk device

OK I sent a v2, thanks.

Regards,
SImon

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

end of thread, other threads:[~2023-07-31 17:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28  2:37 [PATCH 0/8] x86: Improve bootstd support Simon Glass
2023-07-28  2:37 ` [PATCH 1/8] usb: Return -ENOENT when no devices are found Simon Glass
2023-07-28  2:37 ` [PATCH 2/8] lib: Suppress E when writing error-string output Simon Glass
2023-07-28  2:37 ` [PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk() Simon Glass
2023-07-28  8:00   ` Mattijs Korpershoek
2023-07-31 17:08     ` Simon Glass
2023-07-28  2:37 ` [PATCH 4/8] bootstd: Correct creating of bootdev sibling Simon Glass
2023-07-28  7:56   ` Mattijs Korpershoek
2023-07-28  2:37 ` [PATCH 5/8] bootstd: Add some more debugging in the bootdev uclass Simon Glass
2023-07-28  2:37 ` [PATCH 6/8] x86: coreboot: Add IDE and SATA Simon Glass
2023-07-28  2:37 ` [PATCH 7/8] x86: coreboot: Enable standard boot Simon Glass
2023-07-28  2:37 ` [PATCH 8/8] x86: coreboot: Enable support for CBFS Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox