summaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_boottime.c35
-rw-r--r--lib/efi_loader/efi_disk.c71
-rw-r--r--lib/efi_loader/efi_image_loader.c2
-rw-r--r--lib/efi_loader/efi_runtime.c29
4 files changed, 108 insertions, 29 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index da93498b36..6eea2395c7 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -526,6 +526,38 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
}
/*
+ * Create an event in a group.
+ *
+ * This function implements the CreateEventEx service.
+ * See the Unified Extensible Firmware Interface (UEFI) specification
+ * for details.
+ * TODO: Support event groups
+ *
+ * @type type of the event to create
+ * @notify_tpl task priority level of the event
+ * @notify_function notification function of the event
+ * @notify_context pointer passed to the notification function
+ * @event created event
+ * @event_group event group
+ * @return status code
+ */
+efi_status_t EFIAPI efi_create_event_ex(uint32_t type, efi_uintn_t notify_tpl,
+ void (EFIAPI *notify_function) (
+ struct efi_event *event,
+ void *context),
+ void *notify_context,
+ efi_guid_t *event_group,
+ struct efi_event **event)
+{
+ EFI_ENTRY("%d, 0x%zx, %p, %p, %pUl", type, notify_tpl, notify_function,
+ notify_context, event_group);
+ if (event_group)
+ return EFI_EXIT(EFI_UNSUPPORTED);
+ return EFI_EXIT(efi_create_event(type, notify_tpl, notify_function,
+ notify_context, event));
+}
+
+/*
* Create an event.
*
* This function implements the CreateEvent service.
@@ -2851,6 +2883,7 @@ static const struct efi_boot_services efi_boot_services = {
.calculate_crc32 = efi_calculate_crc32,
.copy_mem = efi_copy_mem,
.set_mem = efi_set_mem,
+ .create_event_ex = efi_create_event_ex,
};
@@ -2859,7 +2892,7 @@ static uint16_t __efi_runtime_data firmware_vendor[] = L"Das U-Boot";
struct efi_system_table __efi_runtime_data systab = {
.hdr = {
.signature = EFI_SYSTEM_TABLE_SIGNATURE,
- .revision = 0x20005, /* 2.5 */
+ .revision = 2 << 16 | 70, /* 2.7 */
.headersize = sizeof(struct efi_table_hdr),
},
.fw_vendor = (long)firmware_vendor,
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index ac39a65ee8..825a6d86de 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -226,25 +226,26 @@ efi_fs_from_path(struct efi_device_path *full_path)
* @offset offset into disk for simple partitions
* @return disk object
*/
-static struct efi_disk_obj *efi_disk_add_dev(
+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,
lbaint_t offset,
- unsigned int part)
+ unsigned int part,
+ struct efi_disk_obj **disk)
{
struct efi_disk_obj *diskobj;
efi_status_t ret;
/* Don't add empty devices */
if (!desc->lba)
- return NULL;
+ return EFI_NOT_READY;
diskobj = calloc(1, sizeof(*diskobj));
if (!diskobj)
- goto out_of_memory;
+ return EFI_OUT_OF_RESOURCES;
/* Hook up to the device list */
efi_add_handle(&diskobj->parent);
@@ -262,11 +263,11 @@ static struct efi_disk_obj *efi_disk_add_dev(
ret = efi_add_protocol(diskobj->parent.handle, &efi_block_io_guid,
&diskobj->ops);
if (ret != EFI_SUCCESS)
- goto out_of_memory;
+ return ret;
ret = efi_add_protocol(diskobj->parent.handle, &efi_guid_device_path,
diskobj->dp);
if (ret != EFI_SUCCESS)
- goto out_of_memory;
+ return ret;
if (part >= 1) {
diskobj->volume = efi_simple_file_system(desc, part,
diskobj->dp);
@@ -274,7 +275,7 @@ static struct efi_disk_obj *efi_disk_add_dev(
&efi_simple_file_system_protocol_guid,
diskobj->volume);
if (ret != EFI_SUCCESS)
- goto out_of_memory;
+ return ret;
}
diskobj->ops = block_io_disk_template;
diskobj->ifname = if_typename;
@@ -291,10 +292,9 @@ static struct efi_disk_obj *efi_disk_add_dev(
if (part != 0)
diskobj->media.logical_partition = 1;
diskobj->ops.media = &diskobj->media;
- return diskobj;
-out_of_memory:
- printf("ERROR: Out of memory\n");
- return NULL;
+ if (disk)
+ *disk = diskobj;
+ return EFI_SUCCESS;
}
/*
@@ -330,8 +330,12 @@ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
continue;
snprintf(devname, sizeof(devname), "%s:%d", pdevname,
part);
- efi_disk_add_dev(parent, dp, if_typename, desc, diskid,
- info.start, part);
+ ret = efi_disk_add_dev(parent, dp, if_typename, desc, diskid,
+ info.start, part, NULL);
+ if (ret != EFI_SUCCESS) {
+ printf("Adding partition %s failed\n", pdevname);
+ continue;
+ }
disks++;
}
@@ -349,26 +353,32 @@ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
*
* This gets called from do_bootefi_exec().
*/
-int efi_disk_register(void)
+efi_status_t efi_disk_register(void)
{
struct efi_disk_obj *disk;
int disks = 0;
+ efi_status_t ret;
#ifdef CONFIG_BLK
struct udevice *dev;
- for (uclass_first_device_check(UCLASS_BLK, &dev);
- dev;
+ for (uclass_first_device_check(UCLASS_BLK, &dev); dev;
uclass_next_device_check(&dev)) {
struct blk_desc *desc = dev_get_uclass_platdata(dev);
const char *if_typename = blk_get_if_type_name(desc->if_type);
- printf("Scanning disk %s...\n", dev->name);
-
/* Add block device for the full device */
- disk = efi_disk_add_dev(NULL, NULL, if_typename,
- desc, desc->devnum, 0, 0);
- if (!disk)
- return -ENOMEM;
+ printf("Scanning disk %s...\n", dev->name);
+ ret = efi_disk_add_dev(NULL, NULL, if_typename,
+ desc, desc->devnum, 0, 0, &disk);
+ if (ret == EFI_NOT_READY) {
+ printf("Disk %s not ready\n", dev->name);
+ continue;
+ }
+ if (ret) {
+ printf("ERROR: failure to add disk device %s, r = %lu\n",
+ dev->name, ret & ~EFI_ERROR_MASK);
+ return ret;
+ }
disks++;
/* Partitions show up as block devices in EFI */
@@ -404,10 +414,17 @@ int efi_disk_register(void)
if_typename, i);
/* Add block device for the full device */
- disk = efi_disk_add_dev(NULL, NULL, if_typename, desc,
- i, 0, 0);
- if (!disk)
- return -ENOMEM;
+ ret = efi_disk_add_dev(NULL, NULL, if_typename, desc,
+ i, 0, 0, &disk);
+ if (ret == EFI_NOT_READY) {
+ printf("Disk %s not ready\n", devname);
+ continue;
+ }
+ if (ret) {
+ printf("ERROR: failure to add disk device %s, r = %lu\n",
+ devname, ret & ~EFI_ERROR_MASK);
+ return ret;
+ }
disks++;
/* Partitions show up as block devices in EFI */
@@ -419,5 +436,5 @@ int efi_disk_register(void)
#endif
printf("Found %d disks\n", disks);
- return 0;
+ return EFI_SUCCESS;
}
diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c
index 9d2214b481..cac64ba9fe 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -94,7 +94,7 @@ static void efi_set_code_and_data_type(
loaded_image_info->image_data_type = EFI_BOOT_SERVICES_DATA;
break;
case IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
- case IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER:
+ case IMAGE_SUBSYSTEM_EFI_ROM:
loaded_image_info->image_code_type = EFI_RUNTIME_SERVICES_CODE;
loaded_image_info->image_data_type = EFI_RUNTIME_SERVICES_DATA;
break;
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 8104e08c46..ccb4fc6141 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -381,6 +381,32 @@ static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void)
return EFI_INVALID_PARAMETER;
}
+efi_status_t __efi_runtime EFIAPI efi_update_capsule(
+ struct efi_capsule_header **capsule_header_array,
+ efi_uintn_t capsule_count,
+ u64 scatter_gather_list)
+{
+ return EFI_UNSUPPORTED;
+}
+
+efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps(
+ struct efi_capsule_header **capsule_header_array,
+ efi_uintn_t capsule_count,
+ u64 maximum_capsule_size,
+ u32 reset_type)
+{
+ return EFI_UNSUPPORTED;
+}
+
+efi_status_t __efi_runtime EFIAPI efi_query_variable_info(
+ u32 attributes,
+ u64 maximum_variable_storage_size,
+ u64 remaining_variable_storage_size,
+ u64 maximum_variable_size)
+{
+ return EFI_UNSUPPORTED;
+}
+
struct efi_runtime_services __efi_runtime_data efi_runtime_services = {
.hdr = {
.signature = EFI_RUNTIME_SERVICES_SIGNATURE,
@@ -398,4 +424,7 @@ struct efi_runtime_services __efi_runtime_data efi_runtime_services = {
.set_variable = efi_set_variable,
.get_next_high_mono_count = (void *)&efi_device_error,
.reset_system = &efi_reset_system_boottime,
+ .update_capsule = efi_update_capsule,
+ .query_capsule_caps = efi_query_capsule_caps,
+ .query_variable_info = efi_query_variable_info,
};