diff options
Diffstat (limited to 'payloads/libpayload')
-rw-r--r-- | payloads/libpayload/include/coreboot_tables.h | 32 | ||||
-rw-r--r-- | payloads/libpayload/libc/coreboot.c | 12 |
2 files changed, 16 insertions, 28 deletions
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) |