x86: Improve bootstd support
Subsystems (7)
cover x86: Improve bootstd support
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(-)
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
PATCH 1/8 usb: Return -ENOENT when no devices are found
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.
---
drivers/usb/host/usb-uclass.c | 2 +- include/usb.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/usb/host/usb-uclass.c +1 -1
@@ -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)
include/usb.h +8 -1
@@ -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 */
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
PATCH 2/8 lib: Suppress E when writing error-string output
In reply to Simon GlassWhen CONFIG_ERRNO_STR is not enabled this shows a spurious 'E' from the format string. Fix this.
---
lib/vsprintf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/vsprintf.c +3 -2
@@ -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++; } }
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
PATCH 3/8 bootstd: Rename bootdev_setup_sibling_blk()
In reply to Simon GlassThis 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.
---
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(-)
boot/bootdev-uclass.c +5 -3
@@ -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" );
common/usb_storage.c +1 -1
@@ -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;
doc/develop/bootstd.rst +2 -2
@@ -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);
drivers/mmc/mmc-uclass.c +1 -1
@@ -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);
drivers/nvme/nvme.c +1 -1
@@ -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);
drivers/scsi/scsi.c +1 -1
@@ -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);
drivers/virtio/virtio-uclass.c +1 -1
@@ -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); }
include/bootdev.h +4 -4
@@ -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 ; }
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
Re: [PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk()
Quoted 151 lines · Simon Glass
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 <[email protected]>---
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(-)boot/bootdev-uclass.c +5
-3@@ -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" );common/usb_storage.c +1
-1@@ -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;doc/develop/bootstd.rst +2
-2@@ -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);drivers/mmc/mmc-uclass.c +1
-1@@ -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);drivers/nvme/nvme.c +1
-1@@ -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);drivers/scsi/scsi.c +1
-1@@ -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);drivers/virtio/virtio-uclass.c +1
-1@@ -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); }include/bootdev.h +1
-1@@ -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
include/bootdev.h int bootdev_setup_for_dev(struct udevice *parent, const char *drv_name); · line 401
Quoted 5 lines
include/bootdev.h +1
-1@@ -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
Quoted 16 lines
include/bootdev.h +2
-2/** * 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 ; }Signature · 1 line
2.41.0.487.g6d72f3e995-goog
Re: [PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk()
Hi Mattijs,
Quoted 162 lines · Mattijs Korpershoek
Quoted 151 lines · Simon Glass
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 <[email protected]>---
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(-)boot/bootdev-uclass.c +5
-3@@ -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" );common/usb_storage.c +1
-1@@ -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;doc/develop/bootstd.rst +2
-2@@ -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);drivers/mmc/mmc-uclass.c +1
-1@@ -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);drivers/nvme/nvme.c +1
-1@@ -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);drivers/scsi/scsi.c +1
-1@@ -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);drivers/virtio/virtio-uclass.c +1
-1@@ -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); }include/bootdev.h +1
-1@@ -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 include/bootdev.h int bootdev_setup_for_dev(struct udevice *parent, const char *drv_name); · line 401
Quoted 5 lines
include/bootdev.h +1
-1@@ -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?
Quoted 7 lines
Right now, on master (
c98c401dfb48), the documentation strings states:*
bootdev_setup_for_blk()- Bind a new bootdev device for a blk deviceThis 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
PATCH 4/8 bootstd: Correct creating of bootdev sibling
In reply to Simon GlassUse the correct function here, since there may be multiple IDE devices available.
---
drivers/block/ide.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/ide.c +2 -2
@@ -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 ;
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
Re: [PATCH 4/8] bootstd: Correct creating of bootdev sibling
Quoted 4 lines · Simon Glass
Use the correct function here, since there may be multiple IDE devices available.
Signed-off-by Simon Glass <[email protected]>
Quoted 23 lines
---
drivers/block/ide.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/block/ide.c +2
-2@@ -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 ;Signature · 1 line
2.41.0.487.g6d72f3e995-goog
PATCH 5/8 bootstd: Add some more debugging in the bootdev uclass
In reply to Simon GlassAdd some more output to make it easier to see what is going wrong when a bootdev hunter fails.
---
boot/bootdev-uclass.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
boot/bootdev-uclass.c +8 -1
@@ -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; }
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
PATCH 6/8 x86: coreboot: Add IDE and SATA
In reply to Simon GlassAdd these options to permit access to more disk types.
Add some documentation as well.
---
configs/coreboot64_defconfig | 1 + configs/coreboot_defconfig | 9 +++++++++ doc/board/coreboot/coreboot.rst | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+)
configs/coreboot64_defconfig +1 -0
@@ -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
configs/coreboot_defconfig +9 -0
@@ -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
doc/board/coreboot/coreboot.rst +20 -0
@@ -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 -------------
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
PATCH 7/8 x86: coreboot: Enable standard boot
In reply to Simon GlassEnable bootstd options and provide instructions on how to boot a linux distro using coreboot.
---
configs/coreboot64_defconfig | 14 ++------------ configs/coreboot_defconfig | 1 + doc/board/coreboot/coreboot.rst | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 14 deletions(-)
configs/coreboot64_defconfig +2 -12
@@ -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
configs/coreboot_defconfig +1 -0
@@ -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
doc/board/coreboot/coreboot.rst +14 -2
@@ -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
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
PATCH 8/8 x86: coreboot: Enable support for CBFS
In reply to Simon GlassThis is normally used with coreboot, so enable support for it in the coreboot builds.
Add an example to show how it is used.
---
configs/coreboot64_defconfig | 1 + configs/coreboot_defconfig | 1 + doc/board/coreboot/coreboot.rst | 34 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+)
configs/coreboot64_defconfig +1 -0
@@ -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
configs/coreboot_defconfig +1 -0
@@ -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
doc/board/coreboot/coreboot.rst +34 -0
@@ -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 ----------
Signature · 1 line
2.41.0.487.g6d72f3e995-goog