From d8d8997bbce7ff81799cb20795bdf97db9f8d5f2 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 23 Mar 2018 21:12:17 +0100 Subject: log: fix typo LOGL_EFI According to the documentation the EFI log category is called LOGC_EFI. All other categories start with LOGC_. So let's fix it. Fixes: 1973b381a1b3 ("log: add category LOGC_EFI") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass Signed-off-by: Alexander Graf --- include/log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/log.h b/include/log.h index 20dc5289c7..3cf08de6d0 100644 --- a/include/log.h +++ b/include/log.h @@ -46,7 +46,7 @@ enum log_category_t { LOGC_CORE, LOGC_DM, /* Core driver-model */ LOGC_DT, /* Device-tree */ - LOGL_EFI, /* EFI implementation */ + LOGC_EFI, /* EFI implementation */ LOGC_COUNT, LOGC_END, -- cgit v1.2.3 From b5cd6878e43f913ae31c80425e410ca975082b4a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 16 Apr 2018 07:59:03 +0200 Subject: efi_selftest: do not execute test if setup failed Executing a test after failed setup may lead to unexpected behavior like an illegal memory access. So after a setup failure we should skip to teardown. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- include/efi_selftest.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/efi_selftest.h b/include/efi_selftest.h index 08dd8e43ad..c23bc24bed 100644 --- a/include/efi_selftest.h +++ b/include/efi_selftest.h @@ -114,6 +114,7 @@ u16 efi_st_get_key(void); * @setup: set up the unit test * @teardown: tear down the unit test * @execute: execute the unit test + * @setup_ok: setup was successful (set at runtime) * @on_request: test is only executed on request */ struct efi_unit_test { @@ -123,6 +124,7 @@ struct efi_unit_test { const struct efi_system_table *systable); int (*execute)(void); int (*teardown)(void); + int setup_ok; bool on_request; }; -- cgit v1.2.3 From 211314c107d759c6adeb9b5dd8c81b284c4a03be Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 16 Apr 2018 07:59:05 +0200 Subject: efi_loader: implement CreateDeviceNode Implement the CreateDeviceNode service of the device path utility protocol. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- include/efi_loader.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 17f9d3d1ef..0358bcb1d7 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -330,7 +330,10 @@ struct efi_device_path *efi_dp_append(const struct efi_device_path *dp1, const struct efi_device_path *dp2); struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, const struct efi_device_path *node); - +/* Create a device path node of given type, sub-type, length */ +struct efi_device_path *efi_dp_create_device_node(const u8 type, + const u8 sub_type, + const u16 length); struct efi_device_path *efi_dp_from_dev(struct udevice *dev); struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part); -- cgit v1.2.3 From f6dd3f359c346da64f7db331b82086270388da0c Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 16 Apr 2018 07:59:08 +0200 Subject: efi_loader: correcty determine total device path length Device paths may consist of multiple instances. Up to now we have only considered the size of the first instance. For the services of the EFI_DEVICE_PATH_UTILITIES_PROTOCOL in most cases the total length of the device path is relevant. So let's rename efi_dp_size() to efi_dp_instance_size() and create a new function efi_dp_size() that calculates the total device path length. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- include/efi_loader.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 0358bcb1d7..1298b5e160 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -324,7 +324,10 @@ int efi_dp_match(const struct efi_device_path *a, const struct efi_device_path *b); struct efi_object *efi_dp_find_obj(struct efi_device_path *dp, struct efi_device_path **rem); -unsigned efi_dp_size(const struct efi_device_path *dp); +/* get size of the first device path instance excluding end node */ +efi_uintn_t efi_dp_instance_size(const struct efi_device_path *dp); +/* size of multi-instance device path excluding end node */ +efi_uintn_t efi_dp_size(const struct efi_device_path *dp); struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp); struct efi_device_path *efi_dp_append(const struct efi_device_path *dp1, const struct efi_device_path *dp2); -- cgit v1.2.3 From 3acef5da40f694af74f6165ffd47041231d9e6e1 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 16 Apr 2018 07:59:09 +0200 Subject: efi_loader: complete EFI_DEVICE_PATH_UTILITIES_PROTOCOL The missing services of the EFI_DEVICE_PATH_UTILITIES_PROTOCOL are implemented. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- include/efi_api.h | 1 + include/efi_loader.h | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'include') diff --git a/include/efi_api.h b/include/efi_api.h index ae93061160..64c27e494b 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -343,6 +343,7 @@ struct efi_loaded_image { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b ) #define DEVICE_PATH_TYPE_END 0x7f +# define DEVICE_PATH_SUB_TYPE_INSTANCE_END 0x01 # define DEVICE_PATH_SUB_TYPE_END 0xff struct efi_device_path { diff --git a/include/efi_loader.h b/include/efi_loader.h index 1298b5e160..8d21ba74b1 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -337,6 +337,15 @@ struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, struct efi_device_path *efi_dp_create_device_node(const u8 type, const u8 sub_type, const u16 length); +/* Append device path instance */ +struct efi_device_path *efi_dp_append_instance( + const struct efi_device_path *dp, + const struct efi_device_path *dpi); +/* Get next device path instance */ +struct efi_device_path *efi_dp_get_next_instance(struct efi_device_path **dp, + efi_uintn_t *size); +/* Check if a device path contains muliple instances */ +bool efi_dp_is_multi_instance(const struct efi_device_path *dp); struct efi_device_path *efi_dp_from_dev(struct udevice *dev); struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part); -- cgit v1.2.3