All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/7] efi_loader: Expose efi_install_configuration_table
Date: Mon,  8 Aug 2016 16:06:30 +0200	[thread overview]
Message-ID: <1470665194-19619-4-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1470665194-19619-1-git-send-email-agraf@suse.de>

We want to be able to add configuration table entries from our own code as
well as from EFI payload code. Export the boot service function internally
too, so that we can reuse it.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 include/efi_loader.h          |  2 ++
 lib/efi_loader/efi_boottime.c | 22 +++++++++++++---------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 91d6a84..ac8b77a 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -130,6 +130,8 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
 			    bool overlap_only_ram);
 /* Called by board init to initialize the EFI memory map */
 int efi_memory_init(void);
+/* Adds new or overrides configuration table entry to the system table */
+efi_status_t efi_install_configuration_table(efi_guid_t *guid, void *table);
 
 #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
 extern void *efi_bounce_buffer;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index be6f5e8..3e7a48b 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -37,7 +37,7 @@ static bool efi_is_direct_boot = true;
  * In most cases we want to pass an FDT to the payload, so reserve one slot of
  * config table space for it. The pointer gets populated by do_bootefi_exec().
  */
-static struct efi_configuration_table EFI_RUNTIME_DATA efi_conf_table[1];
+static struct efi_configuration_table EFI_RUNTIME_DATA efi_conf_table[2];
 
 /*
  * The "gd" pointer lives in a register on ARM and AArch64 that we declare
@@ -375,31 +375,35 @@ static efi_status_t EFIAPI efi_locate_device_path(efi_guid_t *protocol,
 	return EFI_EXIT(EFI_NOT_FOUND);
 }
 
-static efi_status_t EFIAPI efi_install_configuration_table(efi_guid_t *guid,
-							   void *table)
+efi_status_t efi_install_configuration_table(efi_guid_t *guid, void *table)
 {
 	int i;
 
-	EFI_ENTRY("%p, %p", guid, table);
-
 	/* Check for guid override */
 	for (i = 0; i < systab.nr_tables; i++) {
 		if (!guidcmp(guid, &efi_conf_table[i].guid)) {
 			efi_conf_table[i].table = table;
-			return EFI_EXIT(EFI_SUCCESS);
+			return EFI_SUCCESS;
 		}
 	}
 
 	/* No override, check for overflow */
 	if (i >= ARRAY_SIZE(efi_conf_table))
-		return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+		return EFI_OUT_OF_RESOURCES;
 
 	/* Add a new entry */
 	memcpy(&efi_conf_table[i].guid, guid, sizeof(*guid));
 	efi_conf_table[i].table = table;
 	systab.nr_tables = i;
 
-	return EFI_EXIT(EFI_SUCCESS);
+	return EFI_SUCCESS;
+}
+
+static efi_status_t EFIAPI efi_install_configuration_table_ext(efi_guid_t *guid,
+							       void *table)
+{
+	EFI_ENTRY("%p, %p", guid, table);
+	return EFI_EXIT(efi_install_configuration_table(guid, table));
 }
 
 static efi_status_t EFIAPI efi_load_image(bool boot_policy,
@@ -750,7 +754,7 @@ static const struct efi_boot_services efi_boot_services = {
 	.register_protocol_notify = efi_register_protocol_notify,
 	.locate_handle = efi_locate_handle,
 	.locate_device_path = efi_locate_device_path,
-	.install_configuration_table = efi_install_configuration_table,
+	.install_configuration_table = efi_install_configuration_table_ext,
 	.load_image = efi_load_image,
 	.start_image = efi_start_image,
 	.exit = efi_exit,
-- 
2.6.6

  parent reply	other threads:[~2016-08-08 14:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 14:06 [U-Boot] [PATCH 0/7] efi_loader: Expose SMBIOS table Alexander Graf
2016-08-08 14:06 ` [U-Boot] [PATCH 1/7] x86: Move table csum into separate header Alexander Graf
2016-08-09  9:23   ` Bin Meng
2016-08-08 14:06 ` [U-Boot] [PATCH 2/7] x86: Move smbios generation into arch independent directory Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-08 14:06 ` Alexander Graf [this message]
2016-08-08 14:06 ` [U-Boot] [PATCH 4/7] smbios: Allow compilation on 64bit systems Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-08 14:06 ` [U-Boot] [PATCH 5/7] smbios: Expose in efi_loader as table Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-11  9:48     ` [U-Boot] [PATCH v2 " Alexander Graf
2016-08-12  1:30       ` Bin Meng
2016-08-12 17:20   ` [U-Boot] [PATCH " Simon Glass
2016-08-12 18:36     ` Alexander Graf
2016-08-12 20:07       ` Simon Glass
2016-08-16  8:38         ` Alexander Graf
2016-08-17  4:15           ` Simon Glass
2016-08-08 14:06 ` [U-Boot] [PATCH 6/7] efi_loader: Fix efi_install_configuration_table Alexander Graf
2016-08-08 14:06 ` [U-Boot] [PATCH 7/7] smbios: Provide serial number Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-11 21:45   ` [U-Boot] [PATCH v2 " Alexander Graf
2016-08-12  1:31     ` Bin Meng
2016-08-12 17:20       ` Simon Glass
2016-08-08 21:44 ` [U-Boot] [PATCH 0/7] efi_loader: Expose SMBIOS table Simon Glass
2016-08-09  3:42   ` Bin Meng
2016-08-09  6:48   ` Alexander Graf
2016-08-09 13:57     ` Simon Glass
2016-08-09 14:11       ` Alexander Graf
2016-08-09 14:35         ` Simon Glass
2016-08-10  7:29           ` Alexander Graf
2016-08-12 17:20             ` Simon Glass
2016-08-12 18:26               ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470665194-19619-4-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.