From 7c3db3d5c8e00b6c273ae240da137062597749aa Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Wed, 12 Nov 2014 16:19:37 -0800 Subject: [PATCH] elog: Fix typecast issues related to 64-bit compilation. BUG=chrome-os-partner:33764 BRANCH=None TEST=Compiles successfully for ryu and nyan. Change-Id: I5e38966fe06aa3302a7c1b536f5ffd8bb22d4947 Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/229413 Reviewed-by: Aaron Durbin Commit-Queue: Furquan Shaikh Tested-by: Furquan Shaikh --- src/drivers/elog/elog.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c index 4cd706d0bf..353406ed65 100644 --- a/src/drivers/elog/elog.c +++ b/src/drivers/elog/elog.c @@ -108,25 +108,10 @@ static inline u32 elog_flash_address_to_offset(u8 *address) return (u32)address - ((u32)~0UL - rom_size + 1); #else - return (u32)address; + return (u32)(uintptr_t)address; #endif } -/* - * Convert a flash offset into a memory mapped flash address - */ -static inline u8* elog_flash_offset_to_address(u32 offset) -{ - u32 rom_size; - - if (!elog_spi) - return NULL; - - rom_size = get_rom_size(); - - return (u8*)((u32)~0UL - rom_size + 1 + offset); -} - /* * Pointer to an event log header in the event data area */ @@ -210,7 +195,7 @@ static int elog_is_header_valid(struct elog_header *header) return 0; } if (header->header_size != sizeof(*header)) { - printk(BIOS_ERR, "ELOG: header size mismatch %u != %u\n", + printk(BIOS_ERR, "ELOG: header size mismatch %u != %zu\n", header->header_size, sizeof(*header)); return 0; } @@ -452,6 +437,23 @@ static int elog_shrink(void) } #ifndef __SMM__ +#if IS_ENABLED(CONFIG_ARCH_X86) + +/* + * Convert a flash offset into a memory mapped flash address + */ +static inline u8 *elog_flash_offset_to_address(u32 offset) +{ + u32 rom_size; + + if (!elog_spi) + return NULL; + + rom_size = get_rom_size(); + + return (u8 *)((u32)~0UL - rom_size + 1 + offset); +} + /* * Fill out SMBIOS Type 15 table entry so the * event log can be discovered at runtime. @@ -492,6 +494,7 @@ int elog_smbios_write_type15(unsigned long *current, int handle) return len; } #endif +#endif /* * Clear the entire event log