From 8e46cc4cb1bbcdba5298eb43d96561da4e9bb1b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 8 Nov 2010 21:12:36 +0000 Subject: [PATCH] Introduce FMT_plx for phys_addr_t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define a zero-padded format string to be used for phys_addr_t arguments. Introduce PRIx{32,64} macros as needed. v2: * Also define PRIx32 for sparc32 and sparc64, requested by Blue. Cc: Mark Cave-Ayland Cc: Blue Swirl Signed-off-by: Andreas Färber git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@949 f158a5a8-5612-0410-a976-696ce0be7e32 --- include/arch/amd64/types.h | 3 +++ include/arch/ia64/types.h | 3 +++ include/arch/ppc/types.h | 5 +++++ include/arch/sparc32/types.h | 6 ++++++ include/arch/sparc64/types.h | 5 +++++ include/arch/x86/types.h | 3 +++ 6 files changed, 25 insertions(+) diff --git a/include/arch/amd64/types.h b/include/arch/amd64/types.h index 672f02c..44d2182 100644 --- a/include/arch/amd64/types.h +++ b/include/arch/amd64/types.h @@ -17,8 +17,11 @@ #include "autoconf.h" /* physical address */ + typedef uint64_t phys_addr_t; +#define FMT_plx "%016" PRIx64 + /* cell based types */ typedef long long cell; diff --git a/include/arch/ia64/types.h b/include/arch/ia64/types.h index d423461..3bd2edb 100644 --- a/include/arch/ia64/types.h +++ b/include/arch/ia64/types.h @@ -18,8 +18,11 @@ #include /* physical address */ + typedef uint64_t phys_addr_t; +#define FMT_plx "%016" PRIx64 + /* cell based types */ typedef int64_t cell; diff --git a/include/arch/ppc/types.h b/include/arch/ppc/types.h index aaa66fc..ed9100c 100644 --- a/include/arch/ppc/types.h +++ b/include/arch/ppc/types.h @@ -25,6 +25,9 @@ typedef short int16_t; typedef int int32_t; typedef long long int64_t; typedef long intptr_t; + +#define PRIx32 "x" +#define PRIx64 "llx" #endif /* endianess */ @@ -33,8 +36,10 @@ typedef long intptr_t; /* physical address */ #if defined(__powerpc64__) typedef uint64_t phys_addr_t; +#define FMT_plx "%016" PRIx64 #else typedef uint32_t phys_addr_t; +#define FMT_plx "%08" PRIx32 #endif /* cell based types */ diff --git a/include/arch/sparc32/types.h b/include/arch/sparc32/types.h index bf96f57..444d648 100644 --- a/include/arch/sparc32/types.h +++ b/include/arch/sparc32/types.h @@ -25,14 +25,20 @@ typedef short int16_t; typedef int int32_t; typedef long long int64_t; typedef long intptr_t; + +#define PRIx32 "x" +#define PRIx64 "llx" #endif /* endianess */ #include "autoconf.h" /* physical address: 36 bits */ + typedef uint64_t phys_addr_t; +#define FMT_plx "%09" PRIx64 + /* cell based types */ typedef int32_t cell; diff --git a/include/arch/sparc64/types.h b/include/arch/sparc64/types.h index 8baa5ee..14d0e41 100644 --- a/include/arch/sparc64/types.h +++ b/include/arch/sparc64/types.h @@ -25,6 +25,9 @@ typedef short int16_t; typedef int int32_t; typedef long long int64_t; typedef long intptr_t; + +#define PRIx32 "x" +#define PRIx64 "llx" #endif /* endianess */ @@ -33,6 +36,8 @@ typedef long intptr_t; /* physical address */ typedef uint64_t phys_addr_t; +#define FMT_plx "%016" PRIx64 + /* cell based types */ typedef long long cell; typedef unsigned long long ucell; diff --git a/include/arch/x86/types.h b/include/arch/x86/types.h index 3ba4807..3b1b331 100644 --- a/include/arch/x86/types.h +++ b/include/arch/x86/types.h @@ -18,8 +18,11 @@ #include "autoconf.h" /* physical address: XXX theoretically 36 bits for PAE */ + typedef uint32_t phys_addr_t; +#define FMT_plx "%08" PRIx32 + /* cell based types */ typedef int32_t cell;