summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2024-02-15 10:28:00 +0100
committerLean Sheng Tan <sheng.tan@9elements.com>2024-02-18 07:50:28 +0000
commit7d4155e6e6751ccd1f0b39051462d6842b435fe2 (patch)
tree0c47797344602fce218d10fab5191f517d6170d5
parent29f7c4f0a6ee00b743c5e1c5ad66753109d1dede (diff)
downloadcoreboot-7d4155e6e6751ccd1f0b39051462d6842b435fe2.tar.gz
coreboot-7d4155e6e6751ccd1f0b39051462d6842b435fe2.tar.bz2
coreboot-7d4155e6e6751ccd1f0b39051462d6842b435fe2.zip
util/cbfstool/linux_trampoline: Support more e820 entries
Since linux commit f9ba70535dc12d9eb57d466a2ecd749e16eca866 "[PATCH] Increase number of e820 entries hard limit from 32 to 128" made in 2005 the number of e820 entries passed from the bootloader is 128. Use the boot protocol version to check for support of 128 entries and use them if necessary. Tested on IBM/SBP1: Fixes booting a Linux payload when more than 32 entries are present in the memory table, which can easily happen on a 4 socket platform. Change-Id: Iec0a832fff091b6c3ae7050ef63e743a30618f25 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80544 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marvin Drees <marvin.drees@9elements.com> Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
-rw-r--r--util/cbfstool/linux_trampoline.S13
-rw-r--r--util/cbfstool/linux_trampoline.c44
2 files changed, 36 insertions, 21 deletions
diff --git a/util/cbfstool/linux_trampoline.S b/util/cbfstool/linux_trampoline.S
index 941ab3f2e0ec..6a62ff0ed522 100644
--- a/util/cbfstool/linux_trampoline.S
+++ b/util/cbfstool/linux_trampoline.S
@@ -61,9 +61,22 @@ jne .testAcpiRsdp
mov 4(%ebx), %eax
sub $8, %eax
shr $2, %eax /* eax = number of dwords of e820 data */
+/*
+ * Historically linux had space for 32 entries. This limit was increased in
+ * the year 2005 (Linux 2.6.11) to hold up to 128 entries.
+ * Assume 128 entries when the boot protocol version is 2.04+.
+ */
+cmpw $0x0204, (LINUX_PARAM_LOC + PROTOCOL_VERSION)
+jge .e820big /* protocol version >= 2.04 can handle 128 entries of 5 dwords */
cmp $(32 * 5), %eax /* linux wants at most 32 entries of 5 dwords */
jng 1f
mov $(32 * 5), %eax /* only copy 32 entries */
+jmp 1f
+
+.e820big:
+cmp $(128 * 5), %eax /* linux wants at most 128 entries of 5 dwords */
+jng 1f
+mov $(128 * 5), %eax /* only copy 128 entries */
1:
mov %eax, %esi
mov $5, %edi
diff --git a/util/cbfstool/linux_trampoline.c b/util/cbfstool/linux_trampoline.c
index 794b24500708..13c0edb55743 100644
--- a/util/cbfstool/linux_trampoline.c
+++ b/util/cbfstool/linux_trampoline.c
@@ -3,25 +3,27 @@
unsigned char trampoline[] = {
0xfc, 0x31, 0xd2, 0xb9, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x01, 0x00, 0x01, 0xcb, 0x8b,
0x01, 0x3d, 0x4c, 0x42, 0x49, 0x4f, 0x74, 0x07, 0x83, 0xc1, 0x10, 0x39, 0xcb, 0x75, 0xe9, 0x39,
- 0xcb, 0x0f, 0x84, 0x2e, 0x01, 0x00, 0x00, 0x8b, 0x59, 0x04, 0x01, 0xcb, 0x8b, 0x49, 0x14, 0x83,
- 0x3b, 0x11, 0x75, 0x05, 0x8b, 0x4b, 0x08, 0xeb, 0xcf, 0x83, 0x3b, 0x01, 0x75, 0x57, 0x8b, 0x43,
- 0x04, 0x83, 0xe8, 0x08, 0xc1, 0xe8, 0x02, 0x3d, 0xa0, 0x00, 0x00, 0x00, 0x7e, 0x05, 0xb8, 0xa0,
- 0x00, 0x00, 0x00, 0x89, 0xc6, 0xbf, 0x05, 0x00, 0x00, 0x00, 0xf7, 0xf7, 0xa3, 0xe8, 0x01, 0x09,
- 0x00, 0x89, 0xf0, 0x91, 0x8d, 0x73, 0x08, 0xbf, 0xd0, 0x02, 0x09, 0x00, 0xf3, 0xa5, 0x91, 0xa1,
- 0xe8, 0x01, 0x09, 0x00, 0xbf, 0xd0, 0x02, 0x09, 0x00, 0x83, 0xf8, 0x00, 0x0f, 0x84, 0x94, 0x00,
- 0x00, 0x00, 0x83, 0x7f, 0x10, 0x0c, 0x7e, 0x07, 0xc7, 0x47, 0x10, 0x02, 0x00, 0x00, 0x00, 0x48,
- 0x83, 0xc7, 0x14, 0xeb, 0xe4, 0x83, 0x3b, 0x43, 0x75, 0x12, 0x8b, 0x43, 0x08, 0xa3, 0x70, 0x00,
- 0x09, 0x00, 0x8b, 0x43, 0x0c, 0xa3, 0x74, 0x00, 0x09, 0x00, 0xeb, 0x6a, 0x83, 0x3b, 0x12, 0x75,
- 0x65, 0x66, 0x81, 0x3d, 0x06, 0x02, 0x09, 0x00, 0x0f, 0x02, 0x7d, 0x06, 0x83, 0x7b, 0x0c, 0x00,
- 0x75, 0x54, 0xbf, 0x00, 0x00, 0x09, 0x00, 0x8b, 0x43, 0x08, 0x89, 0x47, 0x18, 0x8b, 0x43, 0x0c,
- 0x89, 0x47, 0x3a, 0x8b, 0x43, 0x10, 0x66, 0x89, 0x47, 0x12, 0x8b, 0x43, 0x14, 0x66, 0x89, 0x47,
- 0x14, 0x8b, 0x53, 0x18, 0x66, 0x89, 0x57, 0x24, 0xf7, 0xe2, 0x89, 0x47, 0x1c, 0x66, 0x0f, 0xb6,
- 0x43, 0x1c, 0x66, 0x89, 0x47, 0x16, 0xbe, 0x04, 0x00, 0x00, 0x00, 0x66, 0x8b, 0x44, 0x73, 0x1b,
- 0x66, 0xd1, 0xc0, 0x66, 0x89, 0x44, 0x77, 0x24, 0x4e, 0x75, 0xf0, 0xc7, 0x47, 0x36, 0x02, 0x00,
- 0x00, 0x00, 0xc6, 0x47, 0x0f, 0x70, 0x03, 0x5b, 0x04, 0x49, 0x0f, 0x85, 0x0f, 0xff, 0xff, 0xff,
- 0xb8, 0x00, 0x00, 0x04, 0x00, 0xc7, 0x40, 0x10, 0xff, 0xff, 0x00, 0x00, 0xc7, 0x40, 0x14, 0x00,
- 0x9b, 0xcf, 0x00, 0xc7, 0x40, 0x18, 0xff, 0xff, 0x00, 0x00, 0xc7, 0x40, 0x1c, 0x00, 0x93, 0xcf,
- 0x00, 0xc6, 0x00, 0x2b, 0x89, 0x40, 0x02, 0x0f, 0x01, 0x10, 0xbe, 0x00, 0x00, 0x09, 0x00, 0xff,
- 0x25, 0x14, 0x02, 0x09, 0x00, 0xf4, 0xeb, 0xfd
+ 0xcb, 0x0f, 0x84, 0x47, 0x01, 0x00, 0x00, 0x8b, 0x59, 0x04, 0x01, 0xcb, 0x8b, 0x49, 0x14, 0x83,
+ 0x3b, 0x11, 0x75, 0x05, 0x8b, 0x4b, 0x08, 0xeb, 0xcf, 0x83, 0x3b, 0x01, 0x75, 0x70, 0x8b, 0x43,
+ 0x04, 0x83, 0xe8, 0x08, 0xc1, 0xe8, 0x02, 0x66, 0x81, 0x3d, 0x06, 0x02, 0x09, 0x00, 0x04, 0x02,
+ 0x7d, 0x0e, 0x3d, 0xa0, 0x00, 0x00, 0x00, 0x7e, 0x13, 0xb8, 0xa0, 0x00, 0x00, 0x00, 0xeb, 0x0c,
+ 0x3d, 0x80, 0x02, 0x00, 0x00, 0x7e, 0x05, 0xb8, 0x80, 0x02, 0x00, 0x00, 0x89, 0xc6, 0xbf, 0x05,
+ 0x00, 0x00, 0x00, 0xf7, 0xf7, 0xa3, 0xe8, 0x01, 0x09, 0x00, 0x89, 0xf0, 0x91, 0x8d, 0x73, 0x08,
+ 0xbf, 0xd0, 0x02, 0x09, 0x00, 0xf3, 0xa5, 0x91, 0xa1, 0xe8, 0x01, 0x09, 0x00, 0xbf, 0xd0, 0x02,
+ 0x09, 0x00, 0x83, 0xf8, 0x00, 0x0f, 0x84, 0x94, 0x00, 0x00, 0x00, 0x83, 0x7f, 0x10, 0x0c, 0x7e,
+ 0x07, 0xc7, 0x47, 0x10, 0x02, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc7, 0x14, 0xeb, 0xe4, 0x83, 0x3b,
+ 0x43, 0x75, 0x12, 0x8b, 0x43, 0x08, 0xa3, 0x70, 0x00, 0x09, 0x00, 0x8b, 0x43, 0x0c, 0xa3, 0x74,
+ 0x00, 0x09, 0x00, 0xeb, 0x6a, 0x83, 0x3b, 0x12, 0x75, 0x65, 0x66, 0x81, 0x3d, 0x06, 0x02, 0x09,
+ 0x00, 0x0f, 0x02, 0x7d, 0x06, 0x83, 0x7b, 0x0c, 0x00, 0x75, 0x54, 0xbf, 0x00, 0x00, 0x09, 0x00,
+ 0x8b, 0x43, 0x08, 0x89, 0x47, 0x18, 0x8b, 0x43, 0x0c, 0x89, 0x47, 0x3a, 0x8b, 0x43, 0x10, 0x66,
+ 0x89, 0x47, 0x12, 0x8b, 0x43, 0x14, 0x66, 0x89, 0x47, 0x14, 0x8b, 0x53, 0x18, 0x66, 0x89, 0x57,
+ 0x24, 0xf7, 0xe2, 0x89, 0x47, 0x1c, 0x66, 0x0f, 0xb6, 0x43, 0x1c, 0x66, 0x89, 0x47, 0x16, 0xbe,
+ 0x04, 0x00, 0x00, 0x00, 0x66, 0x8b, 0x44, 0x73, 0x1b, 0x66, 0xd1, 0xc0, 0x66, 0x89, 0x44, 0x77,
+ 0x24, 0x4e, 0x75, 0xf0, 0xc7, 0x47, 0x36, 0x02, 0x00, 0x00, 0x00, 0xc6, 0x47, 0x0f, 0x70, 0x03,
+ 0x5b, 0x04, 0x49, 0x0f, 0x85, 0xf6, 0xfe, 0xff, 0xff, 0xb8, 0x00, 0x00, 0x04, 0x00, 0xc7, 0x40,
+ 0x10, 0xff, 0xff, 0x00, 0x00, 0xc7, 0x40, 0x14, 0x00, 0x9b, 0xcf, 0x00, 0xc7, 0x40, 0x18, 0xff,
+ 0xff, 0x00, 0x00, 0xc7, 0x40, 0x1c, 0x00, 0x93, 0xcf, 0x00, 0xc6, 0x00, 0x2b, 0x89, 0x40, 0x02,
+ 0x0f, 0x01, 0x10, 0xbe, 0x00, 0x00, 0x09, 0x00, 0xff, 0x25, 0x14, 0x02, 0x09, 0x00, 0xf4, 0xeb,
+ 0xfd
};
-unsigned int trampoline_len = 344;
+unsigned int trampoline_len = 369;