From: Ard Biesheuvel <ardb+git@google.com>
To: linux-efi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
Aditya Garg <gargaditya08@live.com>,
Hans de Goede <hdegoede@redhat.com>,
Lukas Wunner <lukas@wunner.de>, Kerem Karabay <kekrby@gmail.com>,
Orlando Chamberlain <orlandoch.dev@gmail.com>
Subject: [PATCH v3 1/2] efistub/x86: Enable SMBIOS protocol handling for x86
Date: Mon, 1 Jul 2024 16:09:42 +0200 [thread overview]
Message-ID: <20240701140940.2340297-5-ardb+git@google.com> (raw)
In-Reply-To: <20240701140940.2340297-4-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
The smbios.c source file is not currently included in the x86 build, and
before we can do so, it needs some tweaks to build correctly in
combination with the EFI mixed mode support.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/libstub/Makefile | 2 +-
drivers/firmware/efi/libstub/smbios.c | 42 +++++++++++++-------
2 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 06f0428a723c..1f32d6cf98d6 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -76,7 +76,7 @@ lib-$(CONFIG_EFI_GENERIC_STUB) += efi-stub.o string.o intrinsics.o systable.o \
lib-$(CONFIG_ARM) += arm32-stub.o
lib-$(CONFIG_ARM64) += kaslr.o arm64.o arm64-stub.o smbios.o
-lib-$(CONFIG_X86) += x86-stub.o
+lib-$(CONFIG_X86) += x86-stub.o smbios.o
lib-$(CONFIG_X86_64) += x86-5lvl.o
lib-$(CONFIG_RISCV) += kaslr.o riscv.o riscv-stub.o
lib-$(CONFIG_LOONGARCH) += loongarch.o loongarch-stub.o
diff --git a/drivers/firmware/efi/libstub/smbios.c b/drivers/firmware/efi/libstub/smbios.c
index c217de2cc8d5..2b54b9c289be 100644
--- a/drivers/firmware/efi/libstub/smbios.c
+++ b/drivers/firmware/efi/libstub/smbios.c
@@ -6,30 +6,42 @@
#include "efistub.h"
-typedef struct efi_smbios_protocol efi_smbios_protocol_t;
-
-struct efi_smbios_protocol {
- efi_status_t (__efiapi *add)(efi_smbios_protocol_t *, efi_handle_t,
- u16 *, struct efi_smbios_record *);
- efi_status_t (__efiapi *update_string)(efi_smbios_protocol_t *, u16 *,
- unsigned long *, u8 *);
- efi_status_t (__efiapi *remove)(efi_smbios_protocol_t *, u16);
- efi_status_t (__efiapi *get_next)(efi_smbios_protocol_t *, u16 *, u8 *,
- struct efi_smbios_record **,
- efi_handle_t *);
-
- u8 major_version;
- u8 minor_version;
+typedef union efi_smbios_protocol efi_smbios_protocol_t;
+
+union efi_smbios_protocol {
+ struct {
+ efi_status_t (__efiapi *add)(efi_smbios_protocol_t *, efi_handle_t,
+ u16 *, struct efi_smbios_record *);
+ efi_status_t (__efiapi *update_string)(efi_smbios_protocol_t *, u16 *,
+ unsigned long *, u8 *);
+ efi_status_t (__efiapi *remove)(efi_smbios_protocol_t *, u16);
+ efi_status_t (__efiapi *get_next)(efi_smbios_protocol_t *, u16 *, u8 *,
+ struct efi_smbios_record **,
+ efi_handle_t *);
+
+ u8 major_version;
+ u8 minor_version;
+ };
+ struct {
+ u32 add;
+ u32 update_string;
+ u32 remove;
+ u32 get_next;
+
+ u8 major_version;
+ u8 minor_version;
+ } mixed_mode;
};
const struct efi_smbios_record *efi_get_smbios_record(u8 type)
{
+ static const efi_guid_t guid = EFI_SMBIOS_PROTOCOL_GUID;
struct efi_smbios_record *record;
efi_smbios_protocol_t *smbios;
efi_status_t status;
u16 handle = 0xfffe;
- status = efi_bs_call(locate_protocol, &EFI_SMBIOS_PROTOCOL_GUID, NULL,
+ status = efi_bs_call(locate_protocol, (efi_guid_t *)&guid, NULL,
(void **)&smbios) ?:
efi_call_proto(smbios, get_next, &handle, &type, &record, NULL);
if (status != EFI_SUCCESS)
--
2.45.2.803.g4e1b14247a-goog
next prev parent reply other threads:[~2024-07-01 14:10 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 14:09 [PATCH v3 0/2] efi/x86: Call set_os() protocol on dual GPU Macs Ard Biesheuvel
2024-07-01 14:09 ` Ard Biesheuvel [this message]
2024-07-01 14:09 ` [PATCH v3 2/2] x86/efistub: Call Apple set_os protocol on dual GPU Intel Macs Ard Biesheuvel
2024-07-01 14:17 ` [PATCH v3 0/2] efi/x86: Call set_os() protocol on dual GPU Macs Lukas Wunner
2024-07-01 19:42 ` Aditya Garg
2024-07-17 16:35 ` Aditya Garg
2024-07-17 16:46 ` Ard Biesheuvel
2024-07-17 16:52 ` Aditya Garg
2024-07-17 18:27 ` Sharpened Blade
2024-07-17 18:58 ` Lukas Wunner
2024-07-23 16:25 ` Aditya Garg
2024-07-23 16:26 ` Aditya Garg
2024-07-24 16:01 ` Lukas Wunner
2024-07-24 16:21 ` Aditya Garg
2024-07-24 16:28 ` Lukas Wunner
2024-07-24 16:30 ` Aditya Garg
2024-07-24 16:26 ` Aditya Garg
2024-07-24 16:31 ` Lukas Wunner
2024-07-24 16:34 ` Aditya Garg
2024-07-25 12:42 ` Ard Biesheuvel
2024-07-25 12:58 ` Aditya Garg
2024-07-25 12:39 ` Ard Biesheuvel
2024-07-25 12:55 ` Aditya Garg
2024-07-28 12:03 ` Orlando Chamberlain
2024-07-29 7:27 ` Ard Biesheuvel
2024-07-29 7:46 ` Aditya Garg
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=20240701140940.2340297-5-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=gargaditya08@live.com \
--cc=hdegoede@redhat.com \
--cc=kekrby@gmail.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=orlandoch.dev@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox