Fix coreboot table size calculations.

The code when reporting the coreboot table size did not account
for the last added table record. This change fixes the problem.

 . rebuild coreboot, program it on the target, restart it
 . look for 'Wrote coreboot table at:' in the console log
 . observe the adequate table size reported

 $  grep 'Wrote coreboot table:' /tmp/cb.log
 Wrote coreboot table at: 00000500, 0x10 bytes, checksum c06f
 Wrote coreboot table at: 7f6fc000, 0x1a73 bytes, checksum 3e45
 $

Change-Id: Ic55501a4ae06fab2bcda9aea58e362325f2edccf
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://review.coreboot.org/703
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Vadim Bendebury 2011-08-16 11:44:35 -07:00 committed by Stefan Reinauer
parent c75bfde967
commit 05239898f2
1 changed files with 4 additions and 3 deletions

View File

@ -320,9 +320,10 @@ static unsigned long lb_table_fini(struct lb_header *head, int fixup)
head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes); head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes);
head->header_checksum = 0; head->header_checksum = 0;
head->header_checksum = compute_ip_checksum(head, sizeof(*head)); head->header_checksum = compute_ip_checksum(head, sizeof(*head));
printk(BIOS_DEBUG, "Wrote coreboot table at: %p - %p checksum %x\n", printk(BIOS_DEBUG,
head, rec, head->table_checksum); "Wrote coreboot table at: %p, 0x%x bytes, checksum %x\n",
return (unsigned long)rec; head, head->table_bytes, head->table_checksum);
return (unsigned long)rec + rec->size;
} }
static void lb_cleanup_memory_ranges(struct lb_memory *mem) static void lb_cleanup_memory_ranges(struct lb_memory *mem)