* [PATCH 0/12] EFI: drop arch efi
@ 2017-02-15 19:29 Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
` (3 more replies)
0 siblings, 4 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:29 UTC (permalink / raw)
To: barebox
Today the EFI is build as an other ARCH when in fact it's just a boot mode
so move it back to arch/x86 for the spicific x86 part and the common
to common and driver
The last 3 patches allow to debug EFI and prepare for more efi support
The following changes since commit b225bbf295c92263adbcec2c385c5e8d83542c72:
i.MX: esdhc: fix imx-esdhc driver for non-OF boards (2017-02-14 08:48:34 +0100)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git
for you to fetch changes up to df12536f83b485c9a4ee28f78637356c6abab6f6:
efi: add efi handle dump command (2017-02-15 07:32:24 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (12):
efi: move block io driver to driver/block
efi: move clocksource out of arch
efi: move bus driver to driver/efi
efi: move debug_ll.h to include/efi
efi: move startup and payload to common/efi
x86: move bios bootup code to arch/x86/bios
efi: move x86 efi boot support to x86 arch
ARCH: efi: Finally drop it as now we can build efi bootup from x86
efi: bus: add firmware vendor and resision and tables info
efi: add minor and major to the bus and display it at boot
efi-gui: add Timestamp Protocol GUID definition
efi: add efi handle dump command
Documentation/boards/efi.rst | 2 +-
arch/efi/Kconfig | 51 ---------------------------------------------------
arch/efi/Makefile | 43 -------------------------------------------
arch/efi/efi/Makefile | 2 --
arch/efi/include/asm/barebox.h | 1 -
arch/efi/include/asm/bitops.h | 22 ----------------------
arch/efi/include/asm/bitsperlong.h | 10 ----------
arch/efi/include/asm/byteorder.h | 8 --------
arch/efi/include/asm/common.h | 4 ----
arch/efi/include/asm/dma.h | 13 -------------
arch/efi/include/asm/elf.h | 60 ------------------------------------------------------------
arch/efi/include/asm/io.h | 55 -------------------------------------------------------
arch/efi/include/asm/posix_types.h | 1 -
arch/efi/include/asm/sections.h | 1 -
arch/efi/include/asm/string.h | 1 -
arch/efi/include/asm/swab.h | 6 ------
arch/efi/include/asm/types.h | 65 -----------------------------------------------------------------
arch/efi/include/asm/unaligned.h | 19 -------------------
arch/efi/lib/asm-offsets.c | 12 ------------
arch/x86/Kconfig | 53 ++++++++++++++++++++++++++++++++++++++++++++++-------
arch/x86/Makefile | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
arch/x86/bios/Makefile | 3 +++
arch/x86/{lib => bios}/bios_disk.S | 0
arch/x86/{lib => bios}/memory16.S | 0
arch/x86/{lib => bios}/traveler.S | 0
arch/{efi => x86}/configs/efi_defconfig | 2 +-
arch/x86/configs/generic_defconfig | 1 +
arch/x86/include/asm/elf.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
arch/x86/include/asm/io.h | 71 +++++++++++++++++++++++++++++++++--------------------------------------
arch/x86/include/asm/types.h | 51 +++++++++++++++++++++++++++++++++------------------
arch/x86/include/asm/unaligned.h | 5 +++++
arch/x86/lib/Makefile | 5 ++---
arch/x86/lib/asm-offsets.c | 7 +++++++
arch/{efi/lib => x86/mach-efi}/.gitignore | 0
arch/{efi/lib => x86/mach-efi}/Makefile | 0
arch/{efi/lib => x86/mach-efi}/crt0-efi-ia32.S | 0
arch/{efi/lib => x86/mach-efi}/crt0-efi-x86_64.S | 0
arch/{efi/lib => x86/mach-efi}/elf_ia32_efi.lds.S | 0
arch/{efi/lib => x86/mach-efi}/elf_x86_64_efi.lds.S | 1 -
arch/x86/mach-efi/include/mach/barebox.lds.h | 0
arch/x86/mach-efi/include/mach/debug_ll.h | 1 +
arch/{efi/lib => x86/mach-efi}/reloc_ia32.c | 0
arch/{efi/lib => x86/mach-efi}/reloc_x86_64.c | 0
commands/Kconfig | 2 +-
commands/edit.c | 2 +-
common/Makefile | 1 +
common/efi-guid.c | 6 ++++++
common/efi/Makefile | 3 +++
{arch/efi => common}/efi/efi-image.c | 4 ++--
{arch/efi => common}/efi/efi.c | 6 +++---
{arch/efi => common}/efi/env-efi/network/eth0-discover | 0
common/memory.c | 2 +-
drivers/Kconfig | 1 +
drivers/Makefile | 2 ++
drivers/block/Makefile | 1 +
{arch/efi/efi => drivers/block}/efi-block-io.c | 4 ++--
drivers/clocksource/Kconfig | 4 ++++
drivers/clocksource/Makefile | 1 +
arch/efi/efi/clocksource.c => drivers/clocksource/efi.c | 2 +-
drivers/efi/Kconfig | 2 ++
drivers/efi/Makefile | 1 +
{arch/efi => drivers}/efi/efi-device.c | 205 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
drivers/net/Kconfig | 2 +-
drivers/net/efi-snp.c | 4 ++--
drivers/of/Kconfig | 2 +-
drivers/serial/Kconfig | 2 +-
drivers/serial/efi-stdio.c | 2 +-
fs/Kconfig | 4 ++--
fs/efi.c | 4 ++--
fs/efivarfs.c | 4 ++--
include/efi.h | 20 ++++++++++++++++++--
{arch/efi/include/mach => include/efi}/debug_ll.h | 2 +-
{arch/efi/include/mach => include/efi}/efi-device.h | 6 +++---
{arch/efi/include/mach => include/efi}/efi.h | 0
74 files changed, 525 insertions(+), 501 deletions(-)
delete mode 100644 arch/efi/Kconfig
delete mode 100644 arch/efi/Makefile
delete mode 100644 arch/efi/efi/Makefile
delete mode 100644 arch/efi/include/asm/barebox.h
delete mode 100644 arch/efi/include/asm/bitops.h
delete mode 100644 arch/efi/include/asm/bitsperlong.h
delete mode 100644 arch/efi/include/asm/byteorder.h
delete mode 100644 arch/efi/include/asm/common.h
delete mode 100644 arch/efi/include/asm/dma.h
delete mode 100644 arch/efi/include/asm/elf.h
delete mode 100644 arch/efi/include/asm/io.h
delete mode 100644 arch/efi/include/asm/posix_types.h
delete mode 100644 arch/efi/include/asm/sections.h
delete mode 100644 arch/efi/include/asm/string.h
delete mode 100644 arch/efi/include/asm/swab.h
delete mode 100644 arch/efi/include/asm/types.h
delete mode 100644 arch/efi/include/asm/unaligned.h
delete mode 100644 arch/efi/lib/asm-offsets.c
create mode 100644 arch/x86/bios/Makefile
rename arch/x86/{lib => bios}/bios_disk.S (100%)
rename arch/x86/{lib => bios}/memory16.S (100%)
rename arch/x86/{lib => bios}/traveler.S (100%)
rename arch/{efi => x86}/configs/efi_defconfig (98%)
rename arch/{efi/lib => x86/mach-efi}/.gitignore (100%)
rename arch/{efi/lib => x86/mach-efi}/Makefile (100%)
rename arch/{efi/lib => x86/mach-efi}/crt0-efi-ia32.S (100%)
rename arch/{efi/lib => x86/mach-efi}/crt0-efi-x86_64.S (100%)
rename arch/{efi/lib => x86/mach-efi}/elf_ia32_efi.lds.S (100%)
rename arch/{efi/lib => x86/mach-efi}/elf_x86_64_efi.lds.S (98%)
create mode 100644 arch/x86/mach-efi/include/mach/barebox.lds.h
create mode 100644 arch/x86/mach-efi/include/mach/debug_ll.h
rename arch/{efi/lib => x86/mach-efi}/reloc_ia32.c (100%)
rename arch/{efi/lib => x86/mach-efi}/reloc_x86_64.c (100%)
create mode 100644 common/efi/Makefile
rename {arch/efi => common}/efi/efi-image.c (99%)
rename {arch/efi => common}/efi/efi.c (99%)
rename {arch/efi => common}/efi/env-efi/network/eth0-discover (100%)
create mode 100644 drivers/block/Makefile
rename {arch/efi/efi => drivers/block}/efi-block-io.c (98%)
rename arch/efi/efi/clocksource.c => drivers/clocksource/efi.c (97%)
create mode 100644 drivers/efi/Kconfig
create mode 100644 drivers/efi/Makefile
rename {arch/efi => drivers}/efi/efi-device.c (63%)
rename {arch/efi/include/mach => include/efi}/debug_ll.h (93%)
rename {arch/efi/include/mach => include/efi}/efi-device.h (91%)
rename {arch/efi/include/mach => include/efi}/efi.h (100%)
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 01/12] efi: move block io driver to driver/block
2017-02-15 19:29 [PATCH 0/12] EFI: drop arch efi Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-15 19:34 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 02/12] efi: move clocksource out of arch Jean-Christophe PLAGNIOL-VILLARD
` (7 more replies)
2017-02-16 7:38 ` [PATCH 0/12] EFI: drop arch efi Michael Olbrich
` (2 subsequent siblings)
3 siblings, 8 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:34 UTC (permalink / raw)
To: barebox
so it can be reused on any ARCH
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/efi/efi/Makefile | 5 ++++-
drivers/Makefile | 1 +
drivers/block/Makefile | 1 +
{arch/efi/efi => drivers/block}/efi-block-io.c | 0
4 files changed, 6 insertions(+), 1 deletion(-)
create mode 100644 drivers/block/Makefile
rename {arch/efi/efi => drivers/block}/efi-block-io.c (100%)
diff --git a/arch/efi/efi/Makefile b/arch/efi/efi/Makefile
index a856e5907..f088c7a94 100644
--- a/arch/efi/efi/Makefile
+++ b/arch/efi/efi/Makefile
@@ -1,2 +1,5 @@
-obj-y += efi.o clocksource.o efi-block-io.o efi-device.o efi-image.o
+obj-y += clocksource.o
+obj-y += efi.o
+obj-y += efi-device.o
+obj-y += efi-image.o
bbenv-y += env-efi
diff --git a/drivers/Makefile b/drivers/Makefile
index 6a70f6ee1..9ff261ad2 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -1,4 +1,5 @@
obj-y += base/
+obj-y += block/
obj-$(CONFIG_ARM_AMBA) += amba/
obj-y += net/
obj-y += serial/
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
new file mode 100644
index 000000000..8812c0fae
--- /dev/null
+++ b/drivers/block/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_EFI_BOOTUP) += efi-block-io.o
diff --git a/arch/efi/efi/efi-block-io.c b/drivers/block/efi-block-io.c
similarity index 100%
rename from arch/efi/efi/efi-block-io.c
rename to drivers/block/efi-block-io.c
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 02/12] efi: move clocksource out of arch
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-15 19:34 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 03/12] efi: move bus driver to driver/efi Jean-Christophe PLAGNIOL-VILLARD
` (6 subsequent siblings)
7 siblings, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:34 UTC (permalink / raw)
To: barebox
as efi is not an arch but a boot mode from where barebox is started
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/efi/Kconfig | 1 +
arch/efi/efi/Makefile | 1 -
drivers/clocksource/Kconfig | 4 ++++
drivers/clocksource/Makefile | 1 +
arch/efi/efi/clocksource.c => drivers/clocksource/efi.c | 0
5 files changed, 6 insertions(+), 1 deletion(-)
rename arch/efi/efi/clocksource.c => drivers/clocksource/efi.c (100%)
diff --git a/arch/efi/Kconfig b/arch/efi/Kconfig
index d8d0592e5..01301c04f 100644
--- a/arch/efi/Kconfig
+++ b/arch/efi/Kconfig
@@ -7,6 +7,7 @@ config ARCH_EFI
select EFI_DEVICEPATH
select PRINTF_UUID
select GENERIC_FIND_NEXT_BIT
+ select CLOCKSOURCE_EFI
config ARCH_TEXT_BASE
hex
diff --git a/arch/efi/efi/Makefile b/arch/efi/efi/Makefile
index f088c7a94..51db60b88 100644
--- a/arch/efi/efi/Makefile
+++ b/arch/efi/efi/Makefile
@@ -1,4 +1,3 @@
-obj-y += clocksource.o
obj-y += efi.o
obj-y += efi-device.o
obj-y += efi-image.o
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index f1ab554f9..ae1f10eae 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -34,6 +34,10 @@ config CLOCKSOURCE_DUMMY_RATE
The option CONFIG_CLOCKSOURCE_DUMMY_RATE is used to adjust this clocksource.
The bigger rate valuest makes clocksource "faster".
+config CLOCKSOURCE_EFI
+ bool
+ depends on ARCH_EFI
+
config CLOCKSOURCE_MVEBU
bool
depends on ARCH_MVEBU
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 39982ffb2..e83fdeeec 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_ARM_SMP_TWD) += arm_smp_twd.o
obj-$(CONFIG_CLOCKSOURCE_BCM283X) += bcm2835.o
obj-$(CONFIG_CLOCKSOURCE_CLPS711X) += clps711x.o
obj-$(CONFIG_CLOCKSOURCE_DIGIC) += digic.o
+obj-$(CONFIG_CLOCKSOURCE_EFI) += efi.o
obj-$(CONFIG_CLOCKSOURCE_MVEBU) += mvebu.o
obj-$(CONFIG_CLOCKSOURCE_NOMADIK) += nomadik.o
obj-$(CONFIG_CLOCKSOURCE_ORION) += orion.o
diff --git a/arch/efi/efi/clocksource.c b/drivers/clocksource/efi.c
similarity index 100%
rename from arch/efi/efi/clocksource.c
rename to drivers/clocksource/efi.c
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 03/12] efi: move bus driver to driver/efi
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 02/12] efi: move clocksource out of arch Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-15 19:34 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 04/12] efi: move debug_ll.h to include/efi Jean-Christophe PLAGNIOL-VILLARD
` (5 subsequent siblings)
7 siblings, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:34 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/efi/Kconfig | 1 +
arch/efi/efi/Makefile | 1 -
arch/efi/efi/efi-image.c | 4 ++--
arch/efi/efi/efi.c | 4 ++--
arch/efi/include/mach/debug_ll.h | 2 +-
drivers/Kconfig | 1 +
drivers/Makefile | 1 +
drivers/block/efi-block-io.c | 4 ++--
drivers/clocksource/efi.c | 2 +-
drivers/efi/Kconfig | 2 ++
drivers/efi/Makefile | 1 +
{arch/efi => drivers}/efi/efi-device.c | 4 ++--
drivers/net/efi-snp.c | 4 ++--
drivers/serial/efi-stdio.c | 2 +-
fs/efi.c | 4 ++--
fs/efivarfs.c | 4 ++--
{arch/efi/include/mach => include/efi}/efi-device.h | 6 +++---
{arch/efi/include/mach => include/efi}/efi.h | 0
18 files changed, 26 insertions(+), 21 deletions(-)
create mode 100644 drivers/efi/Kconfig
create mode 100644 drivers/efi/Makefile
rename {arch/efi => drivers}/efi/efi-device.c (99%)
rename {arch/efi/include/mach => include/efi}/efi-device.h (91%)
rename {arch/efi/include/mach => include/efi}/efi.h (100%)
diff --git a/arch/efi/Kconfig b/arch/efi/Kconfig
index 01301c04f..561aac2b2 100644
--- a/arch/efi/Kconfig
+++ b/arch/efi/Kconfig
@@ -4,6 +4,7 @@ config ARCH_EFI
select HAS_DEBUG_LL
select HAS_KALLSYMS
select EFI_GUID
+ select EFI_BOOTUP
select EFI_DEVICEPATH
select PRINTF_UUID
select GENERIC_FIND_NEXT_BIT
diff --git a/arch/efi/efi/Makefile b/arch/efi/efi/Makefile
index 51db60b88..ef19969f9 100644
--- a/arch/efi/efi/Makefile
+++ b/arch/efi/efi/Makefile
@@ -1,4 +1,3 @@
obj-y += efi.o
-obj-y += efi-device.o
obj-y += efi-image.o
bbenv-y += env-efi
diff --git a/arch/efi/efi/efi-image.c b/arch/efi/efi/efi-image.c
index 27f3c1b39..885348da4 100644
--- a/arch/efi/efi/efi-image.c
+++ b/arch/efi/efi/efi-image.c
@@ -36,8 +36,8 @@
#include <libfile.h>
#include <binfmt.h>
#include <wchar.h>
-#include <mach/efi.h>
-#include <mach/efi-device.h>
+#include <efi/efi.h>
+#include <efi/efi-device.h>
struct linux_kernel_header {
/* first sector of the image */
diff --git a/arch/efi/efi/efi.c b/arch/efi/efi/efi.c
index 36ac016a9..b14e1e823 100644
--- a/arch/efi/efi/efi.c
+++ b/arch/efi/efi/efi.c
@@ -38,8 +38,8 @@
#include <wchar.h>
#include <envfs.h>
#include <efi.h>
-#include <mach/efi.h>
-#include <mach/efi-device.h>
+#include <efi/efi.h>
+#include <efi/efi-device.h>
efi_runtime_services_t *RT;
efi_boot_services_t *BS;
diff --git a/arch/efi/include/mach/debug_ll.h b/arch/efi/include/mach/debug_ll.h
index 0fb2cb8c2..4ca72de31 100644
--- a/arch/efi/include/mach/debug_ll.h
+++ b/arch/efi/include/mach/debug_ll.h
@@ -5,7 +5,7 @@
#define EFI_DEBUG_CLEAR_MEMORY 0
#include <efi.h>
-#include <mach/efi.h>
+#include <efi/efi.h>
static inline void PUTC_LL(char c)
{
diff --git a/drivers/Kconfig b/drivers/Kconfig
index cc086ac2d..bf31115fa 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -1,5 +1,6 @@
menu "Drivers"
+source "drivers/efi/Kconfig"
source "drivers/of/Kconfig"
source "drivers/aiodev/Kconfig"
source "drivers/amba/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 9ff261ad2..0fadf4e44 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -1,6 +1,7 @@
obj-y += base/
obj-y += block/
obj-$(CONFIG_ARM_AMBA) += amba/
+obj-$(CONFIG_EFI_BOOTUP) += efi/
obj-y += net/
obj-y += serial/
obj-y += mtd/
diff --git a/drivers/block/efi-block-io.c b/drivers/block/efi-block-io.c
index e02d3b49c..a4d9d3a95 100644
--- a/drivers/block/efi-block-io.c
+++ b/drivers/block/efi-block-io.c
@@ -12,8 +12,8 @@
#include <efi.h>
#include <block.h>
#include <disks.h>
-#include <mach/efi.h>
-#include <mach/efi-device.h>
+#include <efi/efi.h>
+#include <efi/efi-device.h>
#define EFI_BLOCK_IO_PROTOCOL_REVISION2 0x00020001
#define EFI_BLOCK_IO_PROTOCOL_REVISION3 ((2<<16) | (31))
diff --git a/drivers/clocksource/efi.c b/drivers/clocksource/efi.c
index c92c35b11..59fd9918a 100644
--- a/drivers/clocksource/efi.c
+++ b/drivers/clocksource/efi.c
@@ -1,6 +1,6 @@
#include <common.h>
#include <efi.h>
-#include <mach/efi.h>
+#include <efi/efi.h>
#include <clock.h>
#ifdef __x86_64__
diff --git a/drivers/efi/Kconfig b/drivers/efi/Kconfig
new file mode 100644
index 000000000..2cd9dd504
--- /dev/null
+++ b/drivers/efi/Kconfig
@@ -0,0 +1,2 @@
+config EFI_BOOTUP
+ bool
diff --git a/drivers/efi/Makefile b/drivers/efi/Makefile
new file mode 100644
index 000000000..de31212f2
--- /dev/null
+++ b/drivers/efi/Makefile
@@ -0,0 +1 @@
+obj-y += efi-device.o
diff --git a/arch/efi/efi/efi-device.c b/drivers/efi/efi-device.c
similarity index 99%
rename from arch/efi/efi/efi-device.c
rename to drivers/efi/efi-device.c
index 678a28399..2864d0cf1 100644
--- a/arch/efi/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -27,8 +27,8 @@
#include <wchar.h>
#include <init.h>
#include <efi.h>
-#include <mach/efi.h>
-#include <mach/efi-device.h>
+#include <efi/efi.h>
+#include <efi/efi-device.h>
#include <linux/err.h>
int efi_locate_handle(enum efi_locate_search_type search_type,
diff --git a/drivers/net/efi-snp.c b/drivers/net/efi-snp.c
index 963d539db..23edc9f04 100644
--- a/drivers/net/efi-snp.c
+++ b/drivers/net/efi-snp.c
@@ -23,8 +23,8 @@
#include <net.h>
#include <init.h>
#include <efi.h>
-#include <mach/efi.h>
-#include <mach/efi-device.h>
+#include <efi/efi.h>
+#include <efi/efi-device.h>
struct efi_network_statistics {
uint64_t RxTotalFrames;
diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index 5ab917386..0703f727e 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -25,7 +25,7 @@
#include <efi.h>
#include <readkey.h>
#include <linux/ctype.h>
-#include <mach/efi.h>
+#include <efi/efi.h>
#define EFI_SHIFT_STATE_VALID 0x80000000
#define EFI_RIGHT_CONTROL_PRESSED 0x00000004
diff --git a/fs/efi.c b/fs/efi.c
index 7310d7d27..0c0f52e87 100644
--- a/fs/efi.c
+++ b/fs/efi.c
@@ -31,8 +31,8 @@
#include <wchar.h>
#include <efi.h>
#include <libfile.h>
-#include <mach/efi.h>
-#include <mach/efi-device.h>
+#include <efi/efi.h>
+#include <efi/efi-device.h>
#include <linux/stddef.h>
/* Open modes */
diff --git a/fs/efivarfs.c b/fs/efivarfs.c
index 86cdcf0b5..bf7351e6d 100644
--- a/fs/efivarfs.c
+++ b/fs/efivarfs.c
@@ -31,8 +31,8 @@
#include <wchar.h>
#include <linux/err.h>
#include <linux/ctype.h>
-#include <mach/efi.h>
-#include <mach/efi-device.h>
+#include <efi/efi.h>
+#include <efi/efi-device.h>
struct efivarfs_inode {
s16 *name;
diff --git a/arch/efi/include/mach/efi-device.h b/include/efi/efi-device.h
similarity index 91%
rename from arch/efi/include/mach/efi-device.h
rename to include/efi/efi-device.h
index fe074a44b..8f5f1f3f1 100644
--- a/arch/efi/include/mach/efi-device.h
+++ b/include/efi/efi-device.h
@@ -1,5 +1,5 @@
-#ifndef __MACH_EFI_DEVICE_H
-#define __MACH_EFI_DEVICE_H
+#ifndef __EFI_EFI_DEVICE_H
+#define __EFI_EFI_DEVICE_H
struct efi_device {
struct device_d dev;
@@ -42,4 +42,4 @@ static inline int efi_driver_register(struct efi_driver *efidrv)
int efi_connect_all(void);
void efi_register_devices(void);
-#endif /* __MACH_EFI_DEVICE_H */
+#endif /* __EFI_EFI_DEVICE_H */
diff --git a/arch/efi/include/mach/efi.h b/include/efi/efi.h
similarity index 100%
rename from arch/efi/include/mach/efi.h
rename to include/efi/efi.h
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 04/12] efi: move debug_ll.h to include/efi
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 02/12] efi: move clocksource out of arch Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 03/12] efi: move bus driver to driver/efi Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-15 19:34 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 05/12] efi: move startup and payload to common/efi Jean-Christophe PLAGNIOL-VILLARD
` (4 subsequent siblings)
7 siblings, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:34 UTC (permalink / raw)
To: barebox
so other arch could include it too
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/efi/include/mach/debug_ll.h | 21 +--------------------
{arch/efi/include/mach => include/efi}/debug_ll.h | 0
2 files changed, 1 insertion(+), 20 deletions(-)
copy {arch/efi/include/mach => include/efi}/debug_ll.h (100%)
diff --git a/arch/efi/include/mach/debug_ll.h b/arch/efi/include/mach/debug_ll.h
index 4ca72de31..e144d86e0 100644
--- a/arch/efi/include/mach/debug_ll.h
+++ b/arch/efi/include/mach/debug_ll.h
@@ -1,20 +1 @@
-#ifndef __MACH_DEBUG_LL_H__
-#define __MACH_DEBUG_LL_H__
-
-#define EFI_DEBUG 0
-#define EFI_DEBUG_CLEAR_MEMORY 0
-
-#include <efi.h>
-#include <efi/efi.h>
-
-static inline void PUTC_LL(char c)
-{
- uint16_t str[2] = {};
- struct efi_simple_text_output_protocol *con_out = efi_sys_table->con_out;
-
- str[0] = c;
-
- con_out->output_string(con_out, str);
-}
-
-#endif
+#include <efi/debug_ll.h>
diff --git a/arch/efi/include/mach/debug_ll.h b/include/efi/debug_ll.h
similarity index 100%
copy from arch/efi/include/mach/debug_ll.h
copy to include/efi/debug_ll.h
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 05/12] efi: move startup and payload to common/efi
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
2017-02-15 19:34 ` [PATCH 04/12] efi: move debug_ll.h to include/efi Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-15 19:34 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 06/12] x86: move bios bootup code to arch/x86/bios Jean-Christophe PLAGNIOL-VILLARD
` (3 subsequent siblings)
7 siblings, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:34 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/efi/Makefile | 2 +-
common/Makefile | 1 +
{arch/efi => common}/efi/Makefile | 0
{arch/efi => common}/efi/efi-image.c | 0
{arch/efi => common}/efi/efi.c | 2 +-
{arch/efi => common}/efi/env-efi/network/eth0-discover | 0
6 files changed, 3 insertions(+), 2 deletions(-)
rename {arch/efi => common}/efi/Makefile (100%)
rename {arch/efi => common}/efi/efi-image.c (100%)
rename {arch/efi => common}/efi/efi.c (99%)
rename {arch/efi => common}/efi/env-efi/network/eth0-discover (100%)
diff --git a/arch/efi/Makefile b/arch/efi/Makefile
index 32a1c152b..c87a421ad 100644
--- a/arch/efi/Makefile
+++ b/arch/efi/Makefile
@@ -40,4 +40,4 @@ barebox.efi: $(KBUILD_BINARY) FORCE
KBUILD_IMAGE := barebox.efi
-common-y += arch/efi/efi/ arch/efi/lib/
+common-y += arch/efi/lib/
diff --git a/common/Makefile b/common/Makefile
index 869b15a92..5f58c81d2 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BOOTCHOOSER) += bootchooser.o
obj-$(CONFIG_UIMAGE) += image.o uimage.o
obj-$(CONFIG_FITIMAGE) += image-fit.o
obj-$(CONFIG_MENUTREE) += menutree.o
+obj-$(CONFIG_EFI_BOOTUP) += efi/
obj-$(CONFIG_EFI_GUID) += efi-guid.o
obj-$(CONFIG_EFI_DEVICEPATH) += efi-devicepath.o
lwl-$(CONFIG_IMD) += imd-barebox.o
diff --git a/arch/efi/efi/Makefile b/common/efi/Makefile
similarity index 100%
rename from arch/efi/efi/Makefile
rename to common/efi/Makefile
diff --git a/arch/efi/efi/efi-image.c b/common/efi/efi-image.c
similarity index 100%
rename from arch/efi/efi/efi-image.c
rename to common/efi/efi-image.c
diff --git a/arch/efi/efi/efi.c b/common/efi/efi.c
similarity index 99%
rename from arch/efi/efi/efi.c
rename to common/efi/efi.c
index b14e1e823..217a6bea8 100644
--- a/arch/efi/efi/efi.c
+++ b/common/efi/efi.c
@@ -119,7 +119,7 @@ struct efi_boot {
void *binary;
};
-struct efi_boot *efi_get_boot(int num)
+static struct efi_boot *efi_get_boot(int num)
{
struct efi_boot *boot = xzalloc(sizeof(*boot));
void *buf, *ptr;
diff --git a/arch/efi/efi/env-efi/network/eth0-discover b/common/efi/env-efi/network/eth0-discover
similarity index 100%
rename from arch/efi/efi/env-efi/network/eth0-discover
rename to common/efi/env-efi/network/eth0-discover
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 06/12] x86: move bios bootup code to arch/x86/bios
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
` (3 preceding siblings ...)
2017-02-15 19:34 ` [PATCH 05/12] efi: move startup and payload to common/efi Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-15 19:34 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 07/12] efi: move x86 efi boot support to x86 arch Jean-Christophe PLAGNIOL-VILLARD
` (2 subsequent siblings)
7 siblings, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:34 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/x86/Makefile | 1 +
arch/x86/bios/Makefile | 3 +++
arch/x86/{lib => bios}/bios_disk.S | 0
arch/x86/{lib => bios}/memory16.S | 0
arch/x86/{lib => bios}/traveler.S | 0
arch/x86/lib/Makefile | 3 ---
6 files changed, 4 insertions(+), 3 deletions(-)
create mode 100644 arch/x86/bios/Makefile
rename arch/x86/{lib => bios}/bios_disk.S (100%)
rename arch/x86/{lib => bios}/memory16.S (100%)
rename arch/x86/{lib => bios}/traveler.S (100%)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index da17d70bd..640c24b62 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -40,6 +40,7 @@ endif
common-y += $(BOARD) $(MACH)
common-y += arch/x86/lib/
common-y += arch/x86/boot/
+common-$(CONFIG_X86_BIOS_BRINGUP) += arch/x86/bios/
# arch/x86/cpu/
diff --git a/arch/x86/bios/Makefile b/arch/x86/bios/Makefile
new file mode 100644
index 000000000..414ee42a4
--- /dev/null
+++ b/arch/x86/bios/Makefile
@@ -0,0 +1,3 @@
+obj-y += memory16.o
+obj-y += traveler.o
+obj-y += bios_disk.o
diff --git a/arch/x86/lib/bios_disk.S b/arch/x86/bios/bios_disk.S
similarity index 100%
rename from arch/x86/lib/bios_disk.S
rename to arch/x86/bios/bios_disk.S
diff --git a/arch/x86/lib/memory16.S b/arch/x86/bios/memory16.S
similarity index 100%
rename from arch/x86/lib/memory16.S
rename to arch/x86/bios/memory16.S
diff --git a/arch/x86/lib/traveler.S b/arch/x86/bios/traveler.S
similarity index 100%
rename from arch/x86/lib/traveler.S
rename to arch/x86/bios/traveler.S
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index b67629f11..6054b9e3f 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -3,7 +3,4 @@ obj-y += memory.o
obj-y += gdt.o
# needed, when running via a 16 bit BIOS
-obj-$(CONFIG_X86_BIOS_BRINGUP) += memory16.o
-obj-$(CONFIG_X86_BIOS_BRINGUP) += traveler.o
-obj-$(CONFIG_X86_BIOS_BRINGUP) += bios_disk.o
obj-$(CONFIG_CMD_LINUX16) += linux_start.o
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 07/12] efi: move x86 efi boot support to x86 arch
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
` (4 preceding siblings ...)
2017-02-15 19:34 ` [PATCH 06/12] x86: move bios bootup code to arch/x86/bios Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-15 19:34 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-16 7:27 ` Michael Olbrich
2017-02-27 7:50 ` Sascha Hauer
2017-02-15 19:34 ` [PATCH 08/12] ARCH: efi: Finally drop it as now we can build efi bootup from x86 Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 09/12] efi: bus: add firmware vendor and resision and tables info Jean-Christophe PLAGNIOL-VILLARD
7 siblings, 2 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:34 UTC (permalink / raw)
To: barebox
prepare to drop the efi arch as efi boot up is not arch sepecific
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
Documentation/boards/efi.rst | 2 +-
arch/x86/Kconfig | 53 ++++++++++++--
arch/x86/Makefile | 74 +++++++++++++++++--
arch/x86/configs/efi_defconfig | 78 ++++++++++++++++++++
arch/x86/configs/generic_defconfig | 1 +
arch/x86/include/asm/elf.h | 86 +++++++++++++++-------
arch/x86/include/asm/io.h | 71 +++++++++---------
arch/x86/include/asm/types.h | 51 ++++++++-----
arch/x86/include/asm/unaligned.h | 5 ++
arch/x86/lib/Makefile | 2 +
arch/x86/lib/asm-offsets.c | 7 ++
arch/x86/mach-efi/.gitignore | 2 +
arch/x86/mach-efi/Makefile | 4 +
arch/x86/mach-efi/crt0-efi-ia32.S | 76 +++++++++++++++++++
arch/x86/mach-efi/crt0-efi-x86_64.S | 75 +++++++++++++++++++
arch/x86/mach-efi/elf_ia32_efi.lds.S | 106 +++++++++++++++++++++++++++
arch/x86/mach-efi/elf_x86_64_efi.lds.S | 99 +++++++++++++++++++++++++
arch/x86/mach-efi/include/mach/barebox.lds.h | 0
arch/x86/mach-efi/include/mach/debug_ll.h | 1 +
arch/x86/mach-efi/reloc_ia32.c | 97 ++++++++++++++++++++++++
arch/x86/mach-efi/reloc_x86_64.c | 96 ++++++++++++++++++++++++
commands/Kconfig | 2 +-
commands/edit.c | 2 +-
common/memory.c | 2 +-
drivers/clocksource/Kconfig | 2 +-
drivers/net/Kconfig | 2 +-
drivers/of/Kconfig | 2 +-
drivers/serial/Kconfig | 2 +-
fs/Kconfig | 4 +-
include/efi.h | 2 +-
30 files changed, 899 insertions(+), 107 deletions(-)
create mode 100644 arch/x86/configs/efi_defconfig
rewrite arch/x86/include/asm/elf.h (97%)
create mode 100644 arch/x86/mach-efi/.gitignore
create mode 100644 arch/x86/mach-efi/Makefile
create mode 100644 arch/x86/mach-efi/crt0-efi-ia32.S
create mode 100644 arch/x86/mach-efi/crt0-efi-x86_64.S
create mode 100644 arch/x86/mach-efi/elf_ia32_efi.lds.S
create mode 100644 arch/x86/mach-efi/elf_x86_64_efi.lds.S
create mode 100644 arch/x86/mach-efi/include/mach/barebox.lds.h
create mode 100644 arch/x86/mach-efi/include/mach/debug_ll.h
create mode 100644 arch/x86/mach-efi/reloc_ia32.c
create mode 100644 arch/x86/mach-efi/reloc_x86_64.c
diff --git a/Documentation/boards/efi.rst b/Documentation/boards/efi.rst
index b7ad40e47..ecadb3ebb 100644
--- a/Documentation/boards/efi.rst
+++ b/Documentation/boards/efi.rst
@@ -25,7 +25,7 @@ Use the following to build barebox for EFI:
.. code-block:: sh
- export ARCH=efi
+ export ARCH=x86
make efi_defconfig
make
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 346640dcd..9803f3f95 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1,9 +1,16 @@
#
#
#
+config X86
+ bool
+ select HAS_KALLSYMS
+ select GENERIC_FIND_NEXT_BIT
+ default y
+
config ARCH_TEXT_BASE
hex
default 0x00007c00 if MACH_X86_GENERIC
+ default 0x0 if MACH_EFI_GENERIC
config BOARD_LINKER_SCRIPT
bool
@@ -14,17 +21,33 @@ config GENERIC_LINKER_SCRIPT
default y
depends on !BOARD_LINKER_SCRIPT
-config X86
+menu "ARCH specific settings"
+
+config 64BIT
+ def_bool y if X86_EFI
+ help
+ Say yes to build a 64-bit binary - formerly known as x86_64
+ Say no to build a 32-bit binary - formerly known as i386.
+
+ 32-bit support currently does not compile and is not tested
+ due to the lack of hardware.
+
+config X86_32
+ def_bool y
+ depends on !64BIT
+
+config X86_64
+ def_bool y
+ depends on 64BIT
+
+endmenu
+
+config X86_BOOTLOADER
bool
- select HAS_KALLSYMS
+ select X86_32
select HAS_MODULES
select HAVE_CONFIGURABLE_MEMORY_LAYOUT
select HAVE_CONFIGURABLE_TEXT_BASE
- select GENERIC_FIND_NEXT_BIT
- default y
-
-config X86_BOOTLOADER
- bool
choice
prompt "Select your board"
@@ -32,14 +55,30 @@ choice
config MACH_X86_GENERIC
bool "Generic x86"
select X86_BOOTLOADER
+ depends on !X86_EFI
help
Say Y here if you want barebox to be your BIOS based bootloader
+config MACH_EFI_GENERIC
+ bool "Generic EFI"
+ depends on X86_EFI
+ select HAS_DEBUG_LL
+ help
+ Say Y here if you want barebox to be your EFI based bootloader
+
endchoice
choice
prompt "Bring up type"
+ config X86_EFI
+ bool "EFI"
+ select EFI_BOOTUP
+ select EFI_GUID
+ select EFI_DEVICEPATH
+ select PRINTF_UUID
+ select CLOCKSOURCE_EFI
+
config X86_BIOS_BRINGUP
bool "16 bit BIOS"
help
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 640c24b62..e837a2df9 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -1,20 +1,47 @@
KBUILD_DEFCONFIG := generic_defconfig
-CPPFLAGS += -D__X86__ -fno-strict-aliasing
+CPPFLAGS += -D__X86__
-board-y := x86_generic
-machine-y := i386
+board-$(CONFIG_MACH_X86_GENERIC) := x86_generic
TEXT_BASE = $(CONFIG_TEXT_BASE)
-CPPFLAGS += -march=i386 -m32 -DTEXT_BASE=$(TEXT_BASE) \
+ifeq ($(CONFIG_X86_EFI),y)
+machine-y := efi
+CFLAGS += -fpic -fshort-wchar -mno-sse -mno-mmx
+ifeq ($(CONFIG_X86_32),y)
+ TARGET = efi-app-ia32
+else
+ TARGET = efi-app-x86_64
+endif
+else
+CPPFLAGS += -fno-strict-aliasing
+CPPFLAGS += -march=i386 -DTEXT_BASE=$(TEXT_BASE) \
-fno-unwind-tables -fno-asynchronous-unwind-tables
-LDFLAGS += -m elf_i386
+
+machine-y := i386
+endif
+
+ifeq ($(CONFIG_X86_32),y)
+ UTS_MACHINE := i386
+ biarch := $(call cc-option,-m32)
+ AFLAGS += $(biarch)
+ CFLAGS += $(biarch)
+ CPPFLAGS += $(biarch)
+else
+ UTS_MACHINE := x86_64
+ AFLAGS += -m64
+ CFLAGS += -m64 -mno-red-zone
+ CPPFLAGS += -m64
+endif
+
ifndef CONFIG_MODULES
# Add cleanup flags
+ifneq ($(CONFIG_X86_EFI),y)
CPPFLAGS += -fdata-sections -ffunction-sections
-LDFLAGS_uboot += -static --gc-sections
+LDFLAGS_barebox += -static --gc-sections
+endif
endif
machdirs := $(patsubst %,arch/x86/mach-%/,$(machine-y))
@@ -39,13 +66,46 @@ endif
common-y += $(BOARD) $(MACH)
common-y += arch/x86/lib/
-common-y += arch/x86/boot/
common-$(CONFIG_X86_BIOS_BRINGUP) += arch/x86/bios/
# arch/x86/cpu/
+ifeq ($(CONFIG_X86_EFI),y)
+lds-$(CONFIG_X86_32) := arch/x86/mach-efi/elf_ia32_efi.lds
+lds-$(CONFIG_X86_64) := arch/x86/mach-efi/elf_x86_64_efi.lds
+
+cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
+ -T $(lds-y) \
+ -shared -Bsymbolic -nostdlib -znocombreloc \
+ --start-group $(barebox-common) \
+ --end-group \
+ $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^)
+
+quiet_cmd_efi_image = EFI-IMG $@
+ cmd_efi_image = $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
+ -j .dynsym -j .rel -j .rela -j .reloc -j __barebox_initcalls \
+ -j __barebox_cmd -j .barebox_magicvar -j .bbenv.* \
+ --target=$(TARGET) $< $@
+
+KBUILD_BINARY := barebox
+
+LDFLAGS := --no-undefined
+
+barebox.efi: $(KBUILD_BINARY) FORCE
+ $(call if_changed,efi_image)
+
+KBUILD_IMAGE := barebox.efi
+
+else
+common-y += arch/x86/boot/
+
lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/x86/lib/barebox.lds
lds-$(CONFIG_BOARD_LINKER_SCRIPT) := $(BOARD)/barebox.lds
+endif
+
+LDFLAGS += -m elf_$(UTS_MACHINE)
+
+CLEAN_FILES += $(lds-y)
CLEAN_FILES += arch/x86/lib/barebox.lds barebox.map barebox.S
diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig
new file mode 100644
index 000000000..3f7332258
--- /dev/null
+++ b/arch/x86/configs/efi_defconfig
@@ -0,0 +1,78 @@
+CONFIG_MMU=y
+CONFIG_MALLOC_SIZE=0x0
+CONFIG_MALLOC_TLSF=y
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
+# CONFIG_TIMESTAMP is not set
+CONFIG_BOOTM_SHOW_TYPE=y
+CONFIG_BOOTM_VERBOSE=y
+CONFIG_BOOTM_INITRD=y
+CONFIG_BOOTM_OFTREE=y
+CONFIG_BLSPEC=y
+CONFIG_CONSOLE_ACTIVATE_ALL=y
+CONFIG_PARTITION_DISK_EFI=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_POLLER=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_LL=y
+CONFIG_LONGHELP=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_LOADB=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_UIMAGE=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_LOADENV=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_MAGICVAR=y
+CONFIG_CMD_MAGICVAR_HELP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_FILETYPE=y
+CONFIG_CMD_LN=y
+CONFIG_CMD_MD5SUM=y
+CONFIG_CMD_UNCOMPRESS=y
+CONFIG_CMD_LET=y
+CONFIG_CMD_MSLEEP=y
+CONFIG_CMD_READF=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_HOST=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_TFTP=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENUTREE=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_CRC=y
+CONFIG_CMD_CRC_CMP=y
+CONFIG_CMD_MM=y
+CONFIG_CMD_DETECT=y
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_2048=y
+CONFIG_CMD_BAREBOX_UPDATE=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_TIME=y
+CONFIG_NET=y
+CONFIG_NET_NFS=y
+CONFIG_NET_NETCONSOLE=y
+CONFIG_DRIVER_SERIAL_EFI_STDIO=y
+CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_DRIVER_NET_EFI_SNP=y
+# CONFIG_SPI is not set
+CONFIG_DISK=y
+CONFIG_FS_EXT4=y
+CONFIG_FS_TFTP=y
+CONFIG_FS_NFS=y
+CONFIG_FS_EFI=y
+CONFIG_FS_EFIVARFS=y
+CONFIG_FS_FAT=y
+CONFIG_FS_FAT_WRITE=y
+CONFIG_FS_FAT_LFN=y
diff --git a/arch/x86/configs/generic_defconfig b/arch/x86/configs/generic_defconfig
index 5ff7f531e..3b94e02a7 100644
--- a/arch/x86/configs/generic_defconfig
+++ b/arch/x86/configs/generic_defconfig
@@ -1,3 +1,4 @@
+CONFIG_X86_BIOS_BRINGUP=y
CONFIG_X86_HDBOOT=y
CONFIG_STACK_SIZE=0x7000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
dissimilarity index 97%
index 94a40c624..ddde03518 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -1,26 +1,60 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- *
- */
-
-/**
- * @file
- * @brief x86 specific elf information
- *
- */
-
-#ifndef _ASM_X86_ELF_H
-#define _ASM_X86_ELF_H
-
-#define ELF_CLASS ELFCLASS32
-
-#endif /* _ASM_X86_ELF_H */
+#ifndef __ASM_SANDBOX_ELF_H__
+#define __ASM_SANDBOX_ELF_H__
+
+#ifdef __i386__
+
+typedef struct user_fxsr_struct elf_fpxregset_t;
+
+#define R_386_NONE 0
+#define R_386_32 1
+#define R_386_PC32 2
+#define R_386_GOT32 3
+#define R_386_PLT32 4
+#define R_386_COPY 5
+#define R_386_GLOB_DAT 6
+#define R_386_JMP_SLOT 7
+#define R_386_RELATIVE 8
+#define R_386_GOTOFF 9
+#define R_386_GOTPC 10
+#define R_386_NUM 11
+
+/*
+ * These are used to set parameters in the core dumps.
+ */
+#define ELF_CLASS ELFCLASS32
+#define ELF_DATA ELFDATA2LSB
+#define ELF_ARCH EM_386
+
+#else
+
+/* x86-64 relocation types */
+#define R_X86_64_NONE 0 /* No reloc */
+#define R_X86_64_64 1 /* Direct 64 bit */
+#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
+#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
+#define R_X86_64_PLT32 4 /* 32 bit PLT address */
+#define R_X86_64_COPY 5 /* Copy symbol at runtime */
+#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
+#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
+#define R_X86_64_RELATIVE 8 /* Adjust by program base */
+#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
+ offset to GOT */
+#define R_X86_64_32 10 /* Direct 32 bit zero extended */
+#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
+#define R_X86_64_16 12 /* Direct 16 bit zero extended */
+#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
+#define R_X86_64_8 14 /* Direct 8 bit sign extended */
+#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
+
+#define R_X86_64_NUM 16
+
+/*
+ * These are used to set parameters in the core dumps.
+ */
+#define ELF_CLASS ELFCLASS64
+#define ELF_DATA ELFDATA2LSB
+#define ELF_ARCH EM_X86_64
+
+#endif
+
+#endif /* __ASM_SANDBOX_ELF_H__ */
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index f02051056..df4bc99ec 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -12,44 +12,6 @@
#include <asm/byteorder.h>
-#define IO_SPACE_LIMIT 0xffff
-
-static inline void outb(unsigned char value, int port)
-{
- asm volatile("outb %b0, %w1" : : "a"(value), "Nd"(port));
-}
-
-static inline void outw(unsigned short value, int port)
-{
- asm volatile("outw %w0, %w1" : : "a"(value), "Nd"(port));
-}
-
-static inline void outl(unsigned long value, int port)
-{
- asm volatile("outl %0, %w1" : : "a"(value), "Nd"(port));
-}
-
-static inline unsigned char inb(int port)
-{
- unsigned char value;
- asm volatile("inb %w1, %b0" : "=a"(value) : "Nd"(port));
- return value;
-}
-
-static inline unsigned short inw(int port)
-{
- unsigned short value;
- asm volatile("inw %w1, %w0" : "=a"(value) : "Nd"(port));
- return value;
-}
-
-static inline unsigned long inl(int port)
-{
- unsigned long value;
- asm volatile("inl %w1, %0" : "=a"(value) : "Nd"(port));
- return value;
-}
-
#define build_mmio_read(name, size, type, reg, barrier) \
static inline type name(const volatile void *addr) \
{ type ret; asm volatile("mov" size " %1,%0":reg (ret) \
@@ -68,6 +30,39 @@ build_mmio_write(writeb, "b", unsigned char, "q", :"memory")
build_mmio_write(writew, "w", unsigned short, "r", :"memory")
build_mmio_write(writel, "l", unsigned int, "r", :"memory")
+#define BUILDIO(bwl, bw, type) \
+static inline void out##bwl(unsigned type value, int port) \
+{ \
+ asm volatile("out" #bwl " %" #bw "0, %w1" \
+ : : "a"(value), "Nd"(port)); \
+} \
+ \
+static inline unsigned type in##bwl(int port) \
+{ \
+ unsigned type value; \
+ asm volatile("in" #bwl " %w1, %" #bw "0" \
+ : "=a"(value) : "Nd"(port)); \
+ return value; \
+} \
+ \
+static inline void outs##bwl(int port, const void *addr, unsigned long count) \
+{ \
+ asm volatile("rep; outs" #bwl \
+ : "+S"(addr), "+c"(count) : "d"(port)); \
+} \
+ \
+static inline void ins##bwl(int port, void *addr, unsigned long count) \
+{ \
+ asm volatile("rep; ins" #bwl \
+ : "+D"(addr), "+c"(count) : "d"(port)); \
+}
+
+BUILDIO(b, b, char)
+BUILDIO(w, w, short)
+BUILDIO(l, , int)
+
+#define IO_SPACE_LIMIT 0xffff
+
/* do a tiny io delay */
static inline void io_delay(void)
{
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index 7349ba03c..3caac398d 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -1,21 +1,29 @@
+#ifndef __ASM_I386_TYPES_H
+#define __ASM_I386_TYPES_H
+
+#ifndef __ASSEMBLY__
+
+#ifdef __x86_64__
+/*
+ * This is used in dlmalloc. On X86_64 we need it to be
+ * 64 bit
+ */
+#define INTERNAL_SIZE_T unsigned long
+
/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- *
+ * This is a Kconfig variable in the Kernel, but we want to detect
+ * this during compile time, so we set it here.
*/
+#define CONFIG_PHYS_ADDR_T_64BIT
-#ifndef __ASM_X86_TYPES_H
-#define __ASM_X86_TYPES_H
+#endif
-#ifndef __ASSEMBLY__
+typedef unsigned short umode_t;
+
+/*
+ * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
+ * header files exported to user space
+ */
typedef __signed__ char __s8;
typedef unsigned char __u8;
@@ -26,8 +34,15 @@ typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
typedef __signed__ long long __s64;
typedef unsigned long long __u64;
+#endif
+
+/*
+ * These aren't exported outside the kernel to avoid name space clashes
+ */
+#ifdef __KERNEL__
typedef signed char s8;
typedef unsigned char u8;
@@ -41,10 +56,10 @@ typedef unsigned int u32;
typedef signed long long s64;
typedef unsigned long long u64;
-typedef unsigned short umode_t;
+#include <asm/bitsperlong.h>
-#include <asm-generic/bitsperlong.h>
+#endif /* __KERNEL__ */
-#endif /* __ASSEMBLY__ */
+#endif
-#endif /* __ASM_X86_TYPES_H */
+#endif
diff --git a/arch/x86/include/asm/unaligned.h b/arch/x86/include/asm/unaligned.h
index a7bd416b4..7e38706c5 100644
--- a/arch/x86/include/asm/unaligned.h
+++ b/arch/x86/include/asm/unaligned.h
@@ -8,7 +8,12 @@
#include <linux/unaligned/access_ok.h>
#include <linux/unaligned/generic.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
#define get_unaligned __get_unaligned_le
#define put_unaligned __put_unaligned_le
+#else
+#define get_unaligned __get_unaligned_be
+#define put_unaligned __put_unaligned_be
+#endif
#endif /* _ASM_X86_UNALIGNED_H */
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 6054b9e3f..05e43f0f2 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -1,6 +1,8 @@
extra-$(CONFIG_GENERIC_LINKER_SCRIPT) += barebox.lds
+ifneq ($(CONFIG_X86_EFI),y)
obj-y += memory.o
obj-y += gdt.o
+endif
# needed, when running via a 16 bit BIOS
obj-$(CONFIG_CMD_LINUX16) += linux_start.o
diff --git a/arch/x86/lib/asm-offsets.c b/arch/x86/lib/asm-offsets.c
index b1be3e539..0f9c47eaa 100644
--- a/arch/x86/lib/asm-offsets.c
+++ b/arch/x86/lib/asm-offsets.c
@@ -6,6 +6,13 @@
#include <linux/kbuild.h>
+#ifdef CONFIG_EFI_BOOTUP
+int main(void)
+{
+ return 0;
+}
+#else
void common(void)
{
}
+#endif
diff --git a/arch/x86/mach-efi/.gitignore b/arch/x86/mach-efi/.gitignore
new file mode 100644
index 000000000..847e31770
--- /dev/null
+++ b/arch/x86/mach-efi/.gitignore
@@ -0,0 +1,2 @@
+elf_x86_64_efi.lds
+elf_ia32_efi.lds
diff --git a/arch/x86/mach-efi/Makefile b/arch/x86/mach-efi/Makefile
new file mode 100644
index 000000000..c8a97bae0
--- /dev/null
+++ b/arch/x86/mach-efi/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_X86_64) += reloc_x86_64.o crt0-efi-x86_64.o
+obj-$(CONFIG_X86_32) += reloc_ia32.o crt0-efi-ia32.o
+extra-$(CONFIG_X86_32) += elf_ia32_efi.lds
+extra-$(CONFIG_X86_64) += elf_x86_64_efi.lds
diff --git a/arch/x86/mach-efi/crt0-efi-ia32.S b/arch/x86/mach-efi/crt0-efi-ia32.S
new file mode 100644
index 000000000..6f0f2e872
--- /dev/null
+++ b/arch/x86/mach-efi/crt0-efi-ia32.S
@@ -0,0 +1,76 @@
+/* crt0-efi-ia32.S - x86 EFI startup code.
+ Copyright (C) 1999 Hewlett-Packard Co.
+ Contributed by David Mosberger <davidm@hpl.hp.com>.
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+ * Neither the name of Hewlett-Packard Co. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+*/
+
+ .text
+ .align 4
+
+ .globl _start
+_start:
+ pushl %ebp
+ movl %esp,%ebp
+
+ pushl 12(%ebp) # copy "image" argument
+ pushl 8(%ebp) # copy "systab" argument
+
+ call 0f
+0: popl %eax
+ movl %eax,%ebx
+
+ addl $image_base-0b,%eax # %eax = ldbase
+ addl $_DYNAMIC-0b,%ebx # %ebx = _DYNAMIC
+
+ pushl %ebx # pass _DYNAMIC as second argument
+ pushl %eax # pass ldbase as first argument
+ call _relocate
+ popl %ebx
+ popl %ebx
+ testl %eax,%eax
+ jne .exit
+
+ call efi_main # call app with "image" and "systab" argument
+
+.exit: leave
+ ret
+
+ /* hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: */
+
+ .data
+dummy: .long 0
+
+#define IMAGE_REL_ABSOLUTE 0
+ .section .reloc
+ .long dummy /* Page RVA */
+ .long 10 /* Block Size (2*4+2) */
+ .word (IMAGE_REL_ABSOLUTE<<12) + 0 /* reloc for dummy */
diff --git a/arch/x86/mach-efi/crt0-efi-x86_64.S b/arch/x86/mach-efi/crt0-efi-x86_64.S
new file mode 100644
index 000000000..aa03106e9
--- /dev/null
+++ b/arch/x86/mach-efi/crt0-efi-x86_64.S
@@ -0,0 +1,75 @@
+/* crt0-efi-x86_64.S - x86_64 EFI startup code.
+ Copyright (C) 1999 Hewlett-Packard Co.
+ Contributed by David Mosberger <davidm@hpl.hp.com>.
+ Copyright (C) 2005 Intel Co.
+ Contributed by Fenghua Yu <fenghua.yu@intel.com>.
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+ * Neither the name of Hewlett-Packard Co. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+*/
+ .text
+ .align 4
+
+ .globl _start
+_start:
+ subq $8, %rsp
+ pushq %rcx
+ pushq %rdx
+
+0:
+ lea image_base(%rip), %rdi
+ lea _DYNAMIC(%rip), %rsi
+
+ popq %rcx
+ popq %rdx
+ pushq %rcx
+ pushq %rdx
+ call _relocate
+
+ popq %rdi
+ popq %rsi
+
+ call efi_main
+ addq $8, %rsp
+
+.exit:
+ ret
+
+ /* hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: */
+
+ .data
+dummy: .long 0
+
+#define IMAGE_REL_ABSOLUTE 0
+ .section .reloc, "a"
+label1:
+ .long dummy-label1 /* Page RVA */
+ .long 10 /* Block Size (2*4+2) */
+ .word (IMAGE_REL_ABSOLUTE<<12) + 0 /* reloc for dummy */
diff --git a/arch/x86/mach-efi/elf_ia32_efi.lds.S b/arch/x86/mach-efi/elf_ia32_efi.lds.S
new file mode 100644
index 000000000..69f43f554
--- /dev/null
+++ b/arch/x86/mach-efi/elf_ia32_efi.lds.S
@@ -0,0 +1,106 @@
+#include <asm-generic/barebox.lds.h>
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0;
+ image_base = .;
+ .hash : { *(.hash) } /* this MUST come first! */
+ . = ALIGN(4096);
+ .text :
+ {
+ _stext = .;
+ _text = .;
+ *(.text)
+ *(.text.*)
+ *(.gnu.linkonce.t.*)
+ }
+
+ _etext = .;
+
+ . = ALIGN(4096);
+ .sdata : {
+ *(.got.plt)
+ *(.got)
+ *(.srodata)
+ *(.sdata)
+ *(.sbss)
+ *(.scommon)
+ }
+
+ . = ALIGN(4096);
+ _sdata = .;
+
+ .data : {
+ *(.rodata*)
+ *(.data)
+ *(.data1)
+ *(.data.*)
+ *(.sdata)
+ *(.got.plt)
+ *(.got)
+ /* the EFI loader doesn't seem to like a .bss section, so we stick
+ * it all into .data: */
+ *(.sbss)
+ *(.scommon)
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+
+ . = ALIGN(64);
+
+ __barebox_initcalls_start = .;
+ __barebox_initcalls : { INITCALLS }
+ __barebox_initcalls_end = .;
+
+ __barebox_exitcalls_start = .;
+ __barebox_exitcalls : { EXITCALLS }
+ __barebox_exitcalls_end = .;
+
+ . = ALIGN(64);
+ __barebox_magicvar_start = .;
+ .barebox_magicvar : { BAREBOX_MAGICVARS }
+ __barebox_magicvar_end = .;
+
+ . = ALIGN(64);
+ __barebox_cmd_start = .;
+ __barebox_cmd : { BAREBOX_CMDS }
+ __barebox_cmd_end = .;
+
+ . = ALIGN(4096);
+ .dynamic : { *(.dynamic) }
+ . = ALIGN(4096);
+ .rel : {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.got)
+ *(.rel.stab)
+ *(.data.rel.ro.local)
+ *(.data.rel.local)
+ *(.data.rel.ro)
+ *(.data.rel*)
+ }
+
+ . = ALIGN(4096);
+ .reloc : /* This is the PECOFF .reloc section! */
+ {
+ *(.reloc)
+ }
+
+ . = ALIGN(4096);
+ .dynsym : { *(.dynsym) }
+ . = ALIGN(4096);
+ .dynstr : { *(.dynstr) }
+ . = ALIGN(4096);
+ /DISCARD/ :
+ {
+ *(.rel.reloc)
+ *(.eh_frame)
+ *(.note.GNU-stack)
+ }
+
+ .comment 0 : { *(.comment) }
+}
diff --git a/arch/x86/mach-efi/elf_x86_64_efi.lds.S b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
new file mode 100644
index 000000000..e1bc2120f
--- /dev/null
+++ b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
@@ -0,0 +1,99 @@
+#include <asm-generic/barebox.lds.h>
+
+/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
+
+OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
+OUTPUT_ARCH(i386:x86-64)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0;
+ image_base = .;
+ .hash : { *(.hash) } /* this MUST come first! */
+ . = ALIGN(4096);
+ .eh_frame : {
+ *(.eh_frame)
+ }
+
+ . = ALIGN(4096);
+
+ .text : {
+ _stext = .;
+ _text = .;
+ *(.text)
+ *(.text.*)
+ *(.gnu.linkonce.t.*)
+ }
+
+ _etext = .;
+
+ . = ALIGN(4096);
+
+ .reloc : {
+ *(.reloc)
+ }
+
+ . = ALIGN(4096);
+ _sdata = .;
+
+ .data : {
+ *(.rodata*)
+ *(.got.plt)
+ *(.got)
+ *(.data*)
+ *(.sdata)
+ /* the EFI loader doesn't seem to like a .bss section, so we stick
+ * it all into .data: */
+ *(.sbss)
+ *(.scommon)
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ *(.rel.local)
+ }
+
+ . = ALIGN(64);
+
+ __barebox_initcalls_start = .;
+ __barebox_initcalls : { INITCALLS }
+ __barebox_initcalls_end = .;
+
+ __barebox_exitcalls_start = .;
+ __barebox_exitcalls : { EXITCALLS }
+ __barebox_exitcalls_end = .;
+
+ . = ALIGN(64);
+ __barebox_magicvar_start = .;
+ .barebox_magicvar : { BAREBOX_MAGICVARS }
+ __barebox_magicvar_end = .;
+
+ . = ALIGN(64);
+ __barebox_cmd_start = .;
+ __barebox_cmd : { BAREBOX_CMDS }
+ __barebox_cmd_end = .;
+
+ . = ALIGN(4096);
+ .dynamic : { *(.dynamic) }
+ . = ALIGN(4096);
+
+ .rela : {
+ *(.rela.data*)
+ *(.rela.barebox*)
+ *(.rela.initcall*)
+ *(.rela.got)
+ *(.rela.stab)
+ }
+
+ . = ALIGN(4096);
+ .dynsym : { *(.dynsym) }
+ . = ALIGN(4096);
+ .dynstr : { *(.dynstr) }
+ . = ALIGN(4096);
+ .ignored.reloc : {
+ *(.rela.reloc)
+ *(.eh_frame)
+ *(.note.GNU-stack)
+ }
+
+ .comment 0 : { *(.comment) }
+}
diff --git a/arch/x86/mach-efi/include/mach/barebox.lds.h b/arch/x86/mach-efi/include/mach/barebox.lds.h
new file mode 100644
index 000000000..e69de29bb
diff --git a/arch/x86/mach-efi/include/mach/debug_ll.h b/arch/x86/mach-efi/include/mach/debug_ll.h
new file mode 100644
index 000000000..e144d86e0
--- /dev/null
+++ b/arch/x86/mach-efi/include/mach/debug_ll.h
@@ -0,0 +1 @@
+#include <efi/debug_ll.h>
diff --git a/arch/x86/mach-efi/reloc_ia32.c b/arch/x86/mach-efi/reloc_ia32.c
new file mode 100644
index 000000000..46929631e
--- /dev/null
+++ b/arch/x86/mach-efi/reloc_ia32.c
@@ -0,0 +1,97 @@
+/* reloc_ia32.c - position independent x86 ELF shared object relocator
+ Copyright (C) 1999 Hewlett-Packard Co.
+ Contributed by David Mosberger <davidm@hpl.hp.com>.
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+ * Neither the name of Hewlett-Packard Co. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+*/
+
+#include <common.h>
+#include <efi.h>
+
+#include <elf.h>
+
+efi_status_t _relocate(long ldbase, Elf32_Dyn *dyn, efi_handle_t image, efi_system_table_t *systab)
+{
+ long relsz = 0, relent = 0;
+ Elf32_Rel *rel = 0;
+ unsigned long *addr;
+ int i;
+
+ for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
+ switch (dyn[i].d_tag) {
+ case DT_REL:
+ rel = (Elf32_Rel*)
+ ((unsigned long)dyn[i].d_un.d_ptr
+ + ldbase);
+ break;
+
+ case DT_RELSZ:
+ relsz = dyn[i].d_un.d_val;
+ break;
+
+ case DT_RELENT:
+ relent = dyn[i].d_un.d_val;
+ break;
+
+ case DT_RELA:
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (!rel && relent == 0)
+ return EFI_SUCCESS;
+
+ if (!rel || relent == 0)
+ return EFI_LOAD_ERROR;
+
+ while (relsz > 0) {
+ /* apply the relocs */
+ switch (ELF32_R_TYPE (rel->r_info)) {
+ case R_386_NONE:
+ break;
+
+ case R_386_RELATIVE:
+ addr = (unsigned long *)
+ (ldbase + rel->r_offset);
+ *addr += ldbase;
+ break;
+
+ default:
+ break;
+ }
+ rel = (Elf32_Rel*) ((char *) rel + relent);
+ relsz -= relent;
+ }
+ return EFI_SUCCESS;
+}
diff --git a/arch/x86/mach-efi/reloc_x86_64.c b/arch/x86/mach-efi/reloc_x86_64.c
new file mode 100644
index 000000000..1db72f5db
--- /dev/null
+++ b/arch/x86/mach-efi/reloc_x86_64.c
@@ -0,0 +1,96 @@
+/* reloc_x86_64.c - position independent x86_64 ELF shared object relocator
+ Copyright (C) 1999 Hewlett-Packard Co.
+ Contributed by David Mosberger <davidm@hpl.hp.com>.
+ Copyright (C) 2005 Intel Co.
+ Contributed by Fenghua Yu <fenghua.yu@intel.com>.
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+ * Neither the name of Hewlett-Packard Co. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+*/
+
+#include <common.h>
+#include <efi.h>
+
+#include <elf.h>
+
+efi_status_t _relocate (long ldbase, Elf64_Dyn *dyn, efi_handle_t image, efi_system_table_t *systab)
+{
+ long relsz = 0, relent = 0;
+ Elf64_Rel *rel = 0;
+ unsigned long *addr;
+ int i;
+
+ for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
+ switch (dyn[i].d_tag) {
+ case DT_RELA:
+ rel = (Elf64_Rel*)
+ ((unsigned long)dyn[i].d_un.d_ptr
+ + ldbase);
+ break;
+
+ case DT_RELASZ:
+ relsz = dyn[i].d_un.d_val;
+ break;
+
+ case DT_RELAENT:
+ relent = dyn[i].d_un.d_val;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (!rel && relent == 0)
+ return EFI_SUCCESS;
+
+ if (!rel || relent == 0)
+ return EFI_LOAD_ERROR;
+
+ while (relsz > 0) {
+ /* apply the relocs */
+ switch (ELF64_R_TYPE (rel->r_info)) {
+ case R_X86_64_NONE:
+ break;
+
+ case R_X86_64_RELATIVE:
+ addr = (unsigned long *)
+ (ldbase + rel->r_offset);
+ *addr += ldbase;
+ break;
+
+ default:
+ break;
+ }
+ rel = (Elf64_Rel*) ((char *) rel + relent);
+ relsz -= relent;
+ }
+ return EFI_SUCCESS;
+}
diff --git a/commands/Kconfig b/commands/Kconfig
index 21d921268..bc0885c69 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -370,7 +370,7 @@ config CMD_BOOTZ
config CMD_LINUX16
tristate
- depends on X86
+ depends on X86 && !X86_EFI
default y if X86
prompt "linux16"
help
diff --git a/commands/edit.c b/commands/edit.c
index a5415a6e5..696a818d9 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -396,7 +396,7 @@ static int do_edit(int argc, char *argv[])
* down when we write to the right bottom screen position. Reduce the number
* of rows by one to work around this.
*/
- if (IS_ENABLED(CONFIG_ARCH_EFI))
+ if (IS_ENABLED(CONFIG_EFI_BOOTUP))
screenheight = 24;
else
screenheight = 25;
diff --git a/common/memory.c b/common/memory.c
index 4725f6e38..ad38b00ec 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -67,7 +67,7 @@ void mem_malloc_init(void *start, void *end)
mem_malloc_initialized = 1;
}
-#if !defined __SANDBOX__ && !defined CONFIG_ARCH_EFI
+#if !defined __SANDBOX__ && !defined CONFIG_EFI_BOOTUP
static int mem_malloc_resource(void)
{
/*
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index ae1f10eae..54b05bbf3 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -36,7 +36,7 @@ config CLOCKSOURCE_DUMMY_RATE
config CLOCKSOURCE_EFI
bool
- depends on ARCH_EFI
+ depends on EFI_BOOTUP
config CLOCKSOURCE_MVEBU
bool
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index b723a127f..c3980e78f 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -202,7 +202,7 @@ config DRIVER_NET_TAP
config DRIVER_NET_EFI_SNP
bool "EFI SNP ethernet driver"
- depends on ARCH_EFI
+ depends on EFI_BOOTUP
config DRIVER_NET_TSE
depends on NIOS2
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index d0a62bda9..a1fac0e61 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -4,7 +4,7 @@ config OFTREE
config OFTREE_MEM_GENERIC
depends on OFTREE
- depends on PPC || ARM || ARCH_EFI || OPENRISC || SANDBOX
+ depends on PPC || ARM || EFI_BOOTUP || OPENRISC || SANDBOX
def_bool y
config DTC
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 4eab437ea..ced30530a 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -46,7 +46,7 @@ config DRIVER_SERIAL_LINUX_CONSOLE
bool "linux console driver"
config DRIVER_SERIAL_EFI_STDIO
- depends on ARCH_EFI
+ depends on EFI_BOOTUP
bool "EFI stdio driver"
config DRIVER_SERIAL_MPC5XXX
diff --git a/fs/Kconfig b/fs/Kconfig
index c7c42acd7..57f2676f4 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -42,7 +42,7 @@ config FS_NFS
prompt "nfs support"
config FS_EFI
- depends on ARCH_EFI
+ depends on EFI_BOOTUP
bool
prompt "EFI filesystem support"
help
@@ -50,7 +50,7 @@ config FS_EFI
by the EFI Firmware via the EFI Simple File System Protocol.
config FS_EFIVARFS
- depends on ARCH_EFI
+ depends on EFI_BOOTUP
bool
prompt "EFI variable filesystem support (efivarfs)"
help
diff --git a/include/efi.h b/include/efi.h
index b2e965bae..fa6fb2782 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -14,7 +14,7 @@
#include <linux/string.h>
#include <linux/types.h>
-#ifdef CONFIG_ARCH_EFI
+#ifdef CONFIG_EFI_BOOTUP
#define EFIAPI __attribute__((ms_abi))
#else
#define EFIAPI
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 08/12] ARCH: efi: Finally drop it as now we can build efi bootup from x86
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
` (5 preceding siblings ...)
2017-02-15 19:34 ` [PATCH 07/12] efi: move x86 efi boot support to x86 arch Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-15 19:34 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 09/12] efi: bus: add firmware vendor and resision and tables info Jean-Christophe PLAGNIOL-VILLARD
7 siblings, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:34 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/efi/Kconfig | 53 -------------------
arch/efi/Makefile | 43 ---------------
arch/efi/configs/efi_defconfig | 79 ---------------------------
arch/efi/include/asm/barebox.h | 1 -
arch/efi/include/asm/bitops.h | 22 --------
arch/efi/include/asm/bitsperlong.h | 10 ----
arch/efi/include/asm/byteorder.h | 8 ---
arch/efi/include/asm/common.h | 4 --
arch/efi/include/asm/dma.h | 13 -----
arch/efi/include/asm/elf.h | 60 ---------------------
arch/efi/include/asm/io.h | 55 -------------------
arch/efi/include/asm/posix_types.h | 1 -
arch/efi/include/asm/sections.h | 1 -
arch/efi/include/asm/string.h | 1 -
arch/efi/include/asm/swab.h | 6 ---
arch/efi/include/asm/types.h | 65 -----------------------
arch/efi/include/asm/unaligned.h | 19 -------
arch/efi/include/mach/debug_ll.h | 1 -
arch/efi/lib/.gitignore | 2 -
arch/efi/lib/Makefile | 4 --
arch/efi/lib/asm-offsets.c | 12 -----
arch/efi/lib/crt0-efi-ia32.S | 76 --------------------------
arch/efi/lib/crt0-efi-x86_64.S | 75 --------------------------
arch/efi/lib/elf_ia32_efi.lds.S | 106 -------------------------------------
arch/efi/lib/elf_x86_64_efi.lds.S | 100 ----------------------------------
arch/efi/lib/reloc_ia32.c | 97 ---------------------------------
arch/efi/lib/reloc_x86_64.c | 96 ---------------------------------
arch/x86/configs/efi_defconfig | 1 +
28 files changed, 1 insertion(+), 1010 deletions(-)
delete mode 100644 arch/efi/Kconfig
delete mode 100644 arch/efi/Makefile
delete mode 100644 arch/efi/configs/efi_defconfig
delete mode 100644 arch/efi/include/asm/barebox.h
delete mode 100644 arch/efi/include/asm/bitops.h
delete mode 100644 arch/efi/include/asm/bitsperlong.h
delete mode 100644 arch/efi/include/asm/byteorder.h
delete mode 100644 arch/efi/include/asm/common.h
delete mode 100644 arch/efi/include/asm/dma.h
delete mode 100644 arch/efi/include/asm/elf.h
delete mode 100644 arch/efi/include/asm/io.h
delete mode 100644 arch/efi/include/asm/posix_types.h
delete mode 100644 arch/efi/include/asm/sections.h
delete mode 100644 arch/efi/include/asm/string.h
delete mode 100644 arch/efi/include/asm/swab.h
delete mode 100644 arch/efi/include/asm/types.h
delete mode 100644 arch/efi/include/asm/unaligned.h
delete mode 100644 arch/efi/include/mach/debug_ll.h
delete mode 100644 arch/efi/lib/.gitignore
delete mode 100644 arch/efi/lib/Makefile
delete mode 100644 arch/efi/lib/asm-offsets.c
delete mode 100644 arch/efi/lib/crt0-efi-ia32.S
delete mode 100644 arch/efi/lib/crt0-efi-x86_64.S
delete mode 100644 arch/efi/lib/elf_ia32_efi.lds.S
delete mode 100644 arch/efi/lib/elf_x86_64_efi.lds.S
delete mode 100644 arch/efi/lib/reloc_ia32.c
delete mode 100644 arch/efi/lib/reloc_x86_64.c
diff --git a/arch/efi/Kconfig b/arch/efi/Kconfig
deleted file mode 100644
index 561aac2b2..000000000
--- a/arch/efi/Kconfig
+++ /dev/null
@@ -1,53 +0,0 @@
-config ARCH_EFI
- bool
- default y
- select HAS_DEBUG_LL
- select HAS_KALLSYMS
- select EFI_GUID
- select EFI_BOOTUP
- select EFI_DEVICEPATH
- select PRINTF_UUID
- select GENERIC_FIND_NEXT_BIT
- select CLOCKSOURCE_EFI
-
-config ARCH_TEXT_BASE
- hex
- default 0x0
-
-menu "EFI specific settings"
-
-config 64BIT
- def_bool y
- help
- Say yes to build a 64-bit binary - formerly known as x86_64
- Say no to build a 32-bit binary - formerly known as i386.
-
- 32-bit support currently does not compile and is not tested
- due to the lack of hardware.
-
-config X86_32
- def_bool y
- depends on !64BIT
-
-config X86_64
- def_bool y
- depends on 64BIT
-
-config ARCH_EFI_REGISTER_COM1
- bool "Register first serial port"
- help
- Say yes here to register the first serial port on ioport 0x3f8.
- This is useful to control barebox over a serial port if the board
- has one. Enabling this option may not work on boards which do not
- have a serial port. Also enable DRIVER_SERIAL_NS16550 to enable
- the NS16550 driver.
-
-endmenu
-
-source common/Kconfig
-source commands/Kconfig
-source net/Kconfig
-source drivers/Kconfig
-source fs/Kconfig
-source lib/Kconfig
-source crypto/Kconfig
diff --git a/arch/efi/Makefile b/arch/efi/Makefile
deleted file mode 100644
index c87a421ad..000000000
--- a/arch/efi/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-KBUILD_DEFCONFIG := efi_defconfig
-
-CFLAGS += -fpic -fshort-wchar -mno-sse -mno-mmx
-
-ifeq ($(CONFIG_X86_32),y)
- UTS_MACHINE := i386
- biarch := $(call cc-option,-m32)
- AFLAGS += $(biarch)
- CFLAGS += $(biarch)
- TARGET = efi-app-ia32
-else
- UTS_MACHINE := x86_64
- AFLAGS += -m64
- CFLAGS += -m64 -mno-red-zone
- TARGET = efi-app-x86_64
-endif
-
-lds-$(CONFIG_X86_32) := arch/efi/lib/elf_ia32_efi.lds
-lds-$(CONFIG_X86_64) := arch/efi/lib/elf_x86_64_efi.lds
-
-cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
- -T $(lds-y) \
- -shared -Bsymbolic -nostdlib -znocombreloc \
- --start-group $(barebox-common) \
- --end-group \
- $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^)
-
-quiet_cmd_efi_image = EFI-IMG $@
- cmd_efi_image = $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
- -j .dynsym -j .rel -j .rela -j .reloc -j __barebox_initcalls \
- -j __barebox_exitcalls -j __barebox_cmd -j .barebox_magicvar \
- -j .bbenv.* --target=$(TARGET) $< $@
-
-KBUILD_BINARY := barebox
-
-LDFLAGS := -m elf_$(UTS_MACHINE) --no-undefined
-
-barebox.efi: $(KBUILD_BINARY) FORCE
- $(call if_changed,efi_image)
-
-KBUILD_IMAGE := barebox.efi
-
-common-y += arch/efi/lib/
diff --git a/arch/efi/configs/efi_defconfig b/arch/efi/configs/efi_defconfig
deleted file mode 100644
index f24148d3b..000000000
--- a/arch/efi/configs/efi_defconfig
+++ /dev/null
@@ -1,79 +0,0 @@
-CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
-CONFIG_MALLOC_TLSF=y
-CONFIG_PROMPT="barebox> "
-CONFIG_HUSH_FANCY_PROMPT=y
-CONFIG_CMDLINE_EDITING=y
-CONFIG_AUTO_COMPLETE=y
-CONFIG_MENU=y
-# CONFIG_TIMESTAMP is not set
-CONFIG_BOOTM_SHOW_TYPE=y
-CONFIG_BOOTM_VERBOSE=y
-CONFIG_BOOTM_INITRD=y
-CONFIG_BOOTM_OFTREE=y
-CONFIG_BLSPEC=y
-CONFIG_CONSOLE_ACTIVATE_ALL=y
-CONFIG_PARTITION_DISK_EFI=y
-CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_POLLER=y
-CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_LL=y
-CONFIG_LONGHELP=y
-CONFIG_CMD_IOMEM=y
-CONFIG_CMD_MEMINFO=y
-CONFIG_CMD_GO=y
-CONFIG_CMD_LOADB=y
-CONFIG_CMD_RESET=y
-CONFIG_CMD_UIMAGE=y
-CONFIG_CMD_PARTITION=y
-CONFIG_CMD_EXPORT=y
-CONFIG_CMD_LOADENV=y
-CONFIG_CMD_PRINTENV=y
-CONFIG_CMD_MAGICVAR=y
-CONFIG_CMD_MAGICVAR_HELP=y
-CONFIG_CMD_SAVEENV=y
-CONFIG_CMD_FILETYPE=y
-CONFIG_CMD_LN=y
-CONFIG_CMD_MD5SUM=y
-CONFIG_CMD_UNCOMPRESS=y
-CONFIG_CMD_LET=y
-CONFIG_CMD_MSLEEP=y
-CONFIG_CMD_READF=y
-CONFIG_CMD_SLEEP=y
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_HOST=y
-CONFIG_CMD_PING=y
-CONFIG_CMD_TFTP=y
-CONFIG_CMD_ECHO_E=y
-CONFIG_CMD_EDIT=y
-CONFIG_CMD_MENU=y
-CONFIG_CMD_MENUTREE=y
-CONFIG_CMD_READLINE=y
-CONFIG_CMD_TIMEOUT=y
-CONFIG_CMD_CRC=y
-CONFIG_CMD_CRC_CMP=y
-CONFIG_CMD_MM=y
-CONFIG_CMD_DETECT=y
-CONFIG_CMD_FLASH=y
-CONFIG_CMD_2048=y
-CONFIG_CMD_BAREBOX_UPDATE=y
-CONFIG_CMD_OF_NODE=y
-CONFIG_CMD_OF_PROPERTY=y
-CONFIG_CMD_OFTREE=y
-CONFIG_CMD_TIME=y
-CONFIG_NET=y
-CONFIG_NET_NFS=y
-CONFIG_NET_NETCONSOLE=y
-CONFIG_DRIVER_SERIAL_EFI_STDIO=y
-CONFIG_DRIVER_SERIAL_NS16550=y
-CONFIG_DRIVER_NET_EFI_SNP=y
-# CONFIG_SPI is not set
-CONFIG_DISK=y
-CONFIG_FS_EXT4=y
-CONFIG_FS_TFTP=y
-CONFIG_FS_NFS=y
-CONFIG_FS_EFI=y
-CONFIG_FS_EFIVARFS=y
-CONFIG_FS_FAT=y
-CONFIG_FS_FAT_WRITE=y
-CONFIG_FS_FAT_LFN=y
diff --git a/arch/efi/include/asm/barebox.h b/arch/efi/include/asm/barebox.h
deleted file mode 100644
index 2997587d8..000000000
--- a/arch/efi/include/asm/barebox.h
+++ /dev/null
@@ -1 +0,0 @@
-/* dummy */
diff --git a/arch/efi/include/asm/bitops.h b/arch/efi/include/asm/bitops.h
deleted file mode 100644
index 447023da6..000000000
--- a/arch/efi/include/asm/bitops.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _SANDBOX_BITOPS_H
-#define _SANDBOX_BITOPS_H
-
-/* nothing but the defaults.. */
-#include <asm-generic/bitops/__ffs.h>
-#include <asm-generic/bitops/__fls.h>
-#include <asm-generic/bitops/ffs.h>
-#include <asm-generic/bitops/fls.h>
-#include <asm-generic/bitops/ffz.h>
-#include <asm-generic/bitops/find.h>
-#include <asm-generic/bitops/fls64.h>
-#include <asm-generic/bitops/hweight.h>
-#include <asm-generic/bitops/ops.h>
-
-#define set_bit(x, y) __set_bit(x, y)
-#define clear_bit(x, y) __clear_bit(x, y)
-#define change_bit(x, y) __change_bit(x, y)
-#define test_and_set_bit(x, y) __test_and_set_bit(x, y)
-#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y)
-#define test_and_change_bit(x, y) __test_and_change_bit(x, y)
-
-#endif
diff --git a/arch/efi/include/asm/bitsperlong.h b/arch/efi/include/asm/bitsperlong.h
deleted file mode 100644
index 00c1fc262..000000000
--- a/arch/efi/include/asm/bitsperlong.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __ASM_BITSPERLONG_H
-#define __ASM_BITSPERLONG_H
-
-#ifdef __x86_64__
-#define BITS_PER_LONG 64
-#else
-#define BITS_PER_LONG 32
-#endif
-
-#endif /* __ASM_BITSPERLONG_H */
diff --git a/arch/efi/include/asm/byteorder.h b/arch/efi/include/asm/byteorder.h
deleted file mode 100644
index 37316f237..000000000
--- a/arch/efi/include/asm/byteorder.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _I386_BYTEORDER_H
-#define _I386_BYTEORDER_H
-
-#include <asm/types.h>
-
-#include <linux/byteorder/little_endian.h>
-
-#endif /* _I386_BYTEORDER_H */
diff --git a/arch/efi/include/asm/common.h b/arch/efi/include/asm/common.h
deleted file mode 100644
index b0e6b7fb1..000000000
--- a/arch/efi/include/asm/common.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef ASM_COMMON_H
-#define ASM_COMMON_H
-
-#endif /* ASM_COMMON_H */
diff --git a/arch/efi/include/asm/dma.h b/arch/efi/include/asm/dma.h
deleted file mode 100644
index 459536779..000000000
--- a/arch/efi/include/asm/dma.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
- *
- * This file is released under the GPLv2
- *
- */
-
-#ifndef __ASM_DMA_H
-#define __ASM_DMA_H
-
-/* empty*/
-
-#endif /* __ASM_DMA_H */
diff --git a/arch/efi/include/asm/elf.h b/arch/efi/include/asm/elf.h
deleted file mode 100644
index ddde03518..000000000
--- a/arch/efi/include/asm/elf.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef __ASM_SANDBOX_ELF_H__
-#define __ASM_SANDBOX_ELF_H__
-
-#ifdef __i386__
-
-typedef struct user_fxsr_struct elf_fpxregset_t;
-
-#define R_386_NONE 0
-#define R_386_32 1
-#define R_386_PC32 2
-#define R_386_GOT32 3
-#define R_386_PLT32 4
-#define R_386_COPY 5
-#define R_386_GLOB_DAT 6
-#define R_386_JMP_SLOT 7
-#define R_386_RELATIVE 8
-#define R_386_GOTOFF 9
-#define R_386_GOTPC 10
-#define R_386_NUM 11
-
-/*
- * These are used to set parameters in the core dumps.
- */
-#define ELF_CLASS ELFCLASS32
-#define ELF_DATA ELFDATA2LSB
-#define ELF_ARCH EM_386
-
-#else
-
-/* x86-64 relocation types */
-#define R_X86_64_NONE 0 /* No reloc */
-#define R_X86_64_64 1 /* Direct 64 bit */
-#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
-#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
-#define R_X86_64_PLT32 4 /* 32 bit PLT address */
-#define R_X86_64_COPY 5 /* Copy symbol at runtime */
-#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
-#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
-#define R_X86_64_RELATIVE 8 /* Adjust by program base */
-#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
- offset to GOT */
-#define R_X86_64_32 10 /* Direct 32 bit zero extended */
-#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
-#define R_X86_64_16 12 /* Direct 16 bit zero extended */
-#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
-#define R_X86_64_8 14 /* Direct 8 bit sign extended */
-#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
-
-#define R_X86_64_NUM 16
-
-/*
- * These are used to set parameters in the core dumps.
- */
-#define ELF_CLASS ELFCLASS64
-#define ELF_DATA ELFDATA2LSB
-#define ELF_ARCH EM_X86_64
-
-#endif
-
-#endif /* __ASM_SANDBOX_ELF_H__ */
diff --git a/arch/efi/include/asm/io.h b/arch/efi/include/asm/io.h
deleted file mode 100644
index ac8a9c1b3..000000000
--- a/arch/efi/include/asm/io.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef __ASM_SANDBOX_IO_H
-#define __ASM_SANDBOX_IO_H
-
-#define build_mmio_read(name, size, type, reg, barrier) \
- static inline type name(const volatile void *addr) \
- { type ret; asm volatile("mov" size " %1,%0":reg (ret) \
- :"m" (*(volatile type*)addr) barrier); return ret; }
-
-build_mmio_read(readb, "b", unsigned char, "=q", :"memory")
-build_mmio_read(readw, "w", unsigned short, "=r", :"memory")
-build_mmio_read(readl, "l", unsigned int, "=r", :"memory")
-
-#define build_mmio_write(name, size, type, reg, barrier) \
- static inline void name(type val, volatile void *addr) \
- { asm volatile("mov" size " %0,%1": :reg (val), \
- "m" (*(volatile type*)addr) barrier); }
-
-build_mmio_write(writeb, "b", unsigned char, "q", :"memory")
-build_mmio_write(writew, "w", unsigned short, "r", :"memory")
-build_mmio_write(writel, "l", unsigned int, "r", :"memory")
-
-#define BUILDIO(bwl, bw, type) \
-static inline void out##bwl(unsigned type value, int port) \
-{ \
- asm volatile("out" #bwl " %" #bw "0, %w1" \
- : : "a"(value), "Nd"(port)); \
-} \
- \
-static inline unsigned type in##bwl(int port) \
-{ \
- unsigned type value; \
- asm volatile("in" #bwl " %w1, %" #bw "0" \
- : "=a"(value) : "Nd"(port)); \
- return value; \
-} \
- \
-static inline void outs##bwl(int port, const void *addr, unsigned long count) \
-{ \
- asm volatile("rep; outs" #bwl \
- : "+S"(addr), "+c"(count) : "d"(port)); \
-} \
- \
-static inline void ins##bwl(int port, void *addr, unsigned long count) \
-{ \
- asm volatile("rep; ins" #bwl \
- : "+D"(addr), "+c"(count) : "d"(port)); \
-}
-
-BUILDIO(b, b, char)
-BUILDIO(w, w, short)
-BUILDIO(l, , int)
-
-#define IO_SPACE_LIMIT 0xffff
-
-#endif /* __ASM_SANDBOX_IO_H */
diff --git a/arch/efi/include/asm/posix_types.h b/arch/efi/include/asm/posix_types.h
deleted file mode 100644
index 22cae6230..000000000
--- a/arch/efi/include/asm/posix_types.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/posix_types.h>
diff --git a/arch/efi/include/asm/sections.h b/arch/efi/include/asm/sections.h
deleted file mode 100644
index 2b8c51603..000000000
--- a/arch/efi/include/asm/sections.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/sections.h>
diff --git a/arch/efi/include/asm/string.h b/arch/efi/include/asm/string.h
deleted file mode 100644
index 2997587d8..000000000
--- a/arch/efi/include/asm/string.h
+++ /dev/null
@@ -1 +0,0 @@
-/* dummy */
diff --git a/arch/efi/include/asm/swab.h b/arch/efi/include/asm/swab.h
deleted file mode 100644
index 60a90120b..000000000
--- a/arch/efi/include/asm/swab.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_SWAB_H
-#define _ASM_SWAB_H
-
-/* nothing. use generic functions */
-
-#endif /* _ASM_SWAB_H */
diff --git a/arch/efi/include/asm/types.h b/arch/efi/include/asm/types.h
deleted file mode 100644
index 3caac398d..000000000
--- a/arch/efi/include/asm/types.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef __ASM_I386_TYPES_H
-#define __ASM_I386_TYPES_H
-
-#ifndef __ASSEMBLY__
-
-#ifdef __x86_64__
-/*
- * This is used in dlmalloc. On X86_64 we need it to be
- * 64 bit
- */
-#define INTERNAL_SIZE_T unsigned long
-
-/*
- * This is a Kconfig variable in the Kernel, but we want to detect
- * this during compile time, so we set it here.
- */
-#define CONFIG_PHYS_ADDR_T_64BIT
-
-#endif
-
-typedef unsigned short umode_t;
-
-/*
- * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
- * header files exported to user space
- */
-
-typedef __signed__ char __s8;
-typedef unsigned char __u8;
-
-typedef __signed__ short __s16;
-typedef unsigned short __u16;
-
-typedef __signed__ int __s32;
-typedef unsigned int __u32;
-
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
-#endif
-
-/*
- * These aren't exported outside the kernel to avoid name space clashes
- */
-#ifdef __KERNEL__
-
-typedef signed char s8;
-typedef unsigned char u8;
-
-typedef signed short s16;
-typedef unsigned short u16;
-
-typedef signed int s32;
-typedef unsigned int u32;
-
-typedef signed long long s64;
-typedef unsigned long long u64;
-
-#include <asm/bitsperlong.h>
-
-#endif /* __KERNEL__ */
-
-#endif
-
-#endif
diff --git a/arch/efi/include/asm/unaligned.h b/arch/efi/include/asm/unaligned.h
deleted file mode 100644
index d02da6e60..000000000
--- a/arch/efi/include/asm/unaligned.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _ASM_SANDBOX_UNALIGNED_H
-#define _ASM_SANDBOX_UNALIGNED_H
-
-/*
- * The architecture sandbox is compiled on can do unaligned accesses itself.
- */
-
-#include <linux/unaligned/access_ok.h>
-#include <linux/unaligned/generic.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define get_unaligned __get_unaligned_le
-#define put_unaligned __put_unaligned_le
-#else
-#define get_unaligned __get_unaligned_be
-#define put_unaligned __put_unaligned_be
-#endif
-
-#endif /* _ASM_SANDBOX_UNALIGNED_H */
diff --git a/arch/efi/include/mach/debug_ll.h b/arch/efi/include/mach/debug_ll.h
deleted file mode 100644
index e144d86e0..000000000
--- a/arch/efi/include/mach/debug_ll.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <efi/debug_ll.h>
diff --git a/arch/efi/lib/.gitignore b/arch/efi/lib/.gitignore
deleted file mode 100644
index 847e31770..000000000
--- a/arch/efi/lib/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-elf_x86_64_efi.lds
-elf_ia32_efi.lds
diff --git a/arch/efi/lib/Makefile b/arch/efi/lib/Makefile
deleted file mode 100644
index c8a97bae0..000000000
--- a/arch/efi/lib/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-obj-$(CONFIG_X86_64) += reloc_x86_64.o crt0-efi-x86_64.o
-obj-$(CONFIG_X86_32) += reloc_ia32.o crt0-efi-ia32.o
-extra-$(CONFIG_X86_32) += elf_ia32_efi.lds
-extra-$(CONFIG_X86_64) += elf_x86_64_efi.lds
diff --git a/arch/efi/lib/asm-offsets.c b/arch/efi/lib/asm-offsets.c
deleted file mode 100644
index 22f382b71..000000000
--- a/arch/efi/lib/asm-offsets.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed to extract
- * and format the required data.
- */
-
-#include <linux/kbuild.h>
-
-int main(void)
-{
- return 0;
-}
diff --git a/arch/efi/lib/crt0-efi-ia32.S b/arch/efi/lib/crt0-efi-ia32.S
deleted file mode 100644
index 6f0f2e872..000000000
--- a/arch/efi/lib/crt0-efi-ia32.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* crt0-efi-ia32.S - x86 EFI startup code.
- Copyright (C) 1999 Hewlett-Packard Co.
- Contributed by David Mosberger <davidm@hpl.hp.com>.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
- * Neither the name of Hewlett-Packard Co. nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-*/
-
- .text
- .align 4
-
- .globl _start
-_start:
- pushl %ebp
- movl %esp,%ebp
-
- pushl 12(%ebp) # copy "image" argument
- pushl 8(%ebp) # copy "systab" argument
-
- call 0f
-0: popl %eax
- movl %eax,%ebx
-
- addl $image_base-0b,%eax # %eax = ldbase
- addl $_DYNAMIC-0b,%ebx # %ebx = _DYNAMIC
-
- pushl %ebx # pass _DYNAMIC as second argument
- pushl %eax # pass ldbase as first argument
- call _relocate
- popl %ebx
- popl %ebx
- testl %eax,%eax
- jne .exit
-
- call efi_main # call app with "image" and "systab" argument
-
-.exit: leave
- ret
-
- /* hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: */
-
- .data
-dummy: .long 0
-
-#define IMAGE_REL_ABSOLUTE 0
- .section .reloc
- .long dummy /* Page RVA */
- .long 10 /* Block Size (2*4+2) */
- .word (IMAGE_REL_ABSOLUTE<<12) + 0 /* reloc for dummy */
diff --git a/arch/efi/lib/crt0-efi-x86_64.S b/arch/efi/lib/crt0-efi-x86_64.S
deleted file mode 100644
index aa03106e9..000000000
--- a/arch/efi/lib/crt0-efi-x86_64.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* crt0-efi-x86_64.S - x86_64 EFI startup code.
- Copyright (C) 1999 Hewlett-Packard Co.
- Contributed by David Mosberger <davidm@hpl.hp.com>.
- Copyright (C) 2005 Intel Co.
- Contributed by Fenghua Yu <fenghua.yu@intel.com>.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
- * Neither the name of Hewlett-Packard Co. nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-*/
- .text
- .align 4
-
- .globl _start
-_start:
- subq $8, %rsp
- pushq %rcx
- pushq %rdx
-
-0:
- lea image_base(%rip), %rdi
- lea _DYNAMIC(%rip), %rsi
-
- popq %rcx
- popq %rdx
- pushq %rcx
- pushq %rdx
- call _relocate
-
- popq %rdi
- popq %rsi
-
- call efi_main
- addq $8, %rsp
-
-.exit:
- ret
-
- /* hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: */
-
- .data
-dummy: .long 0
-
-#define IMAGE_REL_ABSOLUTE 0
- .section .reloc, "a"
-label1:
- .long dummy-label1 /* Page RVA */
- .long 10 /* Block Size (2*4+2) */
- .word (IMAGE_REL_ABSOLUTE<<12) + 0 /* reloc for dummy */
diff --git a/arch/efi/lib/elf_ia32_efi.lds.S b/arch/efi/lib/elf_ia32_efi.lds.S
deleted file mode 100644
index 69f43f554..000000000
--- a/arch/efi/lib/elf_ia32_efi.lds.S
+++ /dev/null
@@ -1,106 +0,0 @@
-#include <asm-generic/barebox.lds.h>
-
-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
-OUTPUT_ARCH(i386)
-ENTRY(_start)
-SECTIONS
-{
- . = 0;
- image_base = .;
- .hash : { *(.hash) } /* this MUST come first! */
- . = ALIGN(4096);
- .text :
- {
- _stext = .;
- _text = .;
- *(.text)
- *(.text.*)
- *(.gnu.linkonce.t.*)
- }
-
- _etext = .;
-
- . = ALIGN(4096);
- .sdata : {
- *(.got.plt)
- *(.got)
- *(.srodata)
- *(.sdata)
- *(.sbss)
- *(.scommon)
- }
-
- . = ALIGN(4096);
- _sdata = .;
-
- .data : {
- *(.rodata*)
- *(.data)
- *(.data1)
- *(.data.*)
- *(.sdata)
- *(.got.plt)
- *(.got)
- /* the EFI loader doesn't seem to like a .bss section, so we stick
- * it all into .data: */
- *(.sbss)
- *(.scommon)
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
-
- . = ALIGN(64);
-
- __barebox_initcalls_start = .;
- __barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- __barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
-
- . = ALIGN(64);
- __barebox_magicvar_start = .;
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
-
- . = ALIGN(64);
- __barebox_cmd_start = .;
- __barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
-
- . = ALIGN(4096);
- .dynamic : { *(.dynamic) }
- . = ALIGN(4096);
- .rel : {
- *(.rel.data)
- *(.rel.data.*)
- *(.rel.got)
- *(.rel.stab)
- *(.data.rel.ro.local)
- *(.data.rel.local)
- *(.data.rel.ro)
- *(.data.rel*)
- }
-
- . = ALIGN(4096);
- .reloc : /* This is the PECOFF .reloc section! */
- {
- *(.reloc)
- }
-
- . = ALIGN(4096);
- .dynsym : { *(.dynsym) }
- . = ALIGN(4096);
- .dynstr : { *(.dynstr) }
- . = ALIGN(4096);
- /DISCARD/ :
- {
- *(.rel.reloc)
- *(.eh_frame)
- *(.note.GNU-stack)
- }
-
- .comment 0 : { *(.comment) }
-}
diff --git a/arch/efi/lib/elf_x86_64_efi.lds.S b/arch/efi/lib/elf_x86_64_efi.lds.S
deleted file mode 100644
index 93d34d17a..000000000
--- a/arch/efi/lib/elf_x86_64_efi.lds.S
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <asm-generic/barebox.lds.h>
-
-/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
-
-OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
-OUTPUT_ARCH(i386:x86-64)
-ENTRY(_start)
-SECTIONS
-{
- . = 0;
- image_base = .;
- .hash : { *(.hash) } /* this MUST come first! */
- . = ALIGN(4096);
- .eh_frame : {
- *(.eh_frame)
- }
-
- . = ALIGN(4096);
-
- .text : {
- _stext = .;
- _text = .;
- *(.text)
- *(.text.*)
- *(.gnu.linkonce.t.*)
- }
-
- _etext = .;
-
- . = ALIGN(4096);
-
- .reloc : {
- *(.reloc)
- }
-
- . = ALIGN(4096);
- _sdata = .;
-
- .data : {
- *(.rodata*)
- *(.got.plt)
- *(.got)
- *(.data*)
- *(.sdata)
- /* the EFI loader doesn't seem to like a .bss section, so we stick
- * it all into .data: */
- *(.sbss)
- *(.scommon)
- *(.dynbss)
- *(.bss)
- *(COMMON)
- *(.rel.local)
- }
-
- . = ALIGN(64);
-
- __barebox_initcalls_start = .;
- __barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- __barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
-
- . = ALIGN(64);
- __barebox_magicvar_start = .;
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
-
- . = ALIGN(64);
- __barebox_cmd_start = .;
- __barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
-
- . = ALIGN(4096);
- .dynamic : { *(.dynamic) }
- . = ALIGN(4096);
-
- .rela : {
- *(.rela.data*)
- *(.rela.barebox*)
- *(.rela.initcall*)
- *(.rela.exitcall*)
- *(.rela.got)
- *(.rela.stab)
- }
-
- . = ALIGN(4096);
- .dynsym : { *(.dynsym) }
- . = ALIGN(4096);
- .dynstr : { *(.dynstr) }
- . = ALIGN(4096);
- .ignored.reloc : {
- *(.rela.reloc)
- *(.eh_frame)
- *(.note.GNU-stack)
- }
-
- .comment 0 : { *(.comment) }
-}
diff --git a/arch/efi/lib/reloc_ia32.c b/arch/efi/lib/reloc_ia32.c
deleted file mode 100644
index 46929631e..000000000
--- a/arch/efi/lib/reloc_ia32.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* reloc_ia32.c - position independent x86 ELF shared object relocator
- Copyright (C) 1999 Hewlett-Packard Co.
- Contributed by David Mosberger <davidm@hpl.hp.com>.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
- * Neither the name of Hewlett-Packard Co. nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-*/
-
-#include <common.h>
-#include <efi.h>
-
-#include <elf.h>
-
-efi_status_t _relocate(long ldbase, Elf32_Dyn *dyn, efi_handle_t image, efi_system_table_t *systab)
-{
- long relsz = 0, relent = 0;
- Elf32_Rel *rel = 0;
- unsigned long *addr;
- int i;
-
- for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
- switch (dyn[i].d_tag) {
- case DT_REL:
- rel = (Elf32_Rel*)
- ((unsigned long)dyn[i].d_un.d_ptr
- + ldbase);
- break;
-
- case DT_RELSZ:
- relsz = dyn[i].d_un.d_val;
- break;
-
- case DT_RELENT:
- relent = dyn[i].d_un.d_val;
- break;
-
- case DT_RELA:
- break;
-
- default:
- break;
- }
- }
-
- if (!rel && relent == 0)
- return EFI_SUCCESS;
-
- if (!rel || relent == 0)
- return EFI_LOAD_ERROR;
-
- while (relsz > 0) {
- /* apply the relocs */
- switch (ELF32_R_TYPE (rel->r_info)) {
- case R_386_NONE:
- break;
-
- case R_386_RELATIVE:
- addr = (unsigned long *)
- (ldbase + rel->r_offset);
- *addr += ldbase;
- break;
-
- default:
- break;
- }
- rel = (Elf32_Rel*) ((char *) rel + relent);
- relsz -= relent;
- }
- return EFI_SUCCESS;
-}
diff --git a/arch/efi/lib/reloc_x86_64.c b/arch/efi/lib/reloc_x86_64.c
deleted file mode 100644
index 1db72f5db..000000000
--- a/arch/efi/lib/reloc_x86_64.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* reloc_x86_64.c - position independent x86_64 ELF shared object relocator
- Copyright (C) 1999 Hewlett-Packard Co.
- Contributed by David Mosberger <davidm@hpl.hp.com>.
- Copyright (C) 2005 Intel Co.
- Contributed by Fenghua Yu <fenghua.yu@intel.com>.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
- * Neither the name of Hewlett-Packard Co. nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-*/
-
-#include <common.h>
-#include <efi.h>
-
-#include <elf.h>
-
-efi_status_t _relocate (long ldbase, Elf64_Dyn *dyn, efi_handle_t image, efi_system_table_t *systab)
-{
- long relsz = 0, relent = 0;
- Elf64_Rel *rel = 0;
- unsigned long *addr;
- int i;
-
- for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
- switch (dyn[i].d_tag) {
- case DT_RELA:
- rel = (Elf64_Rel*)
- ((unsigned long)dyn[i].d_un.d_ptr
- + ldbase);
- break;
-
- case DT_RELASZ:
- relsz = dyn[i].d_un.d_val;
- break;
-
- case DT_RELAENT:
- relent = dyn[i].d_un.d_val;
- break;
-
- default:
- break;
- }
- }
-
- if (!rel && relent == 0)
- return EFI_SUCCESS;
-
- if (!rel || relent == 0)
- return EFI_LOAD_ERROR;
-
- while (relsz > 0) {
- /* apply the relocs */
- switch (ELF64_R_TYPE (rel->r_info)) {
- case R_X86_64_NONE:
- break;
-
- case R_X86_64_RELATIVE:
- addr = (unsigned long *)
- (ldbase + rel->r_offset);
- *addr += ldbase;
- break;
-
- default:
- break;
- }
- rel = (Elf64_Rel*) ((char *) rel + relent);
- relsz -= relent;
- }
- return EFI_SUCCESS;
-}
diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig
index 3f7332258..0d9a44a4d 100644
--- a/arch/x86/configs/efi_defconfig
+++ b/arch/x86/configs/efi_defconfig
@@ -20,6 +20,7 @@ CONFIG_DEBUG_LL=y
CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_MEMINFO=y
+# CONFIG_CMD_LINUX16 is not set
CONFIG_CMD_GO=y
CONFIG_CMD_LOADB=y
CONFIG_CMD_RESET=y
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 09/12] efi: bus: add firmware vendor and resision and tables info
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
` (6 preceding siblings ...)
2017-02-15 19:34 ` [PATCH 08/12] ARCH: efi: Finally drop it as now we can build efi bootup from x86 Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-15 19:34 ` Jean-Christophe PLAGNIOL-VILLARD
7 siblings, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-15 19:34 UTC (permalink / raw)
To: barebox
This alllow us to known where we boot from
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/efi/efi-device.c | 23 +++++++++++++++++++++++
include/efi.h | 7 ++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index 2864d0cf1..7eb94de45 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -341,10 +341,33 @@ struct bus_type efi_bus = {
.remove = efi_bus_remove,
};
+static void efi_businfo(struct device_d *dev)
+{
+ int i;
+
+ printf("Tables:\n");
+ for (i = 0; i < efi_sys_table->nr_tables; i++) {
+ efi_config_table_t *t = &efi_sys_table->tables[i];
+
+ printf(" %d: %pUl: %s\n", i, &t->guid,
+ efi_guid_string(&t->guid));
+ }
+}
+
static int efi_init_devices(void)
{
+ char *fw_vendor = NULL;
+
bus_register(&efi_bus);
+ fw_vendor = strdup_wchar_to_char((const wchar_t *)efi_sys_table->fw_vendor);
+ dev_add_param_fixed(efi_bus.dev, "fw_vendor", fw_vendor);
+ free(fw_vendor);
+
+ dev_add_param_int_ro(efi_bus.dev, "fw_revision", efi_sys_table->fw_revision, "%u");
+
+ efi_bus.dev->info = efi_businfo;
+
efi_register_devices();
return 0;
diff --git a/include/efi.h b/include/efi.h
index fa6fb2782..4b812c9ab 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -488,6 +488,11 @@ extern efi_guid_t efi_block_io_protocol_guid;
extern efi_guid_t efi_barebox_vendor_guid;
extern efi_guid_t efi_systemd_vendor_guid;
+typedef struct {
+ efi_guid_t guid;
+ unsigned long table;
+} efi_config_table_t;
+
#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
#define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
@@ -510,7 +515,7 @@ typedef struct {
efi_runtime_services_t *runtime;
efi_boot_services_t *boottime;
unsigned long nr_tables;
- unsigned long tables;
+ efi_config_table_t *tables;
} efi_system_table_t;
typedef struct {
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 07/12] efi: move x86 efi boot support to x86 arch
2017-02-15 19:34 ` [PATCH 07/12] efi: move x86 efi boot support to x86 arch Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-16 7:27 ` Michael Olbrich
2017-02-23 11:39 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-27 7:50 ` Sascha Hauer
1 sibling, 1 reply; 24+ messages in thread
From: Michael Olbrich @ 2017-02-16 7:27 UTC (permalink / raw)
To: barebox
On Wed, Feb 15, 2017 at 08:34:15PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> prepare to drop the efi arch as efi boot up is not arch sepecific
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> Documentation/boards/efi.rst | 2 +-
> arch/x86/Kconfig | 53 ++++++++++++--
> arch/x86/Makefile | 74 +++++++++++++++++--
> arch/x86/configs/efi_defconfig | 78 ++++++++++++++++++++
> arch/x86/configs/generic_defconfig | 1 +
> arch/x86/include/asm/elf.h | 86 +++++++++++++++-------
> arch/x86/include/asm/io.h | 71 +++++++++---------
> arch/x86/include/asm/types.h | 51 ++++++++-----
> arch/x86/include/asm/unaligned.h | 5 ++
> arch/x86/lib/Makefile | 2 +
> arch/x86/lib/asm-offsets.c | 7 ++
> arch/x86/mach-efi/.gitignore | 2 +
> arch/x86/mach-efi/Makefile | 4 +
> arch/x86/mach-efi/crt0-efi-ia32.S | 76 +++++++++++++++++++
> arch/x86/mach-efi/crt0-efi-x86_64.S | 75 +++++++++++++++++++
> arch/x86/mach-efi/elf_ia32_efi.lds.S | 106 +++++++++++++++++++++++++++
> arch/x86/mach-efi/elf_x86_64_efi.lds.S | 99 +++++++++++++++++++++++++
> arch/x86/mach-efi/include/mach/barebox.lds.h | 0
I think this should be done instead of adding an empty file:
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index c8a919b928c9..dd2d286d32ec 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -6,7 +6,7 @@
#define STRUCT_ALIGNMENT 32
#define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
-#if defined CONFIG_X86 || \
+#if defined CONFIG_X86_32 || \
defined CONFIG_ARCH_EP93XX || \
defined CONFIG_ARCH_ZYNQ
#include <mach/barebox.lds.h>
> arch/x86/mach-efi/include/mach/debug_ll.h | 1 +
> arch/x86/mach-efi/reloc_ia32.c | 97 ++++++++++++++++++++++++
> arch/x86/mach-efi/reloc_x86_64.c | 96 ++++++++++++++++++++++++
> commands/Kconfig | 2 +-
> commands/edit.c | 2 +-
> common/memory.c | 2 +-
> drivers/clocksource/Kconfig | 2 +-
> drivers/net/Kconfig | 2 +-
> drivers/of/Kconfig | 2 +-
> drivers/serial/Kconfig | 2 +-
> fs/Kconfig | 4 +-
> include/efi.h | 2 +-
> 30 files changed, 899 insertions(+), 107 deletions(-)
> create mode 100644 arch/x86/configs/efi_defconfig
> rewrite arch/x86/include/asm/elf.h (97%)
> create mode 100644 arch/x86/mach-efi/.gitignore
> create mode 100644 arch/x86/mach-efi/Makefile
> create mode 100644 arch/x86/mach-efi/crt0-efi-ia32.S
> create mode 100644 arch/x86/mach-efi/crt0-efi-x86_64.S
> create mode 100644 arch/x86/mach-efi/elf_ia32_efi.lds.S
> create mode 100644 arch/x86/mach-efi/elf_x86_64_efi.lds.S
> create mode 100644 arch/x86/mach-efi/include/mach/barebox.lds.h
> create mode 100644 arch/x86/mach-efi/include/mach/debug_ll.h
> create mode 100644 arch/x86/mach-efi/reloc_ia32.c
> create mode 100644 arch/x86/mach-efi/reloc_x86_64.c
>
> diff --git a/Documentation/boards/efi.rst b/Documentation/boards/efi.rst
> index b7ad40e47..ecadb3ebb 100644
> --- a/Documentation/boards/efi.rst
> +++ b/Documentation/boards/efi.rst
> @@ -25,7 +25,7 @@ Use the following to build barebox for EFI:
>
> .. code-block:: sh
>
> - export ARCH=efi
> + export ARCH=x86
> make efi_defconfig
> make
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 346640dcd..9803f3f95 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1,9 +1,16 @@
> #
> #
> #
> +config X86
> + bool
> + select HAS_KALLSYMS
> + select GENERIC_FIND_NEXT_BIT
> + default y
> +
> config ARCH_TEXT_BASE
> hex
> default 0x00007c00 if MACH_X86_GENERIC
> + default 0x0 if MACH_EFI_GENERIC
>
> config BOARD_LINKER_SCRIPT
> bool
> @@ -14,17 +21,33 @@ config GENERIC_LINKER_SCRIPT
> default y
> depends on !BOARD_LINKER_SCRIPT
>
> -config X86
> +menu "ARCH specific settings"
> +
> +config 64BIT
> + def_bool y if X86_EFI
> + help
> + Say yes to build a 64-bit binary - formerly known as x86_64
> + Say no to build a 32-bit binary - formerly known as i386.
> +
> + 32-bit support currently does not compile and is not tested
> + due to the lack of hardware.
> +
> +config X86_32
> + def_bool y
> + depends on !64BIT
> +
> +config X86_64
> + def_bool y
> + depends on 64BIT
> +
> +endmenu
> +
> +config X86_BOOTLOADER
> bool
> - select HAS_KALLSYMS
> + select X86_32
> select HAS_MODULES
> select HAVE_CONFIGURABLE_MEMORY_LAYOUT
> select HAVE_CONFIGURABLE_TEXT_BASE
> - select GENERIC_FIND_NEXT_BIT
> - default y
> -
> -config X86_BOOTLOADER
> - bool
>
> choice
> prompt "Select your board"
> @@ -32,14 +55,30 @@ choice
> config MACH_X86_GENERIC
> bool "Generic x86"
> select X86_BOOTLOADER
> + depends on !X86_EFI
> help
> Say Y here if you want barebox to be your BIOS based bootloader
>
> +config MACH_EFI_GENERIC
> + bool "Generic EFI"
> + depends on X86_EFI
> + select HAS_DEBUG_LL
> + help
> + Say Y here if you want barebox to be your EFI based bootloader
> +
> endchoice
>
> choice
> prompt "Bring up type"
>
> + config X86_EFI
> + bool "EFI"
> + select EFI_BOOTUP
> + select EFI_GUID
> + select EFI_DEVICEPATH
> + select PRINTF_UUID
> + select CLOCKSOURCE_EFI
> +
> config X86_BIOS_BRINGUP
> bool "16 bit BIOS"
> help
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 640c24b62..e837a2df9 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -1,20 +1,47 @@
> KBUILD_DEFCONFIG := generic_defconfig
>
> -CPPFLAGS += -D__X86__ -fno-strict-aliasing
> +CPPFLAGS += -D__X86__
>
> -board-y := x86_generic
> -machine-y := i386
> +board-$(CONFIG_MACH_X86_GENERIC) := x86_generic
>
> TEXT_BASE = $(CONFIG_TEXT_BASE)
>
> -CPPFLAGS += -march=i386 -m32 -DTEXT_BASE=$(TEXT_BASE) \
> +ifeq ($(CONFIG_X86_EFI),y)
> +machine-y := efi
> +CFLAGS += -fpic -fshort-wchar -mno-sse -mno-mmx
> +ifeq ($(CONFIG_X86_32),y)
> + TARGET = efi-app-ia32
> +else
> + TARGET = efi-app-x86_64
> +endif
> +else
> +CPPFLAGS += -fno-strict-aliasing
> +CPPFLAGS += -march=i386 -DTEXT_BASE=$(TEXT_BASE) \
> -fno-unwind-tables -fno-asynchronous-unwind-tables
> -LDFLAGS += -m elf_i386
> +
> +machine-y := i386
> +endif
> +
> +ifeq ($(CONFIG_X86_32),y)
> + UTS_MACHINE := i386
> + biarch := $(call cc-option,-m32)
> + AFLAGS += $(biarch)
> + CFLAGS += $(biarch)
> + CPPFLAGS += $(biarch)
> +else
> + UTS_MACHINE := x86_64
> + AFLAGS += -m64
> + CFLAGS += -m64 -mno-red-zone
> + CPPFLAGS += -m64
> +endif
> +
>
> ifndef CONFIG_MODULES
> # Add cleanup flags
> +ifneq ($(CONFIG_X86_EFI),y)
> CPPFLAGS += -fdata-sections -ffunction-sections
> -LDFLAGS_uboot += -static --gc-sections
> +LDFLAGS_barebox += -static --gc-sections
> +endif
> endif
>
> machdirs := $(patsubst %,arch/x86/mach-%/,$(machine-y))
> @@ -39,13 +66,46 @@ endif
>
> common-y += $(BOARD) $(MACH)
> common-y += arch/x86/lib/
> -common-y += arch/x86/boot/
> common-$(CONFIG_X86_BIOS_BRINGUP) += arch/x86/bios/
>
> # arch/x86/cpu/
>
> +ifeq ($(CONFIG_X86_EFI),y)
> +lds-$(CONFIG_X86_32) := arch/x86/mach-efi/elf_ia32_efi.lds
> +lds-$(CONFIG_X86_64) := arch/x86/mach-efi/elf_x86_64_efi.lds
> +
> +cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
> + -T $(lds-y) \
> + -shared -Bsymbolic -nostdlib -znocombreloc \
> + --start-group $(barebox-common) \
> + --end-group \
> + $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^)
> +
> +quiet_cmd_efi_image = EFI-IMG $@
> + cmd_efi_image = $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
> + -j .dynsym -j .rel -j .rela -j .reloc -j __barebox_initcalls \
I think you created this from ther version before
71f0587f2049397d86e9eee7983bce623de5fb5e ("efi: include and execute exit
calls"). So this is missing:
-j __barebox_exitcalls \
and below...
> + -j __barebox_cmd -j .barebox_magicvar -j .bbenv.* \
> + --target=$(TARGET) $< $@
> +
> +KBUILD_BINARY := barebox
> +
> +LDFLAGS := --no-undefined
> +
> +barebox.efi: $(KBUILD_BINARY) FORCE
> + $(call if_changed,efi_image)
> +
> +KBUILD_IMAGE := barebox.efi
> +
> +else
> +common-y += arch/x86/boot/
> +
> lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/x86/lib/barebox.lds
> lds-$(CONFIG_BOARD_LINKER_SCRIPT) := $(BOARD)/barebox.lds
>
> +endif
> +
> +LDFLAGS += -m elf_$(UTS_MACHINE)
> +
> +CLEAN_FILES += $(lds-y)
> CLEAN_FILES += arch/x86/lib/barebox.lds barebox.map barebox.S
>
> diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig
> new file mode 100644
> index 000000000..3f7332258
> --- /dev/null
> +++ b/arch/x86/configs/efi_defconfig
> @@ -0,0 +1,78 @@
> +CONFIG_MMU=y
> +CONFIG_MALLOC_SIZE=0x0
> +CONFIG_MALLOC_TLSF=y
> +CONFIG_HUSH_FANCY_PROMPT=y
> +CONFIG_CMDLINE_EDITING=y
> +CONFIG_AUTO_COMPLETE=y
> +CONFIG_MENU=y
> +# CONFIG_TIMESTAMP is not set
> +CONFIG_BOOTM_SHOW_TYPE=y
> +CONFIG_BOOTM_VERBOSE=y
> +CONFIG_BOOTM_INITRD=y
> +CONFIG_BOOTM_OFTREE=y
> +CONFIG_BLSPEC=y
> +CONFIG_CONSOLE_ACTIVATE_ALL=y
> +CONFIG_PARTITION_DISK_EFI=y
> +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
> +CONFIG_POLLER=y
> +CONFIG_DEBUG_INFO=y
> +CONFIG_DEBUG_LL=y
> +CONFIG_LONGHELP=y
> +CONFIG_CMD_IOMEM=y
> +CONFIG_CMD_MEMINFO=y
> +CONFIG_CMD_GO=y
> +CONFIG_CMD_LOADB=y
> +CONFIG_CMD_RESET=y
> +CONFIG_CMD_UIMAGE=y
> +CONFIG_CMD_PARTITION=y
> +CONFIG_CMD_EXPORT=y
> +CONFIG_CMD_LOADENV=y
> +CONFIG_CMD_PRINTENV=y
> +CONFIG_CMD_MAGICVAR=y
> +CONFIG_CMD_MAGICVAR_HELP=y
> +CONFIG_CMD_SAVEENV=y
> +CONFIG_CMD_FILETYPE=y
> +CONFIG_CMD_LN=y
> +CONFIG_CMD_MD5SUM=y
> +CONFIG_CMD_UNCOMPRESS=y
> +CONFIG_CMD_LET=y
> +CONFIG_CMD_MSLEEP=y
> +CONFIG_CMD_READF=y
> +CONFIG_CMD_SLEEP=y
> +CONFIG_CMD_DHCP=y
> +CONFIG_CMD_HOST=y
> +CONFIG_CMD_PING=y
> +CONFIG_CMD_TFTP=y
> +CONFIG_CMD_ECHO_E=y
> +CONFIG_CMD_EDIT=y
> +CONFIG_CMD_MENU=y
> +CONFIG_CMD_MENUTREE=y
> +CONFIG_CMD_READLINE=y
> +CONFIG_CMD_TIMEOUT=y
> +CONFIG_CMD_CRC=y
> +CONFIG_CMD_CRC_CMP=y
> +CONFIG_CMD_MM=y
> +CONFIG_CMD_DETECT=y
> +CONFIG_CMD_FLASH=y
> +CONFIG_CMD_2048=y
> +CONFIG_CMD_BAREBOX_UPDATE=y
> +CONFIG_CMD_OF_NODE=y
> +CONFIG_CMD_OF_PROPERTY=y
> +CONFIG_CMD_OFTREE=y
> +CONFIG_CMD_TIME=y
> +CONFIG_NET=y
> +CONFIG_NET_NFS=y
> +CONFIG_NET_NETCONSOLE=y
> +CONFIG_DRIVER_SERIAL_EFI_STDIO=y
> +CONFIG_DRIVER_SERIAL_NS16550=y
> +CONFIG_DRIVER_NET_EFI_SNP=y
> +# CONFIG_SPI is not set
> +CONFIG_DISK=y
> +CONFIG_FS_EXT4=y
> +CONFIG_FS_TFTP=y
> +CONFIG_FS_NFS=y
> +CONFIG_FS_EFI=y
> +CONFIG_FS_EFIVARFS=y
> +CONFIG_FS_FAT=y
> +CONFIG_FS_FAT_WRITE=y
> +CONFIG_FS_FAT_LFN=y
> diff --git a/arch/x86/configs/generic_defconfig b/arch/x86/configs/generic_defconfig
> index 5ff7f531e..3b94e02a7 100644
> --- a/arch/x86/configs/generic_defconfig
> +++ b/arch/x86/configs/generic_defconfig
> @@ -1,3 +1,4 @@
> +CONFIG_X86_BIOS_BRINGUP=y
> CONFIG_X86_HDBOOT=y
> CONFIG_STACK_SIZE=0x7000
> CONFIG_EXPERIMENTAL=y
> diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
> dissimilarity index 97%
> index 94a40c624..ddde03518 100644
> --- a/arch/x86/include/asm/elf.h
> +++ b/arch/x86/include/asm/elf.h
> @@ -1,26 +1,60 @@
> -/*
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - *
> - */
> -
> -/**
> - * @file
> - * @brief x86 specific elf information
> - *
> - */
> -
> -#ifndef _ASM_X86_ELF_H
> -#define _ASM_X86_ELF_H
> -
> -#define ELF_CLASS ELFCLASS32
> -
> -#endif /* _ASM_X86_ELF_H */
> +#ifndef __ASM_SANDBOX_ELF_H__
> +#define __ASM_SANDBOX_ELF_H__
> +
> +#ifdef __i386__
> +
> +typedef struct user_fxsr_struct elf_fpxregset_t;
> +
> +#define R_386_NONE 0
> +#define R_386_32 1
> +#define R_386_PC32 2
> +#define R_386_GOT32 3
> +#define R_386_PLT32 4
> +#define R_386_COPY 5
> +#define R_386_GLOB_DAT 6
> +#define R_386_JMP_SLOT 7
> +#define R_386_RELATIVE 8
> +#define R_386_GOTOFF 9
> +#define R_386_GOTPC 10
> +#define R_386_NUM 11
> +
> +/*
> + * These are used to set parameters in the core dumps.
> + */
> +#define ELF_CLASS ELFCLASS32
> +#define ELF_DATA ELFDATA2LSB
> +#define ELF_ARCH EM_386
> +
> +#else
> +
> +/* x86-64 relocation types */
> +#define R_X86_64_NONE 0 /* No reloc */
> +#define R_X86_64_64 1 /* Direct 64 bit */
> +#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
> +#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
> +#define R_X86_64_PLT32 4 /* 32 bit PLT address */
> +#define R_X86_64_COPY 5 /* Copy symbol at runtime */
> +#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
> +#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
> +#define R_X86_64_RELATIVE 8 /* Adjust by program base */
> +#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
> + offset to GOT */
> +#define R_X86_64_32 10 /* Direct 32 bit zero extended */
> +#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
> +#define R_X86_64_16 12 /* Direct 16 bit zero extended */
> +#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
> +#define R_X86_64_8 14 /* Direct 8 bit sign extended */
> +#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
> +
> +#define R_X86_64_NUM 16
> +
> +/*
> + * These are used to set parameters in the core dumps.
> + */
> +#define ELF_CLASS ELFCLASS64
> +#define ELF_DATA ELFDATA2LSB
> +#define ELF_ARCH EM_X86_64
> +
> +#endif
> +
> +#endif /* __ASM_SANDBOX_ELF_H__ */
> diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
> index f02051056..df4bc99ec 100644
> --- a/arch/x86/include/asm/io.h
> +++ b/arch/x86/include/asm/io.h
> @@ -12,44 +12,6 @@
>
> #include <asm/byteorder.h>
>
> -#define IO_SPACE_LIMIT 0xffff
> -
> -static inline void outb(unsigned char value, int port)
> -{
> - asm volatile("outb %b0, %w1" : : "a"(value), "Nd"(port));
> -}
> -
> -static inline void outw(unsigned short value, int port)
> -{
> - asm volatile("outw %w0, %w1" : : "a"(value), "Nd"(port));
> -}
> -
> -static inline void outl(unsigned long value, int port)
> -{
> - asm volatile("outl %0, %w1" : : "a"(value), "Nd"(port));
> -}
> -
> -static inline unsigned char inb(int port)
> -{
> - unsigned char value;
> - asm volatile("inb %w1, %b0" : "=a"(value) : "Nd"(port));
> - return value;
> -}
> -
> -static inline unsigned short inw(int port)
> -{
> - unsigned short value;
> - asm volatile("inw %w1, %w0" : "=a"(value) : "Nd"(port));
> - return value;
> -}
> -
> -static inline unsigned long inl(int port)
> -{
> - unsigned long value;
> - asm volatile("inl %w1, %0" : "=a"(value) : "Nd"(port));
> - return value;
> -}
> -
> #define build_mmio_read(name, size, type, reg, barrier) \
> static inline type name(const volatile void *addr) \
> { type ret; asm volatile("mov" size " %1,%0":reg (ret) \
> @@ -68,6 +30,39 @@ build_mmio_write(writeb, "b", unsigned char, "q", :"memory")
> build_mmio_write(writew, "w", unsigned short, "r", :"memory")
> build_mmio_write(writel, "l", unsigned int, "r", :"memory")
>
> +#define BUILDIO(bwl, bw, type) \
> +static inline void out##bwl(unsigned type value, int port) \
> +{ \
> + asm volatile("out" #bwl " %" #bw "0, %w1" \
> + : : "a"(value), "Nd"(port)); \
> +} \
> + \
> +static inline unsigned type in##bwl(int port) \
> +{ \
> + unsigned type value; \
> + asm volatile("in" #bwl " %w1, %" #bw "0" \
> + : "=a"(value) : "Nd"(port)); \
> + return value; \
> +} \
> + \
> +static inline void outs##bwl(int port, const void *addr, unsigned long count) \
> +{ \
> + asm volatile("rep; outs" #bwl \
> + : "+S"(addr), "+c"(count) : "d"(port)); \
> +} \
> + \
> +static inline void ins##bwl(int port, void *addr, unsigned long count) \
> +{ \
> + asm volatile("rep; ins" #bwl \
> + : "+D"(addr), "+c"(count) : "d"(port)); \
> +}
> +
> +BUILDIO(b, b, char)
> +BUILDIO(w, w, short)
> +BUILDIO(l, , int)
> +
> +#define IO_SPACE_LIMIT 0xffff
> +
> /* do a tiny io delay */
> static inline void io_delay(void)
> {
> diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
> index 7349ba03c..3caac398d 100644
> --- a/arch/x86/include/asm/types.h
> +++ b/arch/x86/include/asm/types.h
> @@ -1,21 +1,29 @@
> +#ifndef __ASM_I386_TYPES_H
> +#define __ASM_I386_TYPES_H
> +
> +#ifndef __ASSEMBLY__
> +
> +#ifdef __x86_64__
> +/*
> + * This is used in dlmalloc. On X86_64 we need it to be
> + * 64 bit
> + */
> +#define INTERNAL_SIZE_T unsigned long
> +
> /*
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - *
> + * This is a Kconfig variable in the Kernel, but we want to detect
> + * this during compile time, so we set it here.
> */
> +#define CONFIG_PHYS_ADDR_T_64BIT
>
> -#ifndef __ASM_X86_TYPES_H
> -#define __ASM_X86_TYPES_H
> +#endif
>
> -#ifndef __ASSEMBLY__
> +typedef unsigned short umode_t;
> +
> +/*
> + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
> + * header files exported to user space
> + */
>
> typedef __signed__ char __s8;
> typedef unsigned char __u8;
> @@ -26,8 +34,15 @@ typedef unsigned short __u16;
> typedef __signed__ int __s32;
> typedef unsigned int __u32;
>
> +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
> typedef __signed__ long long __s64;
> typedef unsigned long long __u64;
> +#endif
> +
> +/*
> + * These aren't exported outside the kernel to avoid name space clashes
> + */
> +#ifdef __KERNEL__
>
> typedef signed char s8;
> typedef unsigned char u8;
> @@ -41,10 +56,10 @@ typedef unsigned int u32;
> typedef signed long long s64;
> typedef unsigned long long u64;
>
> -typedef unsigned short umode_t;
> +#include <asm/bitsperlong.h>
>
> -#include <asm-generic/bitsperlong.h>
> +#endif /* __KERNEL__ */
>
> -#endif /* __ASSEMBLY__ */
> +#endif
>
> -#endif /* __ASM_X86_TYPES_H */
> +#endif
> diff --git a/arch/x86/include/asm/unaligned.h b/arch/x86/include/asm/unaligned.h
> index a7bd416b4..7e38706c5 100644
> --- a/arch/x86/include/asm/unaligned.h
> +++ b/arch/x86/include/asm/unaligned.h
> @@ -8,7 +8,12 @@
> #include <linux/unaligned/access_ok.h>
> #include <linux/unaligned/generic.h>
>
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> #define get_unaligned __get_unaligned_le
> #define put_unaligned __put_unaligned_le
> +#else
> +#define get_unaligned __get_unaligned_be
> +#define put_unaligned __put_unaligned_be
> +#endif
>
> #endif /* _ASM_X86_UNALIGNED_H */
> diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
> index 6054b9e3f..05e43f0f2 100644
> --- a/arch/x86/lib/Makefile
> +++ b/arch/x86/lib/Makefile
> @@ -1,6 +1,8 @@
> extra-$(CONFIG_GENERIC_LINKER_SCRIPT) += barebox.lds
> +ifneq ($(CONFIG_X86_EFI),y)
> obj-y += memory.o
> obj-y += gdt.o
> +endif
>
> # needed, when running via a 16 bit BIOS
> obj-$(CONFIG_CMD_LINUX16) += linux_start.o
> diff --git a/arch/x86/lib/asm-offsets.c b/arch/x86/lib/asm-offsets.c
> index b1be3e539..0f9c47eaa 100644
> --- a/arch/x86/lib/asm-offsets.c
> +++ b/arch/x86/lib/asm-offsets.c
> @@ -6,6 +6,13 @@
>
> #include <linux/kbuild.h>
>
> +#ifdef CONFIG_EFI_BOOTUP
> +int main(void)
> +{
> + return 0;
> +}
> +#else
> void common(void)
> {
> }
> +#endif
> diff --git a/arch/x86/mach-efi/.gitignore b/arch/x86/mach-efi/.gitignore
> new file mode 100644
> index 000000000..847e31770
> --- /dev/null
> +++ b/arch/x86/mach-efi/.gitignore
> @@ -0,0 +1,2 @@
> +elf_x86_64_efi.lds
> +elf_ia32_efi.lds
> diff --git a/arch/x86/mach-efi/Makefile b/arch/x86/mach-efi/Makefile
> new file mode 100644
> index 000000000..c8a97bae0
> --- /dev/null
> +++ b/arch/x86/mach-efi/Makefile
> @@ -0,0 +1,4 @@
> +obj-$(CONFIG_X86_64) += reloc_x86_64.o crt0-efi-x86_64.o
> +obj-$(CONFIG_X86_32) += reloc_ia32.o crt0-efi-ia32.o
> +extra-$(CONFIG_X86_32) += elf_ia32_efi.lds
> +extra-$(CONFIG_X86_64) += elf_x86_64_efi.lds
> diff --git a/arch/x86/mach-efi/crt0-efi-ia32.S b/arch/x86/mach-efi/crt0-efi-ia32.S
> new file mode 100644
> index 000000000..6f0f2e872
> --- /dev/null
> +++ b/arch/x86/mach-efi/crt0-efi-ia32.S
> @@ -0,0 +1,76 @@
> +/* crt0-efi-ia32.S - x86 EFI startup code.
> + Copyright (C) 1999 Hewlett-Packard Co.
> + Contributed by David Mosberger <davidm@hpl.hp.com>.
> +
> + All rights reserved.
> +
> + Redistribution and use in source and binary forms, with or without
> + modification, are permitted provided that the following conditions
> + are met:
> +
> + * Redistributions of source code must retain the above copyright
> + notice, this list of conditions and the following disclaimer.
> + * Redistributions in binary form must reproduce the above
> + copyright notice, this list of conditions and the following
> + disclaimer in the documentation and/or other materials
> + provided with the distribution.
> + * Neither the name of Hewlett-Packard Co. nor the names of its
> + contributors may be used to endorse or promote products derived
> + from this software without specific prior written permission.
> +
> + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
> + BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
> + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
> + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
> + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
> + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + SUCH DAMAGE.
> +*/
> +
> + .text
> + .align 4
> +
> + .globl _start
> +_start:
> + pushl %ebp
> + movl %esp,%ebp
> +
> + pushl 12(%ebp) # copy "image" argument
> + pushl 8(%ebp) # copy "systab" argument
> +
> + call 0f
> +0: popl %eax
> + movl %eax,%ebx
> +
> + addl $image_base-0b,%eax # %eax = ldbase
> + addl $_DYNAMIC-0b,%ebx # %ebx = _DYNAMIC
> +
> + pushl %ebx # pass _DYNAMIC as second argument
> + pushl %eax # pass ldbase as first argument
> + call _relocate
> + popl %ebx
> + popl %ebx
> + testl %eax,%eax
> + jne .exit
> +
> + call efi_main # call app with "image" and "systab" argument
> +
> +.exit: leave
> + ret
> +
> + /* hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: */
> +
> + .data
> +dummy: .long 0
> +
> +#define IMAGE_REL_ABSOLUTE 0
> + .section .reloc
> + .long dummy /* Page RVA */
> + .long 10 /* Block Size (2*4+2) */
> + .word (IMAGE_REL_ABSOLUTE<<12) + 0 /* reloc for dummy */
> diff --git a/arch/x86/mach-efi/crt0-efi-x86_64.S b/arch/x86/mach-efi/crt0-efi-x86_64.S
> new file mode 100644
> index 000000000..aa03106e9
> --- /dev/null
> +++ b/arch/x86/mach-efi/crt0-efi-x86_64.S
> @@ -0,0 +1,75 @@
> +/* crt0-efi-x86_64.S - x86_64 EFI startup code.
> + Copyright (C) 1999 Hewlett-Packard Co.
> + Contributed by David Mosberger <davidm@hpl.hp.com>.
> + Copyright (C) 2005 Intel Co.
> + Contributed by Fenghua Yu <fenghua.yu@intel.com>.
> +
> + All rights reserved.
> +
> + Redistribution and use in source and binary forms, with or without
> + modification, are permitted provided that the following conditions
> + are met:
> +
> + * Redistributions of source code must retain the above copyright
> + notice, this list of conditions and the following disclaimer.
> + * Redistributions in binary form must reproduce the above
> + copyright notice, this list of conditions and the following
> + disclaimer in the documentation and/or other materials
> + provided with the distribution.
> + * Neither the name of Hewlett-Packard Co. nor the names of its
> + contributors may be used to endorse or promote products derived
> + from this software without specific prior written permission.
> +
> + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
> + BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
> + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
> + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
> + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
> + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + SUCH DAMAGE.
> +*/
> + .text
> + .align 4
> +
> + .globl _start
> +_start:
> + subq $8, %rsp
> + pushq %rcx
> + pushq %rdx
> +
> +0:
> + lea image_base(%rip), %rdi
> + lea _DYNAMIC(%rip), %rsi
> +
> + popq %rcx
> + popq %rdx
> + pushq %rcx
> + pushq %rdx
> + call _relocate
> +
> + popq %rdi
> + popq %rsi
> +
> + call efi_main
> + addq $8, %rsp
> +
> +.exit:
> + ret
> +
> + /* hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: */
> +
> + .data
> +dummy: .long 0
> +
> +#define IMAGE_REL_ABSOLUTE 0
> + .section .reloc, "a"
> +label1:
> + .long dummy-label1 /* Page RVA */
> + .long 10 /* Block Size (2*4+2) */
> + .word (IMAGE_REL_ABSOLUTE<<12) + 0 /* reloc for dummy */
> diff --git a/arch/x86/mach-efi/elf_ia32_efi.lds.S b/arch/x86/mach-efi/elf_ia32_efi.lds.S
> new file mode 100644
> index 000000000..69f43f554
> --- /dev/null
> +++ b/arch/x86/mach-efi/elf_ia32_efi.lds.S
> @@ -0,0 +1,106 @@
> +#include <asm-generic/barebox.lds.h>
> +
> +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
> +OUTPUT_ARCH(i386)
> +ENTRY(_start)
> +SECTIONS
> +{
> + . = 0;
> + image_base = .;
> + .hash : { *(.hash) } /* this MUST come first! */
> + . = ALIGN(4096);
> + .text :
> + {
> + _stext = .;
> + _text = .;
> + *(.text)
> + *(.text.*)
> + *(.gnu.linkonce.t.*)
> + }
> +
> + _etext = .;
> +
> + . = ALIGN(4096);
> + .sdata : {
> + *(.got.plt)
> + *(.got)
> + *(.srodata)
> + *(.sdata)
> + *(.sbss)
> + *(.scommon)
> + }
> +
> + . = ALIGN(4096);
> + _sdata = .;
> +
> + .data : {
> + *(.rodata*)
> + *(.data)
> + *(.data1)
> + *(.data.*)
> + *(.sdata)
> + *(.got.plt)
> + *(.got)
> + /* the EFI loader doesn't seem to like a .bss section, so we stick
> + * it all into .data: */
> + *(.sbss)
> + *(.scommon)
> + *(.dynbss)
> + *(.bss)
> + *(COMMON)
> + }
> +
> + . = ALIGN(64);
> +
> + __barebox_initcalls_start = .;
> + __barebox_initcalls : { INITCALLS }
> + __barebox_initcalls_end = .;
> +
> + __barebox_exitcalls_start = .;
> + __barebox_exitcalls : { EXITCALLS }
> + __barebox_exitcalls_end = .;
> +
> + . = ALIGN(64);
> + __barebox_magicvar_start = .;
> + .barebox_magicvar : { BAREBOX_MAGICVARS }
> + __barebox_magicvar_end = .;
> +
> + . = ALIGN(64);
> + __barebox_cmd_start = .;
> + __barebox_cmd : { BAREBOX_CMDS }
> + __barebox_cmd_end = .;
> +
> + . = ALIGN(4096);
> + .dynamic : { *(.dynamic) }
> + . = ALIGN(4096);
> + .rel : {
> + *(.rel.data)
> + *(.rel.data.*)
> + *(.rel.got)
> + *(.rel.stab)
> + *(.data.rel.ro.local)
> + *(.data.rel.local)
> + *(.data.rel.ro)
> + *(.data.rel*)
> + }
> +
> + . = ALIGN(4096);
> + .reloc : /* This is the PECOFF .reloc section! */
> + {
> + *(.reloc)
> + }
> +
> + . = ALIGN(4096);
> + .dynsym : { *(.dynsym) }
> + . = ALIGN(4096);
> + .dynstr : { *(.dynstr) }
> + . = ALIGN(4096);
> + /DISCARD/ :
> + {
> + *(.rel.reloc)
> + *(.eh_frame)
> + *(.note.GNU-stack)
> + }
> +
> + .comment 0 : { *(.comment) }
> +}
> diff --git a/arch/x86/mach-efi/elf_x86_64_efi.lds.S b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
> new file mode 100644
> index 000000000..e1bc2120f
> --- /dev/null
> +++ b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
> @@ -0,0 +1,99 @@
> +#include <asm-generic/barebox.lds.h>
> +
> +/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
> +
> +OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
> +OUTPUT_ARCH(i386:x86-64)
> +ENTRY(_start)
> +SECTIONS
> +{
> + . = 0;
> + image_base = .;
> + .hash : { *(.hash) } /* this MUST come first! */
> + . = ALIGN(4096);
> + .eh_frame : {
> + *(.eh_frame)
> + }
> +
> + . = ALIGN(4096);
> +
> + .text : {
> + _stext = .;
> + _text = .;
> + *(.text)
> + *(.text.*)
> + *(.gnu.linkonce.t.*)
> + }
> +
> + _etext = .;
> +
> + . = ALIGN(4096);
> +
> + .reloc : {
> + *(.reloc)
> + }
> +
> + . = ALIGN(4096);
> + _sdata = .;
> +
> + .data : {
> + *(.rodata*)
> + *(.got.plt)
> + *(.got)
> + *(.data*)
> + *(.sdata)
> + /* the EFI loader doesn't seem to like a .bss section, so we stick
> + * it all into .data: */
> + *(.sbss)
> + *(.scommon)
> + *(.dynbss)
> + *(.bss)
> + *(COMMON)
> + *(.rel.local)
> + }
> +
> + . = ALIGN(64);
> +
> + __barebox_initcalls_start = .;
> + __barebox_initcalls : { INITCALLS }
> + __barebox_initcalls_end = .;
> +
> + __barebox_exitcalls_start = .;
> + __barebox_exitcalls : { EXITCALLS }
> + __barebox_exitcalls_end = .;
> +
> + . = ALIGN(64);
> + __barebox_magicvar_start = .;
> + .barebox_magicvar : { BAREBOX_MAGICVARS }
> + __barebox_magicvar_end = .;
> +
> + . = ALIGN(64);
> + __barebox_cmd_start = .;
> + __barebox_cmd : { BAREBOX_CMDS }
> + __barebox_cmd_end = .;
> +
> + . = ALIGN(4096);
> + .dynamic : { *(.dynamic) }
> + . = ALIGN(4096);
> +
> + .rela : {
> + *(.rela.data*)
> + *(.rela.barebox*)
> + *(.rela.initcall*)
... and here:
*(.rela.exitcall*)
Regards,
Michael
> + *(.rela.got)
> + *(.rela.stab)
> + }
> +
> + . = ALIGN(4096);
> + .dynsym : { *(.dynsym) }
> + . = ALIGN(4096);
> + .dynstr : { *(.dynstr) }
> + . = ALIGN(4096);
> + .ignored.reloc : {
> + *(.rela.reloc)
> + *(.eh_frame)
> + *(.note.GNU-stack)
> + }
> +
> + .comment 0 : { *(.comment) }
> +}
> diff --git a/arch/x86/mach-efi/include/mach/barebox.lds.h b/arch/x86/mach-efi/include/mach/barebox.lds.h
> new file mode 100644
> index 000000000..e69de29bb
> diff --git a/arch/x86/mach-efi/include/mach/debug_ll.h b/arch/x86/mach-efi/include/mach/debug_ll.h
> new file mode 100644
> index 000000000..e144d86e0
> --- /dev/null
> +++ b/arch/x86/mach-efi/include/mach/debug_ll.h
> @@ -0,0 +1 @@
> +#include <efi/debug_ll.h>
> diff --git a/arch/x86/mach-efi/reloc_ia32.c b/arch/x86/mach-efi/reloc_ia32.c
> new file mode 100644
> index 000000000..46929631e
> --- /dev/null
> +++ b/arch/x86/mach-efi/reloc_ia32.c
> @@ -0,0 +1,97 @@
> +/* reloc_ia32.c - position independent x86 ELF shared object relocator
> + Copyright (C) 1999 Hewlett-Packard Co.
> + Contributed by David Mosberger <davidm@hpl.hp.com>.
> +
> + All rights reserved.
> +
> + Redistribution and use in source and binary forms, with or without
> + modification, are permitted provided that the following conditions
> + are met:
> +
> + * Redistributions of source code must retain the above copyright
> + notice, this list of conditions and the following disclaimer.
> + * Redistributions in binary form must reproduce the above
> + copyright notice, this list of conditions and the following
> + disclaimer in the documentation and/or other materials
> + provided with the distribution.
> + * Neither the name of Hewlett-Packard Co. nor the names of its
> + contributors may be used to endorse or promote products derived
> + from this software without specific prior written permission.
> +
> + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
> + BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
> + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
> + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
> + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
> + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + SUCH DAMAGE.
> +*/
> +
> +#include <common.h>
> +#include <efi.h>
> +
> +#include <elf.h>
> +
> +efi_status_t _relocate(long ldbase, Elf32_Dyn *dyn, efi_handle_t image, efi_system_table_t *systab)
> +{
> + long relsz = 0, relent = 0;
> + Elf32_Rel *rel = 0;
> + unsigned long *addr;
> + int i;
> +
> + for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
> + switch (dyn[i].d_tag) {
> + case DT_REL:
> + rel = (Elf32_Rel*)
> + ((unsigned long)dyn[i].d_un.d_ptr
> + + ldbase);
> + break;
> +
> + case DT_RELSZ:
> + relsz = dyn[i].d_un.d_val;
> + break;
> +
> + case DT_RELENT:
> + relent = dyn[i].d_un.d_val;
> + break;
> +
> + case DT_RELA:
> + break;
> +
> + default:
> + break;
> + }
> + }
> +
> + if (!rel && relent == 0)
> + return EFI_SUCCESS;
> +
> + if (!rel || relent == 0)
> + return EFI_LOAD_ERROR;
> +
> + while (relsz > 0) {
> + /* apply the relocs */
> + switch (ELF32_R_TYPE (rel->r_info)) {
> + case R_386_NONE:
> + break;
> +
> + case R_386_RELATIVE:
> + addr = (unsigned long *)
> + (ldbase + rel->r_offset);
> + *addr += ldbase;
> + break;
> +
> + default:
> + break;
> + }
> + rel = (Elf32_Rel*) ((char *) rel + relent);
> + relsz -= relent;
> + }
> + return EFI_SUCCESS;
> +}
> diff --git a/arch/x86/mach-efi/reloc_x86_64.c b/arch/x86/mach-efi/reloc_x86_64.c
> new file mode 100644
> index 000000000..1db72f5db
> --- /dev/null
> +++ b/arch/x86/mach-efi/reloc_x86_64.c
> @@ -0,0 +1,96 @@
> +/* reloc_x86_64.c - position independent x86_64 ELF shared object relocator
> + Copyright (C) 1999 Hewlett-Packard Co.
> + Contributed by David Mosberger <davidm@hpl.hp.com>.
> + Copyright (C) 2005 Intel Co.
> + Contributed by Fenghua Yu <fenghua.yu@intel.com>.
> +
> + All rights reserved.
> +
> + Redistribution and use in source and binary forms, with or without
> + modification, are permitted provided that the following conditions
> + are met:
> +
> + * Redistributions of source code must retain the above copyright
> + notice, this list of conditions and the following disclaimer.
> + * Redistributions in binary form must reproduce the above
> + copyright notice, this list of conditions and the following
> + disclaimer in the documentation and/or other materials
> + provided with the distribution.
> + * Neither the name of Hewlett-Packard Co. nor the names of its
> + contributors may be used to endorse or promote products derived
> + from this software without specific prior written permission.
> +
> + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
> + BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
> + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
> + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
> + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
> + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + SUCH DAMAGE.
> +*/
> +
> +#include <common.h>
> +#include <efi.h>
> +
> +#include <elf.h>
> +
> +efi_status_t _relocate (long ldbase, Elf64_Dyn *dyn, efi_handle_t image, efi_system_table_t *systab)
> +{
> + long relsz = 0, relent = 0;
> + Elf64_Rel *rel = 0;
> + unsigned long *addr;
> + int i;
> +
> + for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
> + switch (dyn[i].d_tag) {
> + case DT_RELA:
> + rel = (Elf64_Rel*)
> + ((unsigned long)dyn[i].d_un.d_ptr
> + + ldbase);
> + break;
> +
> + case DT_RELASZ:
> + relsz = dyn[i].d_un.d_val;
> + break;
> +
> + case DT_RELAENT:
> + relent = dyn[i].d_un.d_val;
> + break;
> +
> + default:
> + break;
> + }
> + }
> +
> + if (!rel && relent == 0)
> + return EFI_SUCCESS;
> +
> + if (!rel || relent == 0)
> + return EFI_LOAD_ERROR;
> +
> + while (relsz > 0) {
> + /* apply the relocs */
> + switch (ELF64_R_TYPE (rel->r_info)) {
> + case R_X86_64_NONE:
> + break;
> +
> + case R_X86_64_RELATIVE:
> + addr = (unsigned long *)
> + (ldbase + rel->r_offset);
> + *addr += ldbase;
> + break;
> +
> + default:
> + break;
> + }
> + rel = (Elf64_Rel*) ((char *) rel + relent);
> + relsz -= relent;
> + }
> + return EFI_SUCCESS;
> +}
> diff --git a/commands/Kconfig b/commands/Kconfig
> index 21d921268..bc0885c69 100644
> --- a/commands/Kconfig
> +++ b/commands/Kconfig
> @@ -370,7 +370,7 @@ config CMD_BOOTZ
>
> config CMD_LINUX16
> tristate
> - depends on X86
> + depends on X86 && !X86_EFI
> default y if X86
> prompt "linux16"
> help
> diff --git a/commands/edit.c b/commands/edit.c
> index a5415a6e5..696a818d9 100644
> --- a/commands/edit.c
> +++ b/commands/edit.c
> @@ -396,7 +396,7 @@ static int do_edit(int argc, char *argv[])
> * down when we write to the right bottom screen position. Reduce the number
> * of rows by one to work around this.
> */
> - if (IS_ENABLED(CONFIG_ARCH_EFI))
> + if (IS_ENABLED(CONFIG_EFI_BOOTUP))
> screenheight = 24;
> else
> screenheight = 25;
> diff --git a/common/memory.c b/common/memory.c
> index 4725f6e38..ad38b00ec 100644
> --- a/common/memory.c
> +++ b/common/memory.c
> @@ -67,7 +67,7 @@ void mem_malloc_init(void *start, void *end)
> mem_malloc_initialized = 1;
> }
>
> -#if !defined __SANDBOX__ && !defined CONFIG_ARCH_EFI
> +#if !defined __SANDBOX__ && !defined CONFIG_EFI_BOOTUP
> static int mem_malloc_resource(void)
> {
> /*
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index ae1f10eae..54b05bbf3 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -36,7 +36,7 @@ config CLOCKSOURCE_DUMMY_RATE
>
> config CLOCKSOURCE_EFI
> bool
> - depends on ARCH_EFI
> + depends on EFI_BOOTUP
>
> config CLOCKSOURCE_MVEBU
> bool
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index b723a127f..c3980e78f 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -202,7 +202,7 @@ config DRIVER_NET_TAP
>
> config DRIVER_NET_EFI_SNP
> bool "EFI SNP ethernet driver"
> - depends on ARCH_EFI
> + depends on EFI_BOOTUP
>
> config DRIVER_NET_TSE
> depends on NIOS2
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index d0a62bda9..a1fac0e61 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -4,7 +4,7 @@ config OFTREE
>
> config OFTREE_MEM_GENERIC
> depends on OFTREE
> - depends on PPC || ARM || ARCH_EFI || OPENRISC || SANDBOX
> + depends on PPC || ARM || EFI_BOOTUP || OPENRISC || SANDBOX
> def_bool y
>
> config DTC
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index 4eab437ea..ced30530a 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -46,7 +46,7 @@ config DRIVER_SERIAL_LINUX_CONSOLE
> bool "linux console driver"
>
> config DRIVER_SERIAL_EFI_STDIO
> - depends on ARCH_EFI
> + depends on EFI_BOOTUP
> bool "EFI stdio driver"
>
> config DRIVER_SERIAL_MPC5XXX
> diff --git a/fs/Kconfig b/fs/Kconfig
> index c7c42acd7..57f2676f4 100644
> --- a/fs/Kconfig
> +++ b/fs/Kconfig
> @@ -42,7 +42,7 @@ config FS_NFS
> prompt "nfs support"
>
> config FS_EFI
> - depends on ARCH_EFI
> + depends on EFI_BOOTUP
> bool
> prompt "EFI filesystem support"
> help
> @@ -50,7 +50,7 @@ config FS_EFI
> by the EFI Firmware via the EFI Simple File System Protocol.
>
> config FS_EFIVARFS
> - depends on ARCH_EFI
> + depends on EFI_BOOTUP
> bool
> prompt "EFI variable filesystem support (efivarfs)"
> help
> diff --git a/include/efi.h b/include/efi.h
> index b2e965bae..fa6fb2782 100644
> --- a/include/efi.h
> +++ b/include/efi.h
> @@ -14,7 +14,7 @@
> #include <linux/string.h>
> #include <linux/types.h>
>
> -#ifdef CONFIG_ARCH_EFI
> +#ifdef CONFIG_EFI_BOOTUP
> #define EFIAPI __attribute__((ms_abi))
> #else
> #define EFIAPI
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 0/12] EFI: drop arch efi
2017-02-15 19:29 [PATCH 0/12] EFI: drop arch efi Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-16 7:38 ` Michael Olbrich
2017-02-16 7:42 ` Michael Olbrich
2017-02-20 3:10 ` [PATCH 10/12] efi: add minor and major to the bus and display it at boot Jean-Christophe PLAGNIOL-VILLARD
2017-03-11 16:26 ` [PATCH 0/12] EFI: drop arch efi Michael Olbrich
3 siblings, 1 reply; 24+ messages in thread
From: Michael Olbrich @ 2017-02-16 7:38 UTC (permalink / raw)
To: barebox
Hi,
On Wed, Feb 15, 2017 at 08:29:32PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Today the EFI is build as an other ARCH when in fact it's just a boot mode
>
> so move it back to arch/x86 for the spicific x86 part and the common
> to common and driver
>
> The last 3 patches allow to debug EFI and prepare for more efi support
>
> The following changes since commit b225bbf295c92263adbcec2c385c5e8d83542c72:
>
> i.MX: esdhc: fix imx-esdhc driver for non-OF boards (2017-02-14 08:48:34 +0100)
I've commented on one patch where stuff got lost. I think that was all.
"efi-image.c" was moved so git could handle that correctly.
With that fixed, barebox seemed to work as expected in a short test.
Regards,
Michael
>
> are available in the git repository at:
>
> git://git.jcrosoft.org/barebox.git
>
> for you to fetch changes up to df12536f83b485c9a4ee28f78637356c6abab6f6:
>
> efi: add efi handle dump command (2017-02-15 07:32:24 +0800)
>
> ----------------------------------------------------------------
> Jean-Christophe PLAGNIOL-VILLARD (12):
> efi: move block io driver to driver/block
> efi: move clocksource out of arch
> efi: move bus driver to driver/efi
> efi: move debug_ll.h to include/efi
> efi: move startup and payload to common/efi
> x86: move bios bootup code to arch/x86/bios
> efi: move x86 efi boot support to x86 arch
> ARCH: efi: Finally drop it as now we can build efi bootup from x86
> efi: bus: add firmware vendor and resision and tables info
> efi: add minor and major to the bus and display it at boot
> efi-gui: add Timestamp Protocol GUID definition
> efi: add efi handle dump command
>
> Documentation/boards/efi.rst | 2 +-
> arch/efi/Kconfig | 51 ---------------------------------------------------
> arch/efi/Makefile | 43 -------------------------------------------
> arch/efi/efi/Makefile | 2 --
> arch/efi/include/asm/barebox.h | 1 -
> arch/efi/include/asm/bitops.h | 22 ----------------------
> arch/efi/include/asm/bitsperlong.h | 10 ----------
> arch/efi/include/asm/byteorder.h | 8 --------
> arch/efi/include/asm/common.h | 4 ----
> arch/efi/include/asm/dma.h | 13 -------------
> arch/efi/include/asm/elf.h | 60 ------------------------------------------------------------
> arch/efi/include/asm/io.h | 55 -------------------------------------------------------
> arch/efi/include/asm/posix_types.h | 1 -
> arch/efi/include/asm/sections.h | 1 -
> arch/efi/include/asm/string.h | 1 -
> arch/efi/include/asm/swab.h | 6 ------
> arch/efi/include/asm/types.h | 65 -----------------------------------------------------------------
> arch/efi/include/asm/unaligned.h | 19 -------------------
> arch/efi/lib/asm-offsets.c | 12 ------------
> arch/x86/Kconfig | 53 ++++++++++++++++++++++++++++++++++++++++++++++-------
> arch/x86/Makefile | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
> arch/x86/bios/Makefile | 3 +++
> arch/x86/{lib => bios}/bios_disk.S | 0
> arch/x86/{lib => bios}/memory16.S | 0
> arch/x86/{lib => bios}/traveler.S | 0
> arch/{efi => x86}/configs/efi_defconfig | 2 +-
> arch/x86/configs/generic_defconfig | 1 +
> arch/x86/include/asm/elf.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
> arch/x86/include/asm/io.h | 71 +++++++++++++++++++++++++++++++++--------------------------------------
> arch/x86/include/asm/types.h | 51 +++++++++++++++++++++++++++++++++------------------
> arch/x86/include/asm/unaligned.h | 5 +++++
> arch/x86/lib/Makefile | 5 ++---
> arch/x86/lib/asm-offsets.c | 7 +++++++
> arch/{efi/lib => x86/mach-efi}/.gitignore | 0
> arch/{efi/lib => x86/mach-efi}/Makefile | 0
> arch/{efi/lib => x86/mach-efi}/crt0-efi-ia32.S | 0
> arch/{efi/lib => x86/mach-efi}/crt0-efi-x86_64.S | 0
> arch/{efi/lib => x86/mach-efi}/elf_ia32_efi.lds.S | 0
> arch/{efi/lib => x86/mach-efi}/elf_x86_64_efi.lds.S | 1 -
> arch/x86/mach-efi/include/mach/barebox.lds.h | 0
> arch/x86/mach-efi/include/mach/debug_ll.h | 1 +
> arch/{efi/lib => x86/mach-efi}/reloc_ia32.c | 0
> arch/{efi/lib => x86/mach-efi}/reloc_x86_64.c | 0
> commands/Kconfig | 2 +-
> commands/edit.c | 2 +-
> common/Makefile | 1 +
> common/efi-guid.c | 6 ++++++
> common/efi/Makefile | 3 +++
> {arch/efi => common}/efi/efi-image.c | 4 ++--
> {arch/efi => common}/efi/efi.c | 6 +++---
> {arch/efi => common}/efi/env-efi/network/eth0-discover | 0
> common/memory.c | 2 +-
> drivers/Kconfig | 1 +
> drivers/Makefile | 2 ++
> drivers/block/Makefile | 1 +
> {arch/efi/efi => drivers/block}/efi-block-io.c | 4 ++--
> drivers/clocksource/Kconfig | 4 ++++
> drivers/clocksource/Makefile | 1 +
> arch/efi/efi/clocksource.c => drivers/clocksource/efi.c | 2 +-
> drivers/efi/Kconfig | 2 ++
> drivers/efi/Makefile | 1 +
> {arch/efi => drivers}/efi/efi-device.c | 205 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> drivers/net/Kconfig | 2 +-
> drivers/net/efi-snp.c | 4 ++--
> drivers/of/Kconfig | 2 +-
> drivers/serial/Kconfig | 2 +-
> drivers/serial/efi-stdio.c | 2 +-
> fs/Kconfig | 4 ++--
> fs/efi.c | 4 ++--
> fs/efivarfs.c | 4 ++--
> include/efi.h | 20 ++++++++++++++++++--
> {arch/efi/include/mach => include/efi}/debug_ll.h | 2 +-
> {arch/efi/include/mach => include/efi}/efi-device.h | 6 +++---
> {arch/efi/include/mach => include/efi}/efi.h | 0
> 74 files changed, 525 insertions(+), 501 deletions(-)
> delete mode 100644 arch/efi/Kconfig
> delete mode 100644 arch/efi/Makefile
> delete mode 100644 arch/efi/efi/Makefile
> delete mode 100644 arch/efi/include/asm/barebox.h
> delete mode 100644 arch/efi/include/asm/bitops.h
> delete mode 100644 arch/efi/include/asm/bitsperlong.h
> delete mode 100644 arch/efi/include/asm/byteorder.h
> delete mode 100644 arch/efi/include/asm/common.h
> delete mode 100644 arch/efi/include/asm/dma.h
> delete mode 100644 arch/efi/include/asm/elf.h
> delete mode 100644 arch/efi/include/asm/io.h
> delete mode 100644 arch/efi/include/asm/posix_types.h
> delete mode 100644 arch/efi/include/asm/sections.h
> delete mode 100644 arch/efi/include/asm/string.h
> delete mode 100644 arch/efi/include/asm/swab.h
> delete mode 100644 arch/efi/include/asm/types.h
> delete mode 100644 arch/efi/include/asm/unaligned.h
> delete mode 100644 arch/efi/lib/asm-offsets.c
> create mode 100644 arch/x86/bios/Makefile
> rename arch/x86/{lib => bios}/bios_disk.S (100%)
> rename arch/x86/{lib => bios}/memory16.S (100%)
> rename arch/x86/{lib => bios}/traveler.S (100%)
> rename arch/{efi => x86}/configs/efi_defconfig (98%)
> rename arch/{efi/lib => x86/mach-efi}/.gitignore (100%)
> rename arch/{efi/lib => x86/mach-efi}/Makefile (100%)
> rename arch/{efi/lib => x86/mach-efi}/crt0-efi-ia32.S (100%)
> rename arch/{efi/lib => x86/mach-efi}/crt0-efi-x86_64.S (100%)
> rename arch/{efi/lib => x86/mach-efi}/elf_ia32_efi.lds.S (100%)
> rename arch/{efi/lib => x86/mach-efi}/elf_x86_64_efi.lds.S (98%)
> create mode 100644 arch/x86/mach-efi/include/mach/barebox.lds.h
> create mode 100644 arch/x86/mach-efi/include/mach/debug_ll.h
> rename arch/{efi/lib => x86/mach-efi}/reloc_ia32.c (100%)
> rename arch/{efi/lib => x86/mach-efi}/reloc_x86_64.c (100%)
> create mode 100644 common/efi/Makefile
> rename {arch/efi => common}/efi/efi-image.c (99%)
> rename {arch/efi => common}/efi/efi.c (99%)
> rename {arch/efi => common}/efi/env-efi/network/eth0-discover (100%)
> create mode 100644 drivers/block/Makefile
> rename {arch/efi/efi => drivers/block}/efi-block-io.c (98%)
> rename arch/efi/efi/clocksource.c => drivers/clocksource/efi.c (97%)
> create mode 100644 drivers/efi/Kconfig
> create mode 100644 drivers/efi/Makefile
> rename {arch/efi => drivers}/efi/efi-device.c (63%)
> rename {arch/efi/include/mach => include/efi}/debug_ll.h (93%)
> rename {arch/efi/include/mach => include/efi}/efi-device.h (91%)
> rename {arch/efi/include/mach => include/efi}/efi.h (100%)
>
> Best Regards,
> J.
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 0/12] EFI: drop arch efi
2017-02-16 7:38 ` [PATCH 0/12] EFI: drop arch efi Michael Olbrich
@ 2017-02-16 7:42 ` Michael Olbrich
0 siblings, 0 replies; 24+ messages in thread
From: Michael Olbrich @ 2017-02-16 7:42 UTC (permalink / raw)
To: barebox
Hi,
On Thu, Feb 16, 2017 at 08:38:11AM +0100, Michael Olbrich wrote:
> On Wed, Feb 15, 2017 at 08:29:32PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Today the EFI is build as an other ARCH when in fact it's just a boot mode
> >
> > so move it back to arch/x86 for the spicific x86 part and the common
> > to common and driver
> >
> > The last 3 patches allow to debug EFI and prepare for more efi support
> >
> > The following changes since commit b225bbf295c92263adbcec2c385c5e8d83542c72:
> >
> > i.MX: esdhc: fix imx-esdhc driver for non-OF boards (2017-02-14 08:48:34 +0100)
>
> I've commented on one patch where stuff got lost. I think that was all.
> "efi-image.c" was moved so git could handle that correctly.
>
> With that fixed, barebox seemed to work as expected in a short test.
Oh, and I've only tested patches 1-9. I've not seen 10-12 so far.
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 10/12] efi: add minor and major to the bus and display it at boot
2017-02-15 19:29 [PATCH 0/12] EFI: drop arch efi Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
2017-02-16 7:38 ` [PATCH 0/12] EFI: drop arch efi Michael Olbrich
@ 2017-02-20 3:10 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-20 3:10 ` [PATCH 11/12] efi-gui: add Timestamp Protocol GUID definition Jean-Christophe PLAGNIOL-VILLARD
2017-02-20 3:10 ` [PATCH 12/12] efi: add efi handle dump command Jean-Christophe PLAGNIOL-VILLARD
2017-03-11 16:26 ` [PATCH 0/12] EFI: drop arch efi Michael Olbrich
3 siblings, 2 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-20 3:10 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/efi/efi-device.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index 7eb94de45..1877794c6 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -357,13 +357,22 @@ static void efi_businfo(struct device_d *dev)
static int efi_init_devices(void)
{
char *fw_vendor = NULL;
+ u16 sys_major = efi_sys_table->hdr.revision >> 16;
+ u16 sys_minor = efi_sys_table->hdr.revision & 0xffff;
+
+ fw_vendor = strdup_wchar_to_char((const wchar_t *)efi_sys_table->fw_vendor);
+
+ pr_info("EFI v%u.%.02u by %s v%u\n",
+ sys_major, sys_minor,
+ fw_vendor, efi_sys_table->fw_revision);
bus_register(&efi_bus);
- fw_vendor = strdup_wchar_to_char((const wchar_t *)efi_sys_table->fw_vendor);
dev_add_param_fixed(efi_bus.dev, "fw_vendor", fw_vendor);
free(fw_vendor);
+ dev_add_param_int_ro(efi_bus.dev, "major", sys_major, "%u");
+ dev_add_param_int_ro(efi_bus.dev, "minor", sys_minor, "%u");
dev_add_param_int_ro(efi_bus.dev, "fw_revision", efi_sys_table->fw_revision, "%u");
efi_bus.dev->info = efi_businfo;
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 11/12] efi-gui: add Timestamp Protocol GUID definition
2017-02-20 3:10 ` [PATCH 10/12] efi: add minor and major to the bus and display it at boot Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-20 3:10 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-20 3:10 ` [PATCH 12/12] efi: add efi handle dump command Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-20 3:10 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
common/efi-guid.c | 1 +
include/efi.h | 3 +++
2 files changed, 4 insertions(+)
diff --git a/common/efi-guid.c b/common/efi-guid.c
index 64f3b1f65..04a00ee87 100644
--- a/common/efi-guid.c
+++ b/common/efi-guid.c
@@ -75,6 +75,7 @@ const char *efi_guid_string(efi_guid_t *g)
EFI_GUID_STRING(EFI_COMPONENT_NAME2_PROTOCOL_GUID, "Component Name2 Protocol", "UEFI 2.0 Component Name2 Protocol");
EFI_GUID_STRING(EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID_31, "Network Interface Identifier Protocol_31", "EFI1.1 Network Interface Identifier Protocol");
EFI_GUID_STRING(EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID, "Network Interface Identifier Protocol", "EFI Network Interface Identifier Protocol");
+ EFI_GUID_STRING(EFI_TIMESTAMP_PROTOCOL_GUID, "Timestamp", "Timestamp");
/* File */
EFI_GUID_STRING(EFI_IDEBUSDXE_INF_GUID, "IdeBusDxe.inf", "EFI IdeBusDxe.inf File GUID");
diff --git a/include/efi.h b/include/efi.h
index 4b812c9ab..d1b331ce5 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -469,6 +469,9 @@ extern efi_runtime_services_t *RT;
#define EFI_VLANCONFIGDXE_INF_GUID \
EFI_GUID(0xe4f61863, 0xfe2c, 0x4b56, 0xa8, 0xf4, 0x08, 0x51, 0x9b, 0xc4, 0x39, 0xdf)
+#define EFI_TIMESTAMP_PROTOCOL_GUID \
+ EFI_GUID(0xafbfde41, 0x2e6e, 0x4262, 0xba, 0x65, 0x62, 0xb9, 0x23, 0x6e, 0x54, 0x95)
+
/* barebox specific GUIDs */
#define EFI_BAREBOX_VENDOR_GUID \
EFI_GUID(0x5b91f69c, 0x8b88, 0x4a2b, 0x92, 0x69, 0x5f, 0x1d, 0x80, 0x2b, 0x51, 0x75)
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 12/12] efi: add efi handle dump command
2017-02-20 3:10 ` [PATCH 10/12] efi: add minor and major to the bus and display it at boot Jean-Christophe PLAGNIOL-VILLARD
2017-02-20 3:10 ` [PATCH 11/12] efi-gui: add Timestamp Protocol GUID definition Jean-Christophe PLAGNIOL-VILLARD
@ 2017-02-20 3:10 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-20 3:10 UTC (permalink / raw)
To: barebox
so we can inspect easly what is supported by the EFI implementation we running on
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
common/efi-guid.c | 5 ++
drivers/efi/efi-device.c | 169 +++++++++++++++++++++++++++++++++++++++++++++++
include/efi.h | 8 +++
3 files changed, 182 insertions(+)
diff --git a/common/efi-guid.c b/common/efi-guid.c
index 04a00ee87..71aa21ddd 100644
--- a/common/efi-guid.c
+++ b/common/efi-guid.c
@@ -77,6 +77,11 @@ const char *efi_guid_string(efi_guid_t *g)
EFI_GUID_STRING(EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID, "Network Interface Identifier Protocol", "EFI Network Interface Identifier Protocol");
EFI_GUID_STRING(EFI_TIMESTAMP_PROTOCOL_GUID, "Timestamp", "Timestamp");
+ /* TPM 1.2 */
+ EFI_GUID_STRING( EFI_TCG_PROTOCOL_GUID, "TcgService", "TCGServices Protocol");
+ /* TPM 2.0 */
+ EFI_GUID_STRING( EFI_TCG2_PROTOCOL_GUID, "Tcg2Service", "TCG2Services Protocol");
+
/* File */
EFI_GUID_STRING(EFI_IDEBUSDXE_INF_GUID, "IdeBusDxe.inf", "EFI IdeBusDxe.inf File GUID");
EFI_GUID_STRING(EFI_TERMINALDXE_INF_GUID, "TerminalDxe.inf", "EFI TerminalDxe.inf File GUID");
diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index 1877794c6..db8b25147 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -382,3 +382,172 @@ static int efi_init_devices(void)
return 0;
}
core_initcall(efi_init_devices);
+
+static void efi_devpath(efi_handle_t handle)
+{
+ efi_status_t efiret;
+ void *devpath;
+ char *dev_path_str;
+
+ efiret = BS->open_protocol(handle, &efi_device_path_protocol_guid,
+ &devpath, NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ if (EFI_ERROR(efiret))
+ return;
+
+ dev_path_str = device_path_to_str(devpath);
+ if (dev_path_str) {
+ printf(" Devpath: \n %s\n", dev_path_str);
+ free(dev_path_str);
+ }
+}
+
+static void efi_dump(efi_handle_t *handles, unsigned long handle_count)
+{
+ int i, j;
+ unsigned long num_guids;
+ efi_guid_t **guids;
+
+ if (!handles || !handle_count)
+ return;
+
+ for (i = 0; i < handle_count; i++) {
+ printf("handle-%p\n", handles[i]);
+
+ BS->protocols_per_handle(handles[i], &guids, &num_guids);
+ printf(" Protocols:\n");
+ for (j = 0; j < num_guids; j++)
+ printf(" %d: %pUl: %s\n", j, guids[j],
+ efi_guid_string(guids[j]));
+ efi_devpath(handles[i]);
+ }
+ printf("\n");
+}
+
+static unsigned char to_digit(unsigned char c)
+{
+ if (c >= '0' && c <= '9')
+ c -= '0';
+ else if (c >= 'A' && c <= 'F')
+ c -= 'A' - 10;
+ else
+ c -= 'a' - 10;
+
+ return c;
+}
+
+#define read_xbit(src, dest, bit) \
+ do { \
+ int __i; \
+ for (__i = (bit - 4); __i >= 0; __i -= 4, src++) \
+ dest |= to_digit(*src) << __i; \
+ } while (0)
+
+static int do_efi_protocol_dump(int argc, char **argv)
+{
+ unsigned long handle_count = 0;
+ efi_handle_t *handles = NULL;
+ int ret;
+ efi_guid_t guid;
+ u32 a = 0;
+ u16 b = 0;
+ u16 c = 0;
+ u8 d0 = 0;
+ u8 d1 = 0;
+ u8 d2 = 0;
+ u8 d3 = 0;
+ u8 d4 = 0;
+ u8 d5 = 0;
+ u8 d6 = 0;
+ u8 d7 = 0;
+
+ /* Format 220e73b6-6bdb-4413-8405-b974b108619a */
+ if (argc == 1) {
+ char *s = argv[0];
+ int len = strlen(s);
+
+ if (len != 36)
+ return -EINVAL;
+
+ read_xbit(s, a, 32);
+ if (*s != '-')
+ return -EINVAL;
+ s++;
+ read_xbit(s, b, 16);
+ if (*s != '-')
+ return -EINVAL;
+ s++;
+ read_xbit(s, c, 16);
+ if (*s != '-')
+ return -EINVAL;
+ s++;
+ read_xbit(s, d0, 8);
+ read_xbit(s, d1, 8);
+ if (*s != '-')
+ return -EINVAL;
+ s++;
+ read_xbit(s, d2, 8);
+ read_xbit(s, d3, 8);
+ read_xbit(s, d4, 8);
+ read_xbit(s, d5, 8);
+ read_xbit(s, d6, 8);
+ read_xbit(s, d7, 8);
+ } else if (argc == 11) {
+ /* Format :
+ * 220e73b6 6bdb 4413 84 05 b9 74 b1 08 61 9a
+ * or
+ * 0x220e73b6 0x6bdb 0x14413 0x84 0x05 0xb9 0x74 0xb1 0x08 0x61 0x9a
+ */
+ a = simple_strtoul(argv[0], NULL, 16);
+ b = simple_strtoul(argv[1], NULL, 16);
+ c = simple_strtoul(argv[2], NULL, 16);
+ d0 = simple_strtoul(argv[3], NULL, 16);
+ d1 = simple_strtoul(argv[4], NULL, 16);
+ d2 = simple_strtoul(argv[5], NULL, 16);
+ d3 = simple_strtoul(argv[6], NULL, 16);
+ d4 = simple_strtoul(argv[7], NULL, 16);
+ d5 = simple_strtoul(argv[8], NULL, 16);
+ d6 = simple_strtoul(argv[9], NULL, 16);
+ d7 = simple_strtoul(argv[10], NULL, 16);
+ } else {
+ return -EINVAL;
+ }
+
+ guid = EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7);
+
+ printf("Searching for:\n");
+ printf(" %pUl: %s\n", &guid, efi_guid_string(&guid));
+
+ ret = efi_locate_handle(by_protocol, &guid, NULL, &handle_count, &handles);
+ if (!ret)
+ efi_dump(handles, handle_count);
+
+ return 0;
+}
+
+static int do_efi_handle_dump(int argc, char *argv[])
+{
+ unsigned long handle_count = 0;
+ efi_handle_t *handles = NULL;
+ int ret;
+
+ if (argc > 1)
+ return do_efi_protocol_dump(--argc, ++argv);
+
+ ret = efi_locate_handle(all_handles, NULL, NULL, &handle_count, &handles);
+ if (!ret)
+ efi_dump(handles, handle_count);
+
+ return 0;
+}
+
+BAREBOX_CMD_HELP_START(efi_handle_dump)
+BAREBOX_CMD_HELP_TEXT("Dump all the efi handle with protocol and devpath\n")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(efi_handle_dump)
+ .cmd = do_efi_handle_dump,
+ BAREBOX_CMD_DESC("Usage: efi_handle_dump")
+ BAREBOX_CMD_OPTS("[a-b-c-d0d1-d3d4d5d6d7] or [a b c d0 d1 d2 d3 d4 d5 d6 d7]")
+ BAREBOX_CMD_GROUP(CMD_GRP_MISC)
+ BAREBOX_CMD_HELP(cmd_efi_handle_dump_help)
+BAREBOX_CMD_END
diff --git a/include/efi.h b/include/efi.h
index d1b331ce5..5691f4e8f 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -480,6 +480,14 @@ extern efi_runtime_services_t *RT;
#define EFI_SYSTEMD_VENDOR_GUID \
EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f)
+/* for TPM 1.2 */
+#define EFI_TCG_PROTOCOL_GUID \
+ EFI_GUID(0xf541796d, 0xa62e, 0x4954, 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd)
+
+/* for TPM 2.0 */
+#define EFI_TCG2_PROTOCOL_GUID \
+ EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f)
+
extern efi_guid_t efi_file_info_id;
extern efi_guid_t efi_simple_file_system_protocol_guid;
extern efi_guid_t efi_device_path_protocol_guid;
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 07/12] efi: move x86 efi boot support to x86 arch
2017-02-16 7:27 ` Michael Olbrich
@ 2017-02-23 11:39 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-02-23 11:39 UTC (permalink / raw)
To: barebox
On 08:27 Thu 16 Feb , Michael Olbrich wrote:
> On Wed, Feb 15, 2017 at 08:34:15PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > prepare to drop the efi arch as efi boot up is not arch sepecific
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > Documentation/boards/efi.rst | 2 +-
> > arch/x86/Kconfig | 53 ++++++++++++--
> > arch/x86/Makefile | 74 +++++++++++++++++--
> > arch/x86/configs/efi_defconfig | 78 ++++++++++++++++++++
> > arch/x86/configs/generic_defconfig | 1 +
> > arch/x86/include/asm/elf.h | 86 +++++++++++++++-------
> > arch/x86/include/asm/io.h | 71 +++++++++---------
> > arch/x86/include/asm/types.h | 51 ++++++++-----
> > arch/x86/include/asm/unaligned.h | 5 ++
> > arch/x86/lib/Makefile | 2 +
> > arch/x86/lib/asm-offsets.c | 7 ++
> > arch/x86/mach-efi/.gitignore | 2 +
> > arch/x86/mach-efi/Makefile | 4 +
> > arch/x86/mach-efi/crt0-efi-ia32.S | 76 +++++++++++++++++++
> > arch/x86/mach-efi/crt0-efi-x86_64.S | 75 +++++++++++++++++++
> > arch/x86/mach-efi/elf_ia32_efi.lds.S | 106 +++++++++++++++++++++++++++
> > arch/x86/mach-efi/elf_x86_64_efi.lds.S | 99 +++++++++++++++++++++++++
> > arch/x86/mach-efi/include/mach/barebox.lds.h | 0
>
> I think this should be done instead of adding an empty file:
>
> diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
> index c8a919b928c9..dd2d286d32ec 100644
> --- a/include/asm-generic/barebox.lds.h
> +++ b/include/asm-generic/barebox.lds.h
> @@ -6,7 +6,7 @@
> #define STRUCT_ALIGNMENT 32
> #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
>
> -#if defined CONFIG_X86 || \
> +#if defined CONFIG_X86_32 || \
> defined CONFIG_ARCH_EP93XX || \
> defined CONFIG_ARCH_ZYNQ
I don't like the idead to add more and more ifdef
It's better to switch to a Kconfig instead
and as we can build EFI for X86 32 this will not work anyway
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 07/12] efi: move x86 efi boot support to x86 arch
2017-02-15 19:34 ` [PATCH 07/12] efi: move x86 efi boot support to x86 arch Jean-Christophe PLAGNIOL-VILLARD
2017-02-16 7:27 ` Michael Olbrich
@ 2017-02-27 7:50 ` Sascha Hauer
2017-03-07 8:31 ` [PATCH] fixup! " Michael Olbrich
1 sibling, 1 reply; 24+ messages in thread
From: Sascha Hauer @ 2017-02-27 7:50 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Wed, Feb 15, 2017 at 08:34:15PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> prepare to drop the efi arch as efi boot up is not arch sepecific
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> Documentation/boards/efi.rst | 2 +-
> arch/x86/Kconfig | 53 ++++++++++++--
> arch/x86/Makefile | 74 +++++++++++++++++--
> arch/x86/configs/efi_defconfig | 78 ++++++++++++++++++++
> arch/x86/configs/generic_defconfig | 1 +
> arch/x86/include/asm/elf.h | 86 +++++++++++++++-------
> arch/x86/include/asm/io.h | 71 +++++++++---------
> arch/x86/include/asm/types.h | 51 ++++++++-----
> arch/x86/include/asm/unaligned.h | 5 ++
> arch/x86/lib/Makefile | 2 +
> arch/x86/lib/asm-offsets.c | 7 ++
> arch/x86/mach-efi/.gitignore | 2 +
> arch/x86/mach-efi/Makefile | 4 +
> arch/x86/mach-efi/crt0-efi-ia32.S | 76 +++++++++++++++++++
> arch/x86/mach-efi/crt0-efi-x86_64.S | 75 +++++++++++++++++++
> arch/x86/mach-efi/elf_ia32_efi.lds.S | 106 +++++++++++++++++++++++++++
> arch/x86/mach-efi/elf_x86_64_efi.lds.S | 99 +++++++++++++++++++++++++
> arch/x86/mach-efi/include/mach/barebox.lds.h | 0
This empty file gets removed during make distclean causing build
failures here. I made this file non-empty. With this:
aplied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH] fixup! efi: move x86 efi boot support to x86 arch
2017-02-27 7:50 ` Sascha Hauer
@ 2017-03-07 8:31 ` Michael Olbrich
2017-03-09 6:37 ` Sascha Hauer
0 siblings, 1 reply; 24+ messages in thread
From: Michael Olbrich @ 2017-03-07 8:31 UTC (permalink / raw)
To: barebox; +Cc: Michael Olbrich
As I noted in my other mail, this got lost during the move.
Regards,
Michael
---
arch/x86/Makefile | 4 ++--
arch/x86/mach-efi/elf_x86_64_efi.lds.S | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index e837a2df972c..c36104c2c07f 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -84,8 +84,8 @@ cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
quiet_cmd_efi_image = EFI-IMG $@
cmd_efi_image = $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc -j __barebox_initcalls \
- -j __barebox_cmd -j .barebox_magicvar -j .bbenv.* \
- --target=$(TARGET) $< $@
+ -j __barebox_exitcalls -j __barebox_cmd -j .barebox_magicvar \
+ -j .bbenv.* --target=$(TARGET) $< $@
KBUILD_BINARY := barebox
diff --git a/arch/x86/mach-efi/elf_x86_64_efi.lds.S b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
index e1bc2120fabc..93d34d17ab1f 100644
--- a/arch/x86/mach-efi/elf_x86_64_efi.lds.S
+++ b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
@@ -80,6 +80,7 @@ SECTIONS
*(.rela.data*)
*(.rela.barebox*)
*(.rela.initcall*)
+ *(.rela.exitcall*)
*(.rela.got)
*(.rela.stab)
}
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] fixup! efi: move x86 efi boot support to x86 arch
2017-03-07 8:31 ` [PATCH] fixup! " Michael Olbrich
@ 2017-03-09 6:37 ` Sascha Hauer
0 siblings, 0 replies; 24+ messages in thread
From: Sascha Hauer @ 2017-03-09 6:37 UTC (permalink / raw)
To: Michael Olbrich; +Cc: barebox
On Tue, Mar 07, 2017 at 09:31:47AM +0100, Michael Olbrich wrote:
> As I noted in my other mail, this got lost during the move.
>
> Regards,
> Michael
Fixed this up.
Sascha
>
> ---
> arch/x86/Makefile | 4 ++--
> arch/x86/mach-efi/elf_x86_64_efi.lds.S | 1 +
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index e837a2df972c..c36104c2c07f 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -84,8 +84,8 @@ cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
> quiet_cmd_efi_image = EFI-IMG $@
> cmd_efi_image = $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
> -j .dynsym -j .rel -j .rela -j .reloc -j __barebox_initcalls \
> - -j __barebox_cmd -j .barebox_magicvar -j .bbenv.* \
> - --target=$(TARGET) $< $@
> + -j __barebox_exitcalls -j __barebox_cmd -j .barebox_magicvar \
> + -j .bbenv.* --target=$(TARGET) $< $@
>
> KBUILD_BINARY := barebox
>
> diff --git a/arch/x86/mach-efi/elf_x86_64_efi.lds.S b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
> index e1bc2120fabc..93d34d17ab1f 100644
> --- a/arch/x86/mach-efi/elf_x86_64_efi.lds.S
> +++ b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
> @@ -80,6 +80,7 @@ SECTIONS
> *(.rela.data*)
> *(.rela.barebox*)
> *(.rela.initcall*)
> + *(.rela.exitcall*)
> *(.rela.got)
> *(.rela.stab)
> }
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 0/12] EFI: drop arch efi
2017-02-15 19:29 [PATCH 0/12] EFI: drop arch efi Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
2017-02-20 3:10 ` [PATCH 10/12] efi: add minor and major to the bus and display it at boot Jean-Christophe PLAGNIOL-VILLARD
@ 2017-03-11 16:26 ` Michael Olbrich
2017-03-12 12:05 ` Jean-Christophe PLAGNIOL-VILLARD
3 siblings, 1 reply; 24+ messages in thread
From: Michael Olbrich @ 2017-03-11 16:26 UTC (permalink / raw)
To: barebox
On Wed, Feb 15, 2017 at 08:29:32PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Today the EFI is build as an other ARCH when in fact it's just a boot mode
>
> so move it back to arch/x86 for the spicific x86 part and the common
> to common and driver
>
> The last 3 patches allow to debug EFI and prepare for more efi support
>
> The following changes since commit b225bbf295c92263adbcec2c385c5e8d83542c72:
>
> i.MX: esdhc: fix imx-esdhc driver for non-OF boards (2017-02-14 08:48:34 +0100)
>
> are available in the git repository at:
>
> git://git.jcrosoft.org/barebox.git
>
> for you to fetch changes up to df12536f83b485c9a4ee28f78637356c6abab6f6:
>
> efi: add efi handle dump command (2017-02-15 07:32:24 +0800)
While testing the serial stuff I noticed that the
CONFIG_ARCH_EFI_REGISTER_COM1 option got lost during this rework.
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 0/12] EFI: drop arch efi
2017-03-11 16:26 ` [PATCH 0/12] EFI: drop arch efi Michael Olbrich
@ 2017-03-12 12:05 ` Jean-Christophe PLAGNIOL-VILLARD
2017-03-13 10:27 ` Michael Olbrich
0 siblings, 1 reply; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-03-12 12:05 UTC (permalink / raw)
To: barebox
On 17:26 Sat 11 Mar , Michael Olbrich wrote:
> On Wed, Feb 15, 2017 at 08:29:32PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Today the EFI is build as an other ARCH when in fact it's just a boot mode
> >
> > so move it back to arch/x86 for the spicific x86 part and the common
> > to common and driver
> >
> > The last 3 patches allow to debug EFI and prepare for more efi support
> >
> > The following changes since commit b225bbf295c92263adbcec2c385c5e8d83542c72:
> >
> > i.MX: esdhc: fix imx-esdhc driver for non-OF boards (2017-02-14 08:48:34 +0100)
> >
> > are available in the git repository at:
> >
> > git://git.jcrosoft.org/barebox.git
> >
> > for you to fetch changes up to df12536f83b485c9a4ee28f78637356c6abab6f6:
> >
> > efi: add efi handle dump command (2017-02-15 07:32:24 +0800)
>
> While testing the serial stuff I noticed that the
> CONFIG_ARCH_EFI_REGISTER_COM1 option got lost during this rework.
I did not merge it as it's a hack more than a feature as this by pass the EFI
API and access the hw directly instead of using Serial IO
Which was add after
And I plan to drop this hack
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 0/12] EFI: drop arch efi
2017-03-12 12:05 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2017-03-13 10:27 ` Michael Olbrich
2017-03-13 10:48 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 24+ messages in thread
From: Michael Olbrich @ 2017-03-13 10:27 UTC (permalink / raw)
To: barebox
On Sun, Mar 12, 2017 at 01:05:38PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 17:26 Sat 11 Mar , Michael Olbrich wrote:
> > On Wed, Feb 15, 2017 at 08:29:32PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > Today the EFI is build as an other ARCH when in fact it's just a boot mode
> > >
> > > so move it back to arch/x86 for the spicific x86 part and the common
> > > to common and driver
> > >
> > > The last 3 patches allow to debug EFI and prepare for more efi support
> > >
> > > The following changes since commit b225bbf295c92263adbcec2c385c5e8d83542c72:
> > >
> > > i.MX: esdhc: fix imx-esdhc driver for non-OF boards (2017-02-14 08:48:34 +0100)
> > >
> > > are available in the git repository at:
> > >
> > > git://git.jcrosoft.org/barebox.git
> > >
> > > for you to fetch changes up to df12536f83b485c9a4ee28f78637356c6abab6f6:
> > >
> > > efi: add efi handle dump command (2017-02-15 07:32:24 +0800)
> >
> > While testing the serial stuff I noticed that the
> > CONFIG_ARCH_EFI_REGISTER_COM1 option got lost during this rework.
> I did not merge it as it's a hack more than a feature as this by pass the EFI
> API and access the hw directly instead of using Serial IO
>
> Which was add after
>
> And I plan to drop this hack
You cannot assume a sane EFI. I have a hardware with a serial port that
works just fine with the ns16550 driver but the EFI does not implement the
serial IO protocol. So this hack is still needed in some way.
Maybe we could register the ns16550 console if no efi serial IO protocol is
found?
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 0/12] EFI: drop arch efi
2017-03-13 10:27 ` Michael Olbrich
@ 2017-03-13 10:48 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 24+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-03-13 10:48 UTC (permalink / raw)
To: Michael Olbrich; +Cc: barebox
> On 13 Mar 2017, at 6:27 PM, Michael Olbrich <m.olbrich@pengutronix.de> wrote:
>
> On Sun, Mar 12, 2017 at 01:05:38PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
>> On 17:26 Sat 11 Mar , Michael Olbrich wrote:
>>> On Wed, Feb 15, 2017 at 08:29:32PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
>>>> Today the EFI is build as an other ARCH when in fact it's just a boot mode
>>>>
>>>> so move it back to arch/x86 for the spicific x86 part and the common
>>>> to common and driver
>>>>
>>>> The last 3 patches allow to debug EFI and prepare for more efi support
>>>>
>>>> The following changes since commit b225bbf295c92263adbcec2c385c5e8d83542c72:
>>>>
>>>> i.MX: esdhc: fix imx-esdhc driver for non-OF boards (2017-02-14 08:48:34 +0100)
>>>>
>>>> are available in the git repository at:
>>>>
>>>> git://git.jcrosoft.org/barebox.git
>>>>
>>>> for you to fetch changes up to df12536f83b485c9a4ee28f78637356c6abab6f6:
>>>>
>>>> efi: add efi handle dump command (2017-02-15 07:32:24 +0800)
>>>
>>> While testing the serial stuff I noticed that the
>>> CONFIG_ARCH_EFI_REGISTER_COM1 option got lost during this rework.
>> I did not merge it as it's a hack more than a feature as this by pass the EFI
>> API and access the hw directly instead of using Serial IO
>>
>> Which was add after
>>
>> And I plan to drop this hack
>
> You cannot assume a sane EFI. I have a hardware with a serial port that
> works just fine with the ns16550 driver but the EFI does not implement the
> serial IO protocol. So this hack is still needed in some way.
>
I agree with you on that EFI implementation are erradict at best.
> Maybe we could register the ns16550 console if no efi serial IO protocol is
> found?
I’d prefer we use a DT to add more device at build time or runtime that hack in the
general code.
Or Create a specific board code for you hardware
So we keep the generic code as generic as possible
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2017-03-13 10:49 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15 19:29 [PATCH 0/12] EFI: drop arch efi Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 01/12] efi: move block io driver to driver/block Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 02/12] efi: move clocksource out of arch Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 03/12] efi: move bus driver to driver/efi Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 04/12] efi: move debug_ll.h to include/efi Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 05/12] efi: move startup and payload to common/efi Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 06/12] x86: move bios bootup code to arch/x86/bios Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 07/12] efi: move x86 efi boot support to x86 arch Jean-Christophe PLAGNIOL-VILLARD
2017-02-16 7:27 ` Michael Olbrich
2017-02-23 11:39 ` Jean-Christophe PLAGNIOL-VILLARD
2017-02-27 7:50 ` Sascha Hauer
2017-03-07 8:31 ` [PATCH] fixup! " Michael Olbrich
2017-03-09 6:37 ` Sascha Hauer
2017-02-15 19:34 ` [PATCH 08/12] ARCH: efi: Finally drop it as now we can build efi bootup from x86 Jean-Christophe PLAGNIOL-VILLARD
2017-02-15 19:34 ` [PATCH 09/12] efi: bus: add firmware vendor and resision and tables info Jean-Christophe PLAGNIOL-VILLARD
2017-02-16 7:38 ` [PATCH 0/12] EFI: drop arch efi Michael Olbrich
2017-02-16 7:42 ` Michael Olbrich
2017-02-20 3:10 ` [PATCH 10/12] efi: add minor and major to the bus and display it at boot Jean-Christophe PLAGNIOL-VILLARD
2017-02-20 3:10 ` [PATCH 11/12] efi-gui: add Timestamp Protocol GUID definition Jean-Christophe PLAGNIOL-VILLARD
2017-02-20 3:10 ` [PATCH 12/12] efi: add efi handle dump command Jean-Christophe PLAGNIOL-VILLARD
2017-03-11 16:26 ` [PATCH 0/12] EFI: drop arch efi Michael Olbrich
2017-03-12 12:05 ` Jean-Christophe PLAGNIOL-VILLARD
2017-03-13 10:27 ` Michael Olbrich
2017-03-13 10:48 ` Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox