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:
@@ -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
|
||||
|
@@ -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++;
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user