Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10934
-gerrit
commit 0c19aacfd35eff7df6bc71a2afdcf399e39f6cfb
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Wed Jul 15 20:49:00 2015 +0200
cbfstool: add extended attributes structure to cbfs_file
This is a forward and backward compatible approach to extending the cbfs
format. Unfortunately we forgot to add a header length or offset to the file
name, making old implementations depend on it starting 24 bytes after the
cbfs_file structure.
To work around that, add another, extensible structure after the file name,
and point to it through an offset, so we can add more variable length
structures in the future when necessary.
The offset field which points to the file data is adjusted appropriately and
so old implementations still know where to find both any file's data and its
successor in the directory.
Files within CBFS that don't use advanced features remain fully usable by old
implementations. Files that use advanced features still don't break the data
structures.
Change-Id: I325965286c44f31abd95df684d340cebb0e68b75
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
---
util/cbfstool/cbfs.h | 8 ++++++++
util/cbfstool/cbfs_image.c | 11 +++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/util/cbfstool/cbfs.h b/util/cbfstool/cbfs.h
index 05eabe8..c53ac0e 100644
--- a/util/cbfstool/cbfs.h
+++ b/util/cbfstool/cbfs.h
@@ -74,6 +74,7 @@ struct cbfs_file {
/* length of file data */
uint32_t len;
uint32_t type;
+ /* offset to struct cbfs_file_attributes or 0 */
uint32_t attributes;
/* length of header incl. variable data */
uint32_t offset;
@@ -82,6 +83,10 @@ struct cbfs_file {
_Static_assert(sizeof(struct cbfs_file) == 24, "cbfs_file size mismatch");
+struct cbfs_file_attributes {
+ uint32_t len;
+} __PACKED;
+
struct cbfs_stage {
uint32_t compression;
uint64_t entry;
@@ -142,6 +147,9 @@ struct cbfs_payload {
#define CBFS_COMPONENT_NULL 0xFFFFFFFF
#define CBFS_SUBHEADER(_p) ( (void *) ((((uint8_t *) (_p)) + ntohl((_p)->offset))) )
+#define CBFS_FILE_ATTRIBUTES(_p) (((_p)->attributes == 0) ? NULL : \
+ (struct cbfs_file_attributes *)(((uint8_t *)(_p)) + ntohl((_p)->attributes)))
+
/* cbfs_image.c */
uint32_t get_cbfs_entry_type(const char *name, uint32_t default_value);
uint32_t get_cbfs_compression(const char *name, uint32_t unknown);
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 47aa5aa..9724543 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -118,7 +118,8 @@ int cbfs_parse_comp_algo(const char *name)
static size_t cbfs_calculate_file_header_size(const char *name)
{
return (sizeof(struct cbfs_file) +
- align_up(strlen(name) + 1, CBFS_FILENAME_ALIGN));
+ align_up(strlen(name) + 1, CBFS_FILENAME_ALIGN) +
+ sizeof(struct cbfs_file_attributes));
}
/* Only call on legacy CBFSes possessing a master header. */
@@ -1035,11 +1036,17 @@ int cbfs_create_empty_entry(struct cbfs_file *entry,
memcpy(entry->magic, CBFS_FILE_MAGIC, sizeof(entry->magic));
entry->type = htonl(CBFS_COMPONENT_NULL);
entry->len = htonl(len);
- entry->attributes = 0;
+ /* FIXME: it doesn't make much sense to have the calculation elsewhere
+ * while setting all kinds of offsets here, with more to come. */
entry->offset = htonl(cbfs_calculate_file_header_size(name));
+ entry->attributes = htonl(cbfs_calculate_file_header_size(name) -
+ sizeof(struct cbfs_file_attributes));
memset(entry->filename, 0, ntohl(entry->offset) - sizeof(*entry));
strcpy(entry->filename, name);
memset(CBFS_SUBHEADER(entry), CBFS_CONTENT_DEFAULT_VALUE, len);
+
+ struct cbfs_file_attributes *attr = CBFS_FILE_ATTRIBUTES(entry);
+ attr->len = sizeof(struct cbfs_file_attributes);
return 0;
}
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10933
-gerrit
commit c2a430634c32d782e338c4918a8ccbda18a29d6c
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Wed Jul 15 18:28:23 2015 +0200
cbfstool: rename checksum to attributes
So far it's still unused, but its purpose will change:
It will become an offset to another structure that contains additional file
attributes.
This change is compatible because the binary format doesn't change and so far
the field was always set to 0, which can serve nicely as 'unused' field.
Change-Id: I2dafb06866713d43a236556f9492641526270837
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
---
util/cbfstool/cbfs.h | 2 +-
util/cbfstool/cbfs_image.c | 2 +-
util/cbfstool/common.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/util/cbfstool/cbfs.h b/util/cbfstool/cbfs.h
index 1996b1c..05eabe8 100644
--- a/util/cbfstool/cbfs.h
+++ b/util/cbfstool/cbfs.h
@@ -74,7 +74,7 @@ struct cbfs_file {
/* length of file data */
uint32_t len;
uint32_t type;
- uint32_t checksum;
+ uint32_t attributes;
/* length of header incl. variable data */
uint32_t offset;
char filename[];
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 828d367..47aa5aa 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -1035,7 +1035,7 @@ int cbfs_create_empty_entry(struct cbfs_file *entry,
memcpy(entry->magic, CBFS_FILE_MAGIC, sizeof(entry->magic));
entry->type = htonl(CBFS_COMPONENT_NULL);
entry->len = htonl(len);
- entry->checksum = 0; // TODO Build a checksum algorithm.
+ entry->attributes = 0;
entry->offset = htonl(cbfs_calculate_file_header_size(name));
memset(entry->filename, 0, ntohl(entry->offset) - sizeof(*entry));
strcpy(entry->filename, name);
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index fffd096..b95e8bc 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -131,7 +131,7 @@ void cbfs_file_get_header(struct buffer *buf, struct cbfs_file *file)
bgets(buf, &file->magic, sizeof(file->magic));
file->len = xdr_be.get32(buf);
file->type = xdr_be.get32(buf);
- file->checksum = xdr_be.get32(buf);
+ file->attributes = xdr_be.get32(buf);
file->offset = xdr_be.get32(buf);
}
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10932
-gerrit
commit dbd02be98f068da9f324fd2cf522afede4556969
Author: Sol Boucher <solb(a)chromium.org>
Date: Thu May 7 21:00:05 2015 -0700
cbfstool: Remove extra comma after {0, NULL} list element
Trailing commas are useful for lists that can be extended. These lists are
0-terminated, and there should be no elements following that.
Change-Id: Iea8c6d5579d6363e77e1f5af666948160c4a9bf9
Signed-off-by: Sol Boucher <solb(a)chromium.org>
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Change-Id: I1a117a9473e895feaf455bb30d0f945f57de51eb
Original-Signed-off-by: Sol Boucher <solb(a)chromium.org>
---
util/cbfstool/cbfs_image.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index f5fddcb..828d367 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -77,13 +77,13 @@ static const struct typedesc_t types_cbfs_entry[] = {
{CBFS_COMPONENT_MRC_CACHE, "mrc_cache"},
{CBFS_COMPONENT_DELETED, "deleted"},
{CBFS_COMPONENT_NULL, "null"},
- {0, NULL},
+ {0, NULL}
};
static const struct typedesc_t types_cbfs_compression[] = {
{CBFS_COMPRESS_NONE, "none"},
{CBFS_COMPRESS_LZMA, "LZMA"},
- {0, NULL},
+ {0, NULL}
};
static const char *lookup_name_by_type(const struct typedesc_t *desc, uint32_t type,
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10927
-gerrit
commit dda090577853006f48ecac53f7f245f852444c6f
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Wed Jul 15 16:40:44 2015 +0200
cbfstool: improve specification of struct cbfs_file
Lock down its size and document some of the fields
Change-Id: I09fd6c80185345da0ae17d0f4498b50995fd1ec5
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
---
util/cbfstool/cbfs.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/util/cbfstool/cbfs.h b/util/cbfstool/cbfs.h
index 14a7a37..6286eff 100644
--- a/util/cbfstool/cbfs.h
+++ b/util/cbfstool/cbfs.h
@@ -71,12 +71,16 @@ struct cbfs_header {
struct cbfs_file {
uint8_t magic[8];
+ /* length of file data */
uint32_t len;
uint32_t type;
uint32_t checksum;
+ /* length of header incl. variable data */
uint32_t offset;
} __PACKED;
+_Static_assert(sizeof(struct cbfs_file) == 24, "cbfs_file size mismatch");
+
struct cbfs_stage {
uint32_t compression;
uint64_t entry;
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10903
-gerrit
commit 39c6a59ff0259296783638b6a06f6d3e902b98cc
Author: zbao <fishbaozi(a)gmail.com>
Date: Thu Jun 25 16:58:53 2015 -0400
x86 realmode: Set up the 8254 timer before running option rom
If the 8254 is not set up, the external graphics option rom
hangs and never returns.
The code is tested on AMD/bettong.
Change-Id: I0022de9d9a275a7d4b7a331ae7fcf793b9f4c5f5
Signed-off-by: Zheng Bao <zheng.bao(a)amd.com>
Signed-off-by: Zheng Bao <fishbaozi(a)gmail.com>
---
src/device/oprom/realmode/x86.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c
index 14bcbc0..796c9fe 100644
--- a/src/device/oprom/realmode/x86.c
+++ b/src/device/oprom/realmode/x86.c
@@ -31,6 +31,7 @@
#include <device/pci_ids.h>
#include <lib/jpeg.h>
#include <pc80/i8259.h>
+#include <pc80/i8254.h>
#include <string.h>
#include <vbe.h>
@@ -326,6 +327,7 @@ void run_bios(struct device *dev, unsigned long addr)
* in some option roms.
*/
setup_i8259();
+ setup_i8254();
/* Set up some legacy information in the F segment */
setup_rombios();