Add an xdr function for the cbfs_file header

And use it in fit.c and remove one more use of htonl.

Change-Id: Ibf18dcc0a7f08d75c2374115de0db7a4bf64ec1e
Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Reviewed-on: http://review.coreboot.org/5120
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Ronald G. Minnich
2014-02-04 17:35:44 -08:00
committed by Ronald G. Minnich
parent c625d0983c
commit 3fcde22a30
5 changed files with 37 additions and 4 deletions

View File

@@ -188,17 +188,28 @@ static void add_microcodde_entries(struct cbfs_image *image,
}
}
static int fit_header(void *ptr, uint32_t *current_offset, uint32_t *file_length)
{
struct buffer buf;
struct cbfs_file header;
buf.data = ptr;
buf.size = sizeof(header);
cbfs_file_get_header(&buf, &header);
*current_offset = header.offset;
*file_length = header.len;
return 0;
}
static int parse_microcode_blob(struct cbfs_image *image,
struct cbfs_file *mcode_file,
struct microcode_entry *mcus, int *total_mcus)
{
int num_mcus;
int current_offset;
int file_length;
uint32_t current_offset;
uint32_t file_length;
current_offset = (int)((char *)mcode_file - image->buffer.data);
current_offset += ntohl(mcode_file->offset);
file_length = ntohl(mcode_file->len);
fit_header(mcode_file, &current_offset, &file_length);
num_mcus = 0;
while (file_length > sizeof(struct microcode_header))