From 63ebb24c17dd8ed3c912c2d5548265f0f7dc26c9 Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Fri, 28 Nov 2014 22:26:45 +1100 Subject: [PATCH] vendorcode/amd/agesa: Make Porting.h common between families Change-Id: Ica17b2452498f30b710533caf610c9f0c1a0452c Signed-off-by: Edward O'Callaghan Reviewed-on: http://review.coreboot.org/7594 Reviewed-by: Alexandru Gagniuc Tested-by: build bot (Jenkins) --- src/mainboard/advansus/a785e-i/Makefile.inc | 1 + src/mainboard/asus/m5a88-v/Makefile.inc | 1 + src/mainboard/avalue/eax-785e/Makefile.inc | 1 + src/southbridge/amd/cimx/sb800/smbus_spd.c | 2 +- .../amd/agesa/{f10 => common}/Porting.h | 0 src/vendorcode/amd/agesa/f10/Makefile.inc | 1 + src/vendorcode/amd/agesa/f12/Makefile.inc | 1 + src/vendorcode/amd/agesa/f12/Porting.h | 282 ------------------ src/vendorcode/amd/agesa/f14/Makefile.inc | 1 + src/vendorcode/amd/agesa/f14/Porting.h | 282 ------------------ src/vendorcode/amd/agesa/f15/Makefile.inc | 1 + src/vendorcode/amd/agesa/f15/Porting.h | 282 ------------------ src/vendorcode/amd/agesa/f15tn/Makefile.inc | 1 + src/vendorcode/amd/agesa/f15tn/Porting.h | 282 ------------------ src/vendorcode/amd/agesa/f16kb/Makefile.inc | 1 + src/vendorcode/amd/agesa/f16kb/Porting.h | 282 ------------------ 16 files changed, 10 insertions(+), 1411 deletions(-) rename src/vendorcode/amd/agesa/{f10 => common}/Porting.h (100%) delete mode 100644 src/vendorcode/amd/agesa/f12/Porting.h delete mode 100644 src/vendorcode/amd/agesa/f14/Porting.h delete mode 100644 src/vendorcode/amd/agesa/f15/Porting.h delete mode 100644 src/vendorcode/amd/agesa/f15tn/Porting.h delete mode 100644 src/vendorcode/amd/agesa/f16kb/Porting.h diff --git a/src/mainboard/advansus/a785e-i/Makefile.inc b/src/mainboard/advansus/a785e-i/Makefile.inc index 0bbc26fcce..45c257ad24 100644 --- a/src/mainboard/advansus/a785e-i/Makefile.inc +++ b/src/mainboard/advansus/a785e-i/Makefile.inc @@ -6,6 +6,7 @@ ifneq ($(CONFIG_CPU_AMD_AGESA),y) ramstage-y += ../../../../$(AGESA_ROOT)/Lib/amdlib.c AGESA_INC := -I$(AGESA_ROOT)/ \ + -I$(AGESA_ROOT)/../common \ -I$(AGESA_ROOT)/Include \ -I$(AGESA_ROOT)/Proc/IDS/ \ -I$(AGESA_ROOT)/Proc/CPU/ \ diff --git a/src/mainboard/asus/m5a88-v/Makefile.inc b/src/mainboard/asus/m5a88-v/Makefile.inc index 0bbc26fcce..45c257ad24 100644 --- a/src/mainboard/asus/m5a88-v/Makefile.inc +++ b/src/mainboard/asus/m5a88-v/Makefile.inc @@ -6,6 +6,7 @@ ifneq ($(CONFIG_CPU_AMD_AGESA),y) ramstage-y += ../../../../$(AGESA_ROOT)/Lib/amdlib.c AGESA_INC := -I$(AGESA_ROOT)/ \ + -I$(AGESA_ROOT)/../common \ -I$(AGESA_ROOT)/Include \ -I$(AGESA_ROOT)/Proc/IDS/ \ -I$(AGESA_ROOT)/Proc/CPU/ \ diff --git a/src/mainboard/avalue/eax-785e/Makefile.inc b/src/mainboard/avalue/eax-785e/Makefile.inc index 0bbc26fcce..45c257ad24 100644 --- a/src/mainboard/avalue/eax-785e/Makefile.inc +++ b/src/mainboard/avalue/eax-785e/Makefile.inc @@ -6,6 +6,7 @@ ifneq ($(CONFIG_CPU_AMD_AGESA),y) ramstage-y += ../../../../$(AGESA_ROOT)/Lib/amdlib.c AGESA_INC := -I$(AGESA_ROOT)/ \ + -I$(AGESA_ROOT)/../common \ -I$(AGESA_ROOT)/Include \ -I$(AGESA_ROOT)/Proc/IDS/ \ -I$(AGESA_ROOT)/Proc/CPU/ \ diff --git a/src/southbridge/amd/cimx/sb800/smbus_spd.c b/src/southbridge/amd/cimx/sb800/smbus_spd.c index e3f5acc95b..713711d979 100644 --- a/src/southbridge/amd/cimx/sb800/smbus_spd.c +++ b/src/southbridge/amd/cimx/sb800/smbus_spd.c @@ -23,7 +23,7 @@ #include "OEM.h" /* SMBUS0_BASE_ADDRESS */ /* warning: Porting.h includes an open #pragma pack(1) */ -#include "Porting.h" +#include #include "AGESA.h" #include "chip.h" #include "smbus_spd.h" diff --git a/src/vendorcode/amd/agesa/f10/Porting.h b/src/vendorcode/amd/agesa/common/Porting.h similarity index 100% rename from src/vendorcode/amd/agesa/f10/Porting.h rename to src/vendorcode/amd/agesa/common/Porting.h diff --git a/src/vendorcode/amd/agesa/f10/Makefile.inc b/src/vendorcode/amd/agesa/f10/Makefile.inc index b684a2904e..5647f34ec0 100644 --- a/src/vendorcode/amd/agesa/f10/Makefile.inc +++ b/src/vendorcode/amd/agesa/f10/Makefile.inc @@ -22,6 +22,7 @@ AGESA_ROOT = src/vendorcode/amd/agesa/f10 AGESA_INC ?= -I$(src)/mainboard/$(MAINBOARDDIR) AGESA_INC += -I$(AGESA_ROOT) +AGESA_INC += -I$(AGESA_ROOT)/../common AGESA_INC += -I$(AGESA_ROOT)/Include AGESA_INC += -I$(AGESA_ROOT)/Lib AGESA_INC += -I$(AGESA_ROOT)/Legacy diff --git a/src/vendorcode/amd/agesa/f12/Makefile.inc b/src/vendorcode/amd/agesa/f12/Makefile.inc index b7f9d928bc..1e5bc703cb 100644 --- a/src/vendorcode/amd/agesa/f12/Makefile.inc +++ b/src/vendorcode/amd/agesa/f12/Makefile.inc @@ -32,6 +32,7 @@ AGESA_ROOT = src/vendorcode/amd/agesa/f12 AGESA_INC = -Isrc/mainboard/$(MAINBOARDDIR) AGESA_INC += -I$(AGESA_ROOT) +AGESA_INC += -I$(AGESA_ROOT)/../common AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family AGESA_INC += -I$(AGESA_ROOT)/Include diff --git a/src/vendorcode/amd/agesa/f12/Porting.h b/src/vendorcode/amd/agesa/f12/Porting.h deleted file mode 100644 index fc65cfc613..0000000000 --- a/src/vendorcode/amd/agesa/f12/Porting.h +++ /dev/null @@ -1,282 +0,0 @@ -/* $NoKeywords:$ */ -/** - * @file - * - * Describes compiler dependencies - to support several compile time environments - * - * Contains compiler environment porting descriptions - * - * @xrefitem bom "File Content Label" "Release Content" - * @e project: AGESA - * @e sub-project: Includes - * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 03:16:51 -0600 (Wed, 22 Dec 2010) $ - */ -/***************************************************************************** - * - * Copyright (c) 2008 - 2012, Advanced Micro Devices, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Advanced Micro Devices, Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ***************************************************************************/ - -#ifndef _PORTING_H_ -#define _PORTING_H_ - -#if defined (_MSC_VER) - #include - void _disable (void); - void _enable (void); - #pragma warning(disable: 4103 4001 4733) - #pragma intrinsic (_disable, _enable) - #pragma warning(push) - // ----------------------------------------------------------------------- - // Define a code_seg MACRO - // - #define MAKE_AS_A_STRING(arg) #arg - - #define CODE_GROUP(arg) __pragma (code_seg (MAKE_AS_A_STRING (.t##arg))) - - #define RDATA_GROUP(arg) __pragma (const_seg (MAKE_AS_A_STRING (.d##arg))) - #define FUNC_ATTRIBUTE(arg) __declspec(arg) - //#include // MS has built-in functions - - #if _MSC_VER < 900 - // ----------------------------------------------------------------------- - // Assume MSVC 1.52C (16-bit) - // - // NOTE: When using MSVC 1.52C use the following command line: - // - // CL.EXE /G3 /AL /O1i /Fa - // - // This will produce 32-bit code in USE16 segment that is optimized for code - // size. - typedef void VOID; - - // Create the universal 32, 16, and 8-bit data types - typedef unsigned long UINTN; - typedef long INT32; - typedef unsigned long UINT32; - typedef int INT16; - typedef unsigned int UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - /// struct for 16-bit environment handling of 64-bit value - typedef struct _UINT64 { - IN OUT UINT32 lo; ///< lower 32-bits of 64-bit value - IN OUT UINT32 hi; ///< highest 32-bits of 64-bit value - } UINT64; - - // Create the Boolean type - #define TRUE 1 - #define FALSE 0 - typedef unsigned char BOOLEAN; - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV __pascal - #define ROMDATA __based( __segname( "_CODE" ) ) - #define _16BYTE_ALIGN __declspec(align(16)) - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma warning( disable : 4103 ) // Disable '#pragma pack' in .h warning - #pragma pack(1) - - // Disable WORD->BYTE automatic conversion warnings. Example: - // BYTE LocalByte; - // void MyFunc(BYTE val); - // - // MyFunc(LocalByte*2+1); // Warning, automatic conversion - // - // The problem is any time math is performed on a BYTE, it is converted to a - // WORD by MSVC 1.52c, and then when it is converted back to a BYTE, a warning - // is generated. Disable warning C4761 - #pragma warning( disable : 4761 ) - - #else - // ----------------------------------------------------------------------- - // Assume a 32-bit MSVC++ - // - // Disable the following warnings: - // 4100 - 'identifier' : unreferenced formal parameter - // 4276 - 'function' : no prototype provided; assumed no parameters - // 4214 - non standard extension used : bit field types other than int - // 4001 - nonstandard extension 'single line comment' was used - // 4142 - benign redefinition of type for following declaration - // - typedef char INT8 - #if defined (_M_IX86) - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __w64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #define _16BYTE_ALIGN __declspec(align(64)) - // 64 bit of compiler - #else - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306 4366) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __int64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #endif - #endif - // ----------------------------------------------------------------------- - // End of MS compiler versions - -#elif defined __GNUC__ - - #define IN - #define OUT - #define STATIC static - #define VOLATILE volatile - #define TRUE 1 - #define FALSE 0 -// #undef CONST - #define CONST const - #define ROMDATA - #define CALLCONV - #define _16BYTE_ALIGN __attribute__ ((aligned (16))) - - typedef unsigned char BOOLEAN; - typedef signed char INT8; - typedef signed short INT16; - typedef signed long INT32; - typedef char CHAR8; - typedef unsigned char UINT8; - typedef unsigned short UINT16; - typedef unsigned long UINT32; - typedef unsigned long UINTN; - typedef unsigned long long UINT64; - typedef long long INT64; - typedef void VOID; - //typedef unsigned long size_t; - - //#include // MingW-w64 library header -#pragma pack(1) - -#define CODE_GROUP(arg) -#define RDATA_GROUP(arg) - -#define FUNC_ATTRIBUTE(arg) __attribute__((arg)) -#define MAKE_AS_A_STRING(arg) #arg -#include -#include "gcc-intrin.h" - -#include -#include -#include - -#ifndef NULL - #define NULL (void *)0 -#endif - -#else - // ----------------------------------------------------------------------- - // Unknown or unsupported compiler - // - #error "Unknown compiler in use" -#endif - -// ----------------------------------------------------------------------- -// Common definitions for all compilers -// - -//Support forward reference construct -#define AGESA_FORWARD_DECLARATION(x) typedef struct _##x x - -// The following are use in conformance to the UEFI style guide -#define IN -#define OUT - -#endif // _PORTING_H_ diff --git a/src/vendorcode/amd/agesa/f14/Makefile.inc b/src/vendorcode/amd/agesa/f14/Makefile.inc index 0f570d7dd7..01b0d61576 100644 --- a/src/vendorcode/amd/agesa/f14/Makefile.inc +++ b/src/vendorcode/amd/agesa/f14/Makefile.inc @@ -32,6 +32,7 @@ AGESA_ROOT = src/vendorcode/amd/agesa/f14 AGESA_INC = -Isrc/mainboard/$(MAINBOARDDIR) AGESA_INC += -I$(AGESA_ROOT) +AGESA_INC += -I$(AGESA_ROOT)/../common AGESA_INC += -I$(AGESA_ROOT)/Include AGESA_INC += -I$(AGESA_ROOT)/Lib AGESA_INC += -I$(AGESA_ROOT)/Legacy diff --git a/src/vendorcode/amd/agesa/f14/Porting.h b/src/vendorcode/amd/agesa/f14/Porting.h deleted file mode 100644 index fc65cfc613..0000000000 --- a/src/vendorcode/amd/agesa/f14/Porting.h +++ /dev/null @@ -1,282 +0,0 @@ -/* $NoKeywords:$ */ -/** - * @file - * - * Describes compiler dependencies - to support several compile time environments - * - * Contains compiler environment porting descriptions - * - * @xrefitem bom "File Content Label" "Release Content" - * @e project: AGESA - * @e sub-project: Includes - * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 03:16:51 -0600 (Wed, 22 Dec 2010) $ - */ -/***************************************************************************** - * - * Copyright (c) 2008 - 2012, Advanced Micro Devices, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Advanced Micro Devices, Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ***************************************************************************/ - -#ifndef _PORTING_H_ -#define _PORTING_H_ - -#if defined (_MSC_VER) - #include - void _disable (void); - void _enable (void); - #pragma warning(disable: 4103 4001 4733) - #pragma intrinsic (_disable, _enable) - #pragma warning(push) - // ----------------------------------------------------------------------- - // Define a code_seg MACRO - // - #define MAKE_AS_A_STRING(arg) #arg - - #define CODE_GROUP(arg) __pragma (code_seg (MAKE_AS_A_STRING (.t##arg))) - - #define RDATA_GROUP(arg) __pragma (const_seg (MAKE_AS_A_STRING (.d##arg))) - #define FUNC_ATTRIBUTE(arg) __declspec(arg) - //#include // MS has built-in functions - - #if _MSC_VER < 900 - // ----------------------------------------------------------------------- - // Assume MSVC 1.52C (16-bit) - // - // NOTE: When using MSVC 1.52C use the following command line: - // - // CL.EXE /G3 /AL /O1i /Fa - // - // This will produce 32-bit code in USE16 segment that is optimized for code - // size. - typedef void VOID; - - // Create the universal 32, 16, and 8-bit data types - typedef unsigned long UINTN; - typedef long INT32; - typedef unsigned long UINT32; - typedef int INT16; - typedef unsigned int UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - /// struct for 16-bit environment handling of 64-bit value - typedef struct _UINT64 { - IN OUT UINT32 lo; ///< lower 32-bits of 64-bit value - IN OUT UINT32 hi; ///< highest 32-bits of 64-bit value - } UINT64; - - // Create the Boolean type - #define TRUE 1 - #define FALSE 0 - typedef unsigned char BOOLEAN; - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV __pascal - #define ROMDATA __based( __segname( "_CODE" ) ) - #define _16BYTE_ALIGN __declspec(align(16)) - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma warning( disable : 4103 ) // Disable '#pragma pack' in .h warning - #pragma pack(1) - - // Disable WORD->BYTE automatic conversion warnings. Example: - // BYTE LocalByte; - // void MyFunc(BYTE val); - // - // MyFunc(LocalByte*2+1); // Warning, automatic conversion - // - // The problem is any time math is performed on a BYTE, it is converted to a - // WORD by MSVC 1.52c, and then when it is converted back to a BYTE, a warning - // is generated. Disable warning C4761 - #pragma warning( disable : 4761 ) - - #else - // ----------------------------------------------------------------------- - // Assume a 32-bit MSVC++ - // - // Disable the following warnings: - // 4100 - 'identifier' : unreferenced formal parameter - // 4276 - 'function' : no prototype provided; assumed no parameters - // 4214 - non standard extension used : bit field types other than int - // 4001 - nonstandard extension 'single line comment' was used - // 4142 - benign redefinition of type for following declaration - // - typedef char INT8 - #if defined (_M_IX86) - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __w64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #define _16BYTE_ALIGN __declspec(align(64)) - // 64 bit of compiler - #else - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306 4366) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __int64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #endif - #endif - // ----------------------------------------------------------------------- - // End of MS compiler versions - -#elif defined __GNUC__ - - #define IN - #define OUT - #define STATIC static - #define VOLATILE volatile - #define TRUE 1 - #define FALSE 0 -// #undef CONST - #define CONST const - #define ROMDATA - #define CALLCONV - #define _16BYTE_ALIGN __attribute__ ((aligned (16))) - - typedef unsigned char BOOLEAN; - typedef signed char INT8; - typedef signed short INT16; - typedef signed long INT32; - typedef char CHAR8; - typedef unsigned char UINT8; - typedef unsigned short UINT16; - typedef unsigned long UINT32; - typedef unsigned long UINTN; - typedef unsigned long long UINT64; - typedef long long INT64; - typedef void VOID; - //typedef unsigned long size_t; - - //#include // MingW-w64 library header -#pragma pack(1) - -#define CODE_GROUP(arg) -#define RDATA_GROUP(arg) - -#define FUNC_ATTRIBUTE(arg) __attribute__((arg)) -#define MAKE_AS_A_STRING(arg) #arg -#include -#include "gcc-intrin.h" - -#include -#include -#include - -#ifndef NULL - #define NULL (void *)0 -#endif - -#else - // ----------------------------------------------------------------------- - // Unknown or unsupported compiler - // - #error "Unknown compiler in use" -#endif - -// ----------------------------------------------------------------------- -// Common definitions for all compilers -// - -//Support forward reference construct -#define AGESA_FORWARD_DECLARATION(x) typedef struct _##x x - -// The following are use in conformance to the UEFI style guide -#define IN -#define OUT - -#endif // _PORTING_H_ diff --git a/src/vendorcode/amd/agesa/f15/Makefile.inc b/src/vendorcode/amd/agesa/f15/Makefile.inc index 7c1359e59b..429dddb25d 100644 --- a/src/vendorcode/amd/agesa/f15/Makefile.inc +++ b/src/vendorcode/amd/agesa/f15/Makefile.inc @@ -22,6 +22,7 @@ AGESA_ROOT ?= $(PWD) AGESA_INC ?= -I$(src)/mainboard/$(MAINBOARDDIR) AGESA_INC += -I$(AGESA_ROOT) +AGESA_INC += -I$(AGESA_ROOT)/../common AGESA_INC += -I$(AGESA_ROOT)/Include AGESA_INC += -I$(AGESA_ROOT)/Lib AGESA_INC += -I$(AGESA_ROOT)/Legacy diff --git a/src/vendorcode/amd/agesa/f15/Porting.h b/src/vendorcode/amd/agesa/f15/Porting.h deleted file mode 100644 index fc65cfc613..0000000000 --- a/src/vendorcode/amd/agesa/f15/Porting.h +++ /dev/null @@ -1,282 +0,0 @@ -/* $NoKeywords:$ */ -/** - * @file - * - * Describes compiler dependencies - to support several compile time environments - * - * Contains compiler environment porting descriptions - * - * @xrefitem bom "File Content Label" "Release Content" - * @e project: AGESA - * @e sub-project: Includes - * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 03:16:51 -0600 (Wed, 22 Dec 2010) $ - */ -/***************************************************************************** - * - * Copyright (c) 2008 - 2012, Advanced Micro Devices, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Advanced Micro Devices, Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ***************************************************************************/ - -#ifndef _PORTING_H_ -#define _PORTING_H_ - -#if defined (_MSC_VER) - #include - void _disable (void); - void _enable (void); - #pragma warning(disable: 4103 4001 4733) - #pragma intrinsic (_disable, _enable) - #pragma warning(push) - // ----------------------------------------------------------------------- - // Define a code_seg MACRO - // - #define MAKE_AS_A_STRING(arg) #arg - - #define CODE_GROUP(arg) __pragma (code_seg (MAKE_AS_A_STRING (.t##arg))) - - #define RDATA_GROUP(arg) __pragma (const_seg (MAKE_AS_A_STRING (.d##arg))) - #define FUNC_ATTRIBUTE(arg) __declspec(arg) - //#include // MS has built-in functions - - #if _MSC_VER < 900 - // ----------------------------------------------------------------------- - // Assume MSVC 1.52C (16-bit) - // - // NOTE: When using MSVC 1.52C use the following command line: - // - // CL.EXE /G3 /AL /O1i /Fa - // - // This will produce 32-bit code in USE16 segment that is optimized for code - // size. - typedef void VOID; - - // Create the universal 32, 16, and 8-bit data types - typedef unsigned long UINTN; - typedef long INT32; - typedef unsigned long UINT32; - typedef int INT16; - typedef unsigned int UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - /// struct for 16-bit environment handling of 64-bit value - typedef struct _UINT64 { - IN OUT UINT32 lo; ///< lower 32-bits of 64-bit value - IN OUT UINT32 hi; ///< highest 32-bits of 64-bit value - } UINT64; - - // Create the Boolean type - #define TRUE 1 - #define FALSE 0 - typedef unsigned char BOOLEAN; - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV __pascal - #define ROMDATA __based( __segname( "_CODE" ) ) - #define _16BYTE_ALIGN __declspec(align(16)) - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma warning( disable : 4103 ) // Disable '#pragma pack' in .h warning - #pragma pack(1) - - // Disable WORD->BYTE automatic conversion warnings. Example: - // BYTE LocalByte; - // void MyFunc(BYTE val); - // - // MyFunc(LocalByte*2+1); // Warning, automatic conversion - // - // The problem is any time math is performed on a BYTE, it is converted to a - // WORD by MSVC 1.52c, and then when it is converted back to a BYTE, a warning - // is generated. Disable warning C4761 - #pragma warning( disable : 4761 ) - - #else - // ----------------------------------------------------------------------- - // Assume a 32-bit MSVC++ - // - // Disable the following warnings: - // 4100 - 'identifier' : unreferenced formal parameter - // 4276 - 'function' : no prototype provided; assumed no parameters - // 4214 - non standard extension used : bit field types other than int - // 4001 - nonstandard extension 'single line comment' was used - // 4142 - benign redefinition of type for following declaration - // - typedef char INT8 - #if defined (_M_IX86) - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __w64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #define _16BYTE_ALIGN __declspec(align(64)) - // 64 bit of compiler - #else - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306 4366) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __int64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #endif - #endif - // ----------------------------------------------------------------------- - // End of MS compiler versions - -#elif defined __GNUC__ - - #define IN - #define OUT - #define STATIC static - #define VOLATILE volatile - #define TRUE 1 - #define FALSE 0 -// #undef CONST - #define CONST const - #define ROMDATA - #define CALLCONV - #define _16BYTE_ALIGN __attribute__ ((aligned (16))) - - typedef unsigned char BOOLEAN; - typedef signed char INT8; - typedef signed short INT16; - typedef signed long INT32; - typedef char CHAR8; - typedef unsigned char UINT8; - typedef unsigned short UINT16; - typedef unsigned long UINT32; - typedef unsigned long UINTN; - typedef unsigned long long UINT64; - typedef long long INT64; - typedef void VOID; - //typedef unsigned long size_t; - - //#include // MingW-w64 library header -#pragma pack(1) - -#define CODE_GROUP(arg) -#define RDATA_GROUP(arg) - -#define FUNC_ATTRIBUTE(arg) __attribute__((arg)) -#define MAKE_AS_A_STRING(arg) #arg -#include -#include "gcc-intrin.h" - -#include -#include -#include - -#ifndef NULL - #define NULL (void *)0 -#endif - -#else - // ----------------------------------------------------------------------- - // Unknown or unsupported compiler - // - #error "Unknown compiler in use" -#endif - -// ----------------------------------------------------------------------- -// Common definitions for all compilers -// - -//Support forward reference construct -#define AGESA_FORWARD_DECLARATION(x) typedef struct _##x x - -// The following are use in conformance to the UEFI style guide -#define IN -#define OUT - -#endif // _PORTING_H_ diff --git a/src/vendorcode/amd/agesa/f15tn/Makefile.inc b/src/vendorcode/amd/agesa/f15tn/Makefile.inc index 278cb8e9e4..354167ff27 100644 --- a/src/vendorcode/amd/agesa/f15tn/Makefile.inc +++ b/src/vendorcode/amd/agesa/f15tn/Makefile.inc @@ -32,6 +32,7 @@ AGESA_ROOT = src/vendorcode/amd/agesa/f15tn AGESA_INC = -Isrc/mainboard/$(MAINBOARDDIR) AGESA_INC += -I$(AGESA_ROOT) +AGESA_INC += -I$(AGESA_ROOT)/../common AGESA_INC += -I$(AGESA_ROOT)/Include AGESA_INC += -I$(AGESA_ROOT)/Lib AGESA_INC += -I$(AGESA_ROOT)/Legacy diff --git a/src/vendorcode/amd/agesa/f15tn/Porting.h b/src/vendorcode/amd/agesa/f15tn/Porting.h deleted file mode 100644 index fc65cfc613..0000000000 --- a/src/vendorcode/amd/agesa/f15tn/Porting.h +++ /dev/null @@ -1,282 +0,0 @@ -/* $NoKeywords:$ */ -/** - * @file - * - * Describes compiler dependencies - to support several compile time environments - * - * Contains compiler environment porting descriptions - * - * @xrefitem bom "File Content Label" "Release Content" - * @e project: AGESA - * @e sub-project: Includes - * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 03:16:51 -0600 (Wed, 22 Dec 2010) $ - */ -/***************************************************************************** - * - * Copyright (c) 2008 - 2012, Advanced Micro Devices, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Advanced Micro Devices, Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ***************************************************************************/ - -#ifndef _PORTING_H_ -#define _PORTING_H_ - -#if defined (_MSC_VER) - #include - void _disable (void); - void _enable (void); - #pragma warning(disable: 4103 4001 4733) - #pragma intrinsic (_disable, _enable) - #pragma warning(push) - // ----------------------------------------------------------------------- - // Define a code_seg MACRO - // - #define MAKE_AS_A_STRING(arg) #arg - - #define CODE_GROUP(arg) __pragma (code_seg (MAKE_AS_A_STRING (.t##arg))) - - #define RDATA_GROUP(arg) __pragma (const_seg (MAKE_AS_A_STRING (.d##arg))) - #define FUNC_ATTRIBUTE(arg) __declspec(arg) - //#include // MS has built-in functions - - #if _MSC_VER < 900 - // ----------------------------------------------------------------------- - // Assume MSVC 1.52C (16-bit) - // - // NOTE: When using MSVC 1.52C use the following command line: - // - // CL.EXE /G3 /AL /O1i /Fa - // - // This will produce 32-bit code in USE16 segment that is optimized for code - // size. - typedef void VOID; - - // Create the universal 32, 16, and 8-bit data types - typedef unsigned long UINTN; - typedef long INT32; - typedef unsigned long UINT32; - typedef int INT16; - typedef unsigned int UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - /// struct for 16-bit environment handling of 64-bit value - typedef struct _UINT64 { - IN OUT UINT32 lo; ///< lower 32-bits of 64-bit value - IN OUT UINT32 hi; ///< highest 32-bits of 64-bit value - } UINT64; - - // Create the Boolean type - #define TRUE 1 - #define FALSE 0 - typedef unsigned char BOOLEAN; - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV __pascal - #define ROMDATA __based( __segname( "_CODE" ) ) - #define _16BYTE_ALIGN __declspec(align(16)) - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma warning( disable : 4103 ) // Disable '#pragma pack' in .h warning - #pragma pack(1) - - // Disable WORD->BYTE automatic conversion warnings. Example: - // BYTE LocalByte; - // void MyFunc(BYTE val); - // - // MyFunc(LocalByte*2+1); // Warning, automatic conversion - // - // The problem is any time math is performed on a BYTE, it is converted to a - // WORD by MSVC 1.52c, and then when it is converted back to a BYTE, a warning - // is generated. Disable warning C4761 - #pragma warning( disable : 4761 ) - - #else - // ----------------------------------------------------------------------- - // Assume a 32-bit MSVC++ - // - // Disable the following warnings: - // 4100 - 'identifier' : unreferenced formal parameter - // 4276 - 'function' : no prototype provided; assumed no parameters - // 4214 - non standard extension used : bit field types other than int - // 4001 - nonstandard extension 'single line comment' was used - // 4142 - benign redefinition of type for following declaration - // - typedef char INT8 - #if defined (_M_IX86) - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __w64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #define _16BYTE_ALIGN __declspec(align(64)) - // 64 bit of compiler - #else - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306 4366) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __int64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #endif - #endif - // ----------------------------------------------------------------------- - // End of MS compiler versions - -#elif defined __GNUC__ - - #define IN - #define OUT - #define STATIC static - #define VOLATILE volatile - #define TRUE 1 - #define FALSE 0 -// #undef CONST - #define CONST const - #define ROMDATA - #define CALLCONV - #define _16BYTE_ALIGN __attribute__ ((aligned (16))) - - typedef unsigned char BOOLEAN; - typedef signed char INT8; - typedef signed short INT16; - typedef signed long INT32; - typedef char CHAR8; - typedef unsigned char UINT8; - typedef unsigned short UINT16; - typedef unsigned long UINT32; - typedef unsigned long UINTN; - typedef unsigned long long UINT64; - typedef long long INT64; - typedef void VOID; - //typedef unsigned long size_t; - - //#include // MingW-w64 library header -#pragma pack(1) - -#define CODE_GROUP(arg) -#define RDATA_GROUP(arg) - -#define FUNC_ATTRIBUTE(arg) __attribute__((arg)) -#define MAKE_AS_A_STRING(arg) #arg -#include -#include "gcc-intrin.h" - -#include -#include -#include - -#ifndef NULL - #define NULL (void *)0 -#endif - -#else - // ----------------------------------------------------------------------- - // Unknown or unsupported compiler - // - #error "Unknown compiler in use" -#endif - -// ----------------------------------------------------------------------- -// Common definitions for all compilers -// - -//Support forward reference construct -#define AGESA_FORWARD_DECLARATION(x) typedef struct _##x x - -// The following are use in conformance to the UEFI style guide -#define IN -#define OUT - -#endif // _PORTING_H_ diff --git a/src/vendorcode/amd/agesa/f16kb/Makefile.inc b/src/vendorcode/amd/agesa/f16kb/Makefile.inc index 164b305be7..5ce7aee583 100644 --- a/src/vendorcode/amd/agesa/f16kb/Makefile.inc +++ b/src/vendorcode/amd/agesa/f16kb/Makefile.inc @@ -32,6 +32,7 @@ AGESA_ROOT = src/vendorcode/amd/agesa/f16kb AGESA_INC = -Isrc/mainboard/$(MAINBOARDDIR) AGESA_INC += -I$(AGESA_ROOT) +AGESA_INC += -I$(AGESA_ROOT)/../common AGESA_INC += -I$(AGESA_ROOT)/Include AGESA_INC += -I$(AGESA_ROOT)/Lib AGESA_INC += -I$(AGESA_ROOT)/Legacy diff --git a/src/vendorcode/amd/agesa/f16kb/Porting.h b/src/vendorcode/amd/agesa/f16kb/Porting.h deleted file mode 100644 index fc65cfc613..0000000000 --- a/src/vendorcode/amd/agesa/f16kb/Porting.h +++ /dev/null @@ -1,282 +0,0 @@ -/* $NoKeywords:$ */ -/** - * @file - * - * Describes compiler dependencies - to support several compile time environments - * - * Contains compiler environment porting descriptions - * - * @xrefitem bom "File Content Label" "Release Content" - * @e project: AGESA - * @e sub-project: Includes - * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 03:16:51 -0600 (Wed, 22 Dec 2010) $ - */ -/***************************************************************************** - * - * Copyright (c) 2008 - 2012, Advanced Micro Devices, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Advanced Micro Devices, Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ***************************************************************************/ - -#ifndef _PORTING_H_ -#define _PORTING_H_ - -#if defined (_MSC_VER) - #include - void _disable (void); - void _enable (void); - #pragma warning(disable: 4103 4001 4733) - #pragma intrinsic (_disable, _enable) - #pragma warning(push) - // ----------------------------------------------------------------------- - // Define a code_seg MACRO - // - #define MAKE_AS_A_STRING(arg) #arg - - #define CODE_GROUP(arg) __pragma (code_seg (MAKE_AS_A_STRING (.t##arg))) - - #define RDATA_GROUP(arg) __pragma (const_seg (MAKE_AS_A_STRING (.d##arg))) - #define FUNC_ATTRIBUTE(arg) __declspec(arg) - //#include // MS has built-in functions - - #if _MSC_VER < 900 - // ----------------------------------------------------------------------- - // Assume MSVC 1.52C (16-bit) - // - // NOTE: When using MSVC 1.52C use the following command line: - // - // CL.EXE /G3 /AL /O1i /Fa - // - // This will produce 32-bit code in USE16 segment that is optimized for code - // size. - typedef void VOID; - - // Create the universal 32, 16, and 8-bit data types - typedef unsigned long UINTN; - typedef long INT32; - typedef unsigned long UINT32; - typedef int INT16; - typedef unsigned int UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - /// struct for 16-bit environment handling of 64-bit value - typedef struct _UINT64 { - IN OUT UINT32 lo; ///< lower 32-bits of 64-bit value - IN OUT UINT32 hi; ///< highest 32-bits of 64-bit value - } UINT64; - - // Create the Boolean type - #define TRUE 1 - #define FALSE 0 - typedef unsigned char BOOLEAN; - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV __pascal - #define ROMDATA __based( __segname( "_CODE" ) ) - #define _16BYTE_ALIGN __declspec(align(16)) - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma warning( disable : 4103 ) // Disable '#pragma pack' in .h warning - #pragma pack(1) - - // Disable WORD->BYTE automatic conversion warnings. Example: - // BYTE LocalByte; - // void MyFunc(BYTE val); - // - // MyFunc(LocalByte*2+1); // Warning, automatic conversion - // - // The problem is any time math is performed on a BYTE, it is converted to a - // WORD by MSVC 1.52c, and then when it is converted back to a BYTE, a warning - // is generated. Disable warning C4761 - #pragma warning( disable : 4761 ) - - #else - // ----------------------------------------------------------------------- - // Assume a 32-bit MSVC++ - // - // Disable the following warnings: - // 4100 - 'identifier' : unreferenced formal parameter - // 4276 - 'function' : no prototype provided; assumed no parameters - // 4214 - non standard extension used : bit field types other than int - // 4001 - nonstandard extension 'single line comment' was used - // 4142 - benign redefinition of type for following declaration - // - typedef char INT8 - #if defined (_M_IX86) - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __w64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #define _16BYTE_ALIGN __declspec(align(64)) - // 64 bit of compiler - #else - #pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306 4366) - - #ifndef VOID - typedef void VOID; - #endif - // Create the universal 32, 16, and 8-bit data types - #ifndef UINTN - typedef unsigned __int64 UINTN; - #endif - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - typedef int INT32; - typedef unsigned int UINT32; - typedef short INT16; - typedef unsigned short UINT16; - typedef char INT8; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef unsigned short CHAR16; - - // Create the Boolean type - #ifndef TRUE - #define TRUE 1 - #endif - #ifndef FALSE - #define FALSE 0 - #endif - typedef unsigned char BOOLEAN; - - // Force tight packing of structures - // Note: Entire AGESA (Project / Solution) will be using pragma pack 1 - #pragma pack(1) - - #define CONST const - #define STATIC static - #define VOLATILE volatile - #define CALLCONV - #define ROMDATA - #endif - #endif - // ----------------------------------------------------------------------- - // End of MS compiler versions - -#elif defined __GNUC__ - - #define IN - #define OUT - #define STATIC static - #define VOLATILE volatile - #define TRUE 1 - #define FALSE 0 -// #undef CONST - #define CONST const - #define ROMDATA - #define CALLCONV - #define _16BYTE_ALIGN __attribute__ ((aligned (16))) - - typedef unsigned char BOOLEAN; - typedef signed char INT8; - typedef signed short INT16; - typedef signed long INT32; - typedef char CHAR8; - typedef unsigned char UINT8; - typedef unsigned short UINT16; - typedef unsigned long UINT32; - typedef unsigned long UINTN; - typedef unsigned long long UINT64; - typedef long long INT64; - typedef void VOID; - //typedef unsigned long size_t; - - //#include // MingW-w64 library header -#pragma pack(1) - -#define CODE_GROUP(arg) -#define RDATA_GROUP(arg) - -#define FUNC_ATTRIBUTE(arg) __attribute__((arg)) -#define MAKE_AS_A_STRING(arg) #arg -#include -#include "gcc-intrin.h" - -#include -#include -#include - -#ifndef NULL - #define NULL (void *)0 -#endif - -#else - // ----------------------------------------------------------------------- - // Unknown or unsupported compiler - // - #error "Unknown compiler in use" -#endif - -// ----------------------------------------------------------------------- -// Common definitions for all compilers -// - -//Support forward reference construct -#define AGESA_FORWARD_DECLARATION(x) typedef struct _##x x - -// The following are use in conformance to the UEFI style guide -#define IN -#define OUT - -#endif // _PORTING_H_