summaryrefslogtreecommitdiff
path: root/payloads
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 /payloads
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 'payloads')
-rw-r--r--payloads/coreinfo/coreboot_module.c6
-rw-r--r--payloads/libpayload/include/coreboot_tables.h32
-rw-r--r--payloads/libpayload/libc/coreboot.c12
3 files changed, 18 insertions, 32 deletions
diff --git a/payloads/coreinfo/coreboot_module.c b/payloads/coreinfo/coreboot_module.c
index 87032d5990..2c165e12c5 100644
--- a/payloads/coreinfo/coreboot_module.c
+++ b/payloads/coreinfo/coreboot_module.c
@@ -94,10 +94,8 @@ static int coreboot_module_redraw(WINDOW *win)
mvwprintw(win, row++, 3, " Table: ");
}
- wprintw(win, "%16.16llx - %16.16llx",
- cb_unpack64(cb_info.range[i].start),
- cb_unpack64(cb_info.range[i].start) +
- cb_unpack64(cb_info.range[i].size) - 1);
+ wprintw(win, "%16.16llx - %16.16llx", cb_info.range[i].start,
+ cb_info.range[i].start + cb_info.range[i].size - 1);
}
return 0;
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index bd23d34c83..1d38c19a80 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -91,10 +91,7 @@ enum {
CB_TAG_OPTION_CHECKSUM = 0x00cc,
};
-struct cbuint64 {
- u32 lo;
- u32 hi;
-};
+typedef __aligned(4) uint64_t cb_uint64_t;
struct cb_header {
u8 signature[4];
@@ -111,8 +108,8 @@ struct cb_record {
};
struct cb_memory_range {
- struct cbuint64 start;
- struct cbuint64 size;
+ cb_uint64_t start;
+ cb_uint64_t size;
u32 type;
};
@@ -271,14 +268,14 @@ struct cb_gpios {
struct lb_range {
uint32_t tag;
uint32_t size;
- uint64_t range_start;
+ cb_uint64_t range_start;
uint32_t range_size;
};
struct cb_cbmem_tab {
uint32_t tag;
uint32_t size;
- uint64_t cbmem_tab;
+ cb_uint64_t cbmem_tab;
};
struct cb_x86_rom_mtrr {
@@ -316,10 +313,10 @@ struct cb_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;
+ cb_uint64_t fmap_offset;
+ cb_uint64_t cbfs_offset;
+ cb_uint64_t cbfs_size;
+ cb_uint64_t boot_media_size;
};
@@ -327,7 +324,7 @@ struct cb_cbmem_entry {
uint32_t tag;
uint32_t size;
- uint64_t address;
+ cb_uint64_t address;
uint32_t entry_size;
uint32_t id;
};
@@ -369,7 +366,7 @@ struct cb_board_config {
uint32_t tag;
uint32_t size;
- struct cbuint64 fw_config;
+ cb_uint64_t fw_config;
uint32_t board_id;
uint32_t ram_code;
uint32_t sku_id;
@@ -429,17 +426,12 @@ struct cb_cmos_checksum {
struct cb_acpi_rsdp {
uint32_t tag;
uint32_t size;
- struct cbuint64 rsdp_pointer; /* Address of the ACPI RSDP */
+ cb_uint64_t rsdp_pointer; /* Address of the ACPI RSDP */
};
/* Helpful inlines */
-static inline u64 cb_unpack64(struct cbuint64 val)
-{
- return (((u64) val.hi) << 32) | val.lo;
-}
-
static inline u16 cb_checksum(const void *ptr, unsigned len)
{
return ipchksum(ptr, len);
diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c
index 2474df96fa..cdd6a437b6 100644
--- a/payloads/libpayload/libc/coreboot.c
+++ b/payloads/libpayload/libc/coreboot.c
@@ -61,12 +61,8 @@ static void cb_parse_memory(void *ptr, struct sysinfo_t *info)
continue;
#endif
- info->memrange[info->n_memranges].base =
- cb_unpack64(range->start);
-
- info->memrange[info->n_memranges].size =
- cb_unpack64(range->size);
-
+ info->memrange[info->n_memranges].base = range->start;
+ info->memrange[info->n_memranges].size = range->size;
info->memrange[info->n_memranges].type = range->type;
info->n_memranges++;
@@ -121,7 +117,7 @@ static void cb_parse_mac_addresses(unsigned char *ptr,
static void cb_parse_board_config(unsigned char *ptr, struct sysinfo_t *info)
{
struct cb_board_config *const config = (struct cb_board_config *)ptr;
- info->fw_config = cb_unpack64(config->fw_config);
+ info->fw_config = config->fw_config;
info->board_id = config->board_id;
info->ram_code = config->ram_code;
info->sku_id = config->sku_id;
@@ -271,7 +267,7 @@ static void cb_parse_cbmem_entry(void *ptr, struct sysinfo_t *info)
static void cb_parse_rsdp(void *ptr, struct sysinfo_t *info)
{
const struct cb_acpi_rsdp *cb_acpi_rsdp = ptr;
- info->acpi_rsdp = cb_unpack64(cb_acpi_rsdp->rsdp_pointer);
+ info->acpi_rsdp = cb_acpi_rsdp->rsdp_pointer;
}
int cb_parse_header(void *addr, int len, struct sysinfo_t *info)