]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
efi/libstub/x86: Incorporate eboot.c into libstub
authorArd Biesheuvel <ardb@kernel.org>
Mon, 10 Feb 2020 16:02:36 +0000 (17:02 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Sun, 23 Feb 2020 20:57:15 +0000 (21:57 +0100)
Most of the EFI stub source files of all architectures reside under
drivers/firmware/efi/libstub, where they share a Makefile with special
CFLAGS and an include file with declarations that are only relevant
for stub code.

Currently, we carry a lot of stub specific stuff in linux/efi.h only
because eboot.c in arch/x86 needs them as well. So let's move eboot.c
into libstub/, and move the contents of eboot.h that we still care
about into efistub.h

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
arch/x86/boot/compressed/Makefile
arch/x86/boot/compressed/eboot.h [deleted file]
drivers/firmware/efi/libstub/Makefile
drivers/firmware/efi/libstub/efistub.h
drivers/firmware/efi/libstub/x86-stub.c [moved from arch/x86/boot/compressed/eboot.c with 99% similarity]

index 26050ae0b27e18c116cf409ff1c89262faa78141..e51879bdc51cffc2aa1bfc87da326328ba7b3a6a 100644 (file)
@@ -87,10 +87,7 @@ endif
 
 vmlinux-objs-$(CONFIG_ACPI) += $(obj)/acpi.o
 
-$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
-
-vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o \
-       $(objtree)/drivers/firmware/efi/libstub/lib.a
+vmlinux-objs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
 vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi_thunk_$(BITS).o
 
 # The compressed kernel is built with -fPIC/-fPIE so that a boot loader
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
deleted file mode 100644 (file)
index 99f3534..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef BOOT_COMPRESSED_EBOOT_H
-#define BOOT_COMPRESSED_EBOOT_H
-
-#define SEG_TYPE_DATA          (0 << 3)
-#define SEG_TYPE_READ_WRITE    (1 << 1)
-#define SEG_TYPE_CODE          (1 << 3)
-#define SEG_TYPE_EXEC_READ     (1 << 1)
-#define SEG_TYPE_TSS           ((1 << 3) | (1 << 0))
-#define SEG_OP_SIZE_32BIT      (1 << 0)
-#define SEG_GRANULARITY_4KB    (1 << 0)
-
-#define DESC_TYPE_CODE_DATA    (1 << 0)
-
-typedef union efi_uga_draw_protocol efi_uga_draw_protocol_t;
-
-union efi_uga_draw_protocol {
-       struct {
-               efi_status_t (__efiapi *get_mode)(efi_uga_draw_protocol_t *,
-                                                 u32*, u32*, u32*, u32*);
-               void *set_mode;
-               void *blt;
-       };
-       struct {
-               u32 get_mode;
-               u32 set_mode;
-               u32 blt;
-       } mixed_mode;
-};
-
-#endif /* BOOT_COMPRESSED_EBOOT_H */
index 7226d4b7175beadc1f923f76f9672974181ad602..bda59d82b7f68d5bc0bf71c2d223597923667620 100644 (file)
@@ -53,6 +53,7 @@ lib-$(CONFIG_EFI_ARMSTUB)     += arm-stub.o fdt.o string.o \
 
 lib-$(CONFIG_ARM)              += arm32-stub.o
 lib-$(CONFIG_ARM64)            += arm64-stub.o
+lib-$(CONFIG_X86)              += x86-stub.o
 CFLAGS_arm32-stub.o            := -DTEXT_OFFSET=$(TEXT_OFFSET)
 CFLAGS_arm64-stub.o            := -DTEXT_OFFSET=$(TEXT_OFFSET)
 
index c244b165005e818dc1df8f6b42479c25b052d4d1..55de118e82673614c34fb5b56d87391888345f63 100644 (file)
@@ -90,4 +90,20 @@ void *get_efi_config_table(efi_guid_t guid);
        efi_rt_call(set_variable, (efi_char16_t *)(name),       \
                    (efi_guid_t *)(vendor), __VA_ARGS__)
 
+typedef union efi_uga_draw_protocol efi_uga_draw_protocol_t;
+
+union efi_uga_draw_protocol {
+       struct {
+               efi_status_t (__efiapi *get_mode)(efi_uga_draw_protocol_t *,
+                                                 u32*, u32*, u32*, u32*);
+               void *set_mode;
+               void *blt;
+       };
+       struct {
+               u32 get_mode;
+               u32 set_mode;
+               u32 blt;
+       } mixed_mode;
+};
+
 #endif
similarity index 99%
rename from arch/x86/boot/compressed/eboot.c
rename to drivers/firmware/efi/libstub/x86-stub.c
index 55637135b50c5014f093150dd863d0cda46432b6..7e7c50883cce8d7cb553da06665e0c782b5977d6 100644 (file)
@@ -6,8 +6,6 @@
  *
  * ----------------------------------------------------------------------- */
 
-#pragma GCC visibility push(hidden)
-
 #include <linux/efi.h>
 #include <linux/pci.h>
 
@@ -17,8 +15,7 @@
 #include <asm/desc.h>
 #include <asm/boot.h>
 
-#include "../string.h"
-#include "eboot.h"
+#include "efistub.h"
 
 static efi_system_table_t *sys_table;
 extern const bool efi_is64;