Isaac Christensen (isaac.christensen(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6958
-gerrit
commit a33c070cbe2c9f165e97a1d9f5dd8b2d7c6232b0
Author: Gabe Black <gabeblack(a)google.com>
Date: Fri Feb 21 01:01:06 2014 -0800
cbfstool: If compression fails, warn and use the uncompressed data.
The LZMA compression algorithm, currently the only one available, will fail
if you ask it to write more data to the output than you've given it space for.
The code that calls into LZMA allocates an output buffer the same size as the
input, so if compression increases the size of the output the call will fail.
The caller(s) were written to assume that the call succeeded and check the
returned length to see if the size would have increased, but that will never
happen with LZMA.
Rather than try to rework the LZMA library to dynamically resize the output
buffer or try to guess what the maximal size the data could expand to is, this
change makes the caller simply print a warning and disable compression if the
call failed for some reason.
This may lead to images that are larger than necessary if compression fails
for some other reason and the user doesn't notice, but since compression
errors were ignored entirely until very recently that will hopefully not be
a problem in practice, and we should be guarnateed to at least produce a
correct image.
Change-Id: I5f59529c2d48e9c4c2e011018b40ec336c4fcca8
Signed-off-by: Gabe Black <gabeblack(a)google.com>
Reviewed-on: https://chromium-review.googlesource.com/187365
Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
Tested-by: Gabe Black <gabeblack(a)chromium.org>
Commit-Queue: Gabe Black <gabeblack(a)chromium.org>
(cherry picked from commit b9f622a554d5fb9a9aff839c64e11acb27785f13)
Signed-off-by: Isaac Christensen <isaac.christensen(a)se-eng.com>
---
util/cbfstool/cbfs-mkpayload.c | 53 +++++++++++++++++++-----------------------
util/cbfstool/cbfs-mkstage.c | 11 ++++++---
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/util/cbfstool/cbfs-mkpayload.c b/util/cbfstool/cbfs-mkpayload.c
index dabe322..08da954 100644
--- a/util/cbfstool/cbfs-mkpayload.c
+++ b/util/cbfstool/cbfs-mkpayload.c
@@ -201,25 +201,24 @@ int parse_elf_to_payload(const struct buffer *input,
segs[segments].type = PAYLOAD_SEGMENT_DATA;
segs[segments].load_addr = phdr[i].p_paddr;
segs[segments].mem_len = phdr[i].p_memsz;
- segs[segments].compression = algo;
segs[segments].offset = doffset;
+ /* If the compression failed or made the section is larger,
+ use the original stuff */
+
int len;
if (compress((char *)&header[phdr[i].p_offset],
- phdr[i].p_filesz, output->data + doffset, &len)) {
- buffer_delete(output);
- return -1;
- }
- segs[segments].len = len;
-
- /* If the compressed section is larger, then use the
- original stuff */
-
- if ((unsigned int)len > phdr[i].p_filesz) {
+ phdr[i].p_filesz, output->data + doffset, &len) ||
+ (unsigned int)len > phdr[i].p_filesz) {
+ WARN("Compression failed or would make the data bigger "
+ "- disabled.\n");
segs[segments].compression = 0;
segs[segments].len = phdr[i].p_filesz;
memcpy(output->data + doffset,
&header[phdr[i].p_offset], phdr[i].p_filesz);
+ } else {
+ segs[segments].compression = algo;
+ segs[segments].len = len;
}
doffset += segs[segments].len;
@@ -264,15 +263,13 @@ int parse_flat_binary_to_payload(const struct buffer *input,
segs[0].mem_len = input->size;
segs[0].offset = doffset;
- if (compress(input->data, input->size, output->data + doffset, &len)) {
- buffer_delete(output);
- return -1;
- }
- segs[0].compression = algo;
- segs[0].len = len;
-
- if ((unsigned int)len >= input->size) {
- WARN("Compressing data would make it bigger - disabled.\n");
+ if (!compress(input->data, input->size, output->data + doffset, &len) &&
+ (unsigned int)len < input->size) {
+ segs[0].compression = algo;
+ segs[0].len = len;
+ } else {
+ WARN("Compression failed or would make the data bigger "
+ "- disabled.\n");
segs[0].compression = 0;
segs[0].len = input->size;
memcpy(output->data + doffset, input->data, input->size);
@@ -393,15 +390,13 @@ int parse_fv_to_payload(const struct buffer *input,
segs[0].mem_len = input->size;
segs[0].offset = doffset;
- if (compress(input->data, input->size, output->data + doffset, &len)) {
- buffer_delete(output);
- return -1;
- }
- segs[0].compression = algo;
- segs[0].len = len;
-
- if ((unsigned int)len >= input->size) {
- WARN("Compressing data would make it bigger - disabled.\n");
+ if (!compress(input->data, input->size, output->data + doffset, &len) &&
+ (unsigned int)len < input->size) {
+ segs[0].compression = algo;
+ segs[0].len = len;
+ } else {
+ WARN("Compression failed or would make the data bigger "
+ "- disabled.\n");
segs[0].compression = 0;
segs[0].len = input->size;
memcpy(output->data + doffset, input->data, input->size);
diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c
index 8c77ee5..4a2f4d8 100644
--- a/util/cbfstool/cbfs-mkstage.c
+++ b/util/cbfstool/cbfs-mkstage.c
@@ -155,12 +155,17 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
* to fill out the header. This seems backward but it works because
* - the output header is a known size (not always true in many xdr's)
* - we do need to know the compressed output size first
+ * If compression fails or makes the data bigger, we'll warn about it
+ * and use the original data.
*/
if (compress(buffer, data_end - data_start,
(output->data + sizeof(struct cbfs_stage)),
- &outlen) < 0) {
- free(buffer);
- return -1;
+ &outlen) < 0 || outlen > data_end - data_start) {
+ WARN("Compression failed or would make the data bigger "
+ "- disabled.\n");
+ memcpy(output->data + sizeof(struct cbfs_stage),
+ buffer, data_end - data_start);
+ algo = CBFS_COMPRESS_NONE;
}
free(buffer);
Isaac Christensen (isaac.christensen(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6951
-gerrit
commit 3e546f2612738c17835146e927bb06bf15f43b21
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Thu Mar 6 08:37:49 2014 -0800
google/chromeec: Notify DPTF charger participant on AC state change
The DPTF charger particpant device needs to be notified when the
AC state changes so it can re-evaluate the PPCC object and apply
the proper charge rate limit if necessary.
Change-Id: I6723754e2fe12862f50709875140fcadcddb18eb
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/189029
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-by: Brad Geltz <brad.geltz(a)intel.com>
(cherry picked from commit ed1ee577014421b021e8814edc91a1b696bf9eed)
Signed-off-by: Isaac Christensen <isaac.christensen(a)se-eng.com>
---
src/ec/google/chromeec/acpi/ec.asl | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/ec/google/chromeec/acpi/ec.asl b/src/ec/google/chromeec/acpi/ec.asl
index 5218c88..650efd2 100644
--- a/src/ec/google/chromeec/acpi/ec.asl
+++ b/src/ec/google/chromeec/acpi/ec.asl
@@ -26,6 +26,7 @@
// Mainboard specific throttle handler
External (\_TZ.THRT, MethodObj)
External (\_SB.DPTF.TEVT, MethodObj)
+External (\_SB.DPTF.TCHG, DeviceObj)
Device (EC0)
{
@@ -205,6 +206,9 @@ Device (EC0)
Store ("EC: AC CONNECTED", Debug)
Store (ACEX, \PWRS)
Notify (AC, 0x80)
+ If (CondRefOf (\_SB.DPTF.TCHG)) {
+ Notify (\_SB.DPTF.TCHG, 0x80)
+ }
\PNOT ()
}
@@ -214,6 +218,9 @@ Device (EC0)
Store ("EC: AC DISCONNECTED", Debug)
Store (ACEX, \PWRS)
Notify (AC, 0x80)
+ If (CondRefOf (\_SB.DPTF.TCHG)) {
+ Notify (\_SB.DPTF.TCHG, 0x80)
+ }
\PNOT ()
}
the following patch was just integrated into master:
commit 5c8d3d22c82c5f67d1c8ae1c9479b1baee49ceb2
Author: Gabe Black <gabeblack(a)google.com>
Date: Fri Jan 17 22:11:35 2014 -0800
big: Create a nyan_big mainboard which is a copy of nyan.
The nyan_big mainboard is very similar to nyan, but will be different in a few
ways. For instance, the BCT will be different, and the GPIOs may need to be
configured slightly differently.
This change also adds prefixes to the kconfig variables in "choice" blocks
for both boards since having multiple instances of choice blocks with the same
options confuses kconfig even if all of the instances have mutually exclusive
dependencies.
Change-Id: I290a32e47fc118bd4b86d543df617ad324325dbc
Signed-off-by: Gabe Black <gabeblack(a)google.com>
Reviewed-on: https://chromium-review.googlesource.com/183532
Reviewed-by: Tom Warren <twarren(a)nvidia.com>
Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
Commit-Queue: Gabe Black <gabeblack(a)chromium.org>
Tested-by: Gabe Black <gabeblack(a)chromium.org>
(cherry picked from commit d1a453fe1aa68b3d12936dd48cc6c94b54f81579)
Signed-off-by: Isaac Christensen <isaac.christensen(a)se-eng.com>
Reviewed-on: http://review.coreboot.org/6927
Tested-by: build bot (Jenkins)
See http://review.coreboot.org/6927 for details.
-gerrit
the following patch was just integrated into master:
commit 1893fd7c2b39c6167fafdc8294a5216170a810e2
Author: Isaac Christensen <isaac.christensen(a)se-eng.com>
Date: Mon Sep 22 17:18:11 2014 -0600
arm: add missing gc-sections for ramstage
This is a fix up for recent patch:
c505837 arm: Have the linker garbage-collect unused functions and variables
I missed adding --gc-sections to a couple of the ramstage lines.
Change-Id: I81178eb99fddbd99c603c79ba506db51af975b27
Signed-off-by: Isaac Christensen <isaac.christensen(a)se-eng.com>
Reviewed-on: http://review.coreboot.org/6956
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin(a)google.com>
See http://review.coreboot.org/6956 for details.
-gerrit
the following patch was just integrated into master:
commit ea8f3b4aa0029871ee36a953a927c1af081343c5
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Sun Sep 21 12:21:36 2014 +0200
northbridge/intel/i945/Kconfig: Select VGA
Commit 0092c999 (i945: Support text mode gfx init) [1] broke building
the Lenovo X60 with native graphics initialization by selecting
`CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT`.
CC northbridge/intel/i945/gma.ramstage.o
src/northbridge/intel/i945/gma.c: In function 'intel_gma_init':
src/northbridge/intel/i945/gma.c:398:2: error: implicit declaration of function 'vga_textmode_init' [-Werror=implicit-function-declaration]
Selecting the Kconfig variable VGA makes the declaration of the
function `vga_textmode_init()` to be included by the preprocessor.
[1] http://review.coreboot.org/6723
Change-Id: Iecbb2898193078b8738425cea13cb7e6da508cab
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/6947
Reviewed-by: Vladimir Serbinenko <phcoder(a)gmail.com>
Tested-by: build bot (Jenkins)
See http://review.coreboot.org/6947 for details.
-gerrit