summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2019-01-21 12:13:00 +0900
committerAlexander Graf <agraf@suse.de>2019-02-13 09:40:06 +0100
commitcb728e51a77e515659f4834c2829a956b9f5c9f0 (patch)
treea78224a946de2e79dc9ab9829c062e8e709cd399 /lib
parent8d3b77e36e10a94195642b351d4a85daab9e5fc5 (diff)
efi: hii: add HII config routing/access protocols
This patch is a place holder for HII configuration routing protocol and HII configuration access protocol. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/Makefile2
-rw-r--r--lib/efi_loader/efi_boottime.c6
-rw-r--r--lib/efi_loader/efi_hii_config.c146
3 files changed, 153 insertions, 1 deletions
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 00128d417b..4e90a35896 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -24,7 +24,7 @@ obj-y += efi_device_path.o
obj-y += efi_device_path_to_text.o
obj-y += efi_device_path_utilities.o
obj-y += efi_file.o
-obj-y += efi_hii.o
+obj-y += efi_hii.o efi_hii_config.o
obj-y += efi_image_loader.o
obj-y += efi_memory.o
obj-y += efi_root_node.o
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 73af490377..fc26d6adc1 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1570,6 +1570,12 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,
if (ret != EFI_SUCCESS)
goto failure;
+ ret = efi_add_protocol(&obj->header,
+ &efi_guid_hii_config_routing_protocol,
+ (void *)&efi_hii_config_routing);
+ if (ret != EFI_SUCCESS)
+ goto failure;
+
return ret;
failure:
printf("ERROR: Failure to install protocols for loaded image\n");
diff --git a/lib/efi_loader/efi_hii_config.c b/lib/efi_loader/efi_hii_config.c
new file mode 100644
index 0000000000..f4b1f026c1
--- /dev/null
+++ b/lib/efi_loader/efi_hii_config.c
@@ -0,0 +1,146 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * EFI Human Interface Infrastructure ... Configuration
+ *
+ * Copyright (c) 2017 Leif Lindholm
+ * Copyright (c) 2018 AKASHI Takahiro, Linaro Limited
+ */
+
+#include <common.h>
+#include <efi_loader.h>
+
+const efi_guid_t efi_guid_hii_config_routing_protocol
+ = EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID;
+const efi_guid_t efi_guid_hii_config_access_protocol
+ = EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID;
+
+/*
+ * EFI_HII_CONFIG_ROUTING_PROTOCOL
+ */
+
+static efi_status_t EFIAPI
+extract_config(const struct efi_hii_config_routing_protocol *this,
+ const efi_string_t request,
+ efi_string_t *progress,
+ efi_string_t *results)
+{
+ EFI_ENTRY("%p, \"%ls\", %p, %p", this, request, progress, results);
+
+ return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+}
+
+static efi_status_t EFIAPI
+export_config(const struct efi_hii_config_routing_protocol *this,
+ efi_string_t *results)
+{
+ EFI_ENTRY("%p, %p", this, results);
+
+ return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+}
+
+static efi_status_t EFIAPI
+route_config(const struct efi_hii_config_routing_protocol *this,
+ const efi_string_t configuration,
+ efi_string_t *progress)
+{
+ EFI_ENTRY("%p, \"%ls\", %p", this, configuration, progress);
+
+ return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+}
+
+static efi_status_t EFIAPI
+block_to_config(const struct efi_hii_config_routing_protocol *this,
+ const efi_string_t config_request,
+ const u8 *block,
+ const efi_uintn_t block_size,
+ efi_string_t *config,
+ efi_string_t *progress)
+{
+ EFI_ENTRY("%p, \"%ls\", %p, %zu, %p, %p", this, config_request,
+ block, block_size, config, progress);
+
+ return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+}
+
+static efi_status_t EFIAPI
+config_to_block(const struct efi_hii_config_routing_protocol *this,
+ const efi_string_t config_resp,
+ const u8 *block,
+ const efi_uintn_t *block_size,
+ efi_string_t *progress)
+{
+ EFI_ENTRY("%p, \"%ls\", %p, %p, %p", this, config_resp,
+ block, block_size, progress);
+
+ return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+}
+
+static efi_status_t EFIAPI
+get_alt_config(const struct efi_hii_config_routing_protocol *this,
+ const efi_string_t config_resp,
+ const efi_guid_t *guid,
+ const efi_string_t name,
+ const struct efi_device_path *device_path,
+ const efi_string_t alt_cfg_id,
+ efi_string_t *alt_cfg_resp)
+{
+ EFI_ENTRY("%p, \"%ls\", %pUl, \"%ls\", %p, \"%ls\", %p",
+ this, config_resp, guid, name, device_path,
+ alt_cfg_id, alt_cfg_resp);
+
+ return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+}
+
+/*
+ * EFI_HII_ACCESS_PROTOCOL
+ */
+
+efi_status_t EFIAPI
+extract_config_access(const struct efi_hii_config_access_protocol *this,
+ const efi_string_t request,
+ efi_string_t *progress,
+ efi_string_t *results)
+{
+ EFI_ENTRY("%p, \"%ls\", %p, %p", this, request, progress, results);
+
+ return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+};
+
+efi_status_t EFIAPI
+route_config_access(const struct efi_hii_config_access_protocol *this,
+ const efi_string_t configuration,
+ efi_string_t *progress)
+{
+ EFI_ENTRY("%p, \"%ls\", %p", this, configuration, progress);
+
+ return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+};
+
+efi_status_t EFIAPI
+form_callback(const struct efi_hii_config_access_protocol *this,
+ efi_browser_action_t action,
+ efi_question_id_t question_id,
+ u8 type,
+ union efi_ifr_type_value *value,
+ efi_browser_action_request_t *action_request)
+{
+ EFI_ENTRY("%p, 0x%lx, 0x%x, 0x%x, %p, %p", this, action,
+ question_id, type, value, action_request);
+
+ return EFI_EXIT(EFI_DEVICE_ERROR);
+};
+
+const struct efi_hii_config_routing_protocol efi_hii_config_routing = {
+ .extract_config = extract_config,
+ .export_config = export_config,
+ .route_config = route_config,
+ .block_to_config = block_to_config,
+ .config_to_block = config_to_block,
+ .get_alt_config = get_alt_config
+};
+
+const struct efi_hii_config_access_protocol efi_hii_config_access = {
+ .extract_config_access = extract_config_access,
+ .route_config_access = route_config_access,
+ .form_callback = form_callback
+};