Add constants for fast path resume copying
[coreboot.git] / util / lbtdump / lbtdump.c
index d94eb6e165834dd7f18aed38fecb8691e0f97e10..82ea06c024bab751e9b7782aff73174f0be8f6c0 100644 (file)
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/mman.h>
-#include "../../src/include/boot/linuxbios_tables.h"
+#include "../../src/include/boot/coreboot_tables.h"
 
 void print_lb_records(struct lb_record *rec, struct lb_record *last, unsigned long addr);
 
@@ -48,8 +48,8 @@ unsigned long compute_checksum(void *addr, unsigned long length)
                (((char *)rec) < (((char *)head) + sizeof(*head) + head->table_bytes))  && \
                (rec->size >= 1) && \
                ((((char *)rec) + rec->size) <= (((char *)head) + sizeof(*head) + head->table_bytes)); \
-               rec = (struct lb_record *)(((char *)rec) + rec->size)) 
-               
+               rec = (struct lb_record *)(((char *)rec) + rec->size))
+
 
 static int  count_lb_records(struct lb_header *head)
 {
@@ -72,7 +72,7 @@ struct lb_header *find_lb_table(void *base, unsigned long start, unsigned long e
                struct lb_record *recs = (struct lb_record *)(((char*)base) + addr + sizeof(*head));
                if (memcmp(head->signature, "LBIO", 4) != 0)
                        continue;
-               fprintf(stdout, "Found canidate at: %08lx-%08lx\n", 
+               fprintf(stdout, "Found candidate at: %08lx-%08lx\n",
                        addr, addr + head->table_bytes);
                if (head->header_bytes != sizeof(*head)) {
                        fprintf(stderr, "Header bytes of %d are incorrect\n",
@@ -94,7 +94,7 @@ struct lb_header *find_lb_table(void *base, unsigned long start, unsigned long e
                                head->table_checksum);
                        continue;
                }
-               fprintf(stdout, "Found LinuxBIOS table at: %08lx\n", addr);
+               fprintf(stdout, "Found coreboot table at: %08lx\n", addr);
                return head;
 
        };
@@ -106,8 +106,10 @@ void nop_print(struct lb_record *rec, unsigned long addr)
        return;
 }
 
-void pretty_print_number(FILE *stream, uint64_t value)
+void pretty_print_number(FILE *stream, uint64_t num)
 {
+       unsigned long long value = (unsigned long long) num;
+
        if (value >      1024ULL*1024*1024*1024*1024*1024) {
                value /= 1024ULL*1024*1024*1024*1024*1024;
                fprintf(stream, "%lldEB", value);
@@ -157,10 +159,10 @@ void print_memory(struct lb_record *ptr, unsigned long addr)
                case 2: mem_type = "reserved"; break;
                }
                printf("0x%08llx - 0x%08llx %s (",
-                       start, end, mem_type);
+                       (unsigned long long)start, (unsigned long long)end, mem_type);
                pretty_print_number(stdout, start);
                printf(" - ");
-               pretty_print_number(stdout, end);               
+               pretty_print_number(stdout, end);
                printf(")\n");
        }
 }
@@ -172,7 +174,7 @@ void print_mainboard(struct lb_record *ptr, unsigned long addr)
        rec = (struct lb_mainboard *)ptr;
        max_size = rec->size - sizeof(*rec);
        printf("vendor: %.*s part number: %.*s\n",
-               max_size - rec->vendor_idx,      rec->strings + rec->vendor_idx, 
+               max_size - rec->vendor_idx,      rec->strings + rec->vendor_idx,
                max_size - rec->part_number_idx, rec->strings + rec->part_number_idx);
 }
 
@@ -233,7 +235,7 @@ void print_option_checksum(struct lb_record *ptr, unsigned long addr)
        struct cmos_checksum *rec;
        rec = (struct cmos_checksum *)ptr;
        printf("checksum %d, rec len %d, range %d-%d location %d type %d\n",
-               rec->tag, rec->size, 
+               rec->tag, rec->size,
                rec->range_start, rec->range_end, rec->location, rec->type);
 }
 
@@ -269,7 +271,7 @@ static struct lb_record *next_record(struct lb_record *rec)
        return (struct lb_record *)(((char *)rec) + rec->size);
 }
 
-void print_lb_records(struct lb_record *rec, struct lb_record *last, 
+void print_lb_records(struct lb_record *rec, struct lb_record *last,
        unsigned long addr)
 {
        struct lb_record *next;
@@ -277,8 +279,8 @@ void print_lb_records(struct lb_record *rec, struct lb_record *last,
        int count;
        count = 0;
 
-       for(next = next_record(rec); (rec < last) && (next <= last); 
-               rec = next, addr += rec->size) { 
+       for(next = next_record(rec); (rec < last) && (next <= last);
+               rec = next, addr += rec->size) {
                next = next_record(rec);
                count++;
                for(i = 0; lb_types[i].print != 0; i++) {
@@ -301,13 +303,13 @@ void print_lb_table(struct lb_header *head, unsigned long addr)
        rec  = (struct lb_record *)(((char *)head) + head->header_bytes);
        last = (struct lb_record *)(((char *)rec) + head->table_bytes);
 
-       printf("LinuxBIOS header(%d) checksum: %04x table(%d) checksum: %04x entries: %d\n",
+       printf("Coreboot header(%d) checksum: %04x table(%d) checksum: %04x entries: %d\n",
                head->header_bytes, head->header_checksum,
                head->table_bytes, head->table_checksum, head->table_entries);
        print_lb_records(rec, last, addr + head->header_bytes);
 }
 
-int main(int argc, char **argv) 
+int main(int argc, char **argv)
 {
        unsigned char *low_1MB;
        struct lb_header *lb_table;