From a15347ef1e677ca711ce706877db2416ddfd451a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 Aug 2024 01:43:57 +0100 Subject: coreboot/dell: merge into coreboot/default The libgfxinit patch and other patches e.g. DDR2 fix, are now provided in coreboot/default. The Latitude E6400 is now using the newer coreboot revision from late July 2024. Some other configs had to change because of this, relating to the new way that Nicholas handles timing on LVDS displays with the E6400 port; a default 96MHz clock is still used for pixel reference clock, overridden with a value of 100MHz on other GM45 machines, where 96MHz was previously hardcoded. Signed-off-by: Leah Rowe --- ...gma-plls.adb-Make-reference-clock-frequen.patch | 42 +++++ .../coreboot/dell/intel-microcode/module.cfg | 3 - .../submodule/coreboot/dell/libgfxinit/module.cfg | 3 - ...gma-plls.adb-Make-reference-clock-frequen.patch | 42 ----- .../submodule/coreboot/dell/libhwbase/module.cfg | 3 - config/submodule/coreboot/dell/module.list | 4 - config/submodule/coreboot/dell/vboot/module.cfg | 3 - ...inuz.c-Fix-the-bounds-check-on-vmlinuz_he.patch | 178 --------------------- 8 files changed, 42 insertions(+), 236 deletions(-) create mode 100644 config/submodule/coreboot/default/libgfxinit/patches/0001-g45-hw-gfx-gma-plls.adb-Make-reference-clock-frequen.patch delete mode 100644 config/submodule/coreboot/dell/intel-microcode/module.cfg delete mode 100644 config/submodule/coreboot/dell/libgfxinit/module.cfg delete mode 100644 config/submodule/coreboot/dell/libgfxinit/patches/0001-g45-hw-gfx-gma-plls.adb-Make-reference-clock-frequen.patch delete mode 100644 config/submodule/coreboot/dell/libhwbase/module.cfg delete mode 100644 config/submodule/coreboot/dell/module.list delete mode 100644 config/submodule/coreboot/dell/vboot/module.cfg delete mode 100644 config/submodule/coreboot/dell/vboot/patches/0001-extract_vmlinuz.c-Fix-the-bounds-check-on-vmlinuz_he.patch (limited to 'config/submodule/coreboot') diff --git a/config/submodule/coreboot/default/libgfxinit/patches/0001-g45-hw-gfx-gma-plls.adb-Make-reference-clock-frequen.patch b/config/submodule/coreboot/default/libgfxinit/patches/0001-g45-hw-gfx-gma-plls.adb-Make-reference-clock-frequen.patch new file mode 100644 index 00000000..2d248941 --- /dev/null +++ b/config/submodule/coreboot/default/libgfxinit/patches/0001-g45-hw-gfx-gma-plls.adb-Make-reference-clock-frequen.patch @@ -0,0 +1,42 @@ +From ba078864500de99c26b6ea7e3fdcef19bca582a7 Mon Sep 17 00:00:00 2001 +From: Nicholas Chin +Date: Mon, 20 May 2024 10:10:03 -0600 +Subject: [PATCH 1/1] g45/hw-gfx-gma-plls.adb: Make reference clock frequency + configurable + +Instead of assuming a 96 MHz reference clock frequency, use the value +specified by the new INTEL_GMA_DPLL_REF_FREQ Kconfig. This defaults to +96 MHz to preserve the existing behavior. An example of where this is +needed is the DPLL_REF_SSCLK input, which will typically be 100 MHz +to support LVDS spread spectrum clocking. + +Signed-off-by: Nicholas Chin +--- + common/g45/hw-gfx-gma-plls.adb | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/common/g45/hw-gfx-gma-plls.adb b/common/g45/hw-gfx-gma-plls.adb +index 67242f2..5e970d7 100644 +--- a/common/g45/hw-gfx-gma-plls.adb ++++ b/common/g45/hw-gfx-gma-plls.adb +@@ -12,6 +12,8 @@ + -- GNU General Public License for more details. + -- + ++with CB.Config; ++ + with HW.Time; + with HW.GFX.GMA.Config; + with HW.GFX.GMA.Registers; +@@ -460,7 +462,7 @@ is + (Display => Port_Cfg.Display, + Target_Dotclock => Target_Clock, + -- should be, but doesn't has to be always the same: +- Reference_Clock => 96_000_000, ++ Reference_Clock => CB.Config.INTEL_GMA_DPLL_REF_FREQ, + Best_Clock => Clk, + Valid => Success); + else +-- +2.39.2 + diff --git a/config/submodule/coreboot/dell/intel-microcode/module.cfg b/config/submodule/coreboot/dell/intel-microcode/module.cfg deleted file mode 100644 index 05a174b0..00000000 --- a/config/submodule/coreboot/dell/intel-microcode/module.cfg +++ /dev/null @@ -1,3 +0,0 @@ -subrepo="https://review.coreboot.org/intel-microcode.git" -subrepo_bkup="https://github.com/coreboot/intel-microcode" -subhash="ece0d294a29a1375397941a4e6f2f7217910bc89" diff --git a/config/submodule/coreboot/dell/libgfxinit/module.cfg b/config/submodule/coreboot/dell/libgfxinit/module.cfg deleted file mode 100644 index 7e2536f9..00000000 --- a/config/submodule/coreboot/dell/libgfxinit/module.cfg +++ /dev/null @@ -1,3 +0,0 @@ -subrepo="https://review.coreboot.org/libgfxinit.git" -subrepo_bkup="https://github.com/coreboot/libgfxinit" -subhash="a4be8a21b0e2c752da0042c79aae5942418f53e2" diff --git a/config/submodule/coreboot/dell/libgfxinit/patches/0001-g45-hw-gfx-gma-plls.adb-Make-reference-clock-frequen.patch b/config/submodule/coreboot/dell/libgfxinit/patches/0001-g45-hw-gfx-gma-plls.adb-Make-reference-clock-frequen.patch deleted file mode 100644 index bb772461..00000000 --- a/config/submodule/coreboot/dell/libgfxinit/patches/0001-g45-hw-gfx-gma-plls.adb-Make-reference-clock-frequen.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 2c29f01a18d0a104bcc4f785e3901de584d02d7e Mon Sep 17 00:00:00 2001 -From: Nicholas Chin -Date: Mon, 20 May 2024 10:10:03 -0600 -Subject: [PATCH] g45/hw-gfx-gma-plls.adb: Make reference clock frequency - configurable - -Instead of assuming a 96 MHz reference clock frequency, use the value -specified by the new INTEL_GMA_DPLL_REF_FREQ Kconfig. This defaults to -96 MHz to preserve the existing behavior. An example of where this is -needed is the DPLL_REF_SSCLK input, which will typically be 100 MHz -to support LVDS spread spectrum clocking. - -Signed-off-by: Nicholas Chin ---- - common/g45/hw-gfx-gma-plls.adb | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/common/g45/hw-gfx-gma-plls.adb b/common/g45/hw-gfx-gma-plls.adb -index 67242f2..1aee576 100644 ---- a/common/g45/hw-gfx-gma-plls.adb -+++ b/common/g45/hw-gfx-gma-plls.adb -@@ -12,6 +12,8 @@ - -- GNU General Public License for more details. - -- - -+with CB.Config; -+ - with HW.Time; - with HW.GFX.GMA.Config; - with HW.GFX.GMA.Registers; -@@ -460,7 +462,7 @@ is - (Display => Port_Cfg.Display, - Target_Dotclock => Target_Clock, - -- should be, but doesn't has to be always the same: -- Reference_Clock => 96_000_000, -+ Reference_Clock => CB.Config.INTEL_GMA_DPLL_REF_FREQ, - Best_Clock => Clk, - Valid => Success); - else --- -2.45.1 - diff --git a/config/submodule/coreboot/dell/libhwbase/module.cfg b/config/submodule/coreboot/dell/libhwbase/module.cfg deleted file mode 100644 index 2937b8b7..00000000 --- a/config/submodule/coreboot/dell/libhwbase/module.cfg +++ /dev/null @@ -1,3 +0,0 @@ -subrepo="https://review.coreboot.org/libhwbase.git" -subrepo_bkup="https://github.com/coreboot/libhwbase" -subhash="584629b9f4771b7618951cec57df2ca3af9c6981" diff --git a/config/submodule/coreboot/dell/module.list b/config/submodule/coreboot/dell/module.list deleted file mode 100644 index 3d968b1a..00000000 --- a/config/submodule/coreboot/dell/module.list +++ /dev/null @@ -1,4 +0,0 @@ -3rdparty/intel-microcode -3rdparty/libgfxinit -3rdparty/libhwbase -3rdparty/vboot diff --git a/config/submodule/coreboot/dell/vboot/module.cfg b/config/submodule/coreboot/dell/vboot/module.cfg deleted file mode 100644 index 9a23ee96..00000000 --- a/config/submodule/coreboot/dell/vboot/module.cfg +++ /dev/null @@ -1,3 +0,0 @@ -subrepo="https://review.coreboot.org/vboot.git" -subrepo_bkup="https://github.com/coreboot/vboot" -subhash="3d37d2aafe1f941c532def2a1fbbb58c8dd84182" diff --git a/config/submodule/coreboot/dell/vboot/patches/0001-extract_vmlinuz.c-Fix-the-bounds-check-on-vmlinuz_he.patch b/config/submodule/coreboot/dell/vboot/patches/0001-extract_vmlinuz.c-Fix-the-bounds-check-on-vmlinuz_he.patch deleted file mode 100644 index 1ac41de6..00000000 --- a/config/submodule/coreboot/dell/vboot/patches/0001-extract_vmlinuz.c-Fix-the-bounds-check-on-vmlinuz_he.patch +++ /dev/null @@ -1,178 +0,0 @@ -From 195f61375aeec9eec16604ec59f6eda2e6058cc1 Mon Sep 17 00:00:00 2001 -From: "Luke T. Shumaker" -Date: Thu, 30 May 2024 14:08:33 -0600 -Subject: [PATCH 1/1] extract_vmlinuz.c: Fix the bounds check on - vmlinuz_header_{offset,size} - -The check on vmlinuz_header_offset and vmlinuz_header_size is obviously -wrong: - - if (!vmlinuz_header_size || - kpart_data + vmlinuz_header_offset + vmlinuz_header_size > - kpart_data) { - return 1; - } - -`kpart_data + some_unsigned_values` can obviously never be `> kpart_data`, -unless something has overflowed! And `vmlinuz_header_offset` hasn't even -been set yet (besides being initialized to zero)! - -GCC will deduce that if the check didn't cause the function to bail, then -vmlinuz_header_size (a uint32_t) must be "negative"; that is: in the range -[2GiB,4GiB). - -On platforms where size_t is 32-bits, this is *especially* broken. -memcpy's size argument must be in the range [0,2GiB). Because GCC has -proved that vmlinuz_header_size is higher than that, it will fail to -compile: - - host/lib/extract_vmlinuz.c:67:9: error: 'memcpy' specified bound between 2147483648 and 4294967295 exceeds maximum object size 2147483647 [-Werror=stringop-overflow=] - -So, fix the check. - -I can now say that what I suspect the original author meant to write would -be the following patch, if `vmlinuz_header_offset` were already set: - - -kpart_data + vmlinuz_header_offset + vmlinuz_header_size > kpart_data - +now + vmlinuz_header_offset + vmlinuz_header_size > kpart_size - -This hypothesis is supported by `now` not getting incremented by -`kblob_size` the way it is for the keyblock and preamble sizes. - -However, we can also see that even this "corrected" bounds check is -insufficient: it does not detect the vmlinuz_header overflowing into -kblob_data. - -OK, so let's describe the fix: - -Have a `*vmlinuz_header` pointer instead of a -`uint64_t vmlinuz_header_offset`, to be more similar to all the other -regions. With this change, the correct check becomes a simple - - vmlinuz_header + vmlinuz_header_size > kblob_data - -While we're at it, make some changes that could have helped avoid this in -the first place: - - - Add comments. - - Calculate the vmlinuz_header offset right away, instead of waiting. - - Go ahead and increment `now` by `kblob_size`, to increase regularity. - -Change-Id: I5c03e49070b6dd2e04459566ef7dd129d27736e4 ---- - host/lib/extract_vmlinuz.c | 72 +++++++++++++++++++++++++++----------- - 1 file changed, 51 insertions(+), 21 deletions(-) - -diff --git a/host/lib/extract_vmlinuz.c b/host/lib/extract_vmlinuz.c -index 4ccfcf33..d2c09443 100644 ---- a/host/lib/extract_vmlinuz.c -+++ b/host/lib/extract_vmlinuz.c -@@ -15,16 +15,44 @@ - - int ExtractVmlinuz(void *kpart_data, size_t kpart_size, - void **vmlinuz_out, size_t *vmlinuz_size) { -+ // We're going to be extracting `vmlinuz_header` and -+ // `kblob_data`, and returning the concatenation of them. -+ // -+ // kpart_data = +-[kpart_size]------------------------------------+ -+ // | | -+ // keyblock = | +-[keyblock->keyblock_size]-------------------+ | -+ // | | struct vb2_keyblock keyblock | | -+ // | | char [] ...data... | | -+ // | +---------------------------------------------+ | -+ // | | -+ // preamble = | +-[preamble->preamble_size]-------------------+ | -+ // | | struct vb2_kernel_preamble preamble | | -+ // | | char [] ...data... | | -+ // | | char [] vmlinuz_header | | -+ // | | char [] ...data... | | -+ // | +---------------------------------------------+ | -+ // | | -+ // kblob_data= | +-[preamble->body_signature.data_size]--------+ | -+ // | | char [] ...data... | | -+ // | +---------------------------------------------+ | -+ // | | -+ // +-------------------------------------------------+ -+ - size_t now = 0; -+ // The 3 sections of kpart_data. -+ struct vb2_keyblock *keyblock = NULL; - struct vb2_kernel_preamble *preamble = NULL; - uint8_t *kblob_data = NULL; - uint32_t kblob_size = 0; -+ // vmlinuz_header -+ uint8_t *vmlinuz_header = NULL; - uint32_t vmlinuz_header_size = 0; -- uint64_t vmlinuz_header_address = 0; -- uint64_t vmlinuz_header_offset = 0; -+ // The concatenated result. - void *vmlinuz = NULL; - -- struct vb2_keyblock *keyblock = (struct vb2_keyblock *)kpart_data; -+ // Isolate the 3 sections of kpart_data. -+ -+ keyblock = (struct vb2_keyblock *)kpart_data; - now += keyblock->keyblock_size; - if (now > kpart_size) - return 1; -@@ -36,37 +64,39 @@ int ExtractVmlinuz(void *kpart_data, size_t kpart_size, - - kblob_data = kpart_data + now; - kblob_size = preamble->body_signature.data_size; -- -- if (!kblob_data || (now + kblob_size) > kpart_size) -+ now += kblob_size; -+ if (now > kpart_size) - return 1; - -+ // Find `vmlinuz_header` within `preamble`. -+ - if (preamble->header_version_minor > 0) { -- vmlinuz_header_address = preamble->vmlinuz_header_address; -+ // calculate the vmlinuz_header offset from -+ // the beginning of the kpart_data. The kblob doesn't -+ // include the body_load_offset, but does include -+ // the keyblock and preamble sections. -+ size_t vmlinuz_header_offset = -+ preamble->vmlinuz_header_address - -+ preamble->body_load_address + -+ keyblock->keyblock_size + -+ preamble->preamble_size; -+ -+ vmlinuz_header = kpart_data + vmlinuz_header_offset; - vmlinuz_header_size = preamble->vmlinuz_header_size; - } - -- if (!vmlinuz_header_size || -- kpart_data + vmlinuz_header_offset + vmlinuz_header_size > -- kpart_data) { -+ if (!vmlinuz_header || -+ !vmlinuz_header_size || -+ vmlinuz_header + vmlinuz_header_size > kblob_data) { - return 1; - } - -- // calculate the vmlinuz_header offset from -- // the beginning of the kpart_data. The kblob doesn't -- // include the body_load_offset, but does include -- // the keyblock and preamble sections. -- vmlinuz_header_offset = vmlinuz_header_address - -- preamble->body_load_address + -- keyblock->keyblock_size + -- preamble->preamble_size; -+ // Concatenate and return. - - vmlinuz = malloc(vmlinuz_header_size + kblob_size); - if (vmlinuz == NULL) - return 1; -- -- memcpy(vmlinuz, kpart_data + vmlinuz_header_offset, -- vmlinuz_header_size); -- -+ memcpy(vmlinuz, vmlinuz_header, vmlinuz_header_size); - memcpy(vmlinuz + vmlinuz_header_size, kblob_data, kblob_size); - - *vmlinuz_out = vmlinuz; --- -2.45.1 - -- cgit v1.2.1