Skip to content
Snippets Groups Projects
Commit e824cf3f authored by Alexander Graf's avatar Alexander Graf
Browse files

smbios: Allow compilation on 64bit systems


The SMBIOS generation code passes pointers as u32. That causes the compiler
to warn on casts to pointers. This patch moves all address pointers to
uintptr_t instead.

Technically u32 would be enough for the current SMBIOS2 style tables, but
we may want to extend the code to SMBIOS3 in the future which is 64bit
address capable.

Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
Reviewed-by: default avatarBin Meng <bmeng.cn@gmail.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
parent 488bf12d
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
#include <asm/acpi_table.h> #include <asm/acpi_table.h>
#include <asm/coreboot_tables.h> #include <asm/coreboot_tables.h>
static u32 write_smbios_table_wrapper(u32 addr)
{
return write_smbios_table(addr);
}
/** /**
* Function prototype to write a specific configuration table * Function prototype to write a specific configuration table
* *
...@@ -34,7 +39,7 @@ static table_write table_write_funcs[] = { ...@@ -34,7 +39,7 @@ static table_write table_write_funcs[] = {
write_acpi_tables, write_acpi_tables,
#endif #endif
#ifdef CONFIG_GENERATE_SMBIOS_TABLE #ifdef CONFIG_GENERATE_SMBIOS_TABLE
write_smbios_table, write_smbios_table_wrapper,
#endif #endif
}; };
......
...@@ -221,7 +221,7 @@ static inline void fill_smbios_header(void *table, int type, ...@@ -221,7 +221,7 @@ static inline void fill_smbios_header(void *table, int type,
* @handle: the structure's handle, a unique 16-bit number * @handle: the structure's handle, a unique 16-bit number
* @return: size of the structure * @return: size of the structure
*/ */
typedef int (*smbios_write_type)(u32 *addr, int handle); typedef int (*smbios_write_type)(uintptr_t *addr, int handle);
/** /**
* write_smbios_table() - Write SMBIOS table * write_smbios_table() - Write SMBIOS table
...@@ -231,6 +231,6 @@ typedef int (*smbios_write_type)(u32 *addr, int handle); ...@@ -231,6 +231,6 @@ typedef int (*smbios_write_type)(u32 *addr, int handle);
* @addr: start address to write SMBIOS table * @addr: start address to write SMBIOS table
* @return: end address of SMBIOS table * @return: end address of SMBIOS table
*/ */
u32 write_smbios_table(u32 addr); uintptr_t write_smbios_table(uintptr_t addr);
#endif /* _SMBIOS_H_ */ #endif /* _SMBIOS_H_ */
...@@ -69,7 +69,7 @@ static int smbios_string_table_len(char *start) ...@@ -69,7 +69,7 @@ static int smbios_string_table_len(char *start)
return len + 1; return len + 1;
} }
static int smbios_write_type0(u32 *current, int handle) static int smbios_write_type0(uintptr_t *current, int handle)
{ {
struct smbios_type0 *t = (struct smbios_type0 *)*current; struct smbios_type0 *t = (struct smbios_type0 *)*current;
int len = sizeof(struct smbios_type0); int len = sizeof(struct smbios_type0);
...@@ -98,7 +98,7 @@ static int smbios_write_type0(u32 *current, int handle) ...@@ -98,7 +98,7 @@ static int smbios_write_type0(u32 *current, int handle)
return len; return len;
} }
static int smbios_write_type1(u32 *current, int handle) static int smbios_write_type1(uintptr_t *current, int handle)
{ {
struct smbios_type1 *t = (struct smbios_type1 *)*current; struct smbios_type1 *t = (struct smbios_type1 *)*current;
int len = sizeof(struct smbios_type1); int len = sizeof(struct smbios_type1);
...@@ -114,7 +114,7 @@ static int smbios_write_type1(u32 *current, int handle) ...@@ -114,7 +114,7 @@ static int smbios_write_type1(u32 *current, int handle)
return len; return len;
} }
static int smbios_write_type2(u32 *current, int handle) static int smbios_write_type2(uintptr_t *current, int handle)
{ {
struct smbios_type2 *t = (struct smbios_type2 *)*current; struct smbios_type2 *t = (struct smbios_type2 *)*current;
int len = sizeof(struct smbios_type2); int len = sizeof(struct smbios_type2);
...@@ -132,7 +132,7 @@ static int smbios_write_type2(u32 *current, int handle) ...@@ -132,7 +132,7 @@ static int smbios_write_type2(u32 *current, int handle)
return len; return len;
} }
static int smbios_write_type3(u32 *current, int handle) static int smbios_write_type3(uintptr_t *current, int handle)
{ {
struct smbios_type3 *t = (struct smbios_type3 *)*current; struct smbios_type3 *t = (struct smbios_type3 *)*current;
int len = sizeof(struct smbios_type3); int len = sizeof(struct smbios_type3);
...@@ -152,7 +152,7 @@ static int smbios_write_type3(u32 *current, int handle) ...@@ -152,7 +152,7 @@ static int smbios_write_type3(u32 *current, int handle)
return len; return len;
} }
static int smbios_write_type4(u32 *current, int handle) static int smbios_write_type4(uintptr_t *current, int handle)
{ {
struct smbios_type4 *t = (struct smbios_type4 *)*current; struct smbios_type4 *t = (struct smbios_type4 *)*current;
int len = sizeof(struct smbios_type4); int len = sizeof(struct smbios_type4);
...@@ -185,7 +185,7 @@ static int smbios_write_type4(u32 *current, int handle) ...@@ -185,7 +185,7 @@ static int smbios_write_type4(u32 *current, int handle)
return len; return len;
} }
static int smbios_write_type32(u32 *current, int handle) static int smbios_write_type32(uintptr_t *current, int handle)
{ {
struct smbios_type32 *t = (struct smbios_type32 *)*current; struct smbios_type32 *t = (struct smbios_type32 *)*current;
int len = sizeof(struct smbios_type32); int len = sizeof(struct smbios_type32);
...@@ -198,7 +198,7 @@ static int smbios_write_type32(u32 *current, int handle) ...@@ -198,7 +198,7 @@ static int smbios_write_type32(u32 *current, int handle)
return len; return len;
} }
static int smbios_write_type127(u32 *current, int handle) static int smbios_write_type127(uintptr_t *current, int handle)
{ {
struct smbios_type127 *t = (struct smbios_type127 *)*current; struct smbios_type127 *t = (struct smbios_type127 *)*current;
int len = sizeof(struct smbios_type127); int len = sizeof(struct smbios_type127);
...@@ -221,7 +221,7 @@ static smbios_write_type smbios_write_funcs[] = { ...@@ -221,7 +221,7 @@ static smbios_write_type smbios_write_funcs[] = {
smbios_write_type127 smbios_write_type127
}; };
u32 write_smbios_table(u32 addr) uintptr_t write_smbios_table(uintptr_t addr)
{ {
struct smbios_entry *se; struct smbios_entry *se;
u32 tables; u32 tables;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment