cbfstool: don't pass header_size as separate argument (part 2)
It's already present inside struct cbfs_file Change-Id: Ic9682e93c3d208e2ed458940e4a9f9f5a64b6e98 Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/11333 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
d5a4afa63d
commit
f5252f378b
|
@ -533,7 +533,7 @@ static int cbfs_add_entry_at(struct cbfs_image *image,
|
||||||
|
|
||||||
int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
|
int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
|
||||||
uint32_t content_offset,
|
uint32_t content_offset,
|
||||||
struct cbfs_file *header, uint32_t header_size)
|
struct cbfs_file *header)
|
||||||
{
|
{
|
||||||
assert(image);
|
assert(image);
|
||||||
assert(buffer);
|
assert(buffer);
|
||||||
|
@ -546,6 +546,7 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
|
||||||
uint32_t addr, addr_next;
|
uint32_t addr, addr_next;
|
||||||
struct cbfs_file *entry, *next;
|
struct cbfs_file *entry, *next;
|
||||||
uint32_t need_size;
|
uint32_t need_size;
|
||||||
|
uint32_t header_size = ntohl(header->offset);
|
||||||
|
|
||||||
need_size = header_size + buffer->size;
|
need_size = header_size + buffer->size;
|
||||||
DEBUG("cbfs_add_entry('%s'@0x%x) => need_size = %u+%zu=%u\n",
|
DEBUG("cbfs_add_entry('%s'@0x%x) => need_size = %u+%zu=%u\n",
|
||||||
|
|
|
@ -93,8 +93,7 @@ int cbfs_export_entry(struct cbfs_image *image, const char *entry_name,
|
||||||
* Never pass this function a top-aligned address: convert it to an offset.
|
* Never pass this function a top-aligned address: convert it to an offset.
|
||||||
* Returns 0 on success, otherwise non-zero. */
|
* Returns 0 on success, otherwise non-zero. */
|
||||||
int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
|
int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
|
||||||
uint32_t content_offset,
|
uint32_t content_offset, struct cbfs_file *header);
|
||||||
struct cbfs_file *header, uint32_t header_size);
|
|
||||||
|
|
||||||
/* Removes an entry from CBFS image. Returns 0 on success, otherwise non-zero. */
|
/* Removes an entry from CBFS image. Returns 0 on success, otherwise non-zero. */
|
||||||
int cbfs_remove_entry(struct cbfs_image *image, const char *name);
|
int cbfs_remove_entry(struct cbfs_image *image, const char *name);
|
||||||
|
|
|
@ -154,9 +154,7 @@ static int cbfs_add_integer_component(const char *name,
|
||||||
|
|
||||||
header = cbfs_create_file_header(CBFS_COMPONENT_RAW,
|
header = cbfs_create_file_header(CBFS_COMPONENT_RAW,
|
||||||
buffer.size, name);
|
buffer.size, name);
|
||||||
uint32_t header_size = cbfs_calculate_file_header_size(name);
|
if (cbfs_add_entry(&image, &buffer, offset, header) != 0) {
|
||||||
if (cbfs_add_entry(&image, &buffer,
|
|
||||||
offset, header, header_size) != 0) {
|
|
||||||
ERROR("Failed to add %llu into ROM image as '%s'.\n",
|
ERROR("Failed to add %llu into ROM image as '%s'.\n",
|
||||||
(long long unsigned)u64val, name);
|
(long long unsigned)u64val, name);
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -209,7 +207,6 @@ static int cbfs_add_component(const char *filename,
|
||||||
|
|
||||||
struct cbfs_file *header =
|
struct cbfs_file *header =
|
||||||
cbfs_create_file_header(type, buffer.size, name);
|
cbfs_create_file_header(type, buffer.size, name);
|
||||||
uint32_t header_size = cbfs_calculate_file_header_size(name);
|
|
||||||
|
|
||||||
if (convert && convert(&buffer, &offset, header) != 0) {
|
if (convert && convert(&buffer, &offset, header) != 0) {
|
||||||
ERROR("Failed to parse file '%s'.\n", filename);
|
ERROR("Failed to parse file '%s'.\n", filename);
|
||||||
|
@ -221,9 +218,7 @@ static int cbfs_add_component(const char *filename,
|
||||||
offset = convert_to_from_top_aligned(param.image_region,
|
offset = convert_to_from_top_aligned(param.image_region,
|
||||||
-offset);
|
-offset);
|
||||||
|
|
||||||
if (cbfs_add_entry(&image, &buffer, offset,
|
if (cbfs_add_entry(&image, &buffer, offset, header) != 0) {
|
||||||
header, header_size)
|
|
||||||
!= 0) {
|
|
||||||
ERROR("Failed to add '%s' into ROM image.\n", filename);
|
ERROR("Failed to add '%s' into ROM image.\n", filename);
|
||||||
free(header);
|
free(header);
|
||||||
buffer_delete(&buffer);
|
buffer_delete(&buffer);
|
||||||
|
|
Loading…
Reference in New Issue