diff options
-rw-r--r-- | doc/board/emulation/qemu-riscv.rst | 13 | ||||
-rw-r--r-- | doc/develop/driver-model/design.rst | 47 | ||||
-rw-r--r-- | lib/efi_loader/efi_disk.c | 13 | ||||
-rw-r--r-- | tools/Makefile | 8 |
4 files changed, 54 insertions, 27 deletions
diff --git a/doc/board/emulation/qemu-riscv.rst b/doc/board/emulation/qemu-riscv.rst index 782f372..509bf7c 100644 --- a/doc/board/emulation/qemu-riscv.rst +++ b/doc/board/emulation/qemu-riscv.rst @@ -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 ---------- diff --git a/doc/develop/driver-model/design.rst b/doc/develop/driver-model/design.rst index a75d637..20611e8 100644 --- a/doc/develop/driver-model/design.rst +++ b/doc/develop/driver-model/design.rst @@ -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 ^^^^^^^^^^^^^ diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 16d14b0..f269abf 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -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); diff --git a/tools/Makefile b/tools/Makefile index 005e736..3626919 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -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 2> /dev/null || echo "-lgnutls") HOSTLDLIBS_mkeficapsule += \ - $(shell pkg-config --libs gnutls uuid 2> /dev/null || echo "-lgnutls -luuid") + $(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 |