vendorcode: Port AMD Agesa for Fam14 to 64bit

Change-Id: Ic6b3c3382a6d3fdc6d716ea899db598910b4fe3e
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Signed-off-by: Scott Duplichan <scott@notabs.org>
Reviewed-on: http://review.coreboot.org/10581
Tested-by: build bot (Jenkins)
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>
This commit is contained in:
Stefan Reinauer 2015-06-18 01:16:40 -07:00
parent 12bce3ff93
commit 3e3f4008f8
2 changed files with 29 additions and 23 deletions

View File

@ -27,11 +27,11 @@
*/ */
#if defined (__GNUC__) #if defined (__GNUC__)
#include <stdint.h>
/* I/O intrin functions. */ /* I/O intrin functions. */
static __inline__ __attribute__((always_inline)) unsigned char __inbyte(unsigned short Port) static __inline__ __attribute__((always_inline)) uint8_t __inbyte(uint16_t Port)
{ {
unsigned char value; uint8_t value;
__asm__ __volatile__ ( __asm__ __volatile__ (
"in %1, %0" "in %1, %0"
@ -42,9 +42,9 @@ static __inline__ __attribute__((always_inline)) unsigned char __inbyte(unsigned
return value; return value;
} }
static __inline__ __attribute__((always_inline)) unsigned short __inword(unsigned short Port) static __inline__ __attribute__((always_inline)) uint16_t __inword(uint16_t Port)
{ {
unsigned short value; uint16_t value;
__asm__ __volatile__ ( __asm__ __volatile__ (
"in %1, %0" "in %1, %0"
@ -55,9 +55,9 @@ static __inline__ __attribute__((always_inline)) unsigned short __inword(unsigne
return value; return value;
} }
static __inline__ __attribute__((always_inline)) unsigned long __indword(unsigned short Port) static __inline__ __attribute__((always_inline)) uint32_t __indword(uint16_t Port)
{ {
unsigned long value; uint32_t value;
__asm__ __volatile__ ( __asm__ __volatile__ (
"in %1, %0" "in %1, %0"
@ -68,7 +68,7 @@ static __inline__ __attribute__((always_inline)) unsigned long __indword(unsigne
} }
static __inline__ __attribute__((always_inline)) void __outbyte(unsigned short Port,unsigned char Data) static __inline__ __attribute__((always_inline)) void __outbyte(uint16_t Port,uint8_t Data)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"out %0, %1" "out %0, %1"
@ -77,7 +77,7 @@ static __inline__ __attribute__((always_inline)) void __outbyte(unsigned short P
); );
} }
static __inline__ __attribute__((always_inline)) void __outword(unsigned short Port,unsigned short Data) static __inline__ __attribute__((always_inline)) void __outword(uint16_t Port,uint16_t Data)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"out %0, %1" "out %0, %1"
@ -86,7 +86,7 @@ static __inline__ __attribute__((always_inline)) void __outword(unsigned short P
); );
} }
static __inline__ __attribute__((always_inline)) void __outdword(unsigned short Port,unsigned long Data) static __inline__ __attribute__((always_inline)) void __outdword(uint16_t Port,uint32_t Data)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"out %0, %1" "out %0, %1"
@ -95,7 +95,7 @@ static __inline__ __attribute__((always_inline)) void __outdword(unsigned short
); );
} }
static __inline__ __attribute__((always_inline)) void __inbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count) static __inline__ __attribute__((always_inline)) void __inbytestring(uint16_t Port,uint8_t *Buffer,unsigned long Count)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"rep ; insb" "rep ; insb"
@ -104,7 +104,7 @@ static __inline__ __attribute__((always_inline)) void __inbytestring(unsigned sh
); );
} }
static __inline__ __attribute__((always_inline)) void __inwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count) static __inline__ __attribute__((always_inline)) void __inwordstring(uint16_t Port,uint16_t *Buffer,unsigned long Count)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"rep ; insw" "rep ; insw"
@ -113,7 +113,7 @@ static __inline__ __attribute__((always_inline)) void __inwordstring(unsigned sh
); );
} }
static __inline__ __attribute__((always_inline)) void __indwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count) static __inline__ __attribute__((always_inline)) void __indwordstring(uint16_t Port,unsigned long *Buffer,unsigned long Count)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"rep ; insl" "rep ; insl"
@ -122,7 +122,7 @@ static __inline__ __attribute__((always_inline)) void __indwordstring(unsigned s
); );
} }
static __inline__ __attribute__((always_inline)) void __outbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count) static __inline__ __attribute__((always_inline)) void __outbytestring(uint16_t Port,uint8_t *Buffer,unsigned long Count)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"rep ; outsb" "rep ; outsb"
@ -131,7 +131,7 @@ static __inline__ __attribute__((always_inline)) void __outbytestring(unsigned s
); );
} }
static __inline__ __attribute__((always_inline)) void __outwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count) static __inline__ __attribute__((always_inline)) void __outwordstring(uint16_t Port,uint16_t *Buffer,unsigned long Count)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"rep ; outsw" "rep ; outsw"
@ -140,7 +140,7 @@ static __inline__ __attribute__((always_inline)) void __outwordstring(unsigned s
); );
} }
static __inline__ __attribute__((always_inline)) void __outdwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count) static __inline__ __attribute__((always_inline)) void __outdwordstring(uint16_t Port,unsigned long *Buffer,unsigned long Count)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"rep ; outsl" "rep ; outsl"
@ -525,7 +525,7 @@ static __inline__ __attribute__((always_inline)) void __lidt(void *Source)
} }
static __inline__ __attribute__((always_inline)) void static __inline__ __attribute__((always_inline)) void
__writefsbyte(const unsigned long Offset, const unsigned char Data) __writefsbyte(const unsigned long Offset, const uint8_t Data)
{ {
__asm__ ("movb %[Data], %%fs:%a[Offset]" __asm__ ("movb %[Data], %%fs:%a[Offset]"
: :
@ -533,7 +533,7 @@ __writefsbyte(const unsigned long Offset, const unsigned char Data)
} }
static __inline__ __attribute__((always_inline)) void static __inline__ __attribute__((always_inline)) void
__writefsword(const unsigned long Offset, const unsigned short Data) __writefsword(const unsigned long Offset, const uint16_t Data)
{ {
__asm__ ("movw %[Data], %%fs:%a[Offset]" __asm__ ("movw %[Data], %%fs:%a[Offset]"
: :
@ -541,14 +541,14 @@ __writefsword(const unsigned long Offset, const unsigned short Data)
} }
static __inline__ __attribute__((always_inline)) void static __inline__ __attribute__((always_inline)) void
__writefsdword(const unsigned long Offset, const unsigned long Data) __writefsdword(const unsigned long Offset, const uint32_t Data)
{ {
__asm__ ("movl %[Data], %%fs:%a[Offset]" __asm__ ("movl %[Data], %%fs:%a[Offset]"
: :
: [Offset] "ir" (Offset), [Data] "ir" (Data)); : [Offset] "ir" (Offset), [Data] "ir" (Data));
} }
static __inline__ __attribute__((always_inline)) unsigned char static __inline__ __attribute__((always_inline)) uint8_t
__readfsbyte(const unsigned long Offset) __readfsbyte(const unsigned long Offset)
{ {
unsigned char value; unsigned char value;
@ -558,7 +558,7 @@ __readfsbyte(const unsigned long Offset)
return value; return value;
} }
static __inline__ __attribute__((always_inline)) unsigned short static __inline__ __attribute__((always_inline)) uint16_t
__readfsword(const unsigned long Offset) __readfsword(const unsigned long Offset)
{ {
unsigned short value; unsigned short value;
@ -568,11 +568,11 @@ __readfsword(const unsigned long Offset)
return value; return value;
} }
static __inline__ __attribute__((always_inline)) unsigned long static __inline__ __attribute__((always_inline)) uint32_t
__readfsdword(unsigned long Offset) __readfsdword(unsigned long Offset)
{ {
unsigned long value; unsigned long value;
__asm__ ("movl %%fs:%a[Offset], %[value]" __asm__ ("mov %%fs:%a[Offset], %[value]"
: [value] "=r" (value) : [value] "=r" (value)
: [Offset] "ir" (Offset)); : [Offset] "ir" (Offset));
return value; return value;

View File

@ -64,15 +64,21 @@ AGESA_INC += -I$(AGESA_ROOT)/Proc/Recovery/CPU
AGESA_INC += -I$(AGESA_ROOT)/Proc/Recovery/Mem AGESA_INC += -I$(AGESA_ROOT)/Proc/Recovery/Mem
CFLAGS_x86_32 += -march=k8-sse3 -mtune=k8-sse3 -fno-zero-initialized-in-bss -fno-strict-aliasing CFLAGS_x86_32 += -march=k8-sse3 -mtune=k8-sse3 -fno-zero-initialized-in-bss -fno-strict-aliasing
CFLAGS_x86_64 += -march=k8-sse3 -mtune=k8-sse3 -fno-zero-initialized-in-bss -fno-strict-aliasing
export AGESA_ROOT := $(AGESA_ROOT) export AGESA_ROOT := $(AGESA_ROOT)
export AGESA_INC := $(AGESA_INC) export AGESA_INC := $(AGESA_INC)
CPPFLAGS_x86_32 += $(AGESA_INC) CPPFLAGS_x86_32 += $(AGESA_INC)
CPPFLAGS_x86_64 += $(AGESA_INC)
####################################################################### #######################################################################
classes-y += libagesa classes-y += libagesa
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
$(eval $(call create_class_compiler,libagesa,x86_32)) $(eval $(call create_class_compiler,libagesa,x86_32))
else
$(eval $(call create_class_compiler,libagesa,x86_64))
endif
libagesa-y = Proc/GNB/Modules/GnbGfxConfig/GfxConfigPost.c libagesa-y = Proc/GNB/Modules/GnbGfxConfig/GfxConfigPost.c
libagesa-y += Proc/GNB/Modules/GnbGfxConfig/GfxConfigEnv.c libagesa-y += Proc/GNB/Modules/GnbGfxConfig/GfxConfigEnv.c