Pull request for efi-2022-10-rc3-2

Documentation:
 
 * improve description of device probing
 * describe booting RISC-V with KVM and QEMU
 
 UEFI
 
 * fix Makefile for mkeficapsule
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmMA7kkACgkQxIHbvCwF
 GsQFMw/+JRliitarcCmpkncB7axSwFiGNwm+27+SFl6wwoU+f57Arq2GYsQGWx+H
 GCnlKNKiPZf1L4aSFG8lueyHs9XK5megHPhL9VtYmQb7gBfNpRQDVW9lKwf4NZOS
 IkBur1GF79z/wCFermqZ3ozsKEQuh0OzhQ20nsz4GwQIeXpjdACmnqcY4zKEnZYG
 /aWiP172t2aomTADorNSn3sGqEd3nwPeTUq60uasBz9IGUKR+8rzr8NAfUVotKM5
 f2vuRSq85cthls6KBy1+w+k5HDhiS44yutQVol6ZSr4pn8cvkWYagv+L6Otnz/CE
 NhSyzk22AHzAiz0S44Yjj+4+YM4Qpcoa4zimAqohyrL0SwiZtSlWNBwSlr29vPmb
 pR4ckrBVCTZQh/ngKHApfqj/Nk7Y2GnydCvdaPW0BEoMVGevTF31JxHJuvmft+yl
 X9f82fhW/EdiaK/PfQ9Bkp7Ut3ikQQqVgSxRx5ToDXQ3rhfpsswy7WwKn0GPmAzt
 byQKD68I6YOSwktj8pgtNeORK84itucAtF+KGkhgZxNVokcJRvBs1ZdHnXC4Nb6k
 gvNFciKnP3arDe5EFyjtiU8WVaBjM+CRH6oOVbjA+26beIg5+jvxznE/CJCcpS7l
 oJuB6bDg9/AUReZwZYAwQVfTuY1sMpcw3Sf7FTTmo30SfCna2BY=
 =Fu1m
 -----END PGP SIGNATURE-----

Merge tag 'efi-2022-10-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-10-rc3-2

Documentation:

* improve description of device probing
* describe booting RISC-V with KVM and QEMU

UEFI

* fix Makefile for mkeficapsule
This commit is contained in:
Tom Rini 2022-08-20 13:26:17 -04:00
commit e9a4a176de
4 changed files with 54 additions and 27 deletions

View file

@ -133,6 +133,19 @@ An attached disk can be emulated in RISC-V virt machine by adding::
You will have to run 'scsi scan' to use it.
Running with KVM
----------------
Running with QEMU using KVM requires an S-mode U-Boot binary as created by
qemu-riscv64_smode_defconfig.
Provide the U-Boot S-mode ELF image as *-kernel* parameter and do not add a
*-bios* parameter, e.g.
.. code-block:: bash
qemu-system-riscv64 -accel kvm -nographic -machine virt -kernel u-boot
Debug UART
----------

View file

@ -794,34 +794,53 @@ fall afoul of this rule.
Activation/probe
^^^^^^^^^^^^^^^^
When a device needs to be used, U-Boot activates it, by first reading ofdata
as above and then following these steps (see device_probe()):
To save resources devices in U-Boot are probed lazily. U-Boot is a bootloader,
not an operating system. Many devices are never used during an U-Boot run, and
probing them takes time, requires memory, may add delays to the main loop, etc.
The device should be probed by the uclass code or generic device code (e.g.
device_find_global_by_ofnode()). Uclasses differ but two common use cases can be
seen:
1. The uclass is asked to look up a specific device, such as SPI bus 0,
first chip select - in this case the returned device should be
activated.
2. The uclass is asked to perform a specific function on any device that
supports it, eg. reset the board using any sysreset that can be found -
for this case the core uclass code provides iterators that activate
each device before returning it, and the uclass typically implements a
walk function that iterates over all devices of the uclass and tries
to perform the requested function on each in turn until succesful.
To activate a device U-Boot first reads ofdata as above and then follows these
steps (see device_probe()):
1. All parent devices are probed. It is not possible to activate a device
unless its predecessors (all the way up to the root device) are activated.
This means (for example) that an I2C driver will require that its bus
be activated.
unless its predecessors (all the way up to the root device) are activated.
This means (for example) that an I2C driver will require that its bus
be activated.
2. The device's probe() method is called. This should do anything that
is required by the device to get it going. This could include checking
that the hardware is actually present, setting up clocks for the
hardware and setting up hardware registers to initial values. The code
in probe() can access:
is required by the device to get it going. This could include checking
that the hardware is actually present, setting up clocks for the
hardware and setting up hardware registers to initial values. The code
in probe() can access:
- platform data in dev->plat (for configuration)
- private data in dev->priv (for run-time state)
- uclass data in dev->uclass_priv (for things the uclass stores
about this device)
Note: If you don't use priv_auto then you will need to
allocate the priv space here yourself. The same applies also to
plat_auto. Remember to free them in the remove() method.
Note: If you don't use priv_auto then you will need to
allocate the priv space here yourself. The same applies also to
plat_auto. Remember to free them in the remove() method.
3. The device is marked 'activated'
4. The uclass's post_probe() method is called, if one exists. This may
cause the uclass to do some housekeeping to record the device as
activated and 'known' by the uclass.
cause the uclass to do some housekeeping to record the device as
activated and 'known' by the uclass.
Running stage
^^^^^^^^^^^^^

View file

@ -29,7 +29,6 @@ const efi_guid_t efi_system_partition_guid = PARTITION_SYSTEM_GUID;
*
* @header: EFI object header
* @ops: EFI disk I/O protocol interface
* @ifname: interface name for block device
* @dev_index: device index of block device
* @media: block I/O media information
* @dp: device path to the block device
@ -40,7 +39,6 @@ const efi_guid_t efi_system_partition_guid = PARTITION_SYSTEM_GUID;
struct efi_disk_obj {
struct efi_object header;
struct efi_block_io ops;
const char *ifname;
int dev_index;
struct efi_block_io_media media;
struct efi_device_path *dp;
@ -379,7 +377,6 @@ static int efi_fs_exists(struct blk_desc *desc, int part)
*
* @parent: parent handle
* @dp_parent: parent device path
* @if_typename: interface name for block device
* @desc: internal block device
* @dev_index: device index for block device
* @part_info: partition info
@ -390,7 +387,6 @@ static int efi_fs_exists(struct blk_desc *desc, int part)
static efi_status_t efi_disk_add_dev(
efi_handle_t parent,
struct efi_device_path *dp_parent,
const char *if_typename,
struct blk_desc *desc,
int dev_index,
struct disk_partition *part_info,
@ -475,7 +471,6 @@ static efi_status_t efi_disk_add_dev(
return ret;
}
diskobj->ops = block_io_disk_template;
diskobj->ifname = if_typename;
diskobj->dev_index = dev_index;
/* Fill in EFI IO Media info (for read/write callbacks) */
@ -533,15 +528,13 @@ static int efi_disk_create_raw(struct udevice *dev)
{
struct efi_disk_obj *disk;
struct blk_desc *desc;
const char *if_typename;
int diskid;
efi_status_t ret;
desc = dev_get_uclass_plat(dev);
if_typename = blk_get_if_type_name(desc->if_type);
diskid = desc->devnum;
ret = efi_disk_add_dev(NULL, NULL, if_typename, desc,
ret = efi_disk_add_dev(NULL, NULL, desc,
diskid, NULL, 0, &disk);
if (ret != EFI_SUCCESS) {
if (ret == EFI_NOT_READY)
@ -575,7 +568,6 @@ static int efi_disk_create_part(struct udevice *dev)
{
efi_handle_t parent;
struct blk_desc *desc;
const char *if_typename;
struct disk_part *part_data;
struct disk_partition *info;
unsigned int part;
@ -589,7 +581,6 @@ static int efi_disk_create_part(struct udevice *dev)
return -1;
desc = dev_get_uclass_plat(dev_get_parent(dev));
if_typename = blk_get_if_type_name(desc->if_type);
diskid = desc->devnum;
part_data = dev_get_uclass_plat(dev);
@ -601,7 +592,7 @@ static int efi_disk_create_part(struct udevice *dev)
return -1;
dp_parent = (struct efi_device_path *)handler->protocol_interface;
ret = efi_disk_add_dev(parent, dp_parent, if_typename, desc, diskid,
ret = efi_disk_add_dev(parent, dp_parent, desc, diskid,
info, part, &disk);
if (ret != EFI_SUCCESS) {
log_err("Adding partition for %s failed\n", dev->name);

View file

@ -245,9 +245,13 @@ hostprogs-$(CONFIG_ASN1_COMPILER) += asn1_compiler
HOSTCFLAGS_asn1_compiler.o = -idirafter $(srctree)/include
HOSTCFLAGS_mkeficapsule.o += \
$(shell pkg-config --cflags gnutls uuid 2> /dev/null || echo "")
$(shell pkg-config --cflags gnutls 2> /dev/null || echo "")
HOSTCFLAGS_mkeficapsule.o += \
$(shell pkg-config --cflags uuid 2> /dev/null || echo "")
HOSTLDLIBS_mkeficapsule += \
$(shell pkg-config --libs gnutls uuid 2> /dev/null || echo "-lgnutls -luuid")
$(shell pkg-config --libs gnutls 2> /dev/null || echo "-lgnutls")
HOSTLDLIBS_mkeficapsule += \
$(shell pkg-config --libs uuid 2> /dev/null || echo "-luuid")
hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += mkeficapsule
# We build some files with extra pedantic flags to try to minimize things