Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/75707?usp=email )
Change subject: Rename CBFS master header -> CBFS main header ......................................................................
Rename CBFS master header -> CBFS main header
Calling it the main header is more descriptive of its pupose and should therefore be preferred.
Change-Id: I624da280dd78d707b96897b84768be5f5baf0770 Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org --- M Documentation/cbfs.txt M Documentation/mainboard/gigabyte/ga-g41m-es2l.md M Documentation/releases/coreboot-4.2-relnotes.md M Makefile.inc M payloads/libpayload/arch/x86/rom_media.c M payloads/libpayload/include/cbfs_core.h M payloads/libpayload/libcbfs/cbfs_core.c M src/commonlib/cbfs.c M util/cbfstool/cbfs_image.c M util/cbfstool/cbfs_image.h M util/cbfstool/cbfstool.c M util/nvramtool/cbfs.c 12 files changed, 58 insertions(+), 58 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/75707/1
diff --git a/Documentation/cbfs.txt b/Documentation/cbfs.txt index 831e882..02eefa7 100644 --- a/Documentation/cbfs.txt +++ b/Documentation/cbfs.txt @@ -25,7 +25,7 @@ A header has been added somewhere in the bootblock similar to Carl Daniel's scheme. In addition to the coreboot information, the header reports the size of the ROM, the alignment of the blocks, and the offset -of the first component in the CBFS. The master header provides all +of the first component in the CBFS. The main header provides all the information LAR needs plus the magic number information flashrom needs.
Each "file" (or component, as I style them) now has a type associated @@ -40,7 +40,7 @@ the component itself (see below).
The components are arranged in the ROM aligned along the specified -alignment from the master header - this is to facilitate partial re-write. +alignment from the main header - this is to facilitate partial re-write.
Other then that, the LAR ideas remain pretty much the same.
@@ -124,15 +124,15 @@ are aligned along a pre-defined boundary.
The bootblock occupies the last 20k of the ROM. Within -the bootblock is a master header containing information about the ROM +the bootblock is a main header containing information about the ROM including the size, alignment of the components, and the offset of the start of the first CBFS component within the ROM.
-= Master Header = += Main Header =
-The master header contains essential information about the ROM that is +The main header contains essential information about the ROM that is used by both the CBFS implementation within coreboot at runtime as well -as host based utilities to create and manage the ROM. The master header +as host based utilities to create and manage the ROM. The main header will be located somewhere within the bootblock (last 20k of the ROM). A pointer to the location of the header will be located at offset -4 from the end of the ROM. This translates to address 0xFFFFFFFC on a @@ -141,7 +141,7 @@ to locate the header at run time. Build time utilities will need to read the pointer and do the appropriate math to locate the header.
-The following is the structure of the master header: +The following is the structure of the main header:
struct cbfs_header { u32 magic; @@ -185,13 +185,13 @@ The bootblock is a mandatory component in the ROM. It is located in the last 20k of the ROM space, and contains, among other things, the location of the -master header and the entry point for the loader firmware. The bootblock +main header and the entry point for the loader firmware. The bootblock does not have a component header attached to it.
= Components =
CBFS components are placed in the ROM starting at 'offset' specified in -the master header and ending at the bootblock. Thus the total size +the main header and ending at the bootblock. Thus the total size available for components in the ROM is (ROM size - 20k - 'offset'). Each CBFS component is to be aligned according to the 'align' value in the header. @@ -248,7 +248,7 @@ == Searching Algorithm ==
To locate a specific component in the ROM, one starts at the 'offset' -specified in the CBFS master header. For this example, the offset will +specified in the CBFS main header. For this example, the offset will be 0.
From that offset, the code should search for the magic string on the diff --git a/Documentation/mainboard/gigabyte/ga-g41m-es2l.md b/Documentation/mainboard/gigabyte/ga-g41m-es2l.md index 6c17f4c..de18997 100644 --- a/Documentation/mainboard/gigabyte/ga-g41m-es2l.md +++ b/Documentation/mainboard/gigabyte/ga-g41m-es2l.md @@ -113,7 +113,7 @@
FMAP REGION: COREBOOT Name Offset Type Size Comp -cbfs master header 0x0 cbfs header 32 none +cbfs main header 0x0 cbfs header 32 none fallback/romstage 0x80 stage 62316 none cpu_microcode_blob.bin 0xf480 microcode 180224 none fallback/ramstage 0x3b500 stage 98745 none diff --git a/Documentation/releases/coreboot-4.2-relnotes.md b/Documentation/releases/coreboot-4.2-relnotes.md index 08a0175..7486dcf 100644 --- a/Documentation/releases/coreboot-4.2-relnotes.md +++ b/Documentation/releases/coreboot-4.2-relnotes.md @@ -69,9 +69,9 @@ * Add and align CBFS components in one pass instead of two * Add XIP support for X86 to relocate the romstage when it'™s added * Removed locate command as it'™s no longer needed -* Add bootblock and cbfs_header file types so the master header knows +* Add bootblock and cbfs_header file types so the main header knows about them -* Prefer FMAP data to CBFS master header if FMAP data exists +* Prefer FMAP data to CBFS main header if FMAP data exists * Add hashes to cbfs file metadata for verification of images
### Payloads: diff --git a/Makefile.inc b/Makefile.inc index eb505e5..ededf88 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -1105,8 +1105,8 @@ $(CBFSTOOL) $@.tmp write -u \ -r BOOTBLOCK \ -f $(objcbfs)/bootblock.bin - # make space for the CBFS master header pointer. "ptr_" is just - # arbitrary 4 bytes that will be overwritten by add-master-header. + # make space for the CBFS main header pointer. "ptr_" is just + # arbitrary 4 bytes that will be overwritten by add-main-header. printf "ptr_" > $@.tmp.2 $(CBFSTOOL) $@.tmp add \ -f $@.tmp.2 \ @@ -1116,7 +1116,7 @@ $(CBFSTOOL_ADD_CMD_OPTIONS) rm -f $@.tmp.2 endif # ifeq ($(CONFIG_ARCH_X86),y) - $(CBFSTOOL) $@.tmp add-master-header $(TS_OPTIONS) $(CBFSTOOL_ADD_CMD_OPTIONS) + $(CBFSTOOL) $@.tmp add-main-header $(TS_OPTIONS) $(CBFSTOOL_ADD_CMD_OPTIONS) $(prebuild-files) true mv $@.tmp $@ else # ifneq ($(CONFIG_UPDATE_IMAGE),y) diff --git a/payloads/libpayload/arch/x86/rom_media.c b/payloads/libpayload/arch/x86/rom_media.c index d152963..b258399 100644 --- a/payloads/libpayload/arch/x86/rom_media.c +++ b/payloads/libpayload/arch/x86/rom_media.c @@ -46,7 +46,7 @@
static void *x86_rom_map(struct cbfs_media *media, size_t offset, size_t count) { void *ptr; - // Some address (ex, pointer to master header) may be given in memory + // Some address (ex, pointer to main header) may be given in memory // mapped location. To workaround that, we handle >0xf0000000 as real // memory pointer.
@@ -83,7 +83,7 @@ *(uint32_t*)(0xfffffffc); if (CBFS_HEADER_MAGIC != ntohl(header->magic)) { #if CONFIG(LP_ROM_SIZE) - printk(BIOS_ERR, "Invalid CBFS master header at %p\n", header); + printk(BIOS_ERR, "Invalid CBFS main header at %p\n", header); media->context = (void*)CONFIG_LP_ROM_SIZE; #else return -1; diff --git a/payloads/libpayload/include/cbfs_core.h b/payloads/libpayload/include/cbfs_core.h index fc4caa4..217cfe0 100644 --- a/payloads/libpayload/include/cbfs_core.h +++ b/payloads/libpayload/include/cbfs_core.h @@ -84,7 +84,7 @@
#define CBFS_HEADER_INVALID_ADDRESS ((void*)(0xffffffff))
-/* this is the master cbfs header - it must be located somewhere available +/* this is the main cbfs header - it must be located somewhere available * to bootblock (to load romstage). The last 4 bytes in the image contain its * relative offset from the end of the image (as a 32-bit signed integer). */
@@ -256,7 +256,7 @@ size_t cbfs_decompress(int algo, const void *src, size_t srcn, void *dst, size_t dstn);
-/* returns a pointer to CBFS master header, or CBFS_HEADER_INVALID_ADDRESS +/* returns a pointer to CBFS main header, or CBFS_HEADER_INVALID_ADDRESS * on failure */ const struct cbfs_header *cbfs_get_header(struct cbfs_media *media);
diff --git a/payloads/libpayload/libcbfs/cbfs_core.c b/payloads/libpayload/libcbfs/cbfs_core.c index 82c2846..4c7463e 100644 --- a/payloads/libpayload/libcbfs/cbfs_core.c +++ b/payloads/libpayload/libcbfs/cbfs_core.c @@ -52,7 +52,7 @@ #include <string.h> #include <sysinfo.h>
-/* returns a pointer to CBFS master header, or CBFS_HEADER_INVALID_ADDRESS +/* returns a pointer to CBFS main header, or CBFS_HEADER_INVALID_ADDRESS * on failure */ const struct cbfs_header *cbfs_get_header(struct cbfs_media *media) { @@ -71,7 +71,7 @@
if (!media->read(media, &rel_offset, (size_t)(0 - sizeof(int32_t)), sizeof(int32_t))) { - ERROR("Could not read CBFS master header offset!\n"); + ERROR("Could not read CBFS main header offset!\n"); return CBFS_HEADER_INVALID_ADDRESS; } header = media->map(media, (size_t)rel_offset, sizeof(*header)); @@ -86,7 +86,7 @@ }
if (CBFS_HEADER_MAGIC != ntohl(header->magic)) { - ERROR("Could not find valid CBFS master header at %#zx(-%#zx): " + ERROR("Could not find valid CBFS main header at %#zx(-%#zx): " "magic %#.8x vs %#.8x.\n", (size_t)rel_offset, (size_t)-rel_offset, CBFS_HEADER_MAGIC, ntohl(header->magic)); @@ -110,8 +110,8 @@ return 0; }
- /* read offset and size from cbfs master header */ - DEBUG("Read CBFS offset & size from master header\n"); + /* read offset and size from cbfs main header */ + DEBUG("Read CBFS offset & size from main header\n"); header = cbfs_get_header(media); if (header == CBFS_HEADER_INVALID_ADDRESS) return -1; diff --git a/src/commonlib/cbfs.c b/src/commonlib/cbfs.c index e7f800c..636282e 100644 --- a/src/commonlib/cbfs.c +++ b/src/commonlib/cbfs.c @@ -268,7 +268,7 @@
/* Hash in the potential CBFS header sitting at the beginning of the CBFS * region as well as relative offset at the end. */ -static int cbfs_extend_hash_master_header(struct vb2_digest_context *ctx, +static int cbfs_extend_hash_main_header(struct vb2_digest_context *ctx, const struct region_device *cbfs) { struct region_device rdev; @@ -305,7 +305,7 @@ if (rv) return rv;
- rv = cbfs_extend_hash_master_header(&ctx, cbfs); + rv = cbfs_extend_hash_main_header(&ctx, cbfs); if (rv) return rv;
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 1fb19ba..8a7c1f9 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -69,7 +69,7 @@ align_up(strlen(name) + 1, CBFS_ATTRIBUTE_ALIGN)); }
-/* Only call on legacy CBFSes possessing a master header. */ +/* Only call on legacy CBFSes possessing a main header. */ static int cbfs_fix_legacy_size(struct cbfs_image *image, char *hdr_loc) { assert(image); @@ -79,7 +79,7 @@ // usually CBFS header on x86. We need to workaround that. // Except when we run across a file that contains the actual header, // in which case this image is a safe, new-style - // `cbfstool add-master-header` based image. + // `cbfstool add-main-header` based image.
struct cbfs_file *entry, *first = NULL, *last = NULL; for (first = entry = cbfs_find_first_entry(image); @@ -301,7 +301,7 @@ image->has_header = true;
// The last 4 byte of the image contain the relative offset from the end - // of the image to the master header as a 32-bit signed integer. x86 + // of the image to the main header as a 32-bit signed integer. x86 // relies on this also being its (memory-mapped, top-aligned) absolute // 32-bit address by virtue of how two's complement numbers work. assert(size % sizeof(int32_t) == 0); @@ -348,7 +348,7 @@ cbfs_fix_legacy_size(out, header_loc); return 0; } else if (offset != ~0u) { - ERROR("The -H switch is only valid on legacy images having CBFS master headers.\n"); + ERROR("The -H switch is only valid on legacy images having CBFS main headers.\n"); return 1; } ERROR("Selected image region is not a valid CBFS.\n"); @@ -393,7 +393,7 @@ }
/* Last entry size is all the room above it, except for top 4 bytes - * which may be used by the master header pointer. This messes with + * which may be used by the main header pointer. This messes with * the ability to stash something "top-aligned" into the region, but * keeps things simpler. */ last_entry_size = copy_end - @@ -711,7 +711,7 @@ }
len = addr_next - addr - min_entry_size; - /* keep space for master header pointer */ + /* keep space for main header pointer */ if ((uint8_t *)entry + min_entry_size + len > (uint8_t *)buffer_get(&image->buffer) + buffer_size(&image->buffer) - sizeof(int32_t)) { @@ -1668,7 +1668,7 @@ return NULL; }
- // Try finding relative offset of master header at end of file first. + // Try finding relative offset of main header at end of file first. rel_offset = *(int32_t *)(data + size - sizeof(int32_t)); offset = size + rel_offset; DEBUG("relative offset: %#zx(-%#zx), offset: %#zx\n", diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h index 664d146..58455d4 100644 --- a/util/cbfstool/cbfs_image.h +++ b/util/cbfstool/cbfs_image.h @@ -35,7 +35,7 @@ * contents will be used to place an empty entry of the requested length at the * appropriate position in the existing buffer; otherwise, if not has_header, * the first entries_size bytes of buffer will be filled exclusively with the - * single empty entry (and no CBFS master header). + * single empty entry (and no CBFS main header). * Returns 0 on success, otherwise nonzero. */ int cbfs_image_create(struct cbfs_image *image, size_t entries_size);
@@ -43,7 +43,7 @@ * (bootblock, align, header location, starting offset of CBFS entries). * The output image will contain a valid cbfs_header, with one cbfs_file * entry with type CBFS_TYPE_NULL, with max available size. - * Only call this if you want a legacy CBFS with a master header. + * Only call this if you want a legacy CBFS with a main header. * Returns 0 on success, otherwise nonzero. */ int cbfs_legacy_image_create(struct cbfs_image *image, uint32_t arch, @@ -61,7 +61,7 @@ uint32_t offset);
/* Create a duplicate CBFS image. Returns 0 on success, otherwise non-zero. - * Will not succeed on new-style images without a master header. */ + * Will not succeed on new-style images without a main header. */ int cbfs_copy_instance(struct cbfs_image *image, struct buffer *dst);
/* Compact a fragmented CBFS image by placing all the non-empty files at the @@ -125,7 +125,7 @@
/* Iterates through all entries in CBFS image, and invoke with callback. * Stops if callback returns non-zero values. Unlike the commonlib cbfs_walk(), - * this can deal with different alignments in legacy CBFS (with master header). + * this can deal with different alignments in legacy CBFS (with main header). * Returns number of entries invoked. */ int cbfs_legacy_walk(struct cbfs_image *image, cbfs_entry_callback callback, void *arg); @@ -152,10 +152,10 @@ * This is different from entry->offset (pointer to content). */ uint32_t cbfs_get_entry_addr(struct cbfs_image *image, struct cbfs_file *entry);
-/* Returns 1 if valid new-format CBFS (without a master header), otherwise 0. */ +/* Returns 1 if valid new-format CBFS (without a main header), otherwise 0. */ int cbfs_is_valid_cbfs(struct cbfs_image *image);
-/* Returns 1 if valid legacy CBFS (with a master header), otherwise 0. */ +/* Returns 1 if valid legacy CBFS (with a main header), otherwise 0. */ int cbfs_is_legacy_cbfs(struct cbfs_image *image);
/* Returns 1 if entry has valid data (by checking magic number), otherwise 0. */ diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 6133536..bbf9124 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -661,7 +661,7 @@ write_le32(location, offset); }
-static int update_master_header_loc_topswap(struct cbfs_image *image, +static int update_main_header_loc_topswap(struct cbfs_image *image, void *h_loc, uint32_t header_offset) { struct cbfs_file *entry; @@ -688,9 +688,9 @@ return 0; }
-static int cbfs_add_master_header(void) +static int cbfs_add_main_header(void) { - const char * const name = "cbfs master header"; + const char * const name = "cbfs main header"; struct cbfs_image image; struct cbfs_file *header = NULL; struct buffer buffer; @@ -717,14 +717,14 @@ h->magic = htonl(CBFS_HEADER_MAGIC); h->version = htonl(CBFS_HEADER_VERSION); /* The 4 bytes are left out for two reasons: - * 1. the cbfs master header pointer resides there + * 1. the cbfs main header pointer resides there * 2. some cbfs implementations assume that an image that resides * below 4GB has a bootblock and get confused when the end of the * image is at 4GB == 0. */ h->bootblocksize = htonl(4); h->align = htonl(CBFS_ALIGNMENT); - /* The offset and romsize fields within the master header are absolute + /* The offset and romsize fields within the main header are absolute * values within the boot media. As such, romsize needs to relfect * the end 'offset' for a CBFS. To achieve that the current buffer * representing the CBFS region's size is added to the offset of @@ -737,11 +737,11 @@ h->offset = htonl(offset); h->architecture = htonl(CBFS_ARCHITECTURE_UNKNOWN);
- /* Never add a hash attribute to the master header. */ + /* Never add a hash attribute to the main header. */ header = cbfs_create_file_header(CBFS_TYPE_CBFSHEADER, buffer_size(&buffer), name); if (cbfs_add_entry(&image, &buffer, 0, header, 0) != 0) { - ERROR("Failed to add cbfs master header into ROM image.\n"); + ERROR("Failed to add cbfs main header into ROM image.\n"); goto done; }
@@ -763,7 +763,7 @@ * location in secondary bootblock */ if (param.topswap_size) { - if (update_master_header_loc_topswap(&image, h_loc, + if (update_main_header_loc_topswap(&image, h_loc, header_offset)) return 1; } @@ -1414,7 +1414,7 @@ param.cbfsoffset = align_up(param.headeroffset + sizeof(struct cbfs_header), CBFS_ALIGNMENT); - DEBUG("CBFS entries start beind master header (%#x).\n", + DEBUG("CBFS entries start beind main header (%#x).\n", param.cbfsoffset); } } @@ -1570,7 +1570,7 @@ return 1; } if (!partitioned_file_is_partitioned(param.image_file)) { - ERROR("This operation isn't valid on legacy images having CBFS master headers\n"); + ERROR("This operation isn't valid on legacy images having CBFS main headers\n"); return 1; }
@@ -1648,7 +1648,7 @@ return 1; } if (!partitioned_file_is_partitioned(param.image_file)) { - ERROR("This operation isn't valid on legacy images having CBFS master headers\n"); + ERROR("This operation isn't valid on legacy images having CBFS main headers\n"); return 1; }
@@ -1728,7 +1728,7 @@ {"add-stage", "a:H:r:f:n:t:c:b:P:QS:p:yvA:gh?", cbfs_add_stage, true, true}, {"add-int", "H:r:i:n:b:vgh?", cbfs_add_integer, true, true}, - {"add-master-header", "H:r:vh?j:", cbfs_add_master_header, true, true}, + {"add-main-header", "H:r:vh?j:", cbfs_add_main_header, true, true}, {"compact", "r:h?", cbfs_compact, true, true}, {"copy", "r:R:h?", cbfs_copy, true, true}, {"create", "M:r:s:B:b:H:o:m:vh?", cbfs_create, true, true}, @@ -1924,9 +1924,9 @@ "Add a 32bit flat mode binary\n" " add-int [-r image,regions] -i INTEGER -n NAME [-b base] " "Add a raw 64-bit integer value\n" - " add-master-header [-r image,regions] \ \n" + " add-main-header [-r image,regions] \ \n" " [-j topswap-size] (Intel CPUs only) " - "Add a legacy CBFS master header\n" + "Add a legacy CBFS main header\n" " remove [-r image,regions] -n NAME " "Remove a component\n" " compact -r image,regions " @@ -1935,7 +1935,7 @@ "Create a copy (duplicate) cbfs instance in fmap\n" " create -m ARCH -s size [-b bootblock offset] \\n" " [-o CBFS offset] [-H header offset] [-B bootblock] " - "Create a legacy ROM file with CBFS master header*\n" + "Create a legacy ROM file with CBFS main header*\n" " create -M flashmap [-r list,of,regions,containing,cbfses] " "Create a new-style partitioned firmware image\n" " locate [-r image,regions] -f FILE -n NAME [-P page-size] \\n" @@ -1969,7 +1969,7 @@ printf( "\n* Note that these actions and switches are only valid when\n" " working with legacy images whose structure is described\n" - " primarily by a CBFS master header. New-style images, in\n" + " primarily by a CBFS main header. New-style images, in\n" " contrast, exclusively make use of an FMAP to describe their\n" " layout: this must minimally contain an '%s' section\n" " specifying the location of this FMAP itself and a '%s'\n" diff --git a/util/nvramtool/cbfs.c b/util/nvramtool/cbfs.c index cbf95c4..fdf6597 100644 --- a/util/nvramtool/cbfs.c +++ b/util/nvramtool/cbfs.c @@ -38,7 +38,7 @@ return !strcmp(file->magic, CBFS_FILE_MAGIC) ? 1 : 0; }
-static struct cbfs_header *cbfs_master_header(void) +static struct cbfs_header *cbfs_main_header(void) { struct cbfs_header *header;
@@ -58,7 +58,7 @@
struct cbfs_file *cbfs_find(const char *name) { - struct cbfs_header *header = cbfs_master_header(); + struct cbfs_header *header = cbfs_main_header(); void *offset;
if (header == NULL)