summaryrefslogtreecommitdiff
path: root/src
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 /src
parent6f023ece0860a7988ef7f1f15bea5b54df0161ff (diff)
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 'src')
-rw-r--r--src/commonlib/include/commonlib/coreboot_tables.h56
-rw-r--r--src/lib/bootmem.c4
-rw-r--r--src/lib/coreboot_table.c4
3 files changed, 21 insertions, 43 deletions
diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h
index 01b12f3a48..206ddb4558 100644
--- a/src/commonlib/include/commonlib/coreboot_tables.h
+++ b/src/commonlib/include/commonlib/coreboot_tables.h
@@ -99,33 +99,11 @@ enum {
* 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 __aligned(4) uint64_t lb_uint64_t;
struct lb_header {
uint8_t signature[4]; /* LBIO */
@@ -148,8 +126,8 @@ struct lb_record {
};
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 */
@@ -169,7 +147,7 @@ struct lb_memory {
struct lb_hwrpb {
uint32_t tag;
uint32_t size;
- uint64_t hwrpb;
+ lb_uint64_t hwrpb;
};
struct lb_mainboard {
@@ -237,7 +215,7 @@ struct lb_console {
struct lb_forward {
uint32_t tag;
uint32_t size;
- uint64_t forward;
+ lb_uint64_t forward;
};
/**
@@ -295,7 +273,7 @@ struct lb_framebuffer {
uint32_t tag;
uint32_t size;
- uint64_t physical_address;
+ lb_uint64_t physical_address;
uint32_t x_resolution;
uint32_t y_resolution;
uint32_t bytes_per_line;
@@ -333,7 +311,7 @@ struct lb_range {
uint32_t tag;
uint32_t size;
- uint64_t range_start;
+ lb_uint64_t range_start;
uint32_t range_size;
};
@@ -343,7 +321,7 @@ struct lb_cbmem_ref {
uint32_t tag;
uint32_t size;
- uint64_t cbmem_addr;
+ lb_uint64_t cbmem_addr;
};
struct lb_x86_rom_mtrr {
@@ -379,10 +357,10 @@ struct lb_boot_media_params {
uint32_t tag;
uint32_t size;
/* offsets are relative to start of boot media */
- uint64_t fmap_offset;
- uint64_t cbfs_offset;
- uint64_t cbfs_size;
- uint64_t boot_media_size;
+ lb_uint64_t fmap_offset;
+ lb_uint64_t cbfs_offset;
+ lb_uint64_t cbfs_size;
+ lb_uint64_t boot_media_size;
};
/*
@@ -392,7 +370,7 @@ struct lb_cbmem_entry {
uint32_t tag;
uint32_t size;
- uint64_t address;
+ lb_uint64_t address;
uint32_t entry_size;
uint32_t id;
};
@@ -461,7 +439,7 @@ struct lb_board_config {
uint32_t tag;
uint32_t size;
- struct lb_uint64 fw_config;
+ lb_uint64_t fw_config;
uint32_t board_id;
uint32_t ram_code;
uint32_t sku_id;
@@ -583,7 +561,7 @@ struct lb_tpm_physical_presence {
struct lb_acpi_rsdp {
uint32_t tag;
uint32_t size;
- struct lb_uint64 rsdp_pointer; /* Address of the ACPI RSDP */
+ lb_uint64_t rsdp_pointer; /* Address of the ACPI RSDP */
};
#endif
diff --git a/src/lib/bootmem.c b/src/lib/bootmem.c
index e9d4287d21..d4462d88b4 100644
--- a/src/lib/bootmem.c
+++ b/src/lib/bootmem.c
@@ -110,8 +110,8 @@ void bootmem_write_memory_table(struct lb_memory *mem)
bootmem_dump_ranges();
memranges_each_entry(r, &bootmem_os) {
- lb_r->start = pack_lb64(range_entry_base(r));
- lb_r->size = pack_lb64(range_entry_size(r));
+ lb_r->start = range_entry_base(r);
+ lb_r->size = range_entry_size(r);
lb_r->type = bootmem_to_lb_tag(range_entry_tag(r));
lb_r++;
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 3ceab3746f..c29d3081b5 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -313,7 +313,7 @@ static struct lb_board_config *lb_board_config(struct lb_header *header)
config->board_id = board_id();
config->ram_code = ram_code();
config->sku_id = sku_id();
- config->fw_config = pack_lb64(fw_config);
+ config->fw_config = fw_config;
if (config->board_id != UNDEFINED_STRAPPING_ID)
printk(BIOS_INFO, "Board ID: %d\n", config->board_id);
@@ -428,7 +428,7 @@ static void lb_add_acpi_rsdp(struct lb_header *head)
acpi_rsdp = (struct lb_acpi_rsdp *)rec;
acpi_rsdp->tag = LB_TAG_ACPI_RSDP;
acpi_rsdp->size = sizeof(*acpi_rsdp);
- acpi_rsdp->rsdp_pointer = pack_lb64(get_coreboot_rsdp());
+ acpi_rsdp->rsdp_pointer = get_coreboot_rsdp();
}
size_t write_coreboot_forwarding_table(uintptr_t entry, uintptr_t target)