diff options
| author | Tom Rini <[email protected]> | 2023-05-08 14:31:04 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2023-05-08 14:31:04 -0400 |
| commit | 11910550b65e6072b9542d462c0aa93f4ca81836 (patch) | |
| tree | 8308c98ffad76d9693654a28090b03f270a7d250 /lib/efi_loader | |
| parent | 9876c8c147144db2c120fcc9ffa6de27f6894441 (diff) | |
| parent | f1d33a44ca04fdca241c1d89fd79e2e56c930c7e (diff) | |
Merge branch 'master' into next
Diffstat (limited to 'lib/efi_loader')
| -rw-r--r-- | lib/efi_loader/efi_boottime.c | 4 | ||||
| -rw-r--r-- | lib/efi_loader/efi_capsule.c | 6 | ||||
| -rw-r--r-- | lib/efi_loader/efi_device_path.c | 53 | ||||
| -rw-r--r-- | lib/efi_loader/efi_memory.c | 2 | ||||
| -rw-r--r-- | lib/efi_loader/efi_runtime.c | 2 | ||||
| -rw-r--r-- | lib/efi_loader/helloworld.c | 13 | ||||
| -rw-r--r-- | lib/efi_loader/initrddump.c | 5 |
7 files changed, 52 insertions, 33 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index caaab685ee0..d5065f296ae 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -35,7 +35,7 @@ LIST_HEAD(efi_obj_list); __efi_runtime_data LIST_HEAD(efi_events); /* List of queued events */ -LIST_HEAD(efi_event_queue); +static LIST_HEAD(efi_event_queue); /* Flag to disable timer activity in ExitBootServices() */ static bool timers_enabled = true; @@ -44,7 +44,7 @@ static bool timers_enabled = true; bool efi_st_keep_devices; /* List of all events registered by RegisterProtocolNotify() */ -LIST_HEAD(efi_register_notify_events); +static LIST_HEAD(efi_register_notify_events); /* Handle of the currently executing image */ static efi_handle_t current_image; diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index d5d3ede7ae6..7a6f195cbc0 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -404,12 +404,6 @@ out: return status; } -#else -efi_status_t efi_capsule_authenticate(const void *capsule, efi_uintn_t capsule_size, - void **image, efi_uintn_t *image_size) -{ - return EFI_UNSUPPORTED; -} #endif /* CONFIG_EFI_CAPSULE_AUTHENTICATE */ static __maybe_unused bool fwu_empty_capsule(struct efi_capsule_header *capsule) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index d5cc4958304..e2e98a39be1 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -21,6 +21,9 @@ #include <asm-generic/unaligned.h> #include <linux/compat.h> /* U16_MAX */ +#ifdef CONFIG_BLKMAP +const efi_guid_t efi_guid_blkmap_dev = U_BOOT_BLKMAP_DEV_GUID; +#endif #ifdef CONFIG_SANDBOX const efi_guid_t efi_guid_host_dev = U_BOOT_HOST_DEV_GUID; #endif @@ -110,17 +113,13 @@ int efi_dp_match(const struct efi_device_path *a, /** * efi_dp_shorten() - shorten device-path * - * We can have device paths that start with a USB WWID or a USB Class node, - * and a few other cases which don't encode the full device path with bus - * hierarchy: + * When creating a short boot option we want to use a device-path that is + * independent of the location where the block device is plugged in. * - * * MESSAGING:USB_WWID - * * MESSAGING:USB_CLASS - * * MEDIA:FILE_PATH - * * MEDIA:HARD_DRIVE - * * MESSAGING:URI + * UsbWwi() nodes contain a serial number, hard drive paths a partition + * UUID. Both should be unique. * - * See UEFI spec (section 3.1.2, about short-form device-paths) + * See UEFI spec, section 3.1.2 for "short-form device path". * * @dp: original device-path * @Return: shortened device-path or NULL @@ -128,12 +127,7 @@ int efi_dp_match(const struct efi_device_path *a, struct efi_device_path *efi_dp_shorten(struct efi_device_path *dp) { while (dp) { - /* - * TODO: Add MESSAGING:USB_WWID and MESSAGING:URI.. - * in practice fallback.efi just uses MEDIA:HARD_DRIVE - * so not sure when we would see these other cases. - */ - if (EFI_DP_TYPE(dp, MESSAGING_DEVICE, MSG_USB) || + if (EFI_DP_TYPE(dp, MESSAGING_DEVICE, MSG_USB_WWI) || EFI_DP_TYPE(dp, MEDIA_DEVICE, HARD_DRIVE_PATH) || EFI_DP_TYPE(dp, MEDIA_DEVICE, FILE_PATH)) return dp; @@ -565,6 +559,16 @@ __maybe_unused static unsigned int dp_size(struct udevice *dev) return dp_size(dev->parent) + sizeof(struct efi_device_path_vendor) + 1; #endif +#ifdef CONFIG_BLKMAP + case UCLASS_BLKMAP: + /* + * blkmap devices will be represented as a vendor + * device node with an extra byte for the device + * number. + */ + return dp_size(dev->parent) + + sizeof(struct efi_device_path_vendor) + 1; +#endif default: return dp_size(dev->parent); } @@ -622,6 +626,23 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev) #endif case UCLASS_BLK: switch (dev->parent->uclass->uc_drv->id) { +#ifdef CONFIG_BLKMAP + case UCLASS_BLKMAP: { + struct efi_device_path_vendor *dp; + struct blk_desc *desc = dev_get_uclass_plat(dev); + + dp_fill(buf, dev->parent); + dp = buf; + ++dp; + dp->dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE; + dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR; + dp->dp.length = sizeof(*dp) + 1; + memcpy(&dp->guid, &efi_guid_blkmap_dev, + sizeof(efi_guid_t)); + dp->vendor_data[0] = desc->devnum; + return &dp->vendor_data[1]; + } +#endif #ifdef CONFIG_SANDBOX case UCLASS_HOST: { /* stop traversing parents at this point: */ @@ -735,7 +756,7 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev) #endif #if defined(CONFIG_USB) case UCLASS_MASS_STORAGE: { - struct blk_desc *desc = desc = dev_get_uclass_plat(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); struct efi_device_path_controller *dp = dp_fill(buf, dev->parent); diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 8f82496740f..e2ca78d935f 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -36,7 +36,7 @@ struct efi_mem_list { #define EFI_CARVE_OVERLAPS_NONRAM -3 /* This list contains all memory map items */ -LIST_HEAD(efi_mem); +static LIST_HEAD(efi_mem); #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER void *efi_bounce_buffer; diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index cee96bfc7fc..bf54d6ad871 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -32,7 +32,7 @@ struct efi_runtime_mmio_list { }; /* This list contains all runtime available mmio regions */ -LIST_HEAD(efi_runtime_mmio); +static LIST_HEAD(efi_runtime_mmio); static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void); diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index 49fa8cc2f00..6405f58ec3f 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -197,8 +197,10 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, print_config_tables(); /* Get the loaded image protocol */ - ret = boottime->handle_protocol(handle, &loaded_image_guid, - (void **)&loaded_image); + ret = boottime->open_protocol(handle, &loaded_image_guid, + (void **)&loaded_image, NULL, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (ret != EFI_SUCCESS) { con_out->output_string (con_out, u"Cannot open loaded image protocol\r\n"); @@ -219,9 +221,10 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (con_out, u"Missing device handle\r\n"); goto out; } - ret = boottime->handle_protocol(loaded_image->device_handle, - &device_path_guid, - (void **)&device_path); + ret = boottime->open_protocol(loaded_image->device_handle, + &device_path_guid, + (void **)&device_path, NULL, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (ret != EFI_SUCCESS) { con_out->output_string (con_out, u"Missing device path for device handle\r\n"); diff --git a/lib/efi_loader/initrddump.c b/lib/efi_loader/initrddump.c index 971a3b6236c..5b470f48194 100644 --- a/lib/efi_loader/initrddump.c +++ b/lib/efi_loader/initrddump.c @@ -291,8 +291,9 @@ static efi_status_t get_initrd(void **initrd, efi_uintn_t *initrd_size) error(u"Load File2 protocol not found\r\n"); return ret; } - ret = bs->handle_protocol(handle, &load_file2_guid, - (void **)&load_file2_prot); + ret = bs->open_protocol(handle, &load_file2_guid, + (void **)&load_file2_prot, NULL, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); ret = load_file2_prot->load_file(load_file2_prot, dp, false, initrd_size, NULL); if (ret != EFI_BUFFER_TOO_SMALL) { |
