All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/7] smbios: Allow compilation on 64bit systems
Date: Mon,  8 Aug 2016 16:06:31 +0200	[thread overview]
Message-ID: <1470665194-19619-5-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1470665194-19619-1-git-send-email-agraf@suse.de>

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: Alexander Graf <agraf@suse.de>
---
 arch/x86/lib/tables.c |  7 ++++++-
 include/smbios.h      |  4 ++--
 lib/smbios.c          | 16 ++++++++--------
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c
index e62705a..025b183 100644
--- a/arch/x86/lib/tables.c
+++ b/arch/x86/lib/tables.c
@@ -12,6 +12,11 @@
 #include <asm/acpi_table.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
  *
@@ -34,7 +39,7 @@ static table_write table_write_funcs[] = {
 	write_acpi_tables,
 #endif
 #ifdef CONFIG_GENERATE_SMBIOS_TABLE
-	write_smbios_table,
+	write_smbios_table_wrapper,
 #endif
 };
 
diff --git a/include/smbios.h b/include/smbios.h
index 623a703..5962d4c 100644
--- a/include/smbios.h
+++ b/include/smbios.h
@@ -221,7 +221,7 @@ static inline void fill_smbios_header(void *table, int type,
  * @handle:	the structure's handle, a unique 16-bit number
  * @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
@@ -231,6 +231,6 @@ typedef int (*smbios_write_type)(u32 *addr, int handle);
  * @addr:	start address to write 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_ */
diff --git a/lib/smbios.c b/lib/smbios.c
index 9808ee7..8dfd486 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -69,7 +69,7 @@ static int smbios_string_table_len(char *start)
 	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;
 	int len = sizeof(struct smbios_type0);
@@ -98,7 +98,7 @@ static int smbios_write_type0(u32 *current, int handle)
 	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;
 	int len = sizeof(struct smbios_type1);
@@ -114,7 +114,7 @@ static int smbios_write_type1(u32 *current, int handle)
 	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;
 	int len = sizeof(struct smbios_type2);
@@ -132,7 +132,7 @@ static int smbios_write_type2(u32 *current, int handle)
 	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;
 	int len = sizeof(struct smbios_type3);
@@ -152,7 +152,7 @@ static int smbios_write_type3(u32 *current, int handle)
 	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;
 	int len = sizeof(struct smbios_type4);
@@ -185,7 +185,7 @@ static int smbios_write_type4(u32 *current, int handle)
 	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;
 	int len = sizeof(struct smbios_type32);
@@ -198,7 +198,7 @@ static int smbios_write_type32(u32 *current, int handle)
 	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;
 	int len = sizeof(struct smbios_type127);
@@ -221,7 +221,7 @@ static smbios_write_type smbios_write_funcs[] = {
 	smbios_write_type127
 };
 
-u32 write_smbios_table(u32 addr)
+uintptr_t write_smbios_table(uintptr_t addr)
 {
 	struct smbios_entry *se;
 	u32 tables;
-- 
2.6.6

  parent reply	other threads:[~2016-08-08 14:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 14:06 [U-Boot] [PATCH 0/7] efi_loader: Expose SMBIOS table Alexander Graf
2016-08-08 14:06 ` [U-Boot] [PATCH 1/7] x86: Move table csum into separate header Alexander Graf
2016-08-09  9:23   ` Bin Meng
2016-08-08 14:06 ` [U-Boot] [PATCH 2/7] x86: Move smbios generation into arch independent directory Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-08 14:06 ` [U-Boot] [PATCH 3/7] efi_loader: Expose efi_install_configuration_table Alexander Graf
2016-08-08 14:06 ` Alexander Graf [this message]
2016-08-09  9:24   ` [U-Boot] [PATCH 4/7] smbios: Allow compilation on 64bit systems Bin Meng
2016-08-08 14:06 ` [U-Boot] [PATCH 5/7] smbios: Expose in efi_loader as table Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-11  9:48     ` [U-Boot] [PATCH v2 " Alexander Graf
2016-08-12  1:30       ` Bin Meng
2016-08-12 17:20   ` [U-Boot] [PATCH " Simon Glass
2016-08-12 18:36     ` Alexander Graf
2016-08-12 20:07       ` Simon Glass
2016-08-16  8:38         ` Alexander Graf
2016-08-17  4:15           ` Simon Glass
2016-08-08 14:06 ` [U-Boot] [PATCH 6/7] efi_loader: Fix efi_install_configuration_table Alexander Graf
2016-08-08 14:06 ` [U-Boot] [PATCH 7/7] smbios: Provide serial number Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-11 21:45   ` [U-Boot] [PATCH v2 " Alexander Graf
2016-08-12  1:31     ` Bin Meng
2016-08-12 17:20       ` Simon Glass
2016-08-08 21:44 ` [U-Boot] [PATCH 0/7] efi_loader: Expose SMBIOS table Simon Glass
2016-08-09  3:42   ` Bin Meng
2016-08-09  6:48   ` Alexander Graf
2016-08-09 13:57     ` Simon Glass
2016-08-09 14:11       ` Alexander Graf
2016-08-09 14:35         ` Simon Glass
2016-08-10  7:29           ` Alexander Graf
2016-08-12 17:20             ` Simon Glass
2016-08-12 18:26               ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470665194-19619-5-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.