From cd47560f2ae0758012001d6d954653b4526811ad Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Mon, 7 Jul 2014 21:08:23 +1000 Subject: vendorcode/amd/agesa: Use macros already defined in stdlib.h We already have these macros define in 'stdlib.h'. Make good use of them here to avoid redefinition conflicts of the pre-processor depending on header inclusion ordering. This has the nice side-effect of syncing up AGESA families in this particular regard. Change-Id: Icf911629a4a1a82b01062fe16af4c8f812b05717 Signed-off-by: Edward O'Callaghan Reviewed-on: http://review.coreboot.org/6199 Tested-by: build bot (Jenkins) Reviewed-by: Bruce Griffith --- src/vendorcode/amd/agesa/f10/Proc/Mem/mu.h | 2 +- src/vendorcode/amd/agesa/f12/Proc/GNB/Common/Gnb.h | 10 ++----- src/vendorcode/amd/agesa/f12/Proc/Mem/mu.h | 19 +------------ src/vendorcode/amd/agesa/f14/Proc/GNB/Common/Gnb.h | 9 +------ src/vendorcode/amd/agesa/f14/Proc/Mem/mu.h | 15 +---------- src/vendorcode/amd/agesa/f15/Proc/Mem/mu.h | 15 +---------- .../amd/agesa/f15tn/Proc/GNB/Common/Gnb.h | 10 ++----- src/vendorcode/amd/agesa/f15tn/Proc/Mem/mu.h | 28 +------------------ .../amd/agesa/f16kb/Proc/GNB/Common/Gnb.h | 10 ++----- src/vendorcode/amd/agesa/f16kb/Proc/Mem/mu.h | 31 +--------------------- 10 files changed, 13 insertions(+), 136 deletions(-) diff --git a/src/vendorcode/amd/agesa/f10/Proc/Mem/mu.h b/src/vendorcode/amd/agesa/f10/Proc/Mem/mu.h index b33e7179f2..abeb985da1 100644 --- a/src/vendorcode/amd/agesa/f10/Proc/Mem/mu.h +++ b/src/vendorcode/amd/agesa/f10/Proc/Mem/mu.h @@ -60,7 +60,7 @@ #define PSO_ENTRY UINT8 #endif -#define MAX(X, Y) (((X) < (Y)) ? (Y) : (X)) +#include /*---------------------------------------------------------------------------- * TYPEDEFS, STRUCTURES, ENUMS diff --git a/src/vendorcode/amd/agesa/f12/Proc/GNB/Common/Gnb.h b/src/vendorcode/amd/agesa/f12/Proc/GNB/Common/Gnb.h index f81ca3dc05..3753bbcc54 100644 --- a/src/vendorcode/amd/agesa/f12/Proc/GNB/Common/Gnb.h +++ b/src/vendorcode/amd/agesa/f12/Proc/GNB/Common/Gnb.h @@ -46,6 +46,8 @@ #ifndef _GNB_H_ #define _GNB_H_ +#include + #pragma pack (push, 1) #define GNB_DEADLOOP() \ @@ -70,14 +72,6 @@ #endif #endif -#ifndef MIN - #define MIN(x, y) (((x) > (y))? (y):(x)) -#endif - -#ifndef MAX - #define MAX(x, y) (((x) > (y))? (x):(y)) -#endif - #define OFF 0 #define PVOID UINT64 diff --git a/src/vendorcode/amd/agesa/f12/Proc/Mem/mu.h b/src/vendorcode/amd/agesa/f12/Proc/Mem/mu.h index 5ddf2e3cab..9fc8559c25 100644 --- a/src/vendorcode/amd/agesa/f12/Proc/Mem/mu.h +++ b/src/vendorcode/amd/agesa/f12/Proc/Mem/mu.h @@ -60,24 +60,7 @@ #define PSO_ENTRY UINT8 #endif -// -// Maximum value macro -// -#ifndef MAX -#define MAX(X, Y) (((X) < (Y)) ? (Y) : (X)) -#endif -// -// Minimum Value macro -// -#ifndef MIN -#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) -#endif -// -// Absolute Value Macro -// -#define ABS(X) (((X) < 0) ? (-(X)) : (X)) - - +#include /*---------------------------------------------------------------------------- * TYPEDEFS, STRUCTURES, ENUMS diff --git a/src/vendorcode/amd/agesa/f14/Proc/GNB/Common/Gnb.h b/src/vendorcode/amd/agesa/f14/Proc/GNB/Common/Gnb.h index af467f3eed..8a3700f40d 100644 --- a/src/vendorcode/amd/agesa/f14/Proc/GNB/Common/Gnb.h +++ b/src/vendorcode/amd/agesa/f14/Proc/GNB/Common/Gnb.h @@ -46,6 +46,7 @@ #ifndef _GNB_H_ #define _GNB_H_ +#include #define GNB_DEADLOOP() \ { \ @@ -69,14 +70,6 @@ #endif #endif -#ifndef MIN -#define MIN(x, y) (((x) > (y))? (y):(x)) -#endif - -#ifndef MAX -#define MAX(x, y) (((x) > (y))? (x):(y)) -#endif - #define OFF 0 #define GnbLibGetHeader(x) ((AMD_CONFIG_PARAMS*) (x)->StdHeader) diff --git a/src/vendorcode/amd/agesa/f14/Proc/Mem/mu.h b/src/vendorcode/amd/agesa/f14/Proc/Mem/mu.h index 4b4878824a..d64047bcbe 100644 --- a/src/vendorcode/amd/agesa/f14/Proc/Mem/mu.h +++ b/src/vendorcode/amd/agesa/f14/Proc/Mem/mu.h @@ -62,20 +62,7 @@ #define PSO_ENTRY UINT8 #endif -// -// Maximum value macro -// -#define MAX(X, Y) (((X) < (Y)) ? (Y) : (X)) -// -// Minimum Value macro -// -#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) -// -// Absolute Value Macro -// -#define ABS(X) (((X) < 0) ? (-(X)) : (X)) - - +#include /*---------------------------------------------------------------------------- * TYPEDEFS, STRUCTURES, ENUMS diff --git a/src/vendorcode/amd/agesa/f15/Proc/Mem/mu.h b/src/vendorcode/amd/agesa/f15/Proc/Mem/mu.h index 20d369bda2..c68f321ef7 100644 --- a/src/vendorcode/amd/agesa/f15/Proc/Mem/mu.h +++ b/src/vendorcode/amd/agesa/f15/Proc/Mem/mu.h @@ -61,20 +61,7 @@ #define PSO_ENTRY UINT8 #endif -// -// Maximum value macro -// -#define MAX(X, Y) (((X) < (Y)) ? (Y) : (X)) -// -// Minimum Value macro -// -#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) -// -// Absolute Value Macro -// -#define ABS(X) (((X) < 0) ? (-(X)) : (X)) - - +#include /*---------------------------------------------------------------------------- * TYPEDEFS, STRUCTURES, ENUMS diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Common/Gnb.h b/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Common/Gnb.h index 1a239bda9b..b93e164ac4 100644 --- a/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Common/Gnb.h +++ b/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Common/Gnb.h @@ -45,6 +45,8 @@ #ifndef _GNB_H_ #define _GNB_H_ +#include + #pragma pack (push, 1) #define GNB_DEADLOOP() \ @@ -69,14 +71,6 @@ #endif #endif -#ifndef MIN - #define MIN(x, y) (((x) > (y))? (y):(x)) -#endif - -#ifndef MAX - #define MAX(x, y) (((x) > (y))? (x):(y)) -#endif - #define OFF 0 #define PVOID UINT64 diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Mem/mu.h b/src/vendorcode/amd/agesa/f15tn/Proc/Mem/mu.h index 2933453edb..2c6941df1f 100644 --- a/src/vendorcode/amd/agesa/f15tn/Proc/Mem/mu.h +++ b/src/vendorcode/amd/agesa/f15tn/Proc/Mem/mu.h @@ -60,33 +60,7 @@ #define PSO_ENTRY UINT8 #endif -// -// Maximum value macro -// -#ifndef MAX - #define MAX(X, Y) (((X) < (Y)) ? (Y) : (X)) -#endif -// -// Minimum Value macro -// -#ifndef MIN - #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) -#endif -// -// Absolute Value Macro -// -#ifndef ABS - #define ABS(X) (((X) < 0) ? (-(X)) : (X)) -#endif -// -// Taking ceiling of (a / b) -// -#define CEIL_DIV(a, b) (((a) + (b) - 1) / (b)) -// -// Check if value x is a power of 2 or not -// -#define IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0) - +#include /*---------------------------------------------------------------------------- * TYPEDEFS, STRUCTURES, ENUMS diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/GNB/Common/Gnb.h b/src/vendorcode/amd/agesa/f16kb/Proc/GNB/Common/Gnb.h index 100ae03036..c01fd5ef98 100644 --- a/src/vendorcode/amd/agesa/f16kb/Proc/GNB/Common/Gnb.h +++ b/src/vendorcode/amd/agesa/f16kb/Proc/GNB/Common/Gnb.h @@ -45,6 +45,8 @@ #ifndef _GNB_H_ #define _GNB_H_ +#include + #include "Ids.h" #pragma pack (push, 1) @@ -71,14 +73,6 @@ #endif #endif -#ifndef MIN - #define MIN(x, y) (((x) > (y))? (y):(x)) -#endif - -#ifndef MAX - #define MAX(x, y) (((x) > (y))? (x):(y)) -#endif - #define OFF 0 #define PVOID UINT32 diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Mem/mu.h b/src/vendorcode/amd/agesa/f16kb/Proc/Mem/mu.h index 1489fe8b5a..f415e524e0 100644 --- a/src/vendorcode/amd/agesa/f16kb/Proc/Mem/mu.h +++ b/src/vendorcode/amd/agesa/f16kb/Proc/Mem/mu.h @@ -60,36 +60,7 @@ #define PSO_ENTRY UINT8 #endif -// -// Maximum value macro -// -#ifndef MAX - #define MAX(X, Y) (((X) < (Y)) ? (Y) : (X)) -#endif -// -// Minimum Value macro -// -#ifndef MIN - #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) -#endif -// -// Absolute Value Macro -// -#ifndef ABS - #define ABS(X) (((X) < 0) ? (-(X)) : (X)) -#endif -// -// Taking ceiling of (a / b) -// -#ifndef CEIL_DIV - #define CEIL_DIV(a, b) (((a) + (b) - 1) / (b)) -#endif -// -// Check if value x is a power of 2 or not -// -#ifndef IS_POWER_OF_2 - #define IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0) -#endif +#include // // Find offset of a member variable in a struct // -- cgit v1.2.3