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>
This commit is contained in:
Jianjun Wang
2022-04-08 16:57:28 +08:00
committed by Felix Held
parent 6f023ece08
commit b2537bdad5
11 changed files with 59 additions and 117 deletions

View File

@@ -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