summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorJianjun Wang <jianjun.wang@mediatek.com>2022-04-08 16:57:28 +0800
committerFelix Held <felix-coreboot@felixheld.de>2022-04-14 22:27:50 +0000
commitb2537bdad552443aba58bda7c42af1f039a58c94 (patch)
treeaac90b0d8e31c8986dd9be460199af7503a08263 /util
parent6f023ece0860a7988ef7f1f15bea5b54df0161ff (diff)
downloadcoreboot-b2537bdad552443aba58bda7c42af1f039a58c94.tar.gz
coreboot-b2537bdad552443aba58bda7c42af1f039a58c94.tar.bz2
coreboot-b2537bdad552443aba58bda7c42af1f039a58c94.zip
coreboot_tables: Replace 'struct lb_uint64' with lb_uint64_t
Replace 'struct lb_uint64' with 'typedef __aligned(4) uint64_t lb_uint64_t', and remove unpack_lb64/pack_lb64 functions since it's no longer needed. Also replace 'struct cbuint64' with 'cb_uint64_t' and remove 'cb_unpack64' in libpayload for compatible with lb_uint64_t. Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com> Change-Id: If6b037e4403a8000625f4a5fb8d20311fe76200a Reviewed-on: https://review.coreboot.org/c/coreboot/+/63494 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/cbmem/cbmem.c2
-rw-r--r--util/nvramtool/coreboot_tables.h32
-rw-r--r--util/nvramtool/lbtable.c4
3 files changed, 8 insertions, 30 deletions
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 8add6ec26164..3af8a25020c2 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -1016,7 +1016,7 @@ static void dump_cbmem_hex(void)
return;
}
- hexdump(unpack_lb64(cbmem.start), unpack_lb64(cbmem.size));
+ hexdump(cbmem.start, cbmem.size);
}
static void rawdump(uint64_t base, uint64_t size)
diff --git a/util/nvramtool/coreboot_tables.h b/util/nvramtool/coreboot_tables.h
index 1417c19ba1dc..aafeab4964f4 100644
--- a/util/nvramtool/coreboot_tables.h
+++ b/util/nvramtool/coreboot_tables.h
@@ -45,33 +45,11 @@
* 64bit system, a uint64_t would be aligned to 64bit boundaries,
* breaking the table format.
*
- * lb_uint64 will keep 64bit coreboot table values aligned to 32bit
- * to ensure compatibility. They can be accessed with the two functions
- * below: unpack_lb64() and pack_lb64()
- *
- * See also: util/lbtdump/lbtdump.c
+ * lb_uint64_t will keep 64bit coreboot table values aligned to 32bit
+ * to ensure compatibility.
*/
-struct lb_uint64 {
- uint32_t lo;
- uint32_t hi;
-};
-
-static inline uint64_t unpack_lb64(struct lb_uint64 value)
-{
- uint64_t result;
- result = value.hi;
- result = (result << 32) + value.lo;
- return result;
-}
-
-static inline struct lb_uint64 pack_lb64(uint64_t value)
-{
- struct lb_uint64 result;
- result.lo = (value >> 0) & 0xffffffff;
- result.hi = (value >> 32) & 0xffffffff;
- return result;
-}
+typedef __attribute__((aligned(4))) uint64_t lb_uint64_t;
struct lb_header {
union {
@@ -101,8 +79,8 @@ struct lb_record {
#define LB_TAG_MEMORY 0x0001
struct lb_memory_range {
- struct lb_uint64 start;
- struct lb_uint64 size;
+ lb_uint64_t start;
+ lb_uint64_t size;
uint32_t type;
#define LB_MEM_RAM 1 /* Memory anyone can use */
#define LB_MEM_RESERVED 2 /* Don't use this memory region */
diff --git a/util/nvramtool/lbtable.c b/util/nvramtool/lbtable.c
index fd6c9ec1d6d3..6993cc0ce5d2 100644
--- a/util/nvramtool/lbtable.c
+++ b/util/nvramtool/lbtable.c
@@ -632,8 +632,8 @@ static void memory_print_fn(const struct lb_record *rec)
break;
}
- size = unpack_lb64(ranges[i].size);
- start = unpack_lb64(ranges[i].start);
+ size = ranges[i].size;
+ start = ranges[i].start;
end = start + size - 1;
printf("%s memory:\n"
" from physical addresses 0x%016" PRIx64