-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use upstreamed patches for apple-os-set
- Loading branch information
1 parent
6570a9c
commit 776ae76
Showing
4 changed files
with
314 additions
and
144 deletions.
There are no files selected for viewing
144 changes: 0 additions & 144 deletions
144
2010-efi-libstub-add-support-for-the-apple_set_os-protoco.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
From 0dad9ee3c13930fe8122f2efc936fcd1c277a00d Mon Sep 17 00:00:00 2001 | ||
From: Ard Biesheuvel <[email protected]> | ||
Date: Mon, 1 Jul 2024 18:29:59 +0200 | ||
Subject: efistub/smbios: Simplify SMBIOS enumeration API | ||
|
||
Update the efi_get_smbios_string() macro to take a pointer to the entire | ||
record struct rather than the header. This removes the need to pass the | ||
type explicitly, as it can be inferred from the typed pointer. Also, | ||
drop 'type' from the prototype of __efi_get_smbios_string(), as it is | ||
never referenced. | ||
|
||
Signed-off-by: Ard Biesheuvel <[email protected]> | ||
--- | ||
drivers/firmware/efi/libstub/arm64.c | 3 +-- | ||
drivers/firmware/efi/libstub/efistub.h | 9 ++++----- | ||
drivers/firmware/efi/libstub/smbios.c | 4 ++-- | ||
3 files changed, 7 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/drivers/firmware/efi/libstub/arm64.c b/drivers/firmware/efi/libstub/arm64.c | ||
index 446e35eaf3d943..e57cd3de0a00f4 100644 | ||
--- a/drivers/firmware/efi/libstub/arm64.c | ||
+++ b/drivers/firmware/efi/libstub/arm64.c | ||
@@ -39,8 +39,7 @@ static bool system_needs_vamap(void) | ||
static char const emag[] = "eMAG"; | ||
|
||
default: | ||
- version = efi_get_smbios_string(&record->header, 4, | ||
- processor_version); | ||
+ version = efi_get_smbios_string(record, processor_version); | ||
if (!version || (strncmp(version, altra, sizeof(altra) - 1) && | ||
strncmp(version, emag, sizeof(emag) - 1))) | ||
break; | ||
diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h | ||
index 27abb4ce029173..d33ccbc4a2c630 100644 | ||
--- a/drivers/firmware/efi/libstub/efistub.h | ||
+++ b/drivers/firmware/efi/libstub/efistub.h | ||
@@ -1204,14 +1204,13 @@ struct efi_smbios_type4_record { | ||
u16 thread_enabled; | ||
}; | ||
|
||
-#define efi_get_smbios_string(__record, __type, __name) ({ \ | ||
- int off = offsetof(struct efi_smbios_type ## __type ## _record, \ | ||
- __name); \ | ||
- __efi_get_smbios_string((__record), __type, off); \ | ||
+#define efi_get_smbios_string(__record, __field) ({ \ | ||
+ __typeof__(__record) __rec = __record; \ | ||
+ __efi_get_smbios_string(&__rec->header, &__rec->__field); \ | ||
}) | ||
|
||
const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record, | ||
- u8 type, int offset); | ||
+ const u8 *offset); | ||
|
||
void efi_remap_image(unsigned long image_base, unsigned alloc_size, | ||
unsigned long code_size); | ||
diff --git a/drivers/firmware/efi/libstub/smbios.c b/drivers/firmware/efi/libstub/smbios.c | ||
index c217de2cc8d56d..520c9079717a30 100644 | ||
--- a/drivers/firmware/efi/libstub/smbios.c | ||
+++ b/drivers/firmware/efi/libstub/smbios.c | ||
@@ -38,7 +38,7 @@ const struct efi_smbios_record *efi_get_smbios_record(u8 type) | ||
} | ||
|
||
const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record, | ||
- u8 type, int offset) | ||
+ const u8 *offset) | ||
{ | ||
const u8 *strtable; | ||
|
||
@@ -46,7 +46,7 @@ const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record, | ||
return NULL; | ||
|
||
strtable = (u8 *)record + record->length; | ||
- for (int i = 1; i < ((u8 *)record)[offset]; i++) { | ||
+ for (int i = 1; i < *offset; i++) { | ||
int len = strlen(strtable); | ||
|
||
if (!len) | ||
-- | ||
cgit 1.2.3-korg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
From 84810a21ecab70568586217f185998bcf34b450e Mon Sep 17 00:00:00 2001 | ||
From: Ard Biesheuvel <[email protected]> | ||
Date: Mon, 1 Jul 2024 09:35:33 +0200 | ||
Subject: x86/efistub: Enable SMBIOS protocol handling for x86 | ||
|
||
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. | ||
|
||
Reviewed-by: Lukas Wunner <[email protected]> | ||
Signed-off-by: Ard Biesheuvel <[email protected]> | ||
--- | ||
drivers/firmware/efi/libstub/Makefile | 2 +- | ||
drivers/firmware/efi/libstub/smbios.c | 39 ++++++++++++++++++++++------------- | ||
include/linux/efi.h | 4 ++-- | ||
3 files changed, 28 insertions(+), 17 deletions(-) | ||
|
||
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile | ||
index 06f0428a723cb8..1f32d6cf98d691 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 520c9079717a30..f31410d7e7e180 100644 | ||
--- a/drivers/firmware/efi/libstub/smbios.c | ||
+++ b/drivers/firmware/efi/libstub/smbios.c | ||
@@ -6,20 +6,31 @@ | ||
|
||
#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) | ||
diff --git a/include/linux/efi.h b/include/linux/efi.h | ||
index 418e555459da7c..2a539816a4362d 100644 | ||
--- a/include/linux/efi.h | ||
+++ b/include/linux/efi.h | ||
@@ -74,10 +74,10 @@ typedef void *efi_handle_t; | ||
*/ | ||
typedef guid_t efi_guid_t __aligned(__alignof__(u32)); | ||
|
||
-#define EFI_GUID(a, b, c, d...) (efi_guid_t){ { \ | ||
+#define EFI_GUID(a, b, c, d...) ((efi_guid_t){ { \ | ||
(a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ | ||
(b) & 0xff, ((b) >> 8) & 0xff, \ | ||
- (c) & 0xff, ((c) >> 8) & 0xff, d } } | ||
+ (c) & 0xff, ((c) >> 8) & 0xff, d } }) | ||
|
||
/* | ||
* Generic EFI table header | ||
-- | ||
cgit 1.2.3-korg | ||
|
Oops, something went wrong.