the following patch was just integrated into master:
commit c1b98b909c1d3bbd4eb74140769b118c98a9eb70
Author: George Trudeau <george.trudeau(a)usherbrooke.ca>
Date: Mon Apr 4 00:19:02 2016 -0400
ensure correct byte ordering for cbfs segment list
Decode each cbfs_payload_segment into native byte order during
segments iteration.
Note :
List ordering has been changed, segments are now always inserted
at the end.
cbfs_serialized.h PAYLOAD_SEGMENT definitions have been changed
to their standard order (big-endian).
Change-Id: Icb3c6a7da2d253685a3bc157bc7f5a51183c9652
Signed-off-by: George Trudeau <george.trudeau(a)usherbrooke.ca>
Reviewed-on: https://review.coreboot.org/14294
Tested-by: build bot (Jenkins)
Tested-by: Raptor Engineering Automated Test Stand <noreply(a)raptorengineeringinc.com>
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
See https://review.coreboot.org/14294 for details.
-gerrit
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/7980
-gerrit
commit 0ee9bbf586205d5ea8bbfad70b0fe225a9c124fd
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Mon Dec 29 21:48:55 2014 +0100
libpayload/drivers/storage/ahci.c: Fix resource leak
CID 1260719: Resource leak (RESOURCE_LEAK)
Variable "dev" going out of scope leaks the storage it points to.
So free the memory space pointed to by `dev` before returning.
Change-Id: Iabf00c9dc744a24d04adff6d253d0295b130d9c4
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Found-by: Coverity Scan
---
payloads/libpayload/drivers/storage/ahci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/payloads/libpayload/drivers/storage/ahci.c b/payloads/libpayload/drivers/storage/ahci.c
index deae9e2..8820301 100644
--- a/payloads/libpayload/drivers/storage/ahci.c
+++ b/payloads/libpayload/drivers/storage/ahci.c
@@ -120,12 +120,16 @@ static int ahci_dev_init(hba_ctrl_t *const ctrl,
memset((void *)rcvd_fis, '\0', sizeof(*rcvd_fis));
/* Set command list base and received FIS base. */
- if (ahci_cmdengine_stop(port))
+ if (ahci_cmdengine_stop(port)) {
+ free(dev);
return 1;
+ }
port->cmdlist_base = virt_to_phys(cmdlist);
port->frameinfo_base = virt_to_phys(rcvd_fis);
- if (ahci_cmdengine_start(port))
+ if (ahci_cmdengine_start(port)) {
+ free(dev);
return 1;
+ }
/* Put port into active state. */
port->cmd_stat |= HBA_PxCMD_ICC_ACTIVE;
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/7781
-gerrit
commit 7fce35655fc80aa051ea1f7943b5285ba290185a
Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
Date: Wed Dec 10 23:17:21 2014 +1100
AGESA: Unify some of f*/Proc/Common
Sanitize some board includes to match the refactor.
Change-Id: I5e304d5a02a54322dfce9c376ab32455b81d8a0a
Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
---
src/cpu/amd/agesa/family12/Makefile.inc | 2 +-
src/cpu/amd/agesa/family16kb/Makefile.inc | 4 +-
src/mainboard/amd/dinar/buildOpts.c | 2 +-
src/mainboard/amd/inagua/buildOpts.c | 2 +-
src/mainboard/amd/olivehill/buildOpts.c | 2 +-
src/mainboard/amd/parmer/buildOpts.c | 2 +-
src/mainboard/amd/persimmon/buildOpts.c | 2 +-
src/mainboard/amd/south_station/buildOpts.c | 2 +-
src/mainboard/amd/thatcher/buildOpts.c | 2 +-
src/mainboard/amd/torpedo/buildOpts.c | 2 +-
src/mainboard/amd/union_station/buildOpts.c | 2 +-
src/mainboard/asrock/e350m1/buildOpts.c | 2 +-
src/mainboard/asrock/imb-a180/buildOpts.c | 2 +-
src/mainboard/asus/f2a85-m/buildOpts.c | 2 +-
src/mainboard/asus/f2a85-m_le/buildOpts.c | 2 +-
src/mainboard/gizmosphere/gizmo/buildOpts.c | 2 +-
src/mainboard/gizmosphere/gizmo2/buildOpts.c | 2 +-
src/mainboard/hp/pavilion_m6_1035dx/buildOpts.c | 2 +-
src/mainboard/jetway/nf81-t56n-lf/buildOpts.c | 2 +-
src/mainboard/lenovo/g505s/buildOpts.c | 2 +-
src/mainboard/lippert/frontrunner-af/buildOpts.c | 2 +-
src/mainboard/lippert/toucan-af/buildOpts.c | 2 +-
.../amd/agesa/common/Proc/Common/AmdFch.h | 65 +++++
.../amd/agesa/common/Proc/Common/AmdInitRecovery.c | 168 +++++++++++
.../agesa/common/Proc/Common/AmdLateRunApTask.c | 159 +++++++++++
.../amd/agesa/common/Proc/Common/CommonInits.h | 65 +++++
.../amd/agesa/common/Proc/Common/CommonPage.h | 116 ++++++++
.../amd/agesa/common/Proc/Common/CreateStruct.c | 313 ++++++++++++++++++++
.../amd/agesa/common/Proc/Common/CreateStruct.h | 197 +++++++++++++
src/vendorcode/amd/agesa/f10/Makefile.inc | 3 +-
.../amd/agesa/f10/Proc/Common/AmdInitRecovery.c | 165 -----------
.../amd/agesa/f10/Proc/Common/AmdLateRunApTask.c | 156 ----------
.../amd/agesa/f10/Proc/Common/CommonInits.h | 65 -----
.../amd/agesa/f10/Proc/Common/CommonPage.h | 116 --------
.../amd/agesa/f10/Proc/Common/CreateStruct.h | 195 -------------
src/vendorcode/amd/agesa/f12/Makefile.inc | 1 +
src/vendorcode/amd/agesa/f12/Proc/Common/AmdFch.h | 65 -----
.../amd/agesa/f12/Proc/Common/AmdInitRecovery.c | 168 -----------
.../amd/agesa/f12/Proc/Common/CommonInits.h | 65 -----
.../amd/agesa/f12/Proc/Common/CommonPage.h | 116 --------
.../amd/agesa/f12/Proc/Common/CreateStruct.c | 313 --------------------
.../amd/agesa/f12/Proc/Common/CreateStruct.h | 195 -------------
src/vendorcode/amd/agesa/f14/Makefile.inc | 5 +-
.../amd/agesa/f14/Proc/Common/AmdInitRecovery.c | 171 -----------
.../amd/agesa/f14/Proc/Common/AmdLateRunApTask.c | 161 -----------
.../amd/agesa/f14/Proc/Common/CommonInits.h | 66 -----
.../amd/agesa/f14/Proc/Common/CommonPage.h | 118 --------
.../amd/agesa/f14/Proc/Common/CreateStruct.c | 315 ---------------------
.../amd/agesa/f14/Proc/Common/CreateStruct.h | 197 -------------
src/vendorcode/amd/agesa/f15/Makefile.inc | 5 +-
src/vendorcode/amd/agesa/f15/Proc/Common/AmdFch.h | 65 -----
.../amd/agesa/f15/Proc/Common/AmdInitRecovery.c | 168 -----------
.../amd/agesa/f15/Proc/Common/AmdLateRunApTask.c | 159 -----------
.../amd/agesa/f15/Proc/Common/CommonInits.h | 65 -----
.../amd/agesa/f15/Proc/Common/CommonPage.h | 116 --------
.../amd/agesa/f15/Proc/Common/CreateStruct.c | 313 --------------------
.../amd/agesa/f15/Proc/Common/CreateStruct.h | 195 -------------
src/vendorcode/amd/agesa/f15tn/Makefile.inc | 5 +-
.../amd/agesa/f15tn/Proc/Common/AmdFch.h | 65 -----
.../amd/agesa/f15tn/Proc/Common/AmdInitRecovery.c | 168 -----------
.../amd/agesa/f15tn/Proc/Common/AmdLateRunApTask.c | 159 -----------
.../amd/agesa/f15tn/Proc/Common/CommonInits.h | 65 -----
.../amd/agesa/f15tn/Proc/Common/CommonPage.h | 116 --------
.../amd/agesa/f15tn/Proc/Common/CreateStruct.c | 313 --------------------
.../amd/agesa/f15tn/Proc/Common/CreateStruct.h | 195 -------------
src/vendorcode/amd/agesa/f16kb/Makefile.inc | 1 +
.../amd/agesa/f16kb/Proc/Common/AmdFch.h | 65 -----
.../amd/agesa/f16kb/Proc/Common/AmdLateRunApTask.c | 159 -----------
.../amd/agesa/f16kb/Proc/Common/CommonInits.h | 65 -----
.../amd/agesa/f16kb/Proc/Common/CreateStruct.c | 313 --------------------
.../amd/agesa/f16kb/Proc/Common/CreateStruct.h | 195 -------------
71 files changed, 1119 insertions(+), 5636 deletions(-)
diff --git a/src/cpu/amd/agesa/family12/Makefile.inc b/src/cpu/amd/agesa/family12/Makefile.inc
index e372fdf..b8bd16e 100644
--- a/src/cpu/amd/agesa/family12/Makefile.inc
+++ b/src/cpu/amd/agesa/family12/Makefile.inc
@@ -51,7 +51,7 @@ agesa_lib_src += $(AGESA_ROOT)/Proc/Common/AmdS3LateRestore.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/AmdS3Save.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/CommonInits.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/CommonReturns.c
-agesa_lib_src += $(AGESA_ROOT)/Proc/Common/CreateStruct.c
+agesa_lib_src += $(AGESA_ROOT)/../common/Proc/Common/CreateStruct.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/S3RestoreState.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/S3SaveState.c
agesa_lib_src += $(AGESA_ROOT)/Proc/CPU/cahalt.c
diff --git a/src/cpu/amd/agesa/family16kb/Makefile.inc b/src/cpu/amd/agesa/family16kb/Makefile.inc
index c84391a..7f98965 100644
--- a/src/cpu/amd/agesa/family16kb/Makefile.inc
+++ b/src/cpu/amd/agesa/family16kb/Makefile.inc
@@ -37,12 +37,12 @@ agesa_lib_src += $(AGESA_ROOT)/Proc/Common/AmdInitMid.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/AmdInitPost.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/AmdInitReset.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/AmdInitResume.c
-agesa_lib_src += $(AGESA_ROOT)/Proc/Common/AmdLateRunApTask.c
+agesa_lib_src += $(AGESA_ROOT)/../common/Proc/Common/AmdLateRunApTask.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/AmdS3LateRestore.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/AmdS3Save.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/CommonInits.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/CommonReturns.c
-agesa_lib_src += $(AGESA_ROOT)/Proc/Common/CreateStruct.c
+agesa_lib_src += $(AGESA_ROOT)/../common/Proc/Common/CreateStruct.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/S3RestoreState.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Common/S3SaveState.c
agesa_lib_src += $(AGESA_ROOT)/Proc/CPU/cahaltasm.S
diff --git a/src/mainboard/amd/dinar/buildOpts.c b/src/mainboard/amd/dinar/buildOpts.c
index 88e3c6f..b26d6c9 100644
--- a/src/mainboard/amd/dinar/buildOpts.c
+++ b/src/mainboard/amd/dinar/buildOpts.c
@@ -400,7 +400,7 @@ CONST DEVICE_CAP_OVERRIDE ROMDATA MaranelloOverrideDevCap[2] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "CommonReturns.h"
diff --git a/src/mainboard/amd/inagua/buildOpts.c b/src/mainboard/amd/inagua/buildOpts.c
index 5779ccd..eb984ce 100644
--- a/src/mainboard/amd/inagua/buildOpts.c
+++ b/src/mainboard/amd/inagua/buildOpts.c
@@ -252,7 +252,7 @@ CONST AP_MTRR_SETTINGS ROMDATA OntarioApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "cpuEarlyInit.h"
diff --git a/src/mainboard/amd/olivehill/buildOpts.c b/src/mainboard/amd/olivehill/buildOpts.c
index f739a13..a44651e 100644
--- a/src/mainboard/amd/olivehill/buildOpts.c
+++ b/src/mainboard/amd/olivehill/buildOpts.c
@@ -256,7 +256,7 @@ CONST AP_MTRR_SETTINGS ROMDATA KabiniApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "CommonReturns.h"
diff --git a/src/mainboard/amd/parmer/buildOpts.c b/src/mainboard/amd/parmer/buildOpts.c
index 7aa95c0..cbd1de9 100644
--- a/src/mainboard/amd/parmer/buildOpts.c
+++ b/src/mainboard/amd/parmer/buildOpts.c
@@ -257,7 +257,7 @@ CONST AP_MTRR_SETTINGS ROMDATA TrinityApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "CommonReturns.h"
diff --git a/src/mainboard/amd/persimmon/buildOpts.c b/src/mainboard/amd/persimmon/buildOpts.c
index 2f93930..d67680d 100644
--- a/src/mainboard/amd/persimmon/buildOpts.c
+++ b/src/mainboard/amd/persimmon/buildOpts.c
@@ -252,7 +252,7 @@ CONST AP_MTRR_SETTINGS ROMDATA OntarioApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "cpuEarlyInit.h"
diff --git a/src/mainboard/amd/south_station/buildOpts.c b/src/mainboard/amd/south_station/buildOpts.c
index 9c7c219..8cdb056 100644
--- a/src/mainboard/amd/south_station/buildOpts.c
+++ b/src/mainboard/amd/south_station/buildOpts.c
@@ -252,7 +252,7 @@ CONST AP_MTRR_SETTINGS ROMDATA OntarioApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "cpuEarlyInit.h"
diff --git a/src/mainboard/amd/thatcher/buildOpts.c b/src/mainboard/amd/thatcher/buildOpts.c
index 7ead4c6..d36a918 100644
--- a/src/mainboard/amd/thatcher/buildOpts.c
+++ b/src/mainboard/amd/thatcher/buildOpts.c
@@ -257,7 +257,7 @@ CONST AP_MTRR_SETTINGS ROMDATA TrinityApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "CommonReturns.h"
diff --git a/src/mainboard/amd/torpedo/buildOpts.c b/src/mainboard/amd/torpedo/buildOpts.c
index 31d1fef..2f547be 100644
--- a/src/mainboard/amd/torpedo/buildOpts.c
+++ b/src/mainboard/amd/torpedo/buildOpts.c
@@ -235,7 +235,7 @@ CONST AP_MTRR_SETTINGS ROMDATA LlanoApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "CommonReturns.h"
diff --git a/src/mainboard/amd/union_station/buildOpts.c b/src/mainboard/amd/union_station/buildOpts.c
index 9c7c219..8cdb056 100644
--- a/src/mainboard/amd/union_station/buildOpts.c
+++ b/src/mainboard/amd/union_station/buildOpts.c
@@ -252,7 +252,7 @@ CONST AP_MTRR_SETTINGS ROMDATA OntarioApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "cpuEarlyInit.h"
diff --git a/src/mainboard/asrock/e350m1/buildOpts.c b/src/mainboard/asrock/e350m1/buildOpts.c
index bc106b7..8e733c2 100644
--- a/src/mainboard/asrock/e350m1/buildOpts.c
+++ b/src/mainboard/asrock/e350m1/buildOpts.c
@@ -251,7 +251,7 @@ CONST AP_MTRR_SETTINGS ROMDATA OntarioApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "CommonReturns.h"
diff --git a/src/mainboard/asrock/imb-a180/buildOpts.c b/src/mainboard/asrock/imb-a180/buildOpts.c
index 06199e0..37ee8b6 100644
--- a/src/mainboard/asrock/imb-a180/buildOpts.c
+++ b/src/mainboard/asrock/imb-a180/buildOpts.c
@@ -256,7 +256,7 @@ CONST AP_MTRR_SETTINGS ROMDATA KabiniApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "CommonReturns.h"
diff --git a/src/mainboard/asus/f2a85-m/buildOpts.c b/src/mainboard/asus/f2a85-m/buildOpts.c
index cd1c812..3a0402d 100644
--- a/src/mainboard/asus/f2a85-m/buildOpts.c
+++ b/src/mainboard/asus/f2a85-m/buildOpts.c
@@ -44,7 +44,7 @@
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatures.h>
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/heapManager.h>
/* the next two headers depend on heapManager.h */
-#include <vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.h>
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/cpuEarlyInit.h>
/* These tables are optional and may be used to adjust memory timing settings */
#include <vendorcode/amd/agesa/f15tn/Proc/Mem/mm.h>
diff --git a/src/mainboard/asus/f2a85-m_le/buildOpts.c b/src/mainboard/asus/f2a85-m_le/buildOpts.c
index 4e43ead..bed6c02 100644
--- a/src/mainboard/asus/f2a85-m_le/buildOpts.c
+++ b/src/mainboard/asus/f2a85-m_le/buildOpts.c
@@ -44,7 +44,7 @@
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatures.h>
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/heapManager.h>
/* the next two headers depend on heapManager.h */
-#include <vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.h>
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/cpuEarlyInit.h>
/* These tables are optional and may be used to adjust memory timing settings */
#include <vendorcode/amd/agesa/f15tn/Proc/Mem/mm.h>
diff --git a/src/mainboard/gizmosphere/gizmo/buildOpts.c b/src/mainboard/gizmosphere/gizmo/buildOpts.c
index 613b3bc..adbf1c8 100644
--- a/src/mainboard/gizmosphere/gizmo/buildOpts.c
+++ b/src/mainboard/gizmosphere/gizmo/buildOpts.c
@@ -254,7 +254,7 @@ CONST AP_MTRR_SETTINGS ROMDATA OntarioApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "cpuEarlyInit.h"
diff --git a/src/mainboard/gizmosphere/gizmo2/buildOpts.c b/src/mainboard/gizmosphere/gizmo2/buildOpts.c
index 51d9dd0..8d4e585 100644
--- a/src/mainboard/gizmosphere/gizmo2/buildOpts.c
+++ b/src/mainboard/gizmosphere/gizmo2/buildOpts.c
@@ -258,7 +258,7 @@ CONST AP_MTRR_SETTINGS ROMDATA KabiniApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "CommonReturns.h"
diff --git a/src/mainboard/hp/pavilion_m6_1035dx/buildOpts.c b/src/mainboard/hp/pavilion_m6_1035dx/buildOpts.c
index bfda9da..9153acc 100644
--- a/src/mainboard/hp/pavilion_m6_1035dx/buildOpts.c
+++ b/src/mainboard/hp/pavilion_m6_1035dx/buildOpts.c
@@ -46,7 +46,7 @@
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatures.h>
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/heapManager.h>
/* AGESA nonesense: the next two headers depend on heapManager.h */
-#include <vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.h>
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/cpuEarlyInit.h>
/* These tables are optional and may be used to adjust memory timing settings */
#include <vendorcode/amd/agesa/f15tn/Proc/Mem/mm.h>
diff --git a/src/mainboard/jetway/nf81-t56n-lf/buildOpts.c b/src/mainboard/jetway/nf81-t56n-lf/buildOpts.c
index 8d8bbec..3c4c6a8 100644
--- a/src/mainboard/jetway/nf81-t56n-lf/buildOpts.c
+++ b/src/mainboard/jetway/nf81-t56n-lf/buildOpts.c
@@ -44,7 +44,7 @@
#include <vendorcode/amd/agesa/f14/Proc/CPU/Feature/cpuFeatures.h>
#include <vendorcode/amd/agesa/f14/Proc/CPU/heapManager.h>
/* AGESA nonesense: the next two headers depend on heapManager.h */
-#include <vendorcode/amd/agesa/f14/Proc/Common/CreateStruct.h>
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include <vendorcode/amd/agesa/f14/Proc/CPU/cpuEarlyInit.h>
/* These tables are optional and may be used to adjust memory timing settings */
#include <vendorcode/amd/agesa/f14/Proc/Mem/mm.h>
diff --git a/src/mainboard/lenovo/g505s/buildOpts.c b/src/mainboard/lenovo/g505s/buildOpts.c
index 9ed4c74..82ce249 100644
--- a/src/mainboard/lenovo/g505s/buildOpts.c
+++ b/src/mainboard/lenovo/g505s/buildOpts.c
@@ -46,7 +46,7 @@
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/Feature/cpuFeatures.h>
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/heapManager.h>
/* AGESA nonesense: the next two headers depend on heapManager.h */
-#include <vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.h>
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include <vendorcode/amd/agesa/f15tn/Proc/CPU/cpuEarlyInit.h>
/* These tables are optional and may be used to adjust memory timing settings */
#include <vendorcode/amd/agesa/f15tn/Proc/Mem/mm.h>
diff --git a/src/mainboard/lippert/frontrunner-af/buildOpts.c b/src/mainboard/lippert/frontrunner-af/buildOpts.c
index a6e4472..f9ffa02 100644
--- a/src/mainboard/lippert/frontrunner-af/buildOpts.c
+++ b/src/mainboard/lippert/frontrunner-af/buildOpts.c
@@ -253,7 +253,7 @@ CONST AP_MTRR_SETTINGS ROMDATA OntarioApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "cpuEarlyInit.h"
diff --git a/src/mainboard/lippert/toucan-af/buildOpts.c b/src/mainboard/lippert/toucan-af/buildOpts.c
index a6e4472..f9ffa02 100644
--- a/src/mainboard/lippert/toucan-af/buildOpts.c
+++ b/src/mainboard/lippert/toucan-af/buildOpts.c
@@ -253,7 +253,7 @@ CONST AP_MTRR_SETTINGS ROMDATA OntarioApMtrrSettingsList[] =
#include "cpuFamilyTranslation.h"
#include "AdvancedApi.h"
#include "heapManager.h"
-#include "CreateStruct.h"
+#include <vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h>
#include "cpuFeatures.h"
#include "Table.h"
#include "cpuEarlyInit.h"
diff --git a/src/vendorcode/amd/agesa/common/Proc/Common/AmdFch.h b/src/vendorcode/amd/agesa/common/Proc/Common/AmdFch.h
new file mode 100644
index 0000000..afe565b
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Common/AmdFch.h
@@ -0,0 +1,65 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * AMD FCH Component
+ *
+ *
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: FCH
+ * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
+ *
+ */
+/*
+*****************************************************************************
+*
+ * 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 _AMD_FCH_H_
+#define _AMD_FCH_H_
+
+typedef AGESA_STATUS FCH_INIT (IN VOID *DataPtr);
+typedef VOID FCH_TASK_ENTRY (IN VOID *FchCfg);
+
+
+/// FCH API build options
+typedef struct {
+ FCH_INIT *InitReset; ///< InitReset
+ FCH_INIT *InitResetConstructor; ///< InitResetConstructor
+ FCH_INIT *InitEnv; ///< InitEnv
+ FCH_INIT *InitEnvConstructor; ///< InitEnvConstructor
+ FCH_INIT *InitMid; ///< InitMid
+ FCH_INIT *InitMidConstructor; ///< InitMidConstructor
+ FCH_INIT *InitLate; ///< InitLate
+ FCH_INIT *InitLateConstructor; ///< InitLateConstructor
+} BLDOPT_FCH_FUNCTION;
+
+#endif
diff --git a/src/vendorcode/amd/agesa/common/Proc/Common/AmdInitRecovery.c b/src/vendorcode/amd/agesa/common/Proc/Common/AmdInitRecovery.c
new file mode 100644
index 0000000..ac4c08d
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Common/AmdInitRecovery.c
@@ -0,0 +1,168 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * AMD AGESA Basic Level Public APIs
+ *
+ * Contains basic Level Initialization routines.
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: Common
+ * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
+ *
+ */
+/*****************************************************************************
+ *
+ * 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.
+ ******************************************************************************
+ */
+
+
+/*----------------------------------------------------------------------------------------
+ * M O D U L E S U S E D
+ *----------------------------------------------------------------------------------------
+ */
+#include "AGESA.h"
+#include "amdlib.h"
+#include "Ids.h"
+#include "AdvancedApi.h"
+#include "heapManager.h"
+#include "mm.h"
+#include "GnbInterface.h"
+#include "cpuRecovery.h"
+#include "cpuCacheInit.h"
+#include "Filecode.h"
+CODE_GROUP (G2_PEI)
+RDATA_GROUP (G2_PEI)
+
+#define FILECODE PROC_COMMON_AMDINITRECOVERY_FILECODE
+
+/*----------------------------------------------------------------------------------------
+ * P R O T O T Y P E S O F L O C A L F U N C T I O N S
+ *----------------------------------------------------------------------------------------
+ */
+
+/*----------------------------------------------------------------------------------------
+ * D E F I N I T I O N S A N D M A C R O S
+ *----------------------------------------------------------------------------------------
+ */
+
+/*---------------------------------------------------------------------------------------*/
+/**
+ * Perform initialization services required at the Early Init POST time point.
+ *
+ * Execution Cache, HyperTransport, C1e, and AP Init advanced services are performed.
+ *
+ * @param[in, out] RecoveryParams The interface struct for Recovery services
+ *
+ * @return The most severe AGESA_STATUS returned by any called service.
+ *
+ */
+AGESA_STATUS
+AmdInitRecovery (
+ IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
+ )
+{
+ AGESA_STATUS AgesaStatus;
+ AGESA_STATUS CalledAgesaStatus;
+
+ AGESA_TESTPOINT (TpIfAmdInitRecoveryEntry, &RecoveryParams->StdHeader);
+
+ ASSERT (RecoveryParams != NULL);
+
+ AgesaStatus = AGESA_SUCCESS;
+
+ // Setup ROM execution cache
+ CalledAgesaStatus = AllocateExecutionCache (&RecoveryParams->StdHeader, &RecoveryParams->CacheRegion[0]);
+ if (CalledAgesaStatus > AgesaStatus) {
+ AgesaStatus = CalledAgesaStatus;
+ }
+
+ CalledAgesaStatus = AmdHtInitRecovery (&RecoveryParams->StdHeader);
+ if (CalledAgesaStatus > AgesaStatus) {
+ AgesaStatus = CalledAgesaStatus;
+ }
+
+ CalledAgesaStatus = AmdCpuRecovery ((AMD_CPU_RECOVERY_PARAMS *) &RecoveryParams->StdHeader);
+ if (CalledAgesaStatus > AgesaStatus) {
+ AgesaStatus = CalledAgesaStatus;
+ }
+
+ CalledAgesaStatus = AmdMemRecovery (RecoveryParams->MemConfig.MemData);
+ if (CalledAgesaStatus > AgesaStatus) {
+ AgesaStatus = CalledAgesaStatus;
+ }
+
+ CalledAgesaStatus = AmdGnbRecovery (&RecoveryParams->StdHeader);
+ if (CalledAgesaStatus > AgesaStatus) {
+ AgesaStatus = CalledAgesaStatus;
+ }
+
+ AGESA_TESTPOINT (TpIfAmdInitRecoveryExit, &RecoveryParams->StdHeader);
+ return AgesaStatus;
+}
+
+/*---------------------------------------------------------------------------------------*/
+/**
+ *
+ * Initialize defaults and options for Amd Init Reset.
+ *
+ * @param[in] StdHeader AMD standard header config param.
+ * @param[in] AmdRecoveryParamsPtr The Reset Init interface to initialize.
+ *
+ * @retval AGESA_SUCCESS Always Succeeds.
+ */
+AGESA_STATUS
+AmdInitRecoveryInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
+ )
+{
+ ALLOCATE_HEAP_PARAMS AllocHeapParams;
+
+ ASSERT (StdHeader != NULL);
+ ASSERT (AmdRecoveryParamsPtr != NULL);
+
+ AmdRecoveryParamsPtr->StdHeader = *StdHeader;
+
+ AllocHeapParams.RequestedBufferSize = sizeof (MEM_DATA_STRUCT);
+ AllocHeapParams.BufferHandle = AMD_MEM_DATA_HANDLE;
+ AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
+ if (HeapAllocateBuffer (&AllocHeapParams, &AmdRecoveryParamsPtr->StdHeader) == AGESA_SUCCESS) {
+ AmdRecoveryParamsPtr->MemConfig.MemData = (MEM_DATA_STRUCT *) AllocHeapParams.BufferPtr;
+ AmdRecoveryParamsPtr->MemConfig.MemData->ParameterListPtr = &(AmdRecoveryParamsPtr->MemConfig);
+ LibAmdMemCopy ((VOID *) AmdRecoveryParamsPtr->MemConfig.MemData,
+ (VOID *) AmdRecoveryParamsPtr,
+ (UINTN) sizeof (AmdRecoveryParamsPtr->StdHeader),
+ &AmdRecoveryParamsPtr->StdHeader
+ );
+ AmdMemInitDataStructDefRecovery (AmdRecoveryParamsPtr->MemConfig.MemData);
+ return AGESA_SUCCESS;
+ } else {
+ return AGESA_ERROR;
+ }
+}
diff --git a/src/vendorcode/amd/agesa/common/Proc/Common/AmdLateRunApTask.c b/src/vendorcode/amd/agesa/common/Proc/Common/AmdLateRunApTask.c
new file mode 100644
index 0000000..b7e125e
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Common/AmdLateRunApTask.c
@@ -0,0 +1,159 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * AMD AGESA Basic Level Public APIs
+ *
+ * Contains basic Level Initialization routines.
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: Interface
+ * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
+ *
+ */
+/*****************************************************************************
+ *
+ * Copyright (c) 2008 - 2013, 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.
+ ******************************************************************************
+ */
+
+
+/*----------------------------------------------------------------------------------------
+ * M O D U L E S U S E D
+ *----------------------------------------------------------------------------------------
+ */
+#include "AGESA.h"
+#include "Ids.h"
+#include "Options.h"
+#include "Filecode.h"
+#include "heapManager.h"
+#include "CreateStruct.h"
+CODE_GROUP (G3_DXE)
+RDATA_GROUP (G3_DXE)
+
+#define FILECODE PROC_COMMON_AMDLATERUNAPTASK_FILECODE
+/*----------------------------------------------------------------------------------------
+ * D E F I N I T I O N S A N D M A C R O S
+ *----------------------------------------------------------------------------------------
+ */
+
+
+/*----------------------------------------------------------------------------------------
+ * T Y P E D E F S A N D S T R U C T U R E S
+ *----------------------------------------------------------------------------------------
+ */
+
+
+/*----------------------------------------------------------------------------------------
+ * P R O T O T Y P E S O F L O C A L F U N C T I O N S
+ *----------------------------------------------------------------------------------------
+ */
+
+
+/*----------------------------------------------------------------------------------------
+ * E X P O R T E D F U N C T I O N S
+ *----------------------------------------------------------------------------------------
+ */
+extern CONST DISPATCH_TABLE ApDispatchTable[];
+
+/*---------------------------------------------------------------------------------------*/
+/**
+ * Application Processor perform a function as directed by the BSC.
+ *
+ * This is needed for an AP task that must run after AGESA has relinquished control
+ * of the APs to the IBV.
+ *
+ * @param[in] AmdApExeParams The interface struct for any required routine.
+ *
+ * @return The most severe AGESA_STATUS returned by any called service. Note
+ * that this will be the return value passed back to the BSC as the
+ * return value for the call out.
+ *
+ */
+AGESA_STATUS
+AmdLateRunApTask (
+ IN AP_EXE_PARAMS *AmdApExeParams
+ )
+{
+ AGESA_STATUS CalledAgesaStatus;
+ AGESA_STATUS ApLateTaskStatus;
+ DISPATCH_TABLE *Entry;
+
+ AGESA_TESTPOINT (TpIfAmdLateRunApTaskEntry, &AmdApExeParams->StdHeader);
+
+ ASSERT (AmdApExeParams != NULL);
+ ApLateTaskStatus = AGESA_SUCCESS;
+ CalledAgesaStatus = AGESA_UNSUPPORTED;
+
+ // Dispatch, if valid
+ Entry = (DISPATCH_TABLE *) ApDispatchTable;
+ while (Entry->FunctionId != 0) {
+ if (AmdApExeParams->FunctionNumber == Entry->FunctionId) {
+ CalledAgesaStatus = Entry->EntryPoint (AmdApExeParams);
+ break;
+ }
+ Entry++;
+ }
+
+ if (CalledAgesaStatus > ApLateTaskStatus) {
+ ApLateTaskStatus = CalledAgesaStatus;
+ }
+
+ AGESA_TESTPOINT (TpIfAmdLateRunApTaskExit, &AmdApExeParams->StdHeader);
+ return ApLateTaskStatus;
+}
+
+/*---------------------------------------------------------------------------------------*/
+/**
+ * Constructor for the AMD_LATE_RUN_AP_TASK function.
+ *
+ * This routine is responsible for setting default values for the
+ * input parameters needed by the AMD_S3_SAVE entry point.
+ *
+ * @param[in] StdHeader The standard header.
+ * @param[in,out] AmdApExeParams Required input parameters for the AMD_LATE_RUN_AP_TASK
+ * entry point.
+ *
+ * @retval AGESA_SUCCESS Always Succeeds.
+ *
+ */
+AGESA_STATUS
+AmdLateRunApTaskInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AP_EXE_PARAMS *AmdApExeParams
+ )
+{
+ ASSERT (StdHeader != NULL);
+ ASSERT (AmdApExeParams != NULL);
+
+ AmdApExeParams->StdHeader = *StdHeader;
+ AmdApExeParams->FunctionNumber = 0;
+ AmdApExeParams->RelatedDataBlock = NULL;
+ AmdApExeParams->RelatedBlockLength = 0;
+ return AGESA_SUCCESS;
+}
+
diff --git a/src/vendorcode/amd/agesa/common/Proc/Common/CommonInits.h b/src/vendorcode/amd/agesa/common/Proc/Common/CommonInits.h
new file mode 100644
index 0000000..681bc4a
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Common/CommonInits.h
@@ -0,0 +1,65 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * Common initialization routines.
+ *
+ * Contains common initialization routines across AGESA entries of phases.
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: Common
+ * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
+ *
+ */
+/*
+*****************************************************************************
+*
+ * 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 _COMMON_INITS_H_
+#define _COMMON_INITS_H_
+
+/**
+ * Common routine to initialize PLATFORM_CONFIGURATION.
+ *
+ * @param[in,out] PlatformConfig Platform profile/build option config structure
+ * @param[in,out] StdHeader AMD standard header config param
+ *
+ * @retval AGESA_SUCCESS Always Succeeds.
+ *
+ */
+AGESA_STATUS
+CommonPlatformConfigInit (
+ IN OUT PLATFORM_CONFIGURATION *PlatformConfig,
+ IN OUT AMD_CONFIG_PARAMS *StdHeader
+ );
+
+#endif // _COMMON_INITS_H_
+
diff --git a/src/vendorcode/amd/agesa/common/Proc/Common/CommonPage.h b/src/vendorcode/amd/agesa/common/Proc/Common/CommonPage.h
new file mode 100644
index 0000000..1dcc6da
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Common/CommonPage.h
@@ -0,0 +1,116 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * Create outline and references for Processor Common Component mainpage documentation.
+ *
+ * Design guides, maintenance guides, and general documentation, are
+ * collected using this file onto the documentation mainpage.
+ * This file contains doxygen comment blocks, only.
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: Documentation
+ * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
+ *
+ */
+/*
+ ******************************************************************************
+ *
+ * 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.
+ ******************************************************************************
+ */
+
+/**
+ * @page commonmain Processor Common Component Documentation
+ *
+ * Additional documentation for the Common component consists of
+ *
+ * - Maintenance Guides:
+ * - @subpage amdconfigparamname "Naming Guidelines for type AMD_CONFIG_PARAMS"
+ * - Design Guides:
+ * - add here >>>
+ *
+ */
+
+/**
+ * @page amdconfigparamname Naming Guidelines for type AMD_CONFIG_PARAMS
+ * @par
+ * These are the guidelines for naming objects of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * in AGESA code.
+ * <ul>
+ *
+ * <li>
+ * Formal parameter names of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * will always be named
+ * StdHeader. This covers all function prototypes, function definitions, and method typedefs (a
+ * typedef of a function prototype) in AGESA code. Examples:
+ * @n @code
+ * VOID
+ * LibAmdPciFindNextCap (
+ * IN OUT PCI_ADDR *Address,
+ * IN AMD_CONFIG_PARAMS *StdHeader
+ * )
+ *
+ * typedef VOID F_DO_TABLE_ENTRY (
+ * IN TABLE_ENTRY_DATA *CurrentEntry,
+ * IN PLATFORM_CONFIGURATION *PlatformConfig,
+ * IN AMD_CONFIG_PARAMS *StdHeader
+ * );
+ *
+ * @endcode
+ *
+ * <li>
+ * Structure members of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * will always be named StdHeader. Examples:
+ * @n @code
+ /// Example of struct member naming.
+ * typedef struct {
+ * IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard Header
+ * IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
+ * } AMD_CPU_RECOVERY_PARAMS;
+ *
+ * @endcode
+ *
+ * <li>
+ * Routines which define local variables of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * should
+ * name the local variable as closely as practical to StdHeader, but otherwise freedom is allowed. Example:
+ * @n @code
+ * AMD_CONFIG_PARAMS *NewStdHeader;
+ * [...]
+ * NewStdHeader = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
+ * @endcode
+ *
+ * <li>
+ * Arguments to routines with AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * formal parameters are not
+ * checked. Freedom is allowed in order to conform to these guidelines in a practical, readable
+ * way. This includes typecast arguments. Examples:
+ * @n @code
+ * Status = GetEventLog (&LogEvent, (AMD_CONFIG_PARAMS *)Event);
+ *
+ * MemS3ExitSelfRefRegDA (NBPtr, &MemPtr->StdHeader);
+ * @endcode
+ *
+ * </ul>
+ *
+ */
diff --git a/src/vendorcode/amd/agesa/common/Proc/Common/CreateStruct.c b/src/vendorcode/amd/agesa/common/Proc/Common/CreateStruct.c
new file mode 100644
index 0000000..8468d3b
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Common/CreateStruct.c
@@ -0,0 +1,313 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * AMD AGESA Input Structure Creation
+ *
+ * Contains AGESA input structure creation support.
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: Common
+ * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
+ *
+ */
+/*
+ ******************************************************************************
+ *
+ * Copyright (c) 2008 - 2013, 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.
+ ******************************************************************************
+ */
+
+/*----------------------------------------------------------------------------------------
+ * M O D U L E S U S E D
+ *----------------------------------------------------------------------------------------
+ */
+#include "AGESA.h"
+#include "amdlib.h"
+#include "Ids.h"
+#include "GeneralServices.h"
+#include "heapManager.h"
+#include "CreateStruct.h"
+#include "cpuFamilyTranslation.h"
+#include "Filecode.h"
+CODE_GROUP (G1_PEICC)
+RDATA_GROUP (G1_PEICC)
+
+#define FILECODE PROC_COMMON_CREATESTRUCT_FILECODE
+/*----------------------------------------------------------------------------------------
+ * D E F I N I T I O N S A N D M A C R O S
+ *----------------------------------------------------------------------------------------
+ */
+extern CONST FUNCTION_PARAMS_INFO FuncParamsInfo[];
+extern CONST UINTN InitializerCount;
+
+/*----------------------------------------------------------------------------------------
+ * T Y P E D E F S A N D S T R U C T U R E S
+ *----------------------------------------------------------------------------------------
+ */
+
+/*----------------------------------------------------------------------------------------
+ * P R O T O T Y P E S O F L O C A L F U N C T I O N S
+ *----------------------------------------------------------------------------------------
+ */
+
+/*----------------------------------------------------------------------------------------
+ * E X P O R T E D F U N C T I O N S
+ *----------------------------------------------------------------------------------------
+ */
+extern BUILD_OPT_CFG UserOptions;
+
+/*---------------------------------------------------------------------------------------*/
+/**
+ * Allocate and initialize Config headers and Service Interface structures.
+ *
+ * This function will be called for each AGESA public APIs.
+ * This function will do the following:
+ * -# Locate the AGESA API structure parameters initializer function information.
+ * -# Find the size of the structure that gets passed to each public APIs as
+ * the entry parameter. Allocate heap space using the size for PreMemHeap, callout for
+ * memory allocation for PostMemDram, and just set the config and service interface
+ * pointers for ByHost.
+ * -# If the allocation is not ByHost, copy the AmdConfigParams into the newly created AmdConfigParams.
+ * For ByHost, we're using the caller's existing config params.
+ * -# Call the initializer function, and pass a reference to the Config params and to
+ * the Service Interface struct. On return the constructor will have filled the
+ * remaining structure with default values.
+ * -# Fill the remaining info in the newly created structure on heap in AMD_CONFIG_PARAMS
+ * area (i.e. Fill *newStructPtr with the pointer to the newly created structure)
+ * -# Set the appropriate AGESA function number in the StdHeader member of the input
+ * parameter structure.
+ *
+ * @param[in,out] InterfaceParams Pointer to structure containing the function call
+ * whose parameter structure is to be created, the
+ * allocation method, and a pointer to the newly
+ * created structure.
+ *
+ * @retval AGESA_SUCCESS The interface struct is allocated and initialized.
+ * @retval AGESA_UNSUPPORTED The Service is not supported.
+ *
+ */
+AGESA_STATUS
+AmdCreateStruct (
+ IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
+ )
+{
+ UINTN ServiceIndex;
+ ALLOCATE_HEAP_PARAMS AllocHeapParams;
+ AMD_CONFIG_PARAMS *NewlyCreatedConfig;
+ VOID *NewlyCreatedServiceInterface;
+ AGESA_STATUS AgesaStatus;
+ AGESA_STATUS TempStatus;
+ AGESA_STATUS IgnoredSts;
+ CPU_SPECIFIC_SERVICES *FamilySpecificServices;
+
+ AgesaStatus = AGESA_SUCCESS;
+
+ ASSERT (InterfaceParams != NULL);
+
+ switch (InterfaceParams->AgesaFunctionName) {
+ case AMD_INIT_RESET:
+ if (!IsBsp (&InterfaceParams->StdHeader, &IgnoredSts)) {
+ // APs must transfer their system core number from the mailbox to
+ // a local register while it is still valid.
+ GetCpuServicesOfCurrentCore ((CONST CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, &InterfaceParams->StdHeader);
+ FamilySpecificServices->TransferApCoreNumber (FamilySpecificServices, &InterfaceParams->StdHeader);
+ }
+ InterfaceParams->StdHeader.HeapStatus = HEAP_DO_NOT_EXIST_YET;
+ break;
+ case AMD_INIT_EARLY:
+ case AMD_INIT_RECOVERY:
+ case AMD_INIT_RESUME:
+ case AMD_INIT_POST:
+ InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
+ break;
+ case AMD_INIT_ENV:
+ InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
+ break;
+ case AMD_INIT_LATE:
+ case AMD_INIT_MID:
+ case AMD_S3_SAVE:
+ case AMD_LATE_RUN_AP_TASK:
+ InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
+ break;
+ case AMD_S3LATE_RESTORE:
+ InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
+ break;
+ default:
+ ASSERT (FALSE);
+ InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
+ break;
+ }
+
+ InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
+
+ if (InterfaceParams->AgesaFunctionName == AMD_INIT_RESET) {
+ AgesaStatus = HeapManagerInit (&InterfaceParams->StdHeader);
+ }
+
+ // Step 1
+ for (ServiceIndex = 0; ServiceIndex < InitializerCount; ServiceIndex++) {
+ if (FuncParamsInfo[ServiceIndex].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
+ break;
+ }
+ }
+ if (ServiceIndex >= InitializerCount) {
+ // A call was made to AGESA with an invalid function number. This wrapper error may be due to the build target
+ // not containing the desired entry point.
+ return AGESA_UNSUPPORTED;
+ }
+
+ // Step 2
+ LibAmdMemFill (&AllocHeapParams, 0, (UINTN) (sizeof (ALLOCATE_HEAP_PARAMS)), &InterfaceParams->StdHeader);
+
+ if (InterfaceParams->AllocationMethod < ByHost) {
+ // Allocate one buffer to contain the config params and the service struct.
+ // The service struct begins immediately after the config params.
+ AllocHeapParams.RequestedBufferSize = FuncParamsInfo[ServiceIndex].CreateStructSize + sizeof (AMD_CONFIG_PARAMS);
+ AllocHeapParams.BufferHandle = FuncParamsInfo[ServiceIndex].BufferHandle;
+ AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
+ TempStatus = HeapAllocateBuffer (&AllocHeapParams, &(InterfaceParams->StdHeader));
+ AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
+ NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
+ NewlyCreatedConfig++;
+ NewlyCreatedServiceInterface = NewlyCreatedConfig;
+ NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
+ } else {
+ // The caller (example, agesa basic interface implementation) already has a buffer to use.
+ NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)InterfaceParams;
+ NewlyCreatedServiceInterface = InterfaceParams->NewStructPtr;
+ ASSERT (InterfaceParams->NewStructSize >= FuncParamsInfo[ServiceIndex].CreateStructSize);
+ }
+ ASSERT (NewlyCreatedConfig != NULL);
+ ASSERT (NewlyCreatedServiceInterface != NULL);
+
+ // Step 3
+ if (InterfaceParams->AllocationMethod != ByHost) {
+ *NewlyCreatedConfig = InterfaceParams->StdHeader;
+ }
+
+ // Step 4
+ TempStatus = FuncParamsInfo[ServiceIndex].AgesaFunction (NewlyCreatedConfig, NewlyCreatedServiceInterface);
+ AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
+
+ // Step 5
+ if (InterfaceParams->AllocationMethod != ByHost) {
+ InterfaceParams->NewStructPtr = (VOID *) NewlyCreatedServiceInterface;
+ InterfaceParams->NewStructSize = FuncParamsInfo[ServiceIndex].CreateStructSize;
+ }
+
+ // Step 6
+ ((AMD_CONFIG_PARAMS *) InterfaceParams->NewStructPtr)->Func = InterfaceParams->AgesaFunctionName;
+ return AgesaStatus;
+}
+
+
+/*---------------------------------------------------------------------------------------*/
+/**
+ * Clears storage space from allocation for a parameter block of an
+ * AGESA software call entry.
+ *
+ * @param[in,out] InterfaceParams Pointer to structure containing the function call
+ * whose parameter structure is to be deallocated.
+ *
+ * @retval AGESA_STATUS
+ *
+ *---------------------------------------------------------------------------------------
+ **/
+AGESA_STATUS
+AmdReleaseStruct (
+ IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
+ )
+{
+ UINT8 i;
+ UINT8 *BufferPtr;
+ VOID *ServicePtr;
+ AGESA_STATUS AgesaStatus;
+ AGESA_STATUS TempStatus;
+ LOCATE_HEAP_PTR LocHeap;
+
+ AgesaStatus = AGESA_SUCCESS;
+
+ switch (InterfaceParams->AgesaFunctionName) {
+ case AMD_INIT_RESET:
+ case AMD_INIT_EARLY:
+ case AMD_INIT_RECOVERY:
+ case AMD_INIT_RESUME:
+ InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
+ break;
+ case AMD_INIT_POST:
+ InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
+ break;
+ case AMD_INIT_ENV:
+ case AMD_INIT_LATE:
+ case AMD_INIT_MID:
+ case AMD_S3_SAVE:
+ case AMD_LATE_RUN_AP_TASK:
+ InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
+ break;
+ case AMD_S3LATE_RESTORE:
+ InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
+ break;
+ default:
+ ASSERT (FALSE);
+ InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
+ break;
+ }
+
+ InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
+
+// Step 1
+ for (i = 0; i < InitializerCount; i++) {
+ if (FuncParamsInfo[i].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
+ break;
+ }
+ }
+ if (i >= InitializerCount) {
+ return AGESA_BOUNDS_CHK;
+ }
+
+ // Step 2
+ if (InterfaceParams->AllocationMethod < ByHost) {
+ LocHeap.BufferHandle = FuncParamsInfo[i].BufferHandle;
+ if (HeapLocateBuffer (&LocHeap, &(InterfaceParams->StdHeader)) == AGESA_SUCCESS) {
+ BufferPtr = (UINT8 *) LocHeap.BufferPtr;
+ ServicePtr = &BufferPtr[sizeof (AMD_CONFIG_PARAMS)];
+ TempStatus = FuncParamsInfo[i].AgesaDestructor (&(InterfaceParams->StdHeader), ServicePtr);
+ AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
+ }
+ }
+
+ // Step 3
+ if (InterfaceParams->AllocationMethod < ByHost) {
+ TempStatus = HeapDeallocateBuffer (FuncParamsInfo[i].BufferHandle, &(InterfaceParams->StdHeader));
+ AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
+ } else {
+ // Unless we define service specific destructors, nothing to do for ByHost.
+ return AGESA_SUCCESS;
+ }
+ return AgesaStatus;
+}
diff --git a/src/vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h b/src/vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h
new file mode 100644
index 0000000..ace0176
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Common/CreateStruct.h
@@ -0,0 +1,197 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * AMD AGESA Input Structure Creation
+ *
+ * Contains AGESA input creation structures.
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: Common
+ * @e \$Revision: 34897 $ @e \$Date: 2010-07-14 10:07:10 +0800 (Wed, 14 Jul 2010) $
+ *
+ */
+/*
+ *****************************************************************************
+ *
+ * Copyright (c) 2011, 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 _CREATE_STRUCT_H_
+#define _CREATE_STRUCT_H_
+
+/**
+ * A constructor method.
+ *
+ * Sets inputs to valid, basic level, defaults for the specific service instance.
+ * Constructors should avoid using the header, since these routines should not
+ * do operations which may fail or require status back to the user. The constructor
+ * should always SUCCEED.
+ *
+ * @param[in] StdHeader Opaque handle to standard config header
+ * @param[in] ServiceInterface Service Interface structure to initialize.
+ *
+ * @retval AGESA_SUCCESS Constructors are not allowed to fail
+*/
+typedef AGESA_STATUS
+F_AGESA_FUNCTION (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN VOID *ServiceInterface
+ );
+
+/// Reference to a Method.
+typedef F_AGESA_FUNCTION *PF_AGESA_FUNCTION;
+
+/**
+ * A Destructor method.
+ *
+ * Sets inputs to valid, basic level, defaults for the specific service instance.
+ * The constructor should always SUCCEED.
+ *
+ * @param[in] StdHeader Opaque handle to standard config header.
+ * @param[in] ServiceInterface Service Interface structure to initialize.
+ *
+ * @retval AGESA_SUCCESS Constructors are not allowed to fail
+*/
+typedef AGESA_STATUS
+F_AGESA_DESTRUCTOR (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN VOID *ServiceInterface
+ );
+
+/// Reference to a Method.
+typedef F_AGESA_DESTRUCTOR *PF_AGESA_DESTRUCTOR;
+
+/**
+ * Provide the information needed to invoke each service constructor.
+ */
+typedef struct {
+ IN AGESA_STRUCT_NAME AgesaFunctionName; ///< Identifies the service
+ IN UINT16 CreateStructSize; ///< The service's input struct size.
+ /// Do NOT include a config params header!
+ OUT PF_AGESA_FUNCTION AgesaFunction; ///< The constructor function
+ OUT PF_AGESA_DESTRUCTOR AgesaDestructor; ///< The destructor function.
+ IN UINT32 BufferHandle; ///< The buffer handle id for the service.
+} FUNCTION_PARAMS_INFO;
+
+/**
+ * All available services have their constructor info here.
+ */
+AGESA_STATUS
+AmdInitResetConstructor (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN AMD_RESET_PARAMS *AmdResetParams
+ );
+
+AGESA_STATUS
+AmdInitRecoveryInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
+ );
+
+AGESA_STATUS
+AmdInitEarlyInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_EARLY_PARAMS *EarlyParams
+ );
+
+AGESA_STATUS
+AmdInitPostInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_POST_PARAMS *PostParamsPtr
+ );
+
+AGESA_STATUS
+AmdInitPostDestructor (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN AMD_POST_PARAMS *PostParamsPtr
+ );
+
+AGESA_STATUS
+AmdInitEnvInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_ENV_PARAMS *EnvParamsPtr
+ );
+
+AGESA_STATUS
+AmdInitMidInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_MID_PARAMS *MidParamsPtr
+ );
+
+AGESA_STATUS
+AmdInitLateInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_LATE_PARAMS *LateParamsPtr
+ );
+
+AGESA_STATUS
+AmdInitLateDestructor (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN AMD_LATE_PARAMS *LateParamsPtr
+ );
+
+AGESA_STATUS
+AmdInitResumeInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_RESUME_PARAMS *ResumeParams
+ );
+
+AGESA_STATUS
+AmdInitResumeDestructor (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_RESUME_PARAMS *ResumeParams
+ );
+
+AGESA_STATUS
+AmdS3SaveInitializer (
+ IN OUT AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
+ );
+
+AGESA_STATUS
+AmdS3SaveDestructor (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
+ );
+
+AGESA_STATUS
+AmdS3LateRestoreInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AMD_S3LATE_PARAMS *S3LateParams
+ );
+
+AGESA_STATUS
+AmdLateRunApTaskInitializer (
+ IN AMD_CONFIG_PARAMS *StdHeader,
+ IN OUT AP_EXE_PARAMS *AmdApExeParams
+ );
+#endif // _CREATE_STRUCT_H_
+
diff --git a/src/vendorcode/amd/agesa/f10/Makefile.inc b/src/vendorcode/amd/agesa/f10/Makefile.inc
index b6b2c77..8f8e40c 100644
--- a/src/vendorcode/amd/agesa/f10/Makefile.inc
+++ b/src/vendorcode/amd/agesa/f10/Makefile.inc
@@ -28,6 +28,7 @@ AGESA_INC += -I$(AGESA_ROOT)/../common
AGESA_INC += -I$(AGESA_ROOT)/Include
AGESA_INC += -I$(AGESA_ROOT)/Lib
AGESA_INC += -I$(AGESA_ROOT)/Legacy
+AGESA_INC += -I$(AGESA_ROOT)/../common/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/HT
AGESA_INC += -I$(AGESA_ROOT)/Proc/HT/NbCommon
@@ -133,7 +134,7 @@ libagesa-y += Proc/CPU/Feature/cpuWhea.c
libagesa-y += Proc/Mem/Feat/CSINTLV/mfcsi.c
libagesa-y += Proc/Mem/Feat/ECC/mfecc.c
libagesa-y += Proc/Mem/Feat/DMI/mfDMI.c
-libagesa-y += Proc/Common/AmdLateRunApTask.c
+libagesa-y += ../common/Proc/Common/AmdLateRunApTask.c
libagesa-y += Proc/CPU/cpuPowerMgmtMultiSocket.c
libagesa-y += Proc/Mem/Main/mmUmaAlloc.c
libagesa-y += Proc/CPU/Feature/cpuPstateTables.c
diff --git a/src/vendorcode/amd/agesa/f10/Proc/Common/AmdInitRecovery.c b/src/vendorcode/amd/agesa/f10/Proc/Common/AmdInitRecovery.c
deleted file mode 100644
index 169e09c..0000000
--- a/src/vendorcode/amd/agesa/f10/Proc/Common/AmdInitRecovery.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 7359 $ @e \$Date: 2008-08-13 01:53:23 +0800 (Wed, 13 Aug 2008) $
- *
- */
-/*****************************************************************************
- *
- * Copyright (c) 2011, 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.
- *
- ******************************************************************************
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "AdvancedApi.h"
-#include "heapManager.h"
-#include "mm.h"
-#include "GnbInterface.h"
-#include "cpuRecovery.h"
-#include "cpuCacheInit.h"
-#include "Filecode.h"
-#define FILECODE PROC_COMMON_AMDINITRECOVERY_FILECODE
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Perform initialization services required at the Early Init POST time point.
- *
- * Execution Cache, HyperTransport, C1e, and AP Init advanced services are performed.
- *
- * @param[in, out] RecoveryParams The interface struct for Recovery services
- *
- * @return The most severe AGESA_STATUS returned by any called service.
- *
- */
-AGESA_STATUS
-AmdInitRecovery (
- IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
- )
-{
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS CalledAgesaStatus;
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryEntry, &RecoveryParams->StdHeader);
-
- ASSERT (RecoveryParams != NULL);
-
- AgesaStatus = AGESA_SUCCESS;
-
- // Setup ROM execution cache
- CalledAgesaStatus = AllocateExecutionCache (&RecoveryParams->StdHeader, &RecoveryParams->CacheRegion[0]);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdHtInitRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdCpuRecovery ((AMD_CPU_RECOVERY_PARAMS *) &RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdMemRecovery (RecoveryParams->MemConfig.MemData);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdGnbRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryExit, &RecoveryParams->StdHeader);
- return AgesaStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- *
- * Initialize defaults and options for Amd Init Reset.
- *
- * @param[in] StdHeader AMD standard header config param.
- * @param[in] AmdRecoveryParamsPtr The Reset Init interface to initialize.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- */
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- )
-{
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
-
- ASSERT (StdHeader != NULL);
- ASSERT (AmdRecoveryParamsPtr != NULL);
-
- AmdRecoveryParamsPtr->StdHeader = *StdHeader;
-
- AllocHeapParams.RequestedBufferSize = sizeof (MEM_DATA_STRUCT);
- AllocHeapParams.BufferHandle = AMD_MEM_DATA_HANDLE;
- AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
- if (HeapAllocateBuffer (&AllocHeapParams, &AmdRecoveryParamsPtr->StdHeader) == AGESA_SUCCESS) {
- AmdRecoveryParamsPtr->MemConfig.MemData = (MEM_DATA_STRUCT *) AllocHeapParams.BufferPtr;
- AmdRecoveryParamsPtr->MemConfig.MemData->ParameterListPtr = &(AmdRecoveryParamsPtr->MemConfig);
- LibAmdMemCopy ((VOID *) AmdRecoveryParamsPtr->MemConfig.MemData,
- (VOID *) AmdRecoveryParamsPtr,
- (UINTN) sizeof (AmdRecoveryParamsPtr->StdHeader),
- &AmdRecoveryParamsPtr->StdHeader
- );
- AmdMemInitDataStructDefRecovery (AmdRecoveryParamsPtr->MemConfig.MemData);
- return AGESA_SUCCESS;
- } else {
- return AGESA_ERROR;
- }
-}
diff --git a/src/vendorcode/amd/agesa/f10/Proc/Common/AmdLateRunApTask.c b/src/vendorcode/amd/agesa/f10/Proc/Common/AmdLateRunApTask.c
deleted file mode 100644
index 5bb58af..0000000
--- a/src/vendorcode/amd/agesa/f10/Proc/Common/AmdLateRunApTask.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Interface
- * @e \$Revision: 7735 $ @e \$Date: 2008-08-27 14:49:19 -0500 (Wed, 27 Aug 2008) $
- *
- */
-/*****************************************************************************
- *
- * Copyright (c) 2011, 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.
- *
- ******************************************************************************
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "Ids.h"
-#include "Options.h"
-#include "heapManager.h"
-#include "CreateStruct.h"
-#include "Filecode.h"
-#define FILECODE PROC_COMMON_AMDLATERUNAPTASK_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern CONST DISPATCH_TABLE ApDispatchTable[];
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Application Processor perform a function as directed by the BSC.
- *
- * This is needed for an AP task that must run after AGESA has relinquished control
- * of the APs to the IBV.
- *
- * @param[in] AmdApExeParams The interface struct for any required routine.
- *
- * @return The most severe AGESA_STATUS returned by any called service. Note
- * that this will be the return value passed back to the BSC as the
- * return value for the call out.
- *
- */
-AGESA_STATUS
-AmdLateRunApTask (
- IN AP_EXE_PARAMS *AmdApExeParams
- )
-{
- AGESA_STATUS CalledAgesaStatus;
- AGESA_STATUS ApLateTaskStatus;
- DISPATCH_TABLE *Entry;
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskEntry, &AmdApExeParams->StdHeader);
-
- ASSERT (AmdApExeParams != NULL);
- ApLateTaskStatus = AGESA_SUCCESS;
- CalledAgesaStatus = AGESA_UNSUPPORTED;
-
- // Dispatch, if valid
- Entry = (DISPATCH_TABLE *) ApDispatchTable;
- while (Entry->FunctionId != 0) {
- if (AmdApExeParams->FunctionNumber == Entry->FunctionId) {
- CalledAgesaStatus = Entry->EntryPoint (AmdApExeParams);
- break;
- }
- Entry++;
- }
-
- if (CalledAgesaStatus > ApLateTaskStatus) {
- ApLateTaskStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskExit, &AmdApExeParams->StdHeader);
- return ApLateTaskStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Constructor for the AMD_LATE_RUN_AP_TASK function.
- *
- * This routine is responsible for setting default values for the
- * input parameters needed by the AMD_S3_SAVE entry point.
- *
- * @param[in] StdHeader The standard header.
- * @param[in,out] AmdApExeParams Required input parameters for the AMD_LATE_RUN_AP_TASK
- * entry point.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- )
-{
- ASSERT (StdHeader != NULL);
- ASSERT (AmdApExeParams != NULL);
-
- AmdApExeParams->StdHeader = *StdHeader;
- AmdApExeParams->FunctionNumber = 0;
- AmdApExeParams->RelatedDataBlock = NULL;
- AmdApExeParams->RelatedBlockLength = 0;
- return AGESA_SUCCESS;
-}
-
diff --git a/src/vendorcode/amd/agesa/f10/Proc/Common/CommonInits.h b/src/vendorcode/amd/agesa/f10/Proc/Common/CommonInits.h
deleted file mode 100644
index afecdce..0000000
--- a/src/vendorcode/amd/agesa/f10/Proc/Common/CommonInits.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * @file
- *
- * Common initialization routines.
- *
- * Contains common initialization routines across AGESA entries of phases.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 7735 $ @e \$Date: 2008-08-27 14:49:19 -0500 (Wed, 27 Aug 2008) $
- *
- */
-/*
-*****************************************************************************
-*
-* Copyright (c) 2011, 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 _COMMON_INITS_H_
-#define _COMMON_INITS_H_
-
-/**
- * Common routine to initialize PLATFORM_CONFIGURATION.
- *
- * @param[in,out] PlatformConfig Platform profile/build option config structure
- * @param[in,out] StdHeader AMD standard header config param
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-CommonPlatformConfigInit (
- IN OUT PLATFORM_CONFIGURATION *PlatformConfig,
- IN OUT AMD_CONFIG_PARAMS *StdHeader
- );
-
-#endif // _COMMON_INITS_H_
-
diff --git a/src/vendorcode/amd/agesa/f10/Proc/Common/CommonPage.h b/src/vendorcode/amd/agesa/f10/Proc/Common/CommonPage.h
deleted file mode 100644
index 85aa183..0000000
--- a/src/vendorcode/amd/agesa/f10/Proc/Common/CommonPage.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * @file
- *
- * Create outline and references for Processor Common Component mainpage documentation.
- *
- * Design guides, maintenance guides, and general documentation, are
- * collected using this file onto the documentation mainpage.
- * This file contains doxygen comment blocks, only.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Documentation
- * @e \$Revision: 44323 $ @e \$Date: 2010-12-22 01:24:58 -0700 (Wed, 22 Dec 2010) $
- *
- */
-/*
- ******************************************************************************
- *
- * Copyright (c) 2011, 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.
- *
- ******************************************************************************
- */
-
-/**
- * @page commonmain Processor Common Component Documentation
- *
- * Additional documentation for the Common component consists of
- *
- * - Maintenance Guides:
- * - @subpage amdconfigparamname "Naming Guidelines for type AMD_CONFIG_PARAMS"
- * - Design Guides:
- * - add here >>>
- *
- */
-
-/**
- * @page amdconfigparamname Naming Guidelines for type AMD_CONFIG_PARAMS
- * @par
- * These are the guidelines for naming objects of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * in AGESA code.
- * <ul>
- *
- * <li>
- * Formal parameter names of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * will always be named
- * StdHeader. This covers all function prototypes, function definitions, and method typedefs (a
- * typedef of a function prototype) in AGESA code. Examples:
- * @n @code
- * VOID
- * LibAmdPciFindNextCap (
- * IN OUT PCI_ADDR *Address,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * )
- *
- * typedef VOID F_DO_TABLE_ENTRY (
- * IN TABLE_ENTRY_DATA *CurrentEntry,
- * IN PLATFORM_CONFIGURATION *PlatformConfig,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * );
- *
- * @endcode
- *
- * <li>
- * Structure members of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * will always be named StdHeader. Examples:
- * @n @code
- /// Example of struct member naming.
- * typedef struct {
- * IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard Header
- * IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
- * } AMD_CPU_RECOVERY_PARAMS;
- *
- * @endcode
- *
- * <li>
- * Routines which define local variables of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * should
- * name the local variable as closely as practical to StdHeader, but otherwise freedom is allowed. Example:
- * @n @code
- * AMD_CONFIG_PARAMS *NewStdHeader;
- * [...]
- * NewStdHeader = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- * @endcode
- *
- * <li>
- * Arguments to routines with AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * formal parameters are not
- * checked. Freedom is allowed in order to conform to these guidelines in a practical, readable
- * way. This includes typecast arguments. Examples:
- * @n @code
- * Status = GetEventLog (&LogEvent, (AMD_CONFIG_PARAMS *)Event);
- *
- * MemS3ExitSelfRefRegDA (NBPtr, &MemPtr->StdHeader);
- * @endcode
- *
- * </ul>
- *
- */
diff --git a/src/vendorcode/amd/agesa/f10/Proc/Common/CreateStruct.h b/src/vendorcode/amd/agesa/f10/Proc/Common/CreateStruct.h
deleted file mode 100644
index e782042..0000000
--- a/src/vendorcode/amd/agesa/f10/Proc/Common/CreateStruct.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input creation structures.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 6913 $ @e \$Date: 2008-07-23 11:34:49 -0500 (Wed, 23 Jul 2008) $
- *
- */
-/*
- ******************************************************************************
- *
- * Copyright (c) 2011, 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 _CREATE_STRUCT_H_
-#define _CREATE_STRUCT_H_
-
-/**
- * A constructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * Constructors should avoid using the header, since these routines should not
- * do operations which may fail or require status back to the user. The constructor
- * should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_FUNCTION (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_FUNCTION *PF_AGESA_FUNCTION;
-
-/**
- * A Destructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * The constructor should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header.
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_DESTRUCTOR (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_DESTRUCTOR *PF_AGESA_DESTRUCTOR;
-
-/**
- * Provide the information needed to invoke each service constructor.
- */
-typedef struct {
- IN AGESA_STRUCT_NAME AgesaFunctionName; ///< Identifies the service
- IN UINT16 CreateStructSize; ///< The service's input struct size.
- /// Do NOT include a config params header!
- OUT PF_AGESA_FUNCTION AgesaFunction; ///< The constructor function
- OUT PF_AGESA_DESTRUCTOR AgesaDestructor; ///< The destructor function.
- IN AGESA_BUFFER_HANDLE BufferHandle; ///< The buffer handle id for the service.
-} FUNCTION_PARAMS_INFO;
-
-/**
- * All available services have their constructor info here.
- */
-AGESA_STATUS
-AmdInitResetConstructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_RESET_PARAMS *AmdResetParams
- );
-
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEarlyInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_EARLY_PARAMS *EarlyParams
- );
-
-AGESA_STATUS
-AmdInitPostInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitPostDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEnvInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_ENV_PARAMS *EnvParamsPtr
- );
-
-AGESA_STATUS
-AmdInitMidInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_MID_PARAMS *MidParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitResumeInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdInitResumeDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdS3SaveInitializer (
- IN OUT AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3SaveDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3LateRestoreInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3LATE_PARAMS *S3LateParams
- );
-
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- );
-#endif // _CREATE_STRUCT_H_
-
diff --git a/src/vendorcode/amd/agesa/f12/Makefile.inc b/src/vendorcode/amd/agesa/f12/Makefile.inc
index 1e5bc70..24eb3d2 100644
--- a/src/vendorcode/amd/agesa/f12/Makefile.inc
+++ b/src/vendorcode/amd/agesa/f12/Makefile.inc
@@ -39,6 +39,7 @@ AGESA_INC += -I$(AGESA_ROOT)/Include
AGESA_INC += -I$(AGESA_ROOT)/Proc/IDS
AGESA_INC += -I$(AGESA_ROOT)/Lib
AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Feature
+AGESA_INC += -I$(AGESA_ROOT)/../common/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/Mem
AGESA_INC += -I$(AGESA_ROOT)/Proc/Recovery/CPU
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Common/AmdFch.h b/src/vendorcode/amd/agesa/f12/Proc/Common/AmdFch.h
deleted file mode 100644
index f9bdddb..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Common/AmdFch.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD FCH Component
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 34897 $ @e \$Date: 2010-07-13 19:07:10 -0700 (Tue, 13 Jul 2010) $
- *
- */
-/*
-*****************************************************************************
-*
-* Copyright (c) 2011, 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 _AMD_FCH_H_
-#define _AMD_FCH_H_
-
-typedef AGESA_STATUS FCH_INIT (IN VOID *DataPtr);
-typedef VOID FCH_TASK_ENTRY (IN VOID *FchCfg);
-
-
-/// FCH API build options
-typedef struct {
- FCH_INIT *InitReset; ///< InitReset
- FCH_INIT *InitResetConstructor; ///< InitResetConstructor
- FCH_INIT *InitEnv; ///< InitEnv
- FCH_INIT *InitEnvConstructor; ///< InitEnvConstructor
- FCH_INIT *InitMid; ///< InitMid
- FCH_INIT *InitMidConstructor; ///< InitMidConstructor
- FCH_INIT *InitLate; ///< InitLate
- FCH_INIT *InitLateConstructor; ///< InitLateConstructor
-} BLDOPT_FCH_FUNCTION;
-
-#endif
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Common/AmdInitRecovery.c b/src/vendorcode/amd/agesa/f12/Proc/Common/AmdInitRecovery.c
deleted file mode 100644
index 47fc364..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Common/AmdInitRecovery.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 17:16:51 +0800 (Wed, 22 Dec 2010) $
- *
- */
-/*****************************************************************************
- *
- * Copyright (c) 2011, 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.
- ******************************************************************************
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "AdvancedApi.h"
-#include "heapManager.h"
-#include "mm.h"
-#include "GnbInterface.h"
-#include "cpuRecovery.h"
-#include "cpuCacheInit.h"
-#include "Filecode.h"
-CODE_GROUP (G2_PEI)
-RDATA_GROUP (G2_PEI)
-
-#define FILECODE PROC_COMMON_AMDINITRECOVERY_FILECODE
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Perform initialization services required at the Early Init POST time point.
- *
- * Execution Cache, HyperTransport, C1e, and AP Init advanced services are performed.
- *
- * @param[in, out] RecoveryParams The interface struct for Recovery services
- *
- * @return The most severe AGESA_STATUS returned by any called service.
- *
- */
-AGESA_STATUS
-AmdInitRecovery (
- IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
- )
-{
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS CalledAgesaStatus;
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryEntry, &RecoveryParams->StdHeader);
-
- ASSERT (RecoveryParams != NULL);
-
- AgesaStatus = AGESA_SUCCESS;
-
- // Setup ROM execution cache
- CalledAgesaStatus = AllocateExecutionCache (&RecoveryParams->StdHeader, &RecoveryParams->CacheRegion[0]);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdHtInitRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdCpuRecovery ((AMD_CPU_RECOVERY_PARAMS *) &RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdMemRecovery (RecoveryParams->MemConfig.MemData);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdGnbRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryExit, &RecoveryParams->StdHeader);
- return AgesaStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- *
- * Initialize defaults and options for Amd Init Reset.
- *
- * @param[in] StdHeader AMD standard header config param.
- * @param[in] AmdRecoveryParamsPtr The Reset Init interface to initialize.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- */
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- )
-{
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
-
- ASSERT (StdHeader != NULL);
- ASSERT (AmdRecoveryParamsPtr != NULL);
-
- AmdRecoveryParamsPtr->StdHeader = *StdHeader;
-
- AllocHeapParams.RequestedBufferSize = sizeof (MEM_DATA_STRUCT);
- AllocHeapParams.BufferHandle = AMD_MEM_DATA_HANDLE;
- AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
- if (HeapAllocateBuffer (&AllocHeapParams, &AmdRecoveryParamsPtr->StdHeader) == AGESA_SUCCESS) {
- AmdRecoveryParamsPtr->MemConfig.MemData = (MEM_DATA_STRUCT *) AllocHeapParams.BufferPtr;
- AmdRecoveryParamsPtr->MemConfig.MemData->ParameterListPtr = &(AmdRecoveryParamsPtr->MemConfig);
- LibAmdMemCopy ((VOID *) AmdRecoveryParamsPtr->MemConfig.MemData,
- (VOID *) AmdRecoveryParamsPtr,
- (UINTN) sizeof (AmdRecoveryParamsPtr->StdHeader),
- &AmdRecoveryParamsPtr->StdHeader
- );
- AmdMemInitDataStructDefRecovery (AmdRecoveryParamsPtr->MemConfig.MemData);
- return AGESA_SUCCESS;
- } else {
- return AGESA_ERROR;
- }
-}
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Common/CommonInits.h b/src/vendorcode/amd/agesa/f12/Proc/Common/CommonInits.h
deleted file mode 100644
index 1a736b6..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Common/CommonInits.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * Common initialization routines.
- *
- * Contains common initialization routines across AGESA entries of phases.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 17:16:51 +0800 (Wed, 22 Dec 2010) $
- *
- */
-/*
-*****************************************************************************
-*
-* Copyright (c) 2011, 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 _COMMON_INITS_H_
-#define _COMMON_INITS_H_
-
-/**
- * Common routine to initialize PLATFORM_CONFIGURATION.
- *
- * @param[in,out] PlatformConfig Platform profile/build option config structure
- * @param[in,out] StdHeader AMD standard header config param
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-CommonPlatformConfigInit (
- IN OUT PLATFORM_CONFIGURATION *PlatformConfig,
- IN OUT AMD_CONFIG_PARAMS *StdHeader
- );
-
-#endif // _COMMON_INITS_H_
-
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Common/CommonPage.h b/src/vendorcode/amd/agesa/f12/Proc/Common/CommonPage.h
deleted file mode 100644
index ec08ba8..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Common/CommonPage.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * Create outline and references for Processor Common Component mainpage documentation.
- *
- * Design guides, maintenance guides, and general documentation, are
- * collected using this file onto the documentation mainpage.
- * This file contains doxygen comment blocks, only.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Documentation
- * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 17:16:51 +0800 (Wed, 22 Dec 2010) $
- *
- */
-/*
- ******************************************************************************
- *
- * Copyright (c) 2011, 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.
- ******************************************************************************
- */
-
-/**
- * @page commonmain Processor Common Component Documentation
- *
- * Additional documentation for the Common component consists of
- *
- * - Maintenance Guides:
- * - @subpage amdconfigparamname "Naming Guidelines for type AMD_CONFIG_PARAMS"
- * - Design Guides:
- * - add here >>>
- *
- */
-
-/**
- * @page amdconfigparamname Naming Guidelines for type AMD_CONFIG_PARAMS
- * @par
- * These are the guidelines for naming objects of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * in AGESA code.
- * <ul>
- *
- * <li>
- * Formal parameter names of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * will always be named
- * StdHeader. This covers all function prototypes, function definitions, and method typedefs (a
- * typedef of a function prototype) in AGESA code. Examples:
- * @n @code
- * VOID
- * LibAmdPciFindNextCap (
- * IN OUT PCI_ADDR *Address,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * )
- *
- * typedef VOID F_DO_TABLE_ENTRY (
- * IN TABLE_ENTRY_DATA *CurrentEntry,
- * IN PLATFORM_CONFIGURATION *PlatformConfig,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * );
- *
- * @endcode
- *
- * <li>
- * Structure members of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * will always be named StdHeader. Examples:
- * @n @code
- /// Example of struct member naming.
- * typedef struct {
- * IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard Header
- * IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
- * } AMD_CPU_RECOVERY_PARAMS;
- *
- * @endcode
- *
- * <li>
- * Routines which define local variables of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * should
- * name the local variable as closely as practical to StdHeader, but otherwise freedom is allowed. Example:
- * @n @code
- * AMD_CONFIG_PARAMS *NewStdHeader;
- * [...]
- * NewStdHeader = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- * @endcode
- *
- * <li>
- * Arguments to routines with AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * formal parameters are not
- * checked. Freedom is allowed in order to conform to these guidelines in a practical, readable
- * way. This includes typecast arguments. Examples:
- * @n @code
- * Status = GetEventLog (&LogEvent, (AMD_CONFIG_PARAMS *)Event);
- *
- * MemS3ExitSelfRefRegDA (NBPtr, &MemPtr->StdHeader);
- * @endcode
- *
- * </ul>
- *
- */
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Common/CreateStruct.c b/src/vendorcode/amd/agesa/f12/Proc/Common/CreateStruct.c
deleted file mode 100644
index 010536e..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Common/CreateStruct.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input structure creation support.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 17:16:51 +0800 (Wed, 22 Dec 2010) $
- *
- */
-/*
- ******************************************************************************
- *
- * Copyright (c) 2011, 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.
- ******************************************************************************
- */
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "GeneralServices.h"
-#include "heapManager.h"
-#include "CreateStruct.h"
-#include "cpuFamilyTranslation.h"
-#include "Filecode.h"
-CODE_GROUP (G1_PEICC)
-RDATA_GROUP (G1_PEICC)
-
-#define FILECODE PROC_COMMON_CREATESTRUCT_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-extern CONST FUNCTION_PARAMS_INFO FuncParamsInfo[];
-extern CONST UINTN InitializerCount;
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern BUILD_OPT_CFG UserOptions;
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Allocate and initialize Config headers and Service Interface structures.
- *
- * This function will be called for each AGESA public APIs.
- * This function will do the following:
- * -# Locate the AGESA API structure parameters initializer function information.
- * -# Find the size of the structure that gets passed to each public APIs as
- * the entry parameter. Allocate heap space using the size for PreMemHeap, callout for
- * memory allocation for PostMemDram, and just set the config and service interface
- * pointers for ByHost.
- * -# If the allocation is not ByHost, copy the AmdConfigParams into the newly created AmdConfigParams.
- * For ByHost, we're using the caller's existing config params.
- * -# Call the initializer function, and pass a reference to the Config params and to
- * the Service Interface struct. On return the constructor will have filled the
- * remaining structure with default values.
- * -# Fill the remaining info in the newly created structure on heap in AMD_CONFIG_PARAMS
- * area (i.e. Fill *newStructPtr with the pointer to the newly created structure)
- * -# Set the appropriate AGESA function number in the StdHeader member of the input
- * parameter structure.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be created, the
- * allocation method, and a pointer to the newly
- * created structure.
- *
- * @retval AGESA_SUCCESS The interface struct is allocated and initialized.
- * @retval AGESA_UNSUPPORTED The Service is not supported.
- *
- */
-AGESA_STATUS
-AmdCreateStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINTN ServiceIndex;
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
- AMD_CONFIG_PARAMS *NewlyCreatedConfig;
- VOID *NewlyCreatedServiceInterface;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- AGESA_STATUS IgnoredSts;
- CPU_SPECIFIC_SERVICES *FamilySpecificServices;
-
- AgesaStatus = AGESA_SUCCESS;
-
- ASSERT (InterfaceParams != NULL);
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- if (!IsBsp (&InterfaceParams->StdHeader, &IgnoredSts)) {
- // APs must transfer their system core number from the mailbox to
- // a local register while it is still valid.
- GetCpuServicesOfCurrentCore ((const CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, &InterfaceParams->StdHeader);
- FamilySpecificServices->TransferApCoreNumber (FamilySpecificServices, &InterfaceParams->StdHeader);
- }
- InterfaceParams->StdHeader.HeapStatus = HEAP_DO_NOT_EXIST_YET;
- break;
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_ENV:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
- if (InterfaceParams->AgesaFunctionName == AMD_INIT_RESET) {
- AgesaStatus = HeapManagerInit (&InterfaceParams->StdHeader);
- }
-
- // Step 1
- for (ServiceIndex = 0; ServiceIndex < InitializerCount; ServiceIndex++) {
- if (FuncParamsInfo[ServiceIndex].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (ServiceIndex >= InitializerCount) {
- // A call was made to AGESA with an invalid function number. This wrapper error may be due to the build target
- // not containing the desired entry point.
- return AGESA_UNSUPPORTED;
- }
-
- // Step 2
- LibAmdMemFill (&AllocHeapParams, 0, (UINTN) (sizeof (ALLOCATE_HEAP_PARAMS)), &InterfaceParams->StdHeader);
-
- if (InterfaceParams->AllocationMethod < ByHost) {
- // Allocate one buffer to contain the config params and the service struct.
- // The service struct begins immediately after the config params.
- AllocHeapParams.RequestedBufferSize = FuncParamsInfo[ServiceIndex].CreateStructSize + sizeof (AMD_CONFIG_PARAMS);
- AllocHeapParams.BufferHandle = FuncParamsInfo[ServiceIndex].BufferHandle;
- AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
- TempStatus = HeapAllocateBuffer (&AllocHeapParams, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- NewlyCreatedConfig++;
- NewlyCreatedServiceInterface = NewlyCreatedConfig;
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- } else {
- // The caller (example, agesa basic interface implementation) already has a buffer to use.
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)InterfaceParams;
- NewlyCreatedServiceInterface = InterfaceParams->NewStructPtr;
- ASSERT (InterfaceParams->NewStructSize >= FuncParamsInfo[ServiceIndex].CreateStructSize);
- }
- ASSERT (NewlyCreatedConfig != NULL);
- ASSERT (NewlyCreatedServiceInterface != NULL);
-
- // Step 3
- if (InterfaceParams->AllocationMethod != ByHost) {
- *NewlyCreatedConfig = InterfaceParams->StdHeader;
- }
-
- // Step 4
- TempStatus = FuncParamsInfo[ServiceIndex].AgesaFunction (NewlyCreatedConfig, NewlyCreatedServiceInterface);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
-
- // Step 5
- if (InterfaceParams->AllocationMethod != ByHost) {
- InterfaceParams->NewStructPtr = (VOID *) NewlyCreatedServiceInterface;
- InterfaceParams->NewStructSize = FuncParamsInfo[ServiceIndex].CreateStructSize;
- }
-
- // Step 6
- ((AMD_CONFIG_PARAMS *) InterfaceParams->NewStructPtr)->Func = InterfaceParams->AgesaFunctionName;
- return AgesaStatus;
-}
-
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Clears storage space from allocation for a parameter block of an
- * AGESA software call entry.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be deallocated.
- *
- * @retval AGESA_STATUS
- *
- *---------------------------------------------------------------------------------------
- **/
-AGESA_STATUS
-AmdReleaseStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINT8 i;
- UINT8 *BufferPtr;
- VOID *ServicePtr;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- LOCATE_HEAP_PTR LocHeap;
-
- AgesaStatus = AGESA_SUCCESS;
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_ENV:
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
-// Step 1
- for (i = 0; i < InitializerCount; i++) {
- if (FuncParamsInfo[i].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (i >= InitializerCount) {
- return AGESA_BOUNDS_CHK;
- }
-
- // Step 2
- if (InterfaceParams->AllocationMethod < ByHost) {
- LocHeap.BufferHandle = FuncParamsInfo[i].BufferHandle;
- if (HeapLocateBuffer (&LocHeap, &(InterfaceParams->StdHeader)) == AGESA_SUCCESS) {
- BufferPtr = (UINT8 *) LocHeap.BufferPtr;
- ServicePtr = &BufferPtr[sizeof (AMD_CONFIG_PARAMS)];
- TempStatus = FuncParamsInfo[i].AgesaDestructor (&(InterfaceParams->StdHeader), ServicePtr);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- }
- }
-
- // Step 3
- if (InterfaceParams->AllocationMethod < ByHost) {
- TempStatus = HeapDeallocateBuffer (FuncParamsInfo[i].BufferHandle, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- } else {
- // Unless we define service specific destructors, nothing to do for ByHost.
- return AGESA_SUCCESS;
- }
- return AgesaStatus;
-}
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Common/CreateStruct.h b/src/vendorcode/amd/agesa/f12/Proc/Common/CreateStruct.h
deleted file mode 100644
index 65a2040..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Common/CreateStruct.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input creation structures.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 17:16:51 +0800 (Wed, 22 Dec 2010) $
- *
- */
-/*
- ******************************************************************************
- *
- * Copyright (c) 2011, 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 _CREATE_STRUCT_H_
-#define _CREATE_STRUCT_H_
-
-/**
- * A constructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * Constructors should avoid using the header, since these routines should not
- * do operations which may fail or require status back to the user. The constructor
- * should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_FUNCTION (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_FUNCTION *PF_AGESA_FUNCTION;
-
-/**
- * A Destructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * The constructor should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header.
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_DESTRUCTOR (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_DESTRUCTOR *PF_AGESA_DESTRUCTOR;
-
-/**
- * Provide the information needed to invoke each service constructor.
- */
-typedef struct {
- IN AGESA_STRUCT_NAME AgesaFunctionName; ///< Identifies the service
- IN UINT16 CreateStructSize; ///< The service's input struct size.
- /// Do NOT include a config params header!
- OUT PF_AGESA_FUNCTION AgesaFunction; ///< The constructor function
- OUT PF_AGESA_DESTRUCTOR AgesaDestructor; ///< The destructor function.
- IN AGESA_BUFFER_HANDLE BufferHandle; ///< The buffer handle id for the service.
-} FUNCTION_PARAMS_INFO;
-
-/**
- * All available services have their constructor info here.
- */
-AGESA_STATUS
-AmdInitResetConstructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_RESET_PARAMS *AmdResetParams
- );
-
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEarlyInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_EARLY_PARAMS *EarlyParams
- );
-
-AGESA_STATUS
-AmdInitPostInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitPostDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEnvInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_ENV_PARAMS *EnvParamsPtr
- );
-
-AGESA_STATUS
-AmdInitMidInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_MID_PARAMS *MidParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitResumeInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdInitResumeDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdS3SaveInitializer (
- IN OUT AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3SaveDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3LateRestoreInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3LATE_PARAMS *S3LateParams
- );
-
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- );
-#endif // _CREATE_STRUCT_H_
-
diff --git a/src/vendorcode/amd/agesa/f14/Makefile.inc b/src/vendorcode/amd/agesa/f14/Makefile.inc
index d1c8911..8775a1b 100644
--- a/src/vendorcode/amd/agesa/f14/Makefile.inc
+++ b/src/vendorcode/amd/agesa/f14/Makefile.inc
@@ -36,6 +36,7 @@ AGESA_INC += -I$(AGESA_ROOT)/../common
AGESA_INC += -I$(AGESA_ROOT)/Include
AGESA_INC += -I$(AGESA_ROOT)/Lib
AGESA_INC += -I$(AGESA_ROOT)/Legacy
+AGESA_INC += -I$(AGESA_ROOT)/../common/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU
AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family
@@ -228,13 +229,13 @@ libagesa-y += Proc/Mem/NB/mn.c
libagesa-y += Proc/GNB/Gfx/GfxInitAtEnvPost.c
libagesa-y += Proc/CPU/Feature/cpuHwC1e.c
libagesa-y += Proc/CPU/cpuLateInit.c
-libagesa-y += Proc/Common/CreateStruct.c
+libagesa-y += ../common/Proc/Common/CreateStruct.c
libagesa-y += Proc/CPU/Feature/cpuWhea.c
libagesa-y += Proc/Mem/Feat/CSINTLV/mfcsi.c
libagesa-y += Proc/Mem/Feat/ECC/mfecc.c
libagesa-y += Proc/Mem/Feat/DMI/mfDMI.c
libagesa-y += Proc/Mem/Ps/ON/mpson3.c
-libagesa-y += Proc/Common/AmdLateRunApTask.c
+libagesa-y += ../common/Proc/Common/AmdLateRunApTask.c
libagesa-y += Proc/CPU/cpuPowerMgmtMultiSocket.c
libagesa-y += Proc/Mem/Main/mmUmaAlloc.c
libagesa-y += Proc/CPU/Feature/cpuPstateTables.c
diff --git a/src/vendorcode/amd/agesa/f14/Proc/Common/AmdInitRecovery.c b/src/vendorcode/amd/agesa/f14/Proc/Common/AmdInitRecovery.c
deleted file mode 100644
index fccb5d9..0000000
--- a/src/vendorcode/amd/agesa/f14/Proc/Common/AmdInitRecovery.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 35136 $ @e \$Date: 2010-07-16 11:29:48 +0800 (Fri, 16 Jul 2010) $
- *
- */
-/*
- *****************************************************************************
- *
- * Copyright (c) 2011, 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.
- *
- * ***************************************************************************
- *
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "AdvancedApi.h"
-#include "heapManager.h"
-#include "mm.h"
-#include "GnbInterface.h"
-#include "cpuRecovery.h"
-#include "cpuCacheInit.h"
-#include "Filecode.h"
-CODE_GROUP (G2_PEI)
-RDATA_GROUP (G2_PEI)
-
-#define FILECODE PROC_COMMON_AMDINITRECOVERY_FILECODE
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Perform initialization services required at the Early Init POST time point.
- *
- * Execution Cache, HyperTransport, C1e, and AP Init advanced services are performed.
- *
- * @param[in, out] RecoveryParams The interface struct for Recovery services
- *
- * @return The most severe AGESA_STATUS returned by any called service.
- *
- */
-AGESA_STATUS
-AmdInitRecovery (
- IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
- )
-{
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS CalledAgesaStatus;
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryEntry, &RecoveryParams->StdHeader);
-
- ASSERT (RecoveryParams != NULL);
-
- AgesaStatus = AGESA_SUCCESS;
-
- // Setup ROM execution cache
- CalledAgesaStatus = AllocateExecutionCache (&RecoveryParams->StdHeader, &RecoveryParams->CacheRegion[0]);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdHtInitRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdCpuRecovery ((AMD_CPU_RECOVERY_PARAMS *) &RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdMemRecovery (RecoveryParams->MemConfig.MemData);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdGnbRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryExit, &RecoveryParams->StdHeader);
- return AgesaStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- *
- * Initialize defaults and options for Amd Init Reset.
- *
- * @param[in] StdHeader AMD standard header config param.
- * @param[in] AmdRecoveryParamsPtr The Reset Init interface to initialize.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- */
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- )
-{
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
-
- ASSERT (StdHeader != NULL);
- ASSERT (AmdRecoveryParamsPtr != NULL);
-
- AmdRecoveryParamsPtr->StdHeader = *StdHeader;
-
- AllocHeapParams.RequestedBufferSize = sizeof (MEM_DATA_STRUCT);
- AllocHeapParams.BufferHandle = AMD_MEM_DATA_HANDLE;
- AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
- if (HeapAllocateBuffer (&AllocHeapParams, &AmdRecoveryParamsPtr->StdHeader) == AGESA_SUCCESS) {
- AmdRecoveryParamsPtr->MemConfig.MemData = (MEM_DATA_STRUCT *) AllocHeapParams.BufferPtr;
- AmdRecoveryParamsPtr->MemConfig.MemData->ParameterListPtr = &(AmdRecoveryParamsPtr->MemConfig);
- LibAmdMemCopy ((VOID *) AmdRecoveryParamsPtr->MemConfig.MemData,
- (VOID *) AmdRecoveryParamsPtr,
- (UINTN) sizeof (AmdRecoveryParamsPtr->StdHeader),
- &AmdRecoveryParamsPtr->StdHeader
- );
- AmdMemInitDataStructDefRecovery (AmdRecoveryParamsPtr->MemConfig.MemData);
- return AGESA_SUCCESS;
- } else {
- return AGESA_ERROR;
- }
-}
diff --git a/src/vendorcode/amd/agesa/f14/Proc/Common/AmdLateRunApTask.c b/src/vendorcode/amd/agesa/f14/Proc/Common/AmdLateRunApTask.c
deleted file mode 100644
index 9a1c99e..0000000
--- a/src/vendorcode/amd/agesa/f14/Proc/Common/AmdLateRunApTask.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Interface
- * @e \$Revision: 35136 $ @e \$Date: 2010-07-16 11:29:48 +0800 (Fri, 16 Jul 2010) $
- *
- */
-/*
- *****************************************************************************
- *
- * Copyright (c) 2011, 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.
- *
- * ***************************************************************************
- *
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "Ids.h"
-#include "Options.h"
-#include "CreateStruct.h"
-#include "Filecode.h"
-CODE_GROUP (G3_DXE)
-RDATA_GROUP (G3_DXE)
-
-#define FILECODE PROC_COMMON_AMDLATERUNAPTASK_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern CONST DISPATCH_TABLE ApDispatchTable[];
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Application Processor perform a function as directed by the BSC.
- *
- * This is needed for an AP task that must run after AGESA has relinquished control
- * of the APs to the IBV.
- *
- * @param[in] AmdApExeParams The interface struct for any required routine.
- *
- * @return The most severe AGESA_STATUS returned by any called service. Note
- * that this will be the return value passed back to the BSC as the
- * return value for the call out.
- *
- */
-AGESA_STATUS
-AmdLateRunApTask (
- IN AP_EXE_PARAMS *AmdApExeParams
- )
-{
- AGESA_STATUS CalledAgesaStatus;
- AGESA_STATUS ApLateTaskStatus;
- DISPATCH_TABLE *Entry;
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskEntry, &AmdApExeParams->StdHeader);
-
- ASSERT (AmdApExeParams != NULL);
- ApLateTaskStatus = AGESA_SUCCESS;
- CalledAgesaStatus = AGESA_UNSUPPORTED;
-
- // Dispatch, if valid
- Entry = (DISPATCH_TABLE *) ApDispatchTable;
- while (Entry->FunctionId != 0) {
- if (AmdApExeParams->FunctionNumber == Entry->FunctionId) {
- CalledAgesaStatus = Entry->EntryPoint (AmdApExeParams);
- break;
- }
- Entry++;
- }
-
- if (CalledAgesaStatus > ApLateTaskStatus) {
- ApLateTaskStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskExit, &AmdApExeParams->StdHeader);
- return ApLateTaskStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Constructor for the AMD_LATE_RUN_AP_TASK function.
- *
- * This routine is responsible for setting default values for the
- * input parameters needed by the AMD_S3_SAVE entry point.
- *
- * @param[in] StdHeader The standard header.
- * @param[in,out] AmdApExeParams Required input parameters for the AMD_LATE_RUN_AP_TASK
- * entry point.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- )
-{
- ASSERT (StdHeader != NULL);
- ASSERT (AmdApExeParams != NULL);
-
- AmdApExeParams->StdHeader = *StdHeader;
- AmdApExeParams->FunctionNumber = 0;
- AmdApExeParams->RelatedDataBlock = NULL;
- AmdApExeParams->RelatedBlockLength = 0;
- return AGESA_SUCCESS;
-}
-
diff --git a/src/vendorcode/amd/agesa/f14/Proc/Common/CommonInits.h b/src/vendorcode/amd/agesa/f14/Proc/Common/CommonInits.h
deleted file mode 100644
index 34f3c93..0000000
--- a/src/vendorcode/amd/agesa/f14/Proc/Common/CommonInits.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * Common initialization routines.
- *
- * Contains common initialization routines across AGESA entries of phases.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 34897 $ @e \$Date: 2010-07-14 10:07:10 +0800 (Wed, 14 Jul 2010) $
- *
- */
-/*
- *****************************************************************************
- *
- * Copyright (c) 2011, 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 _COMMON_INITS_H_
-#define _COMMON_INITS_H_
-
-/**
- * Common routine to initialize PLATFORM_CONFIGURATION.
- *
- * @param[in,out] PlatformConfig Platform profile/build option config structure
- * @param[in,out] StdHeader AMD standard header config param
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-CommonPlatformConfigInit (
- IN OUT PLATFORM_CONFIGURATION *PlatformConfig,
- IN OUT AMD_CONFIG_PARAMS *StdHeader
- );
-
-#endif // _COMMON_INITS_H_
-
diff --git a/src/vendorcode/amd/agesa/f14/Proc/Common/CommonPage.h b/src/vendorcode/amd/agesa/f14/Proc/Common/CommonPage.h
deleted file mode 100644
index 4e73e21..0000000
--- a/src/vendorcode/amd/agesa/f14/Proc/Common/CommonPage.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * Create outline and references for Processor Common Component mainpage documentation.
- *
- * Design guides, maintenance guides, and general documentation, are
- * collected using this file onto the documentation mainpage.
- * This file contains doxygen comment blocks, only.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Documentation
- * @e \$Revision: 34897 $ @e \$Date: 2010-07-14 10:07:10 +0800 (Wed, 14 Jul 2010) $
- *
- */
-/*
- *****************************************************************************
- *
- * Copyright (c) 2011, 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.
- *
- * ***************************************************************************
- *
- */
-
-/**
- * @page commonmain Processor Common Component Documentation
- *
- * Additional documentation for the Common component consists of
- *
- * - Maintenance Guides:
- * - @subpage amdconfigparamname "Naming Guidelines for type AMD_CONFIG_PARAMS"
- * - Design Guides:
- * - add here >>>
- *
- */
-
-/**
- * @page amdconfigparamname Naming Guidelines for type AMD_CONFIG_PARAMS
- * @par
- * These are the guidelines for naming objects of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * in AGESA code.
- * <ul>
- *
- * <li>
- * Formal parameter names of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * will always be named
- * StdHeader. This covers all function prototypes, function definitions, and method typedefs (a
- * typedef of a function prototype) in AGESA code. Examples:
- * @n @code
- * VOID
- * LibAmdPciFindNextCap (
- * IN OUT PCI_ADDR *Address,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * )
- *
- * typedef VOID F_DO_TABLE_ENTRY (
- * IN TABLE_ENTRY_DATA *CurrentEntry,
- * IN PLATFORM_CONFIGURATION *PlatformConfig,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * );
- *
- * @endcode
- *
- * <li>
- * Structure members of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * will always be named StdHeader. Examples:
- * @n @code
- /// Example of struct member naming.
- * typedef struct {
- * IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard Header
- * IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
- * } AMD_CPU_RECOVERY_PARAMS;
- *
- * @endcode
- *
- * <li>
- * Routines which define local variables of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * should
- * name the local variable as closely as practical to StdHeader, but otherwise freedom is allowed. Example:
- * @n @code
- * AMD_CONFIG_PARAMS *NewStdHeader;
- * [...]
- * NewStdHeader = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- * @endcode
- *
- * <li>
- * Arguments to routines with AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * formal parameters are not
- * checked. Freedom is allowed in order to conform to these guidelines in a practical, readable
- * way. This includes typecast arguments. Examples:
- * @n @code
- * Status = GetEventLog (&LogEvent, (AMD_CONFIG_PARAMS *)Event);
- *
- * MemS3ExitSelfRefRegDA (NBPtr, &MemPtr->StdHeader);
- * @endcode
- *
- * </ul>
- *
- */
diff --git a/src/vendorcode/amd/agesa/f14/Proc/Common/CreateStruct.c b/src/vendorcode/amd/agesa/f14/Proc/Common/CreateStruct.c
deleted file mode 100644
index d7041d2..0000000
--- a/src/vendorcode/amd/agesa/f14/Proc/Common/CreateStruct.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input structure creation support.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 35136 $ @e \$Date: 2010-07-16 11:29:48 +0800 (Fri, 16 Jul 2010) $
- *
- */
-/*
- *****************************************************************************
- *
- * Copyright (c) 2011, 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.
- *
- * ***************************************************************************
- *
- */
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "GeneralServices.h"
-#include "heapManager.h"
-#include "CreateStruct.h"
-#include "cpuFamilyTranslation.h"
-#include "Filecode.h"
-CODE_GROUP (G1_PEICC)
-RDATA_GROUP (G1_PEICC)
-
-#define FILECODE PROC_COMMON_CREATESTRUCT_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-extern CONST FUNCTION_PARAMS_INFO FuncParamsInfo[];
-extern CONST UINTN InitializerCount;
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern BUILD_OPT_CFG UserOptions;
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Allocate and initialize Config headers and Service Interface structures.
- *
- * This function will be called for each AGESA public APIs.
- * This function will do the following:
- * -# Locate the AGESA API structure parameters initializer function information.
- * -# Find the size of the structure that gets passed to each public APIs as
- * the entry parameter. Allocate heap space using the size for PreMemHeap, callout for
- * memory allocation for PostMemDram, and just set the config and service interface
- * pointers for ByHost.
- * -# If the allocation is not ByHost, copy the AmdConfigParams into the newly created AmdConfigParams.
- * For ByHost, we're using the caller's existing config params.
- * -# Call the initializer function, and pass a reference to the Config params and to
- * the Service Interface struct. On return the constructor will have filled the
- * remaining structure with default values.
- * -# Fill the remaining info in the newly created structure on heap in AMD_CONFIG_PARAMS
- * area (i.e. Fill *newStructPtr with the pointer to the newly created structure)
- * -# Set the appropriate AGESA function number in the StdHeader member of the input
- * parameter structure.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be created, the
- * allocation method, and a pointer to the newly
- * created structure.
- *
- * @retval AGESA_SUCCESS The interface struct is allocated and initialized.
- * @retval AGESA_UNSUPPORTED The Service is not supported.
- *
- */
-AGESA_STATUS
-AmdCreateStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINTN ServiceIndex;
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
- AMD_CONFIG_PARAMS *NewlyCreatedConfig;
- VOID *NewlyCreatedServiceInterface;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- AGESA_STATUS IgnoredSts;
- CPU_SPECIFIC_SERVICES *FamilySpecificServices;
-
- AgesaStatus = AGESA_SUCCESS;
-
- ASSERT (InterfaceParams != NULL);
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- if (!IsBsp (&InterfaceParams->StdHeader, &IgnoredSts)) {
- // APs must transfer their system core number from the mailbox to
- // a local register while it is still valid.
- GetCpuServicesOfCurrentCore ((const CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, &InterfaceParams->StdHeader);
- FamilySpecificServices->TransferApCoreNumber (FamilySpecificServices, &InterfaceParams->StdHeader);
- }
- InterfaceParams->StdHeader.HeapStatus = HEAP_DO_NOT_EXIST_YET;
- break;
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_ENV:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
- if (InterfaceParams->AgesaFunctionName == AMD_INIT_RESET) {
- AgesaStatus = HeapManagerInit (&InterfaceParams->StdHeader);
- }
-
- // Step 1
- for (ServiceIndex = 0; ServiceIndex < InitializerCount; ServiceIndex++) {
- if (FuncParamsInfo[ServiceIndex].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (ServiceIndex >= InitializerCount) {
- // A call was made to AGESA with an invalid function number. This wrapper error may be due to the build target
- // not containing the desired entry point.
- return AGESA_UNSUPPORTED;
- }
-
- // Step 2
- LibAmdMemFill (&AllocHeapParams, 0, (UINTN) (sizeof (ALLOCATE_HEAP_PARAMS)), &InterfaceParams->StdHeader);
-
- if (InterfaceParams->AllocationMethod < ByHost) {
- // Allocate one buffer to contain the config params and the service struct.
- // The service struct begins immediately after the config params.
- AllocHeapParams.RequestedBufferSize = FuncParamsInfo[ServiceIndex].CreateStructSize + sizeof (AMD_CONFIG_PARAMS);
- AllocHeapParams.BufferHandle = FuncParamsInfo[ServiceIndex].BufferHandle;
- AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
- TempStatus = HeapAllocateBuffer (&AllocHeapParams, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- NewlyCreatedConfig++;
- NewlyCreatedServiceInterface = NewlyCreatedConfig;
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- } else {
- // The caller (example, agesa basic interface implementation) already has a buffer to use.
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)InterfaceParams;
- NewlyCreatedServiceInterface = InterfaceParams->NewStructPtr;
- ASSERT (InterfaceParams->NewStructSize >= FuncParamsInfo[ServiceIndex].CreateStructSize);
- }
- ASSERT (NewlyCreatedConfig != NULL);
- ASSERT (NewlyCreatedServiceInterface != NULL);
-
- // Step 3
- if (InterfaceParams->AllocationMethod != ByHost) {
- *NewlyCreatedConfig = InterfaceParams->StdHeader;
- }
-
- // Step 4
- TempStatus = FuncParamsInfo[ServiceIndex].AgesaFunction (NewlyCreatedConfig, NewlyCreatedServiceInterface);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
-
- // Step 5
- if (InterfaceParams->AllocationMethod != ByHost) {
- InterfaceParams->NewStructPtr = (VOID *) NewlyCreatedServiceInterface;
- InterfaceParams->NewStructSize = FuncParamsInfo[ServiceIndex].CreateStructSize;
- }
-
- // Step 6
- ((AMD_CONFIG_PARAMS *) InterfaceParams->NewStructPtr)->Func = InterfaceParams->AgesaFunctionName;
- return AgesaStatus;
-}
-
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Clears storage space from allocation for a parameter block of an
- * AGESA software call entry.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be deallocated.
- *
- * @retval AGESA_STATUS
- *
- *---------------------------------------------------------------------------------------
- **/
-AGESA_STATUS
-AmdReleaseStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINT8 i;
- UINT8 *BufferPtr;
- VOID *ServicePtr;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- LOCATE_HEAP_PTR LocHeap;
-
- AgesaStatus = AGESA_SUCCESS;
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_ENV:
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
-// Step 1
- for (i = 0; i < InitializerCount; i++) {
- if (FuncParamsInfo[i].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (i >= InitializerCount) {
- return AGESA_BOUNDS_CHK;
- }
-
- // Step 2
- if (InterfaceParams->AllocationMethod < ByHost) {
- LocHeap.BufferHandle = FuncParamsInfo[i].BufferHandle;
- if (HeapLocateBuffer (&LocHeap, &(InterfaceParams->StdHeader)) == AGESA_SUCCESS) {
- BufferPtr = (UINT8 *) LocHeap.BufferPtr;
- ServicePtr = &BufferPtr[sizeof (AMD_CONFIG_PARAMS)];
- TempStatus = FuncParamsInfo[i].AgesaDestructor (&(InterfaceParams->StdHeader), ServicePtr);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- }
- }
-
- // Step 3
- if (InterfaceParams->AllocationMethod < ByHost) {
- TempStatus = HeapDeallocateBuffer (FuncParamsInfo[i].BufferHandle, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- } else {
- // Unless we define service specific destructors, nothing to do for ByHost.
- return AGESA_SUCCESS;
- }
- return AgesaStatus;
-}
diff --git a/src/vendorcode/amd/agesa/f14/Proc/Common/CreateStruct.h b/src/vendorcode/amd/agesa/f14/Proc/Common/CreateStruct.h
deleted file mode 100644
index ace0176..0000000
--- a/src/vendorcode/amd/agesa/f14/Proc/Common/CreateStruct.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input creation structures.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 34897 $ @e \$Date: 2010-07-14 10:07:10 +0800 (Wed, 14 Jul 2010) $
- *
- */
-/*
- *****************************************************************************
- *
- * Copyright (c) 2011, 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 _CREATE_STRUCT_H_
-#define _CREATE_STRUCT_H_
-
-/**
- * A constructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * Constructors should avoid using the header, since these routines should not
- * do operations which may fail or require status back to the user. The constructor
- * should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_FUNCTION (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_FUNCTION *PF_AGESA_FUNCTION;
-
-/**
- * A Destructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * The constructor should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header.
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_DESTRUCTOR (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_DESTRUCTOR *PF_AGESA_DESTRUCTOR;
-
-/**
- * Provide the information needed to invoke each service constructor.
- */
-typedef struct {
- IN AGESA_STRUCT_NAME AgesaFunctionName; ///< Identifies the service
- IN UINT16 CreateStructSize; ///< The service's input struct size.
- /// Do NOT include a config params header!
- OUT PF_AGESA_FUNCTION AgesaFunction; ///< The constructor function
- OUT PF_AGESA_DESTRUCTOR AgesaDestructor; ///< The destructor function.
- IN UINT32 BufferHandle; ///< The buffer handle id for the service.
-} FUNCTION_PARAMS_INFO;
-
-/**
- * All available services have their constructor info here.
- */
-AGESA_STATUS
-AmdInitResetConstructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_RESET_PARAMS *AmdResetParams
- );
-
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEarlyInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_EARLY_PARAMS *EarlyParams
- );
-
-AGESA_STATUS
-AmdInitPostInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitPostDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEnvInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_ENV_PARAMS *EnvParamsPtr
- );
-
-AGESA_STATUS
-AmdInitMidInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_MID_PARAMS *MidParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitResumeInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdInitResumeDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdS3SaveInitializer (
- IN OUT AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3SaveDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3LateRestoreInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3LATE_PARAMS *S3LateParams
- );
-
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- );
-#endif // _CREATE_STRUCT_H_
-
diff --git a/src/vendorcode/amd/agesa/f15/Makefile.inc b/src/vendorcode/amd/agesa/f15/Makefile.inc
index d709199..51260bf 100644
--- a/src/vendorcode/amd/agesa/f15/Makefile.inc
+++ b/src/vendorcode/amd/agesa/f15/Makefile.inc
@@ -35,6 +35,7 @@ AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family/0x10
AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family/0x15
AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Family/0x15/OR
AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU/Feature
+AGESA_INC += -I$(AGESA_ROOT)/../common/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/HT
AGESA_INC += -I$(AGESA_ROOT)/Proc/HT/Fam10
@@ -80,12 +81,12 @@ libagesa-y += Proc/Common/AmdInitMid.c
libagesa-y += Proc/Common/AmdInitPost.c
libagesa-y += Proc/Common/AmdInitReset.c
libagesa-y += Proc/Common/AmdInitResume.c
-libagesa-y += Proc/Common/AmdLateRunApTask.c
+libagesa-y += ../common/Proc/Common/AmdLateRunApTask.c
libagesa-y += Proc/Common/AmdS3LateRestore.c
libagesa-y += Proc/Common/AmdS3Save.c
libagesa-y += Proc/Common/CommonInits.c
libagesa-y += Proc/Common/CommonReturns.c
-libagesa-y += Proc/Common/CreateStruct.c
+libagesa-y += ../common/Proc/Common/CreateStruct.c
libagesa-y += Proc/Common/S3RestoreState.c
libagesa-y += Proc/Common/S3SaveState.c
libagesa-y += Proc/CPU/cahaltasm.S
diff --git a/src/vendorcode/amd/agesa/f15/Proc/Common/AmdFch.h b/src/vendorcode/amd/agesa/f15/Proc/Common/AmdFch.h
deleted file mode 100644
index afe565b..0000000
--- a/src/vendorcode/amd/agesa/f15/Proc/Common/AmdFch.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD FCH Component
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
-*****************************************************************************
-*
- * 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 _AMD_FCH_H_
-#define _AMD_FCH_H_
-
-typedef AGESA_STATUS FCH_INIT (IN VOID *DataPtr);
-typedef VOID FCH_TASK_ENTRY (IN VOID *FchCfg);
-
-
-/// FCH API build options
-typedef struct {
- FCH_INIT *InitReset; ///< InitReset
- FCH_INIT *InitResetConstructor; ///< InitResetConstructor
- FCH_INIT *InitEnv; ///< InitEnv
- FCH_INIT *InitEnvConstructor; ///< InitEnvConstructor
- FCH_INIT *InitMid; ///< InitMid
- FCH_INIT *InitMidConstructor; ///< InitMidConstructor
- FCH_INIT *InitLate; ///< InitLate
- FCH_INIT *InitLateConstructor; ///< InitLateConstructor
-} BLDOPT_FCH_FUNCTION;
-
-#endif
diff --git a/src/vendorcode/amd/agesa/f15/Proc/Common/AmdInitRecovery.c b/src/vendorcode/amd/agesa/f15/Proc/Common/AmdInitRecovery.c
deleted file mode 100644
index ac4c08d..0000000
--- a/src/vendorcode/amd/agesa/f15/Proc/Common/AmdInitRecovery.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*****************************************************************************
- *
- * 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.
- ******************************************************************************
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "AdvancedApi.h"
-#include "heapManager.h"
-#include "mm.h"
-#include "GnbInterface.h"
-#include "cpuRecovery.h"
-#include "cpuCacheInit.h"
-#include "Filecode.h"
-CODE_GROUP (G2_PEI)
-RDATA_GROUP (G2_PEI)
-
-#define FILECODE PROC_COMMON_AMDINITRECOVERY_FILECODE
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Perform initialization services required at the Early Init POST time point.
- *
- * Execution Cache, HyperTransport, C1e, and AP Init advanced services are performed.
- *
- * @param[in, out] RecoveryParams The interface struct for Recovery services
- *
- * @return The most severe AGESA_STATUS returned by any called service.
- *
- */
-AGESA_STATUS
-AmdInitRecovery (
- IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
- )
-{
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS CalledAgesaStatus;
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryEntry, &RecoveryParams->StdHeader);
-
- ASSERT (RecoveryParams != NULL);
-
- AgesaStatus = AGESA_SUCCESS;
-
- // Setup ROM execution cache
- CalledAgesaStatus = AllocateExecutionCache (&RecoveryParams->StdHeader, &RecoveryParams->CacheRegion[0]);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdHtInitRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdCpuRecovery ((AMD_CPU_RECOVERY_PARAMS *) &RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdMemRecovery (RecoveryParams->MemConfig.MemData);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdGnbRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryExit, &RecoveryParams->StdHeader);
- return AgesaStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- *
- * Initialize defaults and options for Amd Init Reset.
- *
- * @param[in] StdHeader AMD standard header config param.
- * @param[in] AmdRecoveryParamsPtr The Reset Init interface to initialize.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- */
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- )
-{
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
-
- ASSERT (StdHeader != NULL);
- ASSERT (AmdRecoveryParamsPtr != NULL);
-
- AmdRecoveryParamsPtr->StdHeader = *StdHeader;
-
- AllocHeapParams.RequestedBufferSize = sizeof (MEM_DATA_STRUCT);
- AllocHeapParams.BufferHandle = AMD_MEM_DATA_HANDLE;
- AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
- if (HeapAllocateBuffer (&AllocHeapParams, &AmdRecoveryParamsPtr->StdHeader) == AGESA_SUCCESS) {
- AmdRecoveryParamsPtr->MemConfig.MemData = (MEM_DATA_STRUCT *) AllocHeapParams.BufferPtr;
- AmdRecoveryParamsPtr->MemConfig.MemData->ParameterListPtr = &(AmdRecoveryParamsPtr->MemConfig);
- LibAmdMemCopy ((VOID *) AmdRecoveryParamsPtr->MemConfig.MemData,
- (VOID *) AmdRecoveryParamsPtr,
- (UINTN) sizeof (AmdRecoveryParamsPtr->StdHeader),
- &AmdRecoveryParamsPtr->StdHeader
- );
- AmdMemInitDataStructDefRecovery (AmdRecoveryParamsPtr->MemConfig.MemData);
- return AGESA_SUCCESS;
- } else {
- return AGESA_ERROR;
- }
-}
diff --git a/src/vendorcode/amd/agesa/f15/Proc/Common/AmdLateRunApTask.c b/src/vendorcode/amd/agesa/f15/Proc/Common/AmdLateRunApTask.c
deleted file mode 100644
index b11fca2..0000000
--- a/src/vendorcode/amd/agesa/f15/Proc/Common/AmdLateRunApTask.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Interface
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*****************************************************************************
- *
- * 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.
- ******************************************************************************
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "Ids.h"
-#include "Options.h"
-#include "Filecode.h"
-#include "heapManager.h"
-#include "CreateStruct.h"
-CODE_GROUP (G3_DXE)
-RDATA_GROUP (G3_DXE)
-
-#define FILECODE PROC_COMMON_AMDLATERUNAPTASK_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern CONST DISPATCH_TABLE ApDispatchTable[];
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Application Processor perform a function as directed by the BSC.
- *
- * This is needed for an AP task that must run after AGESA has relinquished control
- * of the APs to the IBV.
- *
- * @param[in] AmdApExeParams The interface struct for any required routine.
- *
- * @return The most severe AGESA_STATUS returned by any called service. Note
- * that this will be the return value passed back to the BSC as the
- * return value for the call out.
- *
- */
-AGESA_STATUS
-AmdLateRunApTask (
- IN AP_EXE_PARAMS *AmdApExeParams
- )
-{
- AGESA_STATUS CalledAgesaStatus;
- AGESA_STATUS ApLateTaskStatus;
- DISPATCH_TABLE *Entry;
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskEntry, &AmdApExeParams->StdHeader);
-
- ASSERT (AmdApExeParams != NULL);
- ApLateTaskStatus = AGESA_SUCCESS;
- CalledAgesaStatus = AGESA_UNSUPPORTED;
-
- // Dispatch, if valid
- Entry = (DISPATCH_TABLE *) ApDispatchTable;
- while (Entry->FunctionId != 0) {
- if (AmdApExeParams->FunctionNumber == Entry->FunctionId) {
- CalledAgesaStatus = Entry->EntryPoint (AmdApExeParams);
- break;
- }
- Entry++;
- }
-
- if (CalledAgesaStatus > ApLateTaskStatus) {
- ApLateTaskStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskExit, &AmdApExeParams->StdHeader);
- return ApLateTaskStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Constructor for the AMD_LATE_RUN_AP_TASK function.
- *
- * This routine is responsible for setting default values for the
- * input parameters needed by the AMD_S3_SAVE entry point.
- *
- * @param[in] StdHeader The standard header.
- * @param[in,out] AmdApExeParams Required input parameters for the AMD_LATE_RUN_AP_TASK
- * entry point.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- )
-{
- ASSERT (StdHeader != NULL);
- ASSERT (AmdApExeParams != NULL);
-
- AmdApExeParams->StdHeader = *StdHeader;
- AmdApExeParams->FunctionNumber = 0;
- AmdApExeParams->RelatedDataBlock = NULL;
- AmdApExeParams->RelatedBlockLength = 0;
- return AGESA_SUCCESS;
-}
-
diff --git a/src/vendorcode/amd/agesa/f15/Proc/Common/CommonInits.h b/src/vendorcode/amd/agesa/f15/Proc/Common/CommonInits.h
deleted file mode 100644
index 681bc4a..0000000
--- a/src/vendorcode/amd/agesa/f15/Proc/Common/CommonInits.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * Common initialization routines.
- *
- * Contains common initialization routines across AGESA entries of phases.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
-*****************************************************************************
-*
- * 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 _COMMON_INITS_H_
-#define _COMMON_INITS_H_
-
-/**
- * Common routine to initialize PLATFORM_CONFIGURATION.
- *
- * @param[in,out] PlatformConfig Platform profile/build option config structure
- * @param[in,out] StdHeader AMD standard header config param
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-CommonPlatformConfigInit (
- IN OUT PLATFORM_CONFIGURATION *PlatformConfig,
- IN OUT AMD_CONFIG_PARAMS *StdHeader
- );
-
-#endif // _COMMON_INITS_H_
-
diff --git a/src/vendorcode/amd/agesa/f15/Proc/Common/CommonPage.h b/src/vendorcode/amd/agesa/f15/Proc/Common/CommonPage.h
deleted file mode 100644
index 1dcc6da..0000000
--- a/src/vendorcode/amd/agesa/f15/Proc/Common/CommonPage.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * Create outline and references for Processor Common Component mainpage documentation.
- *
- * Design guides, maintenance guides, and general documentation, are
- * collected using this file onto the documentation mainpage.
- * This file contains doxygen comment blocks, only.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Documentation
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
- ******************************************************************************
- *
- * 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.
- ******************************************************************************
- */
-
-/**
- * @page commonmain Processor Common Component Documentation
- *
- * Additional documentation for the Common component consists of
- *
- * - Maintenance Guides:
- * - @subpage amdconfigparamname "Naming Guidelines for type AMD_CONFIG_PARAMS"
- * - Design Guides:
- * - add here >>>
- *
- */
-
-/**
- * @page amdconfigparamname Naming Guidelines for type AMD_CONFIG_PARAMS
- * @par
- * These are the guidelines for naming objects of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * in AGESA code.
- * <ul>
- *
- * <li>
- * Formal parameter names of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * will always be named
- * StdHeader. This covers all function prototypes, function definitions, and method typedefs (a
- * typedef of a function prototype) in AGESA code. Examples:
- * @n @code
- * VOID
- * LibAmdPciFindNextCap (
- * IN OUT PCI_ADDR *Address,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * )
- *
- * typedef VOID F_DO_TABLE_ENTRY (
- * IN TABLE_ENTRY_DATA *CurrentEntry,
- * IN PLATFORM_CONFIGURATION *PlatformConfig,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * );
- *
- * @endcode
- *
- * <li>
- * Structure members of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * will always be named StdHeader. Examples:
- * @n @code
- /// Example of struct member naming.
- * typedef struct {
- * IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard Header
- * IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
- * } AMD_CPU_RECOVERY_PARAMS;
- *
- * @endcode
- *
- * <li>
- * Routines which define local variables of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * should
- * name the local variable as closely as practical to StdHeader, but otherwise freedom is allowed. Example:
- * @n @code
- * AMD_CONFIG_PARAMS *NewStdHeader;
- * [...]
- * NewStdHeader = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- * @endcode
- *
- * <li>
- * Arguments to routines with AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * formal parameters are not
- * checked. Freedom is allowed in order to conform to these guidelines in a practical, readable
- * way. This includes typecast arguments. Examples:
- * @n @code
- * Status = GetEventLog (&LogEvent, (AMD_CONFIG_PARAMS *)Event);
- *
- * MemS3ExitSelfRefRegDA (NBPtr, &MemPtr->StdHeader);
- * @endcode
- *
- * </ul>
- *
- */
diff --git a/src/vendorcode/amd/agesa/f15/Proc/Common/CreateStruct.c b/src/vendorcode/amd/agesa/f15/Proc/Common/CreateStruct.c
deleted file mode 100644
index f99bd66..0000000
--- a/src/vendorcode/amd/agesa/f15/Proc/Common/CreateStruct.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input structure creation support.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
- ******************************************************************************
- *
- * 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.
- ******************************************************************************
- */
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "GeneralServices.h"
-#include "heapManager.h"
-#include "CreateStruct.h"
-#include "cpuFamilyTranslation.h"
-#include "Filecode.h"
-CODE_GROUP (G1_PEICC)
-RDATA_GROUP (G1_PEICC)
-
-#define FILECODE PROC_COMMON_CREATESTRUCT_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-extern CONST FUNCTION_PARAMS_INFO FuncParamsInfo[];
-extern CONST UINTN InitializerCount;
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern BUILD_OPT_CFG UserOptions;
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Allocate and initialize Config headers and Service Interface structures.
- *
- * This function will be called for each AGESA public APIs.
- * This function will do the following:
- * -# Locate the AGESA API structure parameters initializer function information.
- * -# Find the size of the structure that gets passed to each public APIs as
- * the entry parameter. Allocate heap space using the size for PreMemHeap, callout for
- * memory allocation for PostMemDram, and just set the config and service interface
- * pointers for ByHost.
- * -# If the allocation is not ByHost, copy the AmdConfigParams into the newly created AmdConfigParams.
- * For ByHost, we're using the caller's existing config params.
- * -# Call the initializer function, and pass a reference to the Config params and to
- * the Service Interface struct. On return the constructor will have filled the
- * remaining structure with default values.
- * -# Fill the remaining info in the newly created structure on heap in AMD_CONFIG_PARAMS
- * area (i.e. Fill *newStructPtr with the pointer to the newly created structure)
- * -# Set the appropriate AGESA function number in the StdHeader member of the input
- * parameter structure.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be created, the
- * allocation method, and a pointer to the newly
- * created structure.
- *
- * @retval AGESA_SUCCESS The interface struct is allocated and initialized.
- * @retval AGESA_UNSUPPORTED The Service is not supported.
- *
- */
-AGESA_STATUS
-AmdCreateStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINTN ServiceIndex;
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
- AMD_CONFIG_PARAMS *NewlyCreatedConfig;
- VOID *NewlyCreatedServiceInterface;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- AGESA_STATUS IgnoredSts;
- CPU_SPECIFIC_SERVICES *FamilySpecificServices;
-
- AgesaStatus = AGESA_SUCCESS;
-
- ASSERT (InterfaceParams != NULL);
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- if (!IsBsp (&InterfaceParams->StdHeader, &IgnoredSts)) {
- // APs must transfer their system core number from the mailbox to
- // a local register while it is still valid.
- GetCpuServicesOfCurrentCore ((CONST CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, &InterfaceParams->StdHeader);
- FamilySpecificServices->TransferApCoreNumber (FamilySpecificServices, &InterfaceParams->StdHeader);
- }
- InterfaceParams->StdHeader.HeapStatus = HEAP_DO_NOT_EXIST_YET;
- break;
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_ENV:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
- if (InterfaceParams->AgesaFunctionName == AMD_INIT_RESET) {
- AgesaStatus = HeapManagerInit (&InterfaceParams->StdHeader);
- }
-
- // Step 1
- for (ServiceIndex = 0; ServiceIndex < InitializerCount; ServiceIndex++) {
- if (FuncParamsInfo[ServiceIndex].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (ServiceIndex >= InitializerCount) {
- // A call was made to AGESA with an invalid function number. This wrapper error may be due to the build target
- // not containing the desired entry point.
- return AGESA_UNSUPPORTED;
- }
-
- // Step 2
- LibAmdMemFill (&AllocHeapParams, 0, (UINTN) (sizeof (ALLOCATE_HEAP_PARAMS)), &InterfaceParams->StdHeader);
-
- if (InterfaceParams->AllocationMethod < ByHost) {
- // Allocate one buffer to contain the config params and the service struct.
- // The service struct begins immediately after the config params.
- AllocHeapParams.RequestedBufferSize = FuncParamsInfo[ServiceIndex].CreateStructSize + sizeof (AMD_CONFIG_PARAMS);
- AllocHeapParams.BufferHandle = FuncParamsInfo[ServiceIndex].BufferHandle;
- AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
- TempStatus = HeapAllocateBuffer (&AllocHeapParams, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- NewlyCreatedConfig++;
- NewlyCreatedServiceInterface = NewlyCreatedConfig;
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- } else {
- // The caller (example, agesa basic interface implementation) already has a buffer to use.
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)InterfaceParams;
- NewlyCreatedServiceInterface = InterfaceParams->NewStructPtr;
- ASSERT (InterfaceParams->NewStructSize >= FuncParamsInfo[ServiceIndex].CreateStructSize);
- }
- ASSERT (NewlyCreatedConfig != NULL);
- ASSERT (NewlyCreatedServiceInterface != NULL);
-
- // Step 3
- if (InterfaceParams->AllocationMethod != ByHost) {
- *NewlyCreatedConfig = InterfaceParams->StdHeader;
- }
-
- // Step 4
- TempStatus = FuncParamsInfo[ServiceIndex].AgesaFunction (NewlyCreatedConfig, NewlyCreatedServiceInterface);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
-
- // Step 5
- if (InterfaceParams->AllocationMethod != ByHost) {
- InterfaceParams->NewStructPtr = (VOID *) NewlyCreatedServiceInterface;
- InterfaceParams->NewStructSize = FuncParamsInfo[ServiceIndex].CreateStructSize;
- }
-
- // Step 6
- ((AMD_CONFIG_PARAMS *) InterfaceParams->NewStructPtr)->Func = InterfaceParams->AgesaFunctionName;
- return AgesaStatus;
-}
-
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Clears storage space from allocation for a parameter block of an
- * AGESA software call entry.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be deallocated.
- *
- * @retval AGESA_STATUS
- *
- *---------------------------------------------------------------------------------------
- **/
-AGESA_STATUS
-AmdReleaseStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINT8 i;
- UINT8 *BufferPtr;
- VOID *ServicePtr;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- LOCATE_HEAP_PTR LocHeap;
-
- AgesaStatus = AGESA_SUCCESS;
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_ENV:
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
-// Step 1
- for (i = 0; i < InitializerCount; i++) {
- if (FuncParamsInfo[i].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (i >= InitializerCount) {
- return AGESA_BOUNDS_CHK;
- }
-
- // Step 2
- if (InterfaceParams->AllocationMethod < ByHost) {
- LocHeap.BufferHandle = FuncParamsInfo[i].BufferHandle;
- if (HeapLocateBuffer (&LocHeap, &(InterfaceParams->StdHeader)) == AGESA_SUCCESS) {
- BufferPtr = (UINT8 *) LocHeap.BufferPtr;
- ServicePtr = &BufferPtr[sizeof (AMD_CONFIG_PARAMS)];
- TempStatus = FuncParamsInfo[i].AgesaDestructor (&(InterfaceParams->StdHeader), ServicePtr);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- }
- }
-
- // Step 3
- if (InterfaceParams->AllocationMethod < ByHost) {
- TempStatus = HeapDeallocateBuffer (FuncParamsInfo[i].BufferHandle, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- } else {
- // Unless we define service specific destructors, nothing to do for ByHost.
- return AGESA_SUCCESS;
- }
- return AgesaStatus;
-}
diff --git a/src/vendorcode/amd/agesa/f15/Proc/Common/CreateStruct.h b/src/vendorcode/amd/agesa/f15/Proc/Common/CreateStruct.h
deleted file mode 100644
index 66a7bbf..0000000
--- a/src/vendorcode/amd/agesa/f15/Proc/Common/CreateStruct.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input creation structures.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
- ******************************************************************************
- *
- * 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 _CREATE_STRUCT_H_
-#define _CREATE_STRUCT_H_
-
-/**
- * A constructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * Constructors should avoid using the header, since these routines should not
- * do operations which may fail or require status back to the user. The constructor
- * should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_FUNCTION (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_FUNCTION *PF_AGESA_FUNCTION;
-
-/**
- * A Destructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * The constructor should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header.
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_DESTRUCTOR (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_DESTRUCTOR *PF_AGESA_DESTRUCTOR;
-
-/**
- * Provide the information needed to invoke each service constructor.
- */
-typedef struct {
- IN AGESA_STRUCT_NAME AgesaFunctionName; ///< Identifies the service
- IN UINT16 CreateStructSize; ///< The service's input struct size.
- /// Do NOT include a config params header!
- OUT PF_AGESA_FUNCTION AgesaFunction; ///< The constructor function
- OUT PF_AGESA_DESTRUCTOR AgesaDestructor; ///< The destructor function.
- IN AGESA_BUFFER_HANDLE BufferHandle; ///< The buffer handle id for the service.
-} FUNCTION_PARAMS_INFO;
-
-/**
- * All available services have their constructor info here.
- */
-AGESA_STATUS
-AmdInitResetConstructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_RESET_PARAMS *AmdResetParams
- );
-
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEarlyInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_EARLY_PARAMS *EarlyParams
- );
-
-AGESA_STATUS
-AmdInitPostInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitPostDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEnvInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_ENV_PARAMS *EnvParamsPtr
- );
-
-AGESA_STATUS
-AmdInitMidInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_MID_PARAMS *MidParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitResumeInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdInitResumeDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdS3SaveInitializer (
- IN OUT AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3SaveDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3LateRestoreInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3LATE_PARAMS *S3LateParams
- );
-
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- );
-#endif // _CREATE_STRUCT_H_
-
diff --git a/src/vendorcode/amd/agesa/f15tn/Makefile.inc b/src/vendorcode/amd/agesa/f15tn/Makefile.inc
index 0de46b0..c4a7eeb 100644
--- a/src/vendorcode/amd/agesa/f15tn/Makefile.inc
+++ b/src/vendorcode/amd/agesa/f15tn/Makefile.inc
@@ -36,6 +36,7 @@ AGESA_INC += -I$(AGESA_ROOT)/../common
AGESA_INC += -I$(AGESA_ROOT)/Include
AGESA_INC += -I$(AGESA_ROOT)/Lib
AGESA_INC += -I$(AGESA_ROOT)/Legacy
+AGESA_INC += -I$(AGESA_ROOT)/../common/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/HT
AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU
@@ -169,12 +170,12 @@ libagesa-y += Proc/Common/AmdInitMid.c
libagesa-y += Proc/Common/AmdInitPost.c
libagesa-y += Proc/Common/AmdInitReset.c
libagesa-y += Proc/Common/AmdInitResume.c
-libagesa-y += Proc/Common/AmdLateRunApTask.c
+libagesa-y += ../common/Proc/Common/AmdLateRunApTask.c
libagesa-y += Proc/Common/AmdS3LateRestore.c
libagesa-y += Proc/Common/AmdS3Save.c
libagesa-y += Proc/Common/CommonInits.c
libagesa-y += Proc/Common/CommonReturns.c
-libagesa-y += Proc/Common/CreateStruct.c
+libagesa-y += ../common/Proc/Common/CreateStruct.c
libagesa-y += Proc/Common/S3RestoreState.c
libagesa-y += Proc/Common/S3SaveState.c
libagesa-y += Proc/GNB/Common/GnbLibFeatures.c
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Common/AmdFch.h b/src/vendorcode/amd/agesa/f15tn/Proc/Common/AmdFch.h
deleted file mode 100644
index afe565b..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Common/AmdFch.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD FCH Component
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
-*****************************************************************************
-*
- * 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 _AMD_FCH_H_
-#define _AMD_FCH_H_
-
-typedef AGESA_STATUS FCH_INIT (IN VOID *DataPtr);
-typedef VOID FCH_TASK_ENTRY (IN VOID *FchCfg);
-
-
-/// FCH API build options
-typedef struct {
- FCH_INIT *InitReset; ///< InitReset
- FCH_INIT *InitResetConstructor; ///< InitResetConstructor
- FCH_INIT *InitEnv; ///< InitEnv
- FCH_INIT *InitEnvConstructor; ///< InitEnvConstructor
- FCH_INIT *InitMid; ///< InitMid
- FCH_INIT *InitMidConstructor; ///< InitMidConstructor
- FCH_INIT *InitLate; ///< InitLate
- FCH_INIT *InitLateConstructor; ///< InitLateConstructor
-} BLDOPT_FCH_FUNCTION;
-
-#endif
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Common/AmdInitRecovery.c b/src/vendorcode/amd/agesa/f15tn/Proc/Common/AmdInitRecovery.c
deleted file mode 100644
index ac4c08d..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Common/AmdInitRecovery.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*****************************************************************************
- *
- * 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.
- ******************************************************************************
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "AdvancedApi.h"
-#include "heapManager.h"
-#include "mm.h"
-#include "GnbInterface.h"
-#include "cpuRecovery.h"
-#include "cpuCacheInit.h"
-#include "Filecode.h"
-CODE_GROUP (G2_PEI)
-RDATA_GROUP (G2_PEI)
-
-#define FILECODE PROC_COMMON_AMDINITRECOVERY_FILECODE
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Perform initialization services required at the Early Init POST time point.
- *
- * Execution Cache, HyperTransport, C1e, and AP Init advanced services are performed.
- *
- * @param[in, out] RecoveryParams The interface struct for Recovery services
- *
- * @return The most severe AGESA_STATUS returned by any called service.
- *
- */
-AGESA_STATUS
-AmdInitRecovery (
- IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
- )
-{
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS CalledAgesaStatus;
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryEntry, &RecoveryParams->StdHeader);
-
- ASSERT (RecoveryParams != NULL);
-
- AgesaStatus = AGESA_SUCCESS;
-
- // Setup ROM execution cache
- CalledAgesaStatus = AllocateExecutionCache (&RecoveryParams->StdHeader, &RecoveryParams->CacheRegion[0]);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdHtInitRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdCpuRecovery ((AMD_CPU_RECOVERY_PARAMS *) &RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdMemRecovery (RecoveryParams->MemConfig.MemData);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- CalledAgesaStatus = AmdGnbRecovery (&RecoveryParams->StdHeader);
- if (CalledAgesaStatus > AgesaStatus) {
- AgesaStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdInitRecoveryExit, &RecoveryParams->StdHeader);
- return AgesaStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- *
- * Initialize defaults and options for Amd Init Reset.
- *
- * @param[in] StdHeader AMD standard header config param.
- * @param[in] AmdRecoveryParamsPtr The Reset Init interface to initialize.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- */
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- )
-{
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
-
- ASSERT (StdHeader != NULL);
- ASSERT (AmdRecoveryParamsPtr != NULL);
-
- AmdRecoveryParamsPtr->StdHeader = *StdHeader;
-
- AllocHeapParams.RequestedBufferSize = sizeof (MEM_DATA_STRUCT);
- AllocHeapParams.BufferHandle = AMD_MEM_DATA_HANDLE;
- AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
- if (HeapAllocateBuffer (&AllocHeapParams, &AmdRecoveryParamsPtr->StdHeader) == AGESA_SUCCESS) {
- AmdRecoveryParamsPtr->MemConfig.MemData = (MEM_DATA_STRUCT *) AllocHeapParams.BufferPtr;
- AmdRecoveryParamsPtr->MemConfig.MemData->ParameterListPtr = &(AmdRecoveryParamsPtr->MemConfig);
- LibAmdMemCopy ((VOID *) AmdRecoveryParamsPtr->MemConfig.MemData,
- (VOID *) AmdRecoveryParamsPtr,
- (UINTN) sizeof (AmdRecoveryParamsPtr->StdHeader),
- &AmdRecoveryParamsPtr->StdHeader
- );
- AmdMemInitDataStructDefRecovery (AmdRecoveryParamsPtr->MemConfig.MemData);
- return AGESA_SUCCESS;
- } else {
- return AGESA_ERROR;
- }
-}
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Common/AmdLateRunApTask.c b/src/vendorcode/amd/agesa/f15tn/Proc/Common/AmdLateRunApTask.c
deleted file mode 100644
index b11fca2..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Common/AmdLateRunApTask.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Interface
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*****************************************************************************
- *
- * 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.
- ******************************************************************************
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "Ids.h"
-#include "Options.h"
-#include "Filecode.h"
-#include "heapManager.h"
-#include "CreateStruct.h"
-CODE_GROUP (G3_DXE)
-RDATA_GROUP (G3_DXE)
-
-#define FILECODE PROC_COMMON_AMDLATERUNAPTASK_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern CONST DISPATCH_TABLE ApDispatchTable[];
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Application Processor perform a function as directed by the BSC.
- *
- * This is needed for an AP task that must run after AGESA has relinquished control
- * of the APs to the IBV.
- *
- * @param[in] AmdApExeParams The interface struct for any required routine.
- *
- * @return The most severe AGESA_STATUS returned by any called service. Note
- * that this will be the return value passed back to the BSC as the
- * return value for the call out.
- *
- */
-AGESA_STATUS
-AmdLateRunApTask (
- IN AP_EXE_PARAMS *AmdApExeParams
- )
-{
- AGESA_STATUS CalledAgesaStatus;
- AGESA_STATUS ApLateTaskStatus;
- DISPATCH_TABLE *Entry;
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskEntry, &AmdApExeParams->StdHeader);
-
- ASSERT (AmdApExeParams != NULL);
- ApLateTaskStatus = AGESA_SUCCESS;
- CalledAgesaStatus = AGESA_UNSUPPORTED;
-
- // Dispatch, if valid
- Entry = (DISPATCH_TABLE *) ApDispatchTable;
- while (Entry->FunctionId != 0) {
- if (AmdApExeParams->FunctionNumber == Entry->FunctionId) {
- CalledAgesaStatus = Entry->EntryPoint (AmdApExeParams);
- break;
- }
- Entry++;
- }
-
- if (CalledAgesaStatus > ApLateTaskStatus) {
- ApLateTaskStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskExit, &AmdApExeParams->StdHeader);
- return ApLateTaskStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Constructor for the AMD_LATE_RUN_AP_TASK function.
- *
- * This routine is responsible for setting default values for the
- * input parameters needed by the AMD_S3_SAVE entry point.
- *
- * @param[in] StdHeader The standard header.
- * @param[in,out] AmdApExeParams Required input parameters for the AMD_LATE_RUN_AP_TASK
- * entry point.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- )
-{
- ASSERT (StdHeader != NULL);
- ASSERT (AmdApExeParams != NULL);
-
- AmdApExeParams->StdHeader = *StdHeader;
- AmdApExeParams->FunctionNumber = 0;
- AmdApExeParams->RelatedDataBlock = NULL;
- AmdApExeParams->RelatedBlockLength = 0;
- return AGESA_SUCCESS;
-}
-
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Common/CommonInits.h b/src/vendorcode/amd/agesa/f15tn/Proc/Common/CommonInits.h
deleted file mode 100644
index 681bc4a..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Common/CommonInits.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * Common initialization routines.
- *
- * Contains common initialization routines across AGESA entries of phases.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
-*****************************************************************************
-*
- * 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 _COMMON_INITS_H_
-#define _COMMON_INITS_H_
-
-/**
- * Common routine to initialize PLATFORM_CONFIGURATION.
- *
- * @param[in,out] PlatformConfig Platform profile/build option config structure
- * @param[in,out] StdHeader AMD standard header config param
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-CommonPlatformConfigInit (
- IN OUT PLATFORM_CONFIGURATION *PlatformConfig,
- IN OUT AMD_CONFIG_PARAMS *StdHeader
- );
-
-#endif // _COMMON_INITS_H_
-
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Common/CommonPage.h b/src/vendorcode/amd/agesa/f15tn/Proc/Common/CommonPage.h
deleted file mode 100644
index 1dcc6da..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Common/CommonPage.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * Create outline and references for Processor Common Component mainpage documentation.
- *
- * Design guides, maintenance guides, and general documentation, are
- * collected using this file onto the documentation mainpage.
- * This file contains doxygen comment blocks, only.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Documentation
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
- ******************************************************************************
- *
- * 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.
- ******************************************************************************
- */
-
-/**
- * @page commonmain Processor Common Component Documentation
- *
- * Additional documentation for the Common component consists of
- *
- * - Maintenance Guides:
- * - @subpage amdconfigparamname "Naming Guidelines for type AMD_CONFIG_PARAMS"
- * - Design Guides:
- * - add here >>>
- *
- */
-
-/**
- * @page amdconfigparamname Naming Guidelines for type AMD_CONFIG_PARAMS
- * @par
- * These are the guidelines for naming objects of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * in AGESA code.
- * <ul>
- *
- * <li>
- * Formal parameter names of type AMD_CONFIG_PARAMS and AMD_CONFIG_PARAMS * will always be named
- * StdHeader. This covers all function prototypes, function definitions, and method typedefs (a
- * typedef of a function prototype) in AGESA code. Examples:
- * @n @code
- * VOID
- * LibAmdPciFindNextCap (
- * IN OUT PCI_ADDR *Address,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * )
- *
- * typedef VOID F_DO_TABLE_ENTRY (
- * IN TABLE_ENTRY_DATA *CurrentEntry,
- * IN PLATFORM_CONFIGURATION *PlatformConfig,
- * IN AMD_CONFIG_PARAMS *StdHeader
- * );
- *
- * @endcode
- *
- * <li>
- * Structure members of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * will always be named StdHeader. Examples:
- * @n @code
- /// Example of struct member naming.
- * typedef struct {
- * IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard Header
- * IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
- * } AMD_CPU_RECOVERY_PARAMS;
- *
- * @endcode
- *
- * <li>
- * Routines which define local variables of type AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * should
- * name the local variable as closely as practical to StdHeader, but otherwise freedom is allowed. Example:
- * @n @code
- * AMD_CONFIG_PARAMS *NewStdHeader;
- * [...]
- * NewStdHeader = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- * @endcode
- *
- * <li>
- * Arguments to routines with AMD_CONFIG_PARAMS or AMD_CONFIG_PARAMS * formal parameters are not
- * checked. Freedom is allowed in order to conform to these guidelines in a practical, readable
- * way. This includes typecast arguments. Examples:
- * @n @code
- * Status = GetEventLog (&LogEvent, (AMD_CONFIG_PARAMS *)Event);
- *
- * MemS3ExitSelfRefRegDA (NBPtr, &MemPtr->StdHeader);
- * @endcode
- *
- * </ul>
- *
- */
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.c b/src/vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.c
deleted file mode 100644
index f99bd66..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input structure creation support.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
- ******************************************************************************
- *
- * 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.
- ******************************************************************************
- */
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "GeneralServices.h"
-#include "heapManager.h"
-#include "CreateStruct.h"
-#include "cpuFamilyTranslation.h"
-#include "Filecode.h"
-CODE_GROUP (G1_PEICC)
-RDATA_GROUP (G1_PEICC)
-
-#define FILECODE PROC_COMMON_CREATESTRUCT_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-extern CONST FUNCTION_PARAMS_INFO FuncParamsInfo[];
-extern CONST UINTN InitializerCount;
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern BUILD_OPT_CFG UserOptions;
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Allocate and initialize Config headers and Service Interface structures.
- *
- * This function will be called for each AGESA public APIs.
- * This function will do the following:
- * -# Locate the AGESA API structure parameters initializer function information.
- * -# Find the size of the structure that gets passed to each public APIs as
- * the entry parameter. Allocate heap space using the size for PreMemHeap, callout for
- * memory allocation for PostMemDram, and just set the config and service interface
- * pointers for ByHost.
- * -# If the allocation is not ByHost, copy the AmdConfigParams into the newly created AmdConfigParams.
- * For ByHost, we're using the caller's existing config params.
- * -# Call the initializer function, and pass a reference to the Config params and to
- * the Service Interface struct. On return the constructor will have filled the
- * remaining structure with default values.
- * -# Fill the remaining info in the newly created structure on heap in AMD_CONFIG_PARAMS
- * area (i.e. Fill *newStructPtr with the pointer to the newly created structure)
- * -# Set the appropriate AGESA function number in the StdHeader member of the input
- * parameter structure.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be created, the
- * allocation method, and a pointer to the newly
- * created structure.
- *
- * @retval AGESA_SUCCESS The interface struct is allocated and initialized.
- * @retval AGESA_UNSUPPORTED The Service is not supported.
- *
- */
-AGESA_STATUS
-AmdCreateStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINTN ServiceIndex;
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
- AMD_CONFIG_PARAMS *NewlyCreatedConfig;
- VOID *NewlyCreatedServiceInterface;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- AGESA_STATUS IgnoredSts;
- CPU_SPECIFIC_SERVICES *FamilySpecificServices;
-
- AgesaStatus = AGESA_SUCCESS;
-
- ASSERT (InterfaceParams != NULL);
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- if (!IsBsp (&InterfaceParams->StdHeader, &IgnoredSts)) {
- // APs must transfer their system core number from the mailbox to
- // a local register while it is still valid.
- GetCpuServicesOfCurrentCore ((CONST CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, &InterfaceParams->StdHeader);
- FamilySpecificServices->TransferApCoreNumber (FamilySpecificServices, &InterfaceParams->StdHeader);
- }
- InterfaceParams->StdHeader.HeapStatus = HEAP_DO_NOT_EXIST_YET;
- break;
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_ENV:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
- if (InterfaceParams->AgesaFunctionName == AMD_INIT_RESET) {
- AgesaStatus = HeapManagerInit (&InterfaceParams->StdHeader);
- }
-
- // Step 1
- for (ServiceIndex = 0; ServiceIndex < InitializerCount; ServiceIndex++) {
- if (FuncParamsInfo[ServiceIndex].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (ServiceIndex >= InitializerCount) {
- // A call was made to AGESA with an invalid function number. This wrapper error may be due to the build target
- // not containing the desired entry point.
- return AGESA_UNSUPPORTED;
- }
-
- // Step 2
- LibAmdMemFill (&AllocHeapParams, 0, (UINTN) (sizeof (ALLOCATE_HEAP_PARAMS)), &InterfaceParams->StdHeader);
-
- if (InterfaceParams->AllocationMethod < ByHost) {
- // Allocate one buffer to contain the config params and the service struct.
- // The service struct begins immediately after the config params.
- AllocHeapParams.RequestedBufferSize = FuncParamsInfo[ServiceIndex].CreateStructSize + sizeof (AMD_CONFIG_PARAMS);
- AllocHeapParams.BufferHandle = FuncParamsInfo[ServiceIndex].BufferHandle;
- AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
- TempStatus = HeapAllocateBuffer (&AllocHeapParams, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- NewlyCreatedConfig++;
- NewlyCreatedServiceInterface = NewlyCreatedConfig;
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- } else {
- // The caller (example, agesa basic interface implementation) already has a buffer to use.
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)InterfaceParams;
- NewlyCreatedServiceInterface = InterfaceParams->NewStructPtr;
- ASSERT (InterfaceParams->NewStructSize >= FuncParamsInfo[ServiceIndex].CreateStructSize);
- }
- ASSERT (NewlyCreatedConfig != NULL);
- ASSERT (NewlyCreatedServiceInterface != NULL);
-
- // Step 3
- if (InterfaceParams->AllocationMethod != ByHost) {
- *NewlyCreatedConfig = InterfaceParams->StdHeader;
- }
-
- // Step 4
- TempStatus = FuncParamsInfo[ServiceIndex].AgesaFunction (NewlyCreatedConfig, NewlyCreatedServiceInterface);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
-
- // Step 5
- if (InterfaceParams->AllocationMethod != ByHost) {
- InterfaceParams->NewStructPtr = (VOID *) NewlyCreatedServiceInterface;
- InterfaceParams->NewStructSize = FuncParamsInfo[ServiceIndex].CreateStructSize;
- }
-
- // Step 6
- ((AMD_CONFIG_PARAMS *) InterfaceParams->NewStructPtr)->Func = InterfaceParams->AgesaFunctionName;
- return AgesaStatus;
-}
-
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Clears storage space from allocation for a parameter block of an
- * AGESA software call entry.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be deallocated.
- *
- * @retval AGESA_STATUS
- *
- *---------------------------------------------------------------------------------------
- **/
-AGESA_STATUS
-AmdReleaseStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINT8 i;
- UINT8 *BufferPtr;
- VOID *ServicePtr;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- LOCATE_HEAP_PTR LocHeap;
-
- AgesaStatus = AGESA_SUCCESS;
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_ENV:
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
-// Step 1
- for (i = 0; i < InitializerCount; i++) {
- if (FuncParamsInfo[i].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (i >= InitializerCount) {
- return AGESA_BOUNDS_CHK;
- }
-
- // Step 2
- if (InterfaceParams->AllocationMethod < ByHost) {
- LocHeap.BufferHandle = FuncParamsInfo[i].BufferHandle;
- if (HeapLocateBuffer (&LocHeap, &(InterfaceParams->StdHeader)) == AGESA_SUCCESS) {
- BufferPtr = (UINT8 *) LocHeap.BufferPtr;
- ServicePtr = &BufferPtr[sizeof (AMD_CONFIG_PARAMS)];
- TempStatus = FuncParamsInfo[i].AgesaDestructor (&(InterfaceParams->StdHeader), ServicePtr);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- }
- }
-
- // Step 3
- if (InterfaceParams->AllocationMethod < ByHost) {
- TempStatus = HeapDeallocateBuffer (FuncParamsInfo[i].BufferHandle, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- } else {
- // Unless we define service specific destructors, nothing to do for ByHost.
- return AGESA_SUCCESS;
- }
- return AgesaStatus;
-}
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.h b/src/vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.h
deleted file mode 100644
index 66a7bbf..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Common/CreateStruct.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input creation structures.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
- ******************************************************************************
- *
- * 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 _CREATE_STRUCT_H_
-#define _CREATE_STRUCT_H_
-
-/**
- * A constructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * Constructors should avoid using the header, since these routines should not
- * do operations which may fail or require status back to the user. The constructor
- * should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_FUNCTION (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_FUNCTION *PF_AGESA_FUNCTION;
-
-/**
- * A Destructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * The constructor should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header.
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_DESTRUCTOR (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_DESTRUCTOR *PF_AGESA_DESTRUCTOR;
-
-/**
- * Provide the information needed to invoke each service constructor.
- */
-typedef struct {
- IN AGESA_STRUCT_NAME AgesaFunctionName; ///< Identifies the service
- IN UINT16 CreateStructSize; ///< The service's input struct size.
- /// Do NOT include a config params header!
- OUT PF_AGESA_FUNCTION AgesaFunction; ///< The constructor function
- OUT PF_AGESA_DESTRUCTOR AgesaDestructor; ///< The destructor function.
- IN AGESA_BUFFER_HANDLE BufferHandle; ///< The buffer handle id for the service.
-} FUNCTION_PARAMS_INFO;
-
-/**
- * All available services have their constructor info here.
- */
-AGESA_STATUS
-AmdInitResetConstructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_RESET_PARAMS *AmdResetParams
- );
-
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEarlyInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_EARLY_PARAMS *EarlyParams
- );
-
-AGESA_STATUS
-AmdInitPostInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitPostDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEnvInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_ENV_PARAMS *EnvParamsPtr
- );
-
-AGESA_STATUS
-AmdInitMidInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_MID_PARAMS *MidParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitResumeInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdInitResumeDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdS3SaveInitializer (
- IN OUT AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3SaveDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3LateRestoreInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3LATE_PARAMS *S3LateParams
- );
-
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- );
-#endif // _CREATE_STRUCT_H_
-
diff --git a/src/vendorcode/amd/agesa/f16kb/Makefile.inc b/src/vendorcode/amd/agesa/f16kb/Makefile.inc
index 5ce7aee..ab82bcc 100644
--- a/src/vendorcode/amd/agesa/f16kb/Makefile.inc
+++ b/src/vendorcode/amd/agesa/f16kb/Makefile.inc
@@ -36,6 +36,7 @@ AGESA_INC += -I$(AGESA_ROOT)/../common
AGESA_INC += -I$(AGESA_ROOT)/Include
AGESA_INC += -I$(AGESA_ROOT)/Lib
AGESA_INC += -I$(AGESA_ROOT)/Legacy
+AGESA_INC += -I$(AGESA_ROOT)/../common/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/HT
AGESA_INC += -I$(AGESA_ROOT)/Proc/CPU
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Common/AmdFch.h b/src/vendorcode/amd/agesa/f16kb/Proc/Common/AmdFch.h
deleted file mode 100644
index adef011..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Common/AmdFch.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD FCH Component
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*
-*****************************************************************************
-*
- * Copyright (c) 2008 - 2013, 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 _AMD_FCH_H_
-#define _AMD_FCH_H_
-
-typedef AGESA_STATUS FCH_INIT (IN VOID *DataPtr);
-typedef VOID FCH_TASK_ENTRY (IN VOID *FchCfg);
-
-
-/// FCH API build options
-typedef struct {
- FCH_INIT *InitReset; ///< InitReset
- FCH_INIT *InitResetConstructor; ///< InitResetConstructor
- FCH_INIT *InitEnv; ///< InitEnv
- FCH_INIT *InitEnvConstructor; ///< InitEnvConstructor
- FCH_INIT *InitMid; ///< InitMid
- FCH_INIT *InitMidConstructor; ///< InitMidConstructor
- FCH_INIT *InitLate; ///< InitLate
- FCH_INIT *InitLateConstructor; ///< InitLateConstructor
-} BLDOPT_FCH_FUNCTION;
-
-#endif
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Common/AmdLateRunApTask.c b/src/vendorcode/amd/agesa/f16kb/Proc/Common/AmdLateRunApTask.c
deleted file mode 100644
index b7e125e..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Common/AmdLateRunApTask.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Basic Level Public APIs
- *
- * Contains basic Level Initialization routines.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Interface
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*****************************************************************************
- *
- * Copyright (c) 2008 - 2013, 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.
- ******************************************************************************
- */
-
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "Ids.h"
-#include "Options.h"
-#include "Filecode.h"
-#include "heapManager.h"
-#include "CreateStruct.h"
-CODE_GROUP (G3_DXE)
-RDATA_GROUP (G3_DXE)
-
-#define FILECODE PROC_COMMON_AMDLATERUNAPTASK_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern CONST DISPATCH_TABLE ApDispatchTable[];
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Application Processor perform a function as directed by the BSC.
- *
- * This is needed for an AP task that must run after AGESA has relinquished control
- * of the APs to the IBV.
- *
- * @param[in] AmdApExeParams The interface struct for any required routine.
- *
- * @return The most severe AGESA_STATUS returned by any called service. Note
- * that this will be the return value passed back to the BSC as the
- * return value for the call out.
- *
- */
-AGESA_STATUS
-AmdLateRunApTask (
- IN AP_EXE_PARAMS *AmdApExeParams
- )
-{
- AGESA_STATUS CalledAgesaStatus;
- AGESA_STATUS ApLateTaskStatus;
- DISPATCH_TABLE *Entry;
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskEntry, &AmdApExeParams->StdHeader);
-
- ASSERT (AmdApExeParams != NULL);
- ApLateTaskStatus = AGESA_SUCCESS;
- CalledAgesaStatus = AGESA_UNSUPPORTED;
-
- // Dispatch, if valid
- Entry = (DISPATCH_TABLE *) ApDispatchTable;
- while (Entry->FunctionId != 0) {
- if (AmdApExeParams->FunctionNumber == Entry->FunctionId) {
- CalledAgesaStatus = Entry->EntryPoint (AmdApExeParams);
- break;
- }
- Entry++;
- }
-
- if (CalledAgesaStatus > ApLateTaskStatus) {
- ApLateTaskStatus = CalledAgesaStatus;
- }
-
- AGESA_TESTPOINT (TpIfAmdLateRunApTaskExit, &AmdApExeParams->StdHeader);
- return ApLateTaskStatus;
-}
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Constructor for the AMD_LATE_RUN_AP_TASK function.
- *
- * This routine is responsible for setting default values for the
- * input parameters needed by the AMD_S3_SAVE entry point.
- *
- * @param[in] StdHeader The standard header.
- * @param[in,out] AmdApExeParams Required input parameters for the AMD_LATE_RUN_AP_TASK
- * entry point.
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- )
-{
- ASSERT (StdHeader != NULL);
- ASSERT (AmdApExeParams != NULL);
-
- AmdApExeParams->StdHeader = *StdHeader;
- AmdApExeParams->FunctionNumber = 0;
- AmdApExeParams->RelatedDataBlock = NULL;
- AmdApExeParams->RelatedBlockLength = 0;
- return AGESA_SUCCESS;
-}
-
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Common/CommonInits.h b/src/vendorcode/amd/agesa/f16kb/Proc/Common/CommonInits.h
deleted file mode 100644
index d08cbf8..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Common/CommonInits.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * Common initialization routines.
- *
- * Contains common initialization routines across AGESA entries of phases.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*
-*****************************************************************************
-*
- * Copyright (c) 2008 - 2013, 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 _COMMON_INITS_H_
-#define _COMMON_INITS_H_
-
-/**
- * Common routine to initialize PLATFORM_CONFIGURATION.
- *
- * @param[in,out] PlatformConfig Platform profile/build option config structure
- * @param[in,out] StdHeader AMD standard header config param
- *
- * @retval AGESA_SUCCESS Always Succeeds.
- *
- */
-AGESA_STATUS
-CommonPlatformConfigInit (
- IN OUT PLATFORM_CONFIGURATION *PlatformConfig,
- IN OUT AMD_CONFIG_PARAMS *StdHeader
- );
-
-#endif // _COMMON_INITS_H_
-
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Common/CreateStruct.c b/src/vendorcode/amd/agesa/f16kb/Proc/Common/CreateStruct.c
deleted file mode 100644
index 8468d3b..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Common/CreateStruct.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input structure creation support.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*
- ******************************************************************************
- *
- * Copyright (c) 2008 - 2013, 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.
- ******************************************************************************
- */
-
-/*----------------------------------------------------------------------------------------
- * M O D U L E S U S E D
- *----------------------------------------------------------------------------------------
- */
-#include "AGESA.h"
-#include "amdlib.h"
-#include "Ids.h"
-#include "GeneralServices.h"
-#include "heapManager.h"
-#include "CreateStruct.h"
-#include "cpuFamilyTranslation.h"
-#include "Filecode.h"
-CODE_GROUP (G1_PEICC)
-RDATA_GROUP (G1_PEICC)
-
-#define FILECODE PROC_COMMON_CREATESTRUCT_FILECODE
-/*----------------------------------------------------------------------------------------
- * D E F I N I T I O N S A N D M A C R O S
- *----------------------------------------------------------------------------------------
- */
-extern CONST FUNCTION_PARAMS_INFO FuncParamsInfo[];
-extern CONST UINTN InitializerCount;
-
-/*----------------------------------------------------------------------------------------
- * T Y P E D E F S A N D S T R U C T U R E S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * P R O T O T Y P E S O F L O C A L F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-
-/*----------------------------------------------------------------------------------------
- * E X P O R T E D F U N C T I O N S
- *----------------------------------------------------------------------------------------
- */
-extern BUILD_OPT_CFG UserOptions;
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Allocate and initialize Config headers and Service Interface structures.
- *
- * This function will be called for each AGESA public APIs.
- * This function will do the following:
- * -# Locate the AGESA API structure parameters initializer function information.
- * -# Find the size of the structure that gets passed to each public APIs as
- * the entry parameter. Allocate heap space using the size for PreMemHeap, callout for
- * memory allocation for PostMemDram, and just set the config and service interface
- * pointers for ByHost.
- * -# If the allocation is not ByHost, copy the AmdConfigParams into the newly created AmdConfigParams.
- * For ByHost, we're using the caller's existing config params.
- * -# Call the initializer function, and pass a reference to the Config params and to
- * the Service Interface struct. On return the constructor will have filled the
- * remaining structure with default values.
- * -# Fill the remaining info in the newly created structure on heap in AMD_CONFIG_PARAMS
- * area (i.e. Fill *newStructPtr with the pointer to the newly created structure)
- * -# Set the appropriate AGESA function number in the StdHeader member of the input
- * parameter structure.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be created, the
- * allocation method, and a pointer to the newly
- * created structure.
- *
- * @retval AGESA_SUCCESS The interface struct is allocated and initialized.
- * @retval AGESA_UNSUPPORTED The Service is not supported.
- *
- */
-AGESA_STATUS
-AmdCreateStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINTN ServiceIndex;
- ALLOCATE_HEAP_PARAMS AllocHeapParams;
- AMD_CONFIG_PARAMS *NewlyCreatedConfig;
- VOID *NewlyCreatedServiceInterface;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- AGESA_STATUS IgnoredSts;
- CPU_SPECIFIC_SERVICES *FamilySpecificServices;
-
- AgesaStatus = AGESA_SUCCESS;
-
- ASSERT (InterfaceParams != NULL);
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- if (!IsBsp (&InterfaceParams->StdHeader, &IgnoredSts)) {
- // APs must transfer their system core number from the mailbox to
- // a local register while it is still valid.
- GetCpuServicesOfCurrentCore ((CONST CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, &InterfaceParams->StdHeader);
- FamilySpecificServices->TransferApCoreNumber (FamilySpecificServices, &InterfaceParams->StdHeader);
- }
- InterfaceParams->StdHeader.HeapStatus = HEAP_DO_NOT_EXIST_YET;
- break;
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_ENV:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
- if (InterfaceParams->AgesaFunctionName == AMD_INIT_RESET) {
- AgesaStatus = HeapManagerInit (&InterfaceParams->StdHeader);
- }
-
- // Step 1
- for (ServiceIndex = 0; ServiceIndex < InitializerCount; ServiceIndex++) {
- if (FuncParamsInfo[ServiceIndex].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (ServiceIndex >= InitializerCount) {
- // A call was made to AGESA with an invalid function number. This wrapper error may be due to the build target
- // not containing the desired entry point.
- return AGESA_UNSUPPORTED;
- }
-
- // Step 2
- LibAmdMemFill (&AllocHeapParams, 0, (UINTN) (sizeof (ALLOCATE_HEAP_PARAMS)), &InterfaceParams->StdHeader);
-
- if (InterfaceParams->AllocationMethod < ByHost) {
- // Allocate one buffer to contain the config params and the service struct.
- // The service struct begins immediately after the config params.
- AllocHeapParams.RequestedBufferSize = FuncParamsInfo[ServiceIndex].CreateStructSize + sizeof (AMD_CONFIG_PARAMS);
- AllocHeapParams.BufferHandle = FuncParamsInfo[ServiceIndex].BufferHandle;
- AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
- TempStatus = HeapAllocateBuffer (&AllocHeapParams, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- NewlyCreatedConfig++;
- NewlyCreatedServiceInterface = NewlyCreatedConfig;
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)AllocHeapParams.BufferPtr;
- } else {
- // The caller (example, agesa basic interface implementation) already has a buffer to use.
- NewlyCreatedConfig = (AMD_CONFIG_PARAMS *)InterfaceParams;
- NewlyCreatedServiceInterface = InterfaceParams->NewStructPtr;
- ASSERT (InterfaceParams->NewStructSize >= FuncParamsInfo[ServiceIndex].CreateStructSize);
- }
- ASSERT (NewlyCreatedConfig != NULL);
- ASSERT (NewlyCreatedServiceInterface != NULL);
-
- // Step 3
- if (InterfaceParams->AllocationMethod != ByHost) {
- *NewlyCreatedConfig = InterfaceParams->StdHeader;
- }
-
- // Step 4
- TempStatus = FuncParamsInfo[ServiceIndex].AgesaFunction (NewlyCreatedConfig, NewlyCreatedServiceInterface);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
-
- // Step 5
- if (InterfaceParams->AllocationMethod != ByHost) {
- InterfaceParams->NewStructPtr = (VOID *) NewlyCreatedServiceInterface;
- InterfaceParams->NewStructSize = FuncParamsInfo[ServiceIndex].CreateStructSize;
- }
-
- // Step 6
- ((AMD_CONFIG_PARAMS *) InterfaceParams->NewStructPtr)->Func = InterfaceParams->AgesaFunctionName;
- return AgesaStatus;
-}
-
-
-/*---------------------------------------------------------------------------------------*/
-/**
- * Clears storage space from allocation for a parameter block of an
- * AGESA software call entry.
- *
- * @param[in,out] InterfaceParams Pointer to structure containing the function call
- * whose parameter structure is to be deallocated.
- *
- * @retval AGESA_STATUS
- *
- *---------------------------------------------------------------------------------------
- **/
-AGESA_STATUS
-AmdReleaseStruct (
- IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
- )
-{
- UINT8 i;
- UINT8 *BufferPtr;
- VOID *ServicePtr;
- AGESA_STATUS AgesaStatus;
- AGESA_STATUS TempStatus;
- LOCATE_HEAP_PTR LocHeap;
-
- AgesaStatus = AGESA_SUCCESS;
-
- switch (InterfaceParams->AgesaFunctionName) {
- case AMD_INIT_RESET:
- case AMD_INIT_EARLY:
- case AMD_INIT_RECOVERY:
- case AMD_INIT_RESUME:
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- case AMD_INIT_POST:
- InterfaceParams->StdHeader.HeapStatus = HEAP_TEMP_MEM;
- break;
- case AMD_INIT_ENV:
- case AMD_INIT_LATE:
- case AMD_INIT_MID:
- case AMD_S3_SAVE:
- case AMD_LATE_RUN_AP_TASK:
- InterfaceParams->StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
- break;
- case AMD_S3LATE_RESTORE:
- InterfaceParams->StdHeader.HeapStatus = HEAP_S3_RESUME;
- break;
- default:
- ASSERT (FALSE);
- InterfaceParams->StdHeader.HeapStatus = HEAP_LOCAL_CACHE;
- break;
- }
-
- InterfaceParams->StdHeader.HeapBasePtr = HeapGetBaseAddress (&InterfaceParams->StdHeader);
-
-// Step 1
- for (i = 0; i < InitializerCount; i++) {
- if (FuncParamsInfo[i].AgesaFunctionName == InterfaceParams->AgesaFunctionName) {
- break;
- }
- }
- if (i >= InitializerCount) {
- return AGESA_BOUNDS_CHK;
- }
-
- // Step 2
- if (InterfaceParams->AllocationMethod < ByHost) {
- LocHeap.BufferHandle = FuncParamsInfo[i].BufferHandle;
- if (HeapLocateBuffer (&LocHeap, &(InterfaceParams->StdHeader)) == AGESA_SUCCESS) {
- BufferPtr = (UINT8 *) LocHeap.BufferPtr;
- ServicePtr = &BufferPtr[sizeof (AMD_CONFIG_PARAMS)];
- TempStatus = FuncParamsInfo[i].AgesaDestructor (&(InterfaceParams->StdHeader), ServicePtr);
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- }
- }
-
- // Step 3
- if (InterfaceParams->AllocationMethod < ByHost) {
- TempStatus = HeapDeallocateBuffer (FuncParamsInfo[i].BufferHandle, &(InterfaceParams->StdHeader));
- AgesaStatus = ((AgesaStatus > TempStatus) ? AgesaStatus : TempStatus);
- } else {
- // Unless we define service specific destructors, nothing to do for ByHost.
- return AGESA_SUCCESS;
- }
- return AgesaStatus;
-}
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Common/CreateStruct.h b/src/vendorcode/amd/agesa/f16kb/Proc/Common/CreateStruct.h
deleted file mode 100644
index 6b67f5f..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Common/CreateStruct.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * AMD AGESA Input Structure Creation
- *
- * Contains AGESA input creation structures.
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: Common
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*
- ******************************************************************************
- *
- * Copyright (c) 2008 - 2013, 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 _CREATE_STRUCT_H_
-#define _CREATE_STRUCT_H_
-
-/**
- * A constructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * Constructors should avoid using the header, since these routines should not
- * do operations which may fail or require status back to the user. The constructor
- * should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_FUNCTION (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_FUNCTION *PF_AGESA_FUNCTION;
-
-/**
- * A Destructor method.
- *
- * Sets inputs to valid, basic level, defaults for the specific service instance.
- * The constructor should always SUCCEED.
- *
- * @param[in] StdHeader Opaque handle to standard config header.
- * @param[in] ServiceInterface Service Interface structure to initialize.
- *
- * @retval AGESA_SUCCESS Constructors are not allowed to fail
-*/
-typedef AGESA_STATUS
-F_AGESA_DESTRUCTOR (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN VOID *ServiceInterface
- );
-
-/// Reference to a Method.
-typedef F_AGESA_DESTRUCTOR *PF_AGESA_DESTRUCTOR;
-
-/**
- * Provide the information needed to invoke each service constructor.
- */
-typedef struct {
- IN AGESA_STRUCT_NAME AgesaFunctionName; ///< Identifies the service
- IN UINT16 CreateStructSize; ///< The service's input struct size.
- /// Do NOT include a config params header!
- OUT PF_AGESA_FUNCTION AgesaFunction; ///< The constructor function
- OUT PF_AGESA_DESTRUCTOR AgesaDestructor; ///< The destructor function.
- IN AGESA_BUFFER_HANDLE BufferHandle; ///< The buffer handle id for the service.
-} FUNCTION_PARAMS_INFO;
-
-/**
- * All available services have their constructor info here.
- */
-AGESA_STATUS
-AmdInitResetConstructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_RESET_PARAMS *AmdResetParams
- );
-
-AGESA_STATUS
-AmdInitRecoveryInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEarlyInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_EARLY_PARAMS *EarlyParams
- );
-
-AGESA_STATUS
-AmdInitPostInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitPostDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_POST_PARAMS *PostParamsPtr
- );
-
-AGESA_STATUS
-AmdInitEnvInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_ENV_PARAMS *EnvParamsPtr
- );
-
-AGESA_STATUS
-AmdInitMidInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_MID_PARAMS *MidParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitLateDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN AMD_LATE_PARAMS *LateParamsPtr
- );
-
-AGESA_STATUS
-AmdInitResumeInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdInitResumeDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_RESUME_PARAMS *ResumeParams
- );
-
-AGESA_STATUS
-AmdS3SaveInitializer (
- IN OUT AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3SaveDestructor (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3SAVE_PARAMS *S3SaveParams
- );
-
-AGESA_STATUS
-AmdS3LateRestoreInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AMD_S3LATE_PARAMS *S3LateParams
- );
-
-AGESA_STATUS
-AmdLateRunApTaskInitializer (
- IN AMD_CONFIG_PARAMS *StdHeader,
- IN OUT AP_EXE_PARAMS *AmdApExeParams
- );
-#endif // _CREATE_STRUCT_H_
-
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/7782
-gerrit
commit f07d6b938e33368302ecf619679bae1f081c9fde
Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
Date: Thu Dec 11 01:26:33 2014 +1100
AGESA: Unify some of f*/Proc/Fch/Common
Sanitize some board includes to match the refactor.
Change-Id: I690e0bbcf11cf143bc63bb960b2357809926cda2
Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
---
src/cpu/amd/agesa/family16kb/Makefile.inc | 2 +-
src/mainboard/amd/olivehill/BiosCallOuts.c | 2 +-
src/mainboard/amd/parmer/BiosCallOuts.c | 2 +-
src/mainboard/amd/thatcher/BiosCallOuts.c | 2 +-
src/mainboard/asrock/imb-a180/BiosCallOuts.c | 2 +-
src/mainboard/asus/f2a85-m/BiosCallOuts.c | 2 +-
src/mainboard/asus/f2a85-m_le/BiosCallOuts.c | 2 +-
src/mainboard/gizmosphere/gizmo2/BiosCallOuts.c | 2 +-
src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c | 2 +-
src/mainboard/lenovo/g505s/BiosCallOuts.c | 2 +-
.../amd/agesa/common/Proc/Fch/Common/AcpiLib.c | 243 +++++++++++++++++++++
.../amd/agesa/common/Proc/Fch/Common/AcpiLib.h | 91 ++++++++
.../amd/agesa/common/Proc/Fch/Common/MemLib.c | 144 ++++++++++++
.../amd/agesa/common/Proc/Fch/Common/PciLib.c | 94 ++++++++
.../amd/agesa/common/Proc/Fch/FchPlatform.h | 128 +++++++++++
.../amd/agesa/f12/Proc/Fch/Common/AcpiLib.c | 231 --------------------
.../amd/agesa/f12/Proc/Fch/Common/AcpiLib.h | 87 --------
.../amd/agesa/f12/Proc/Fch/Common/MemLib.c | 144 ------------
.../amd/agesa/f12/Proc/Fch/Common/PciLib.c | 94 --------
.../amd/agesa/f12/Proc/Fch/FchPlatform.h | 117 ----------
src/vendorcode/amd/agesa/f15tn/Makefile.inc | 5 +-
.../amd/agesa/f15tn/Proc/Fch/Common/AcpiLib.c | 243 ---------------------
.../amd/agesa/f15tn/Proc/Fch/Common/AcpiLib.h | 87 --------
.../amd/agesa/f15tn/Proc/Fch/Common/MemLib.c | 144 ------------
.../amd/agesa/f15tn/Proc/Fch/Common/PciLib.c | 94 --------
.../amd/agesa/f15tn/Proc/Fch/FchPlatform.h | 128 -----------
src/vendorcode/amd/agesa/f16kb/Makefile.inc | 1 +
.../amd/agesa/f16kb/Proc/Fch/Common/AcpiLib.c | 242 --------------------
.../amd/agesa/f16kb/Proc/Fch/Common/AcpiLib.h | 91 --------
.../amd/agesa/f16kb/Proc/Fch/Common/MemLib.c | 145 ------------
.../amd/agesa/f16kb/Proc/Fch/Common/PciLib.c | 94 --------
.../amd/agesa/f16kb/Proc/Fch/FchPlatform.h | 127 -----------
32 files changed, 714 insertions(+), 2080 deletions(-)
diff --git a/src/cpu/amd/agesa/family16kb/Makefile.inc b/src/cpu/amd/agesa/family16kb/Makefile.inc
index c0c98e5..58294f1 100644
--- a/src/cpu/amd/agesa/family16kb/Makefile.inc
+++ b/src/cpu/amd/agesa/family16kb/Makefile.inc
@@ -311,7 +311,7 @@ agesa_lib_src += $(AGESA_ROOT)/Proc/Fch/Azalia/AzaliaEnv.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Fch/Azalia/AzaliaLate.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Fch/Azalia/AzaliaMid.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Fch/Azalia/AzaliaReset.c
-agesa_lib_src += $(AGESA_ROOT)/Proc/Fch/Common/AcpiLib.c
+agesa_lib_src += $(AGESA_ROOT)/../common/Proc/Fch/Common/AcpiLib.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Fch/Common/FchCommon.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Fch/Common/FchLib.c
agesa_lib_src += $(AGESA_ROOT)/Proc/Fch/Common/FchPeLib.c
diff --git a/src/mainboard/amd/olivehill/BiosCallOuts.c b/src/mainboard/amd/olivehill/BiosCallOuts.c
index 97f8769..d944f55 100644
--- a/src/mainboard/amd/olivehill/BiosCallOuts.c
+++ b/src/mainboard/amd/olivehill/BiosCallOuts.c
@@ -23,7 +23,7 @@
#include "Ids.h"
#include "OptionsIds.h"
#include "heapManager.h"
-#include "FchPlatform.h"
+#include <vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h>
#include "cbfs.h"
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
#include "imc.h"
diff --git a/src/mainboard/amd/parmer/BiosCallOuts.c b/src/mainboard/amd/parmer/BiosCallOuts.c
index e09218e..00f6a29 100644
--- a/src/mainboard/amd/parmer/BiosCallOuts.c
+++ b/src/mainboard/amd/parmer/BiosCallOuts.c
@@ -23,7 +23,7 @@
#include "Ids.h"
#include "OptionsIds.h"
#include "heapManager.h"
-#include "FchPlatform.h"
+#include <vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h>
#include "cbfs.h"
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
#include "imc.h"
diff --git a/src/mainboard/amd/thatcher/BiosCallOuts.c b/src/mainboard/amd/thatcher/BiosCallOuts.c
index 3bd7237..d266577 100644
--- a/src/mainboard/amd/thatcher/BiosCallOuts.c
+++ b/src/mainboard/amd/thatcher/BiosCallOuts.c
@@ -23,7 +23,7 @@
#include "Ids.h"
#include "OptionsIds.h"
#include "heapManager.h"
-#include "FchPlatform.h"
+#include <vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h>
#include "cbfs.h"
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
#include "imc.h"
diff --git a/src/mainboard/asrock/imb-a180/BiosCallOuts.c b/src/mainboard/asrock/imb-a180/BiosCallOuts.c
index 53b6871..0f52294 100644
--- a/src/mainboard/asrock/imb-a180/BiosCallOuts.c
+++ b/src/mainboard/asrock/imb-a180/BiosCallOuts.c
@@ -24,7 +24,7 @@
#include "Ids.h"
#include "OptionsIds.h"
#include "heapManager.h"
-#include "FchPlatform.h"
+#include <vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h>
#include "cbfs.h"
#include <stdlib.h>
diff --git a/src/mainboard/asus/f2a85-m/BiosCallOuts.c b/src/mainboard/asus/f2a85-m/BiosCallOuts.c
index 13bee0c..77dacf0 100644
--- a/src/mainboard/asus/f2a85-m/BiosCallOuts.c
+++ b/src/mainboard/asus/f2a85-m/BiosCallOuts.c
@@ -22,7 +22,7 @@
#include "OptionsIds.h"
#include <cbfs.h>
-#include <vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h>
+#include <vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h>
#include <stdlib.h>
static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr);
diff --git a/src/mainboard/asus/f2a85-m_le/BiosCallOuts.c b/src/mainboard/asus/f2a85-m_le/BiosCallOuts.c
index cfc0ee1..2949f83 100644
--- a/src/mainboard/asus/f2a85-m_le/BiosCallOuts.c
+++ b/src/mainboard/asus/f2a85-m_le/BiosCallOuts.c
@@ -22,7 +22,7 @@
#include "OptionsIds.h"
#include <cbfs.h>
-#include <vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h>
+#include <vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h>
#include <stdlib.h>
static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr);
diff --git a/src/mainboard/gizmosphere/gizmo2/BiosCallOuts.c b/src/mainboard/gizmosphere/gizmo2/BiosCallOuts.c
index 44273ab..fc51e24 100644
--- a/src/mainboard/gizmosphere/gizmo2/BiosCallOuts.c
+++ b/src/mainboard/gizmosphere/gizmo2/BiosCallOuts.c
@@ -23,7 +23,7 @@
#include "Ids.h"
#include "OptionsIds.h"
#include "heapManager.h"
-#include "FchPlatform.h"
+#include <vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h>
#include "cbfs.h"
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
#include "imc.h"
diff --git a/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c b/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c
index 5373d90..98cc400 100644
--- a/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c
+++ b/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c
@@ -23,7 +23,7 @@
#include <cbfs.h>
#include <southbridge/amd/agesa/hudson/imc.h>
-#include <vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h>
+#include <vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h>
#include <stdlib.h>
static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr);
diff --git a/src/mainboard/lenovo/g505s/BiosCallOuts.c b/src/mainboard/lenovo/g505s/BiosCallOuts.c
index 5373d90..98cc400 100644
--- a/src/mainboard/lenovo/g505s/BiosCallOuts.c
+++ b/src/mainboard/lenovo/g505s/BiosCallOuts.c
@@ -23,7 +23,7 @@
#include <cbfs.h>
#include <southbridge/amd/agesa/hudson/imc.h>
-#include <vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h>
+#include <vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h>
#include <stdlib.h>
static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr);
diff --git a/src/vendorcode/amd/agesa/common/Proc/Fch/Common/AcpiLib.c b/src/vendorcode/amd/agesa/common/Proc/Fch/Common/AcpiLib.c
new file mode 100644
index 0000000..1aaa56c
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Fch/Common/AcpiLib.c
@@ -0,0 +1,243 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * FCH ACPI lib
+ *
+ *
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: FCH
+ * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
+ *
+ */
+/*
+*****************************************************************************
+*
+ * 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.
+****************************************************************************
+*/
+#include "FchPlatform.h"
+#define FILECODE PROC_FCH_COMMON_ACPILIB_FILECODE
+//
+//
+// Routine Description:
+//
+// Locate ACPI table
+//
+// Arguments:
+//
+// Signature - table signature
+//
+//Returns:
+//
+// pointer to ACPI table
+//
+//
+VOID*
+AcpiLocateTable (
+ IN UINT32 Signature
+ )
+{
+ UINT32 Index;
+ UINT32 *RsdPtr;
+ UINT32 *Rsdt;
+ UINTN TableOffset;
+ DESCRIPTION_HEADER *CurrentTable;
+
+ RsdPtr = (UINT32*) (UINTN) FCHOEM_ACPI_TABLE_RANGE_LOW;
+ Rsdt = NULL;
+ do {
+ if ( *RsdPtr == Int32FromChar('R','S','D',' ') && *(RsdPtr + 1) == Int32FromChar('P','T','R',' ') ) { /* ' DSR' & ' RTP' */
+ Rsdt = (UINT32*) (UINTN) ((RSDP_HEADER*)RsdPtr)->RsdtAddress;
+ break;
+ }
+ RsdPtr += 4;
+ } while ( RsdPtr <= (UINT32*) (UINTN) FCHOEM_ACPI_TABLE_RANGE_HIGH );
+
+ if ( Rsdt != NULL && AcpiGetTableCheckSum (Rsdt) == 0 ) {
+ for ( Index = 0; Index < (((DESCRIPTION_HEADER*)Rsdt)->Length - sizeof (DESCRIPTION_HEADER)) / 4; Index++ ) {
+ TableOffset = *(UINTN*) ((UINT8*)Rsdt + sizeof (DESCRIPTION_HEADER) + Index * 4);
+ CurrentTable = (DESCRIPTION_HEADER*)TableOffset;
+ if ( CurrentTable->Signature == Signature ) {
+ return CurrentTable;
+ }
+ }
+ }
+ return NULL;
+}
+
+//
+//
+// Routine Description:
+//
+// Update table CheckSum
+//
+// Arguments:
+//
+// TablePtr - table pointer
+//
+// Returns:
+//
+// none
+//
+//
+VOID
+AcpiSetTableCheckSum (
+ IN VOID *TablePtr
+ )
+{
+ UINT8 CheckSum;
+
+ CheckSum = 0;
+ ((DESCRIPTION_HEADER*)TablePtr)->CheckSum = 0;
+ CheckSum = AcpiGetTableCheckSum (TablePtr);
+ ((DESCRIPTION_HEADER*)TablePtr)->CheckSum = (UINT8) (FCHOEM_ACPI_BYTE_CHECHSUM - CheckSum);
+}
+
+//
+//
+// Routine Description:
+//
+// Get table CheckSum - Get ACPI table checksum
+//
+// Arguments:
+//
+// TablePtr - table pointer
+//
+// Returns:
+//
+// none
+//
+//
+UINT8
+AcpiGetTableCheckSum (
+ IN VOID *TablePtr
+ )
+{
+ return GetByteSum (TablePtr, ((DESCRIPTION_HEADER*)TablePtr)->Length);
+}
+
+
+//
+//
+// Routine Description:
+//
+// GetByteSum - Get BYTE checksum value
+//
+// Arguments:
+//
+// DataPtr - table pointer
+// Length - table length
+//
+// Returns:
+//
+// CheckSum - CheckSum value
+//
+//
+UINT8
+GetByteSum (
+ IN VOID *DataPtr,
+ IN UINT32 Length
+ )
+{
+ UINT32 Index;
+ UINT8 CheckSum;
+
+ CheckSum = 0;
+ for ( Index = 0; Index < Length; Index++ ) {
+ CheckSum = CheckSum + (*((UINT8*)DataPtr + Index));
+ }
+ return CheckSum;
+}
+
+//
+//
+// Routine Description:
+//
+// GetFchAcpiMmioBase - Get FCH HwAcpi MMIO Base Address
+//
+// Arguments:
+//
+// AcpiMmioBase - HwAcpi MMIO Base Address
+// StdHeader - Amd Stand Header
+//
+// Returns:
+//
+// AcpiMmioBase - HwAcpi MMIO Base Address
+//
+//
+VOID
+GetFchAcpiMmioBase (
+ OUT UINT32 *AcpiMmioBase,
+ IN AMD_CONFIG_PARAMS *StdHeader
+ )
+{
+ UINT32 AcpiMmioBaseAddressDword;
+
+ ReadPmio (FCH_PMIOA_REG24 + 2, AccessWidth16, &AcpiMmioBaseAddressDword, StdHeader);
+ *AcpiMmioBase = AcpiMmioBaseAddressDword << 16;
+}
+
+//
+//
+// Routine Description:
+//
+// GetFchAcpiPmBase - Get FCH HwAcpi PM Base Address
+//
+// Arguments:
+//
+// AcpiPmBase - HwAcpi PM Base Address
+// StdHeader - Amd Stand Header
+//
+// Returns:
+//
+// AcpiPmBase - HwAcpi PM Base Address
+//
+//
+VOID
+GetFchAcpiPmBase (
+ OUT UINT16 *AcpiPmBase,
+ IN AMD_CONFIG_PARAMS *StdHeader
+ )
+{
+ ReadPmio (FCH_PMIOA_REG60, AccessWidth16, AcpiPmBase, StdHeader);
+}
+
+
+UINT8
+ReadFchSleepType (
+ IN AMD_CONFIG_PARAMS *StdHeader
+ )
+{
+ UINT16 Value16;
+
+ ReadPmio (FCH_PMIOA_REG62, AccessWidth16, &Value16, StdHeader);
+ LibAmdIoRead (AccessWidth16, Value16, &Value16, StdHeader);
+ return (UINT8) ((Value16 >> 10) & 7);
+}
+
diff --git a/src/vendorcode/amd/agesa/common/Proc/Fch/Common/AcpiLib.h b/src/vendorcode/amd/agesa/common/Proc/Fch/Common/AcpiLib.h
new file mode 100644
index 0000000..5c7f375
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Fch/Common/AcpiLib.h
@@ -0,0 +1,91 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * FCH ACPI lib
+ *
+ *
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: FCH
+ * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
+ *
+ */
+/*
+*****************************************************************************
+*
+ * Copyright (c) 2008 - 2013, 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 _FCH_ACPILIB_H_
+#define _FCH_ACPILIB_H_
+///
+/// RSDP - ACPI 2.0 table RSDP
+///
+typedef struct _RSDP_HEADER {
+ UINT64 Signature; ///< RSDP signature "RSD PTR"
+ UINT8 CheckSum; ///< checksum of the first 20 bytes
+ UINT8 OEMID[6]; ///< OEM ID
+ UINT8 Revision; ///< 0 for APCI 1.0, 2 for ACPI 2.0
+ UINT32 RsdtAddress; ///< physical address of RSDT
+ UINT32 Length; ///< total length of RSDP (including extended part)
+ UINT64 XsdtAddress; ///< physical address of XSDT
+ UINT8 ExtendedCheckSum; ///< chechsum of whole table
+ UINT8 Reserved[3]; ///< Reserved
+} RSDP_HEADER;
+
+///
+/// DESCRIPTION_HEADER - ACPI common table header
+///
+typedef struct _DESCRIPTION_HEADER {
+ UINT32 Signature; ///< ACPI signature (4 ASCII characters)
+ UINT32 Length; ///< Length of table, in bytes, including header
+ UINT8 Revision; ///< ACPI Specification minor version #
+ UINT8 CheckSum; ///< To make sum of entire table == 0
+ UINT8 OemId[6]; ///< OEM identification
+ UINT8 OemTableId[8]; ///< OEM table identification
+ UINT32 OemRevision; ///< OEM revision number
+ UINT32 CreatorId; ///< ASL compiler vendor ID
+ UINT32 CreatorRevision; ///< ASL compiler revision number
+} DESCRIPTION_HEADER;
+
+///
+/// _AcpiRegWrite - ACPI MMIO register R/W structure
+///
+typedef struct _ACPI_REG_WRITE {
+ UINT8 MmioBase; /// MmioBase: Index of Fch block (For instance GPIO_BASE:0x01 SMI_BASE:0x02)
+ UINT8 MmioReg; /// MmioReg : Register index
+ UINT8 DataAndMask; /// DataANDMask : AND Register Data
+ UINT8 DataOrMask; /// DataOrMask : Or Register Data
+} ACPI_REG_WRITE;
+
+VOID* AcpiLocateTable (IN UINT32 Signature);
+VOID AcpiSetTableCheckSum (IN VOID *TablePtr);
+UINT8 AcpiGetTableCheckSum (IN VOID *TablePtr);
+UINT8 GetByteSum (IN VOID *DataPtr, IN UINT32 Length);
+
+#endif
diff --git a/src/vendorcode/amd/agesa/common/Proc/Fch/Common/MemLib.c b/src/vendorcode/amd/agesa/common/Proc/Fch/Common/MemLib.c
new file mode 100644
index 0000000..9fc14fb
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Fch/Common/MemLib.c
@@ -0,0 +1,144 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * FCH memory access lib
+ *
+ *
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: FCH
+ * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
+ *
+ */
+/*
+*****************************************************************************
+*
+ * Copyright (c) 2008 - 2013, 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.
+****************************************************************************
+*/
+#include "FchPlatform.h"
+#include "Ids.h"
+#define FILECODE PROC_FCH_COMMON_MEMLIB_FILECODE
+
+
+/**
+ * ReadMem - Read FCH BAR Memory
+ *
+ * @param[in] Address - Memory BAR address
+ * @param[in] OpFlag - Access width
+ * @param[in] *ValuePtr - In/Out value pointer
+ *
+ */
+VOID
+ReadMem (
+ IN UINT32 Address,
+ IN UINT8 OpFlag,
+ IN VOID *ValuePtr
+ )
+{
+ OpFlag = OpFlag & 0x7f;
+
+ switch ( OpFlag ) {
+ case AccessWidth8:
+ *((UINT8*)ValuePtr) = *((UINT8*) ((UINTN)Address));
+ break;
+
+ case AccessWidth16:
+ *((UINT16*)ValuePtr) = *((UINT16*) ((UINTN)Address));
+ break;
+
+ case AccessWidth32:
+ *((UINT32*)ValuePtr) = *((UINT32*) ((UINTN)Address));
+ break;
+
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+}
+
+/**
+ * WriteMem - Write FCH BAR Memory
+ *
+ * @param[in] Address - Memory BAR address
+ * @param[in] OpFlag - Access width
+ * @param[in] *ValuePtr - In/Out Value pointer
+ *
+ */
+VOID
+WriteMem (
+ IN UINT32 Address,
+ IN UINT8 OpFlag,
+ IN VOID *ValuePtr
+ )
+{
+ OpFlag = OpFlag & 0x7f;
+
+ switch ( OpFlag ) {
+ case AccessWidth8 :
+ *((UINT8*) ((UINTN)Address)) = *((UINT8*)ValuePtr);
+ break;
+
+ case AccessWidth16:
+ *((UINT16*) ((UINTN)Address)) = *((UINT16*)ValuePtr);
+ break;
+
+ case AccessWidth32:
+ *((UINT32*) ((UINTN)Address)) = *((UINT32*)ValuePtr);
+ break;
+
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+}
+
+/**
+ * RwMem - Read & Write FCH BAR Memory
+ *
+ * @param[in] Address - Memory BAR address
+ * @param[in] OpFlag - Access width
+ * @param[in] Mask - Mask Value of data
+ * @param[in] Data - Write data
+ *
+ */
+VOID
+RwMem (
+ IN UINT32 Address,
+ IN UINT8 OpFlag,
+ IN UINT32 Mask,
+ IN UINT32 Data
+ )
+{
+ UINT32 Result;
+
+ ReadMem (Address, OpFlag, &Result);
+ Result = (Result & Mask) | Data;
+ WriteMem (Address, OpFlag, &Result);
+ ReadMem (Address, OpFlag, &Result);
+}
diff --git a/src/vendorcode/amd/agesa/common/Proc/Fch/Common/PciLib.c b/src/vendorcode/amd/agesa/common/Proc/Fch/Common/PciLib.c
new file mode 100644
index 0000000..6ef1bd0
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Fch/Common/PciLib.c
@@ -0,0 +1,94 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * FCH PCI access lib
+ *
+ *
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: FCH
+ * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
+ *
+ */
+/*
+*****************************************************************************
+*
+ * Copyright (c) 2008 - 2013, 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.
+****************************************************************************
+*/
+#include "FchPlatform.h"
+#define FILECODE PROC_FCH_COMMON_PCILIB_FILECODE
+
+VOID
+ReadPci (
+ IN UINT32 Address,
+ IN UINT8 OpFlag,
+ IN VOID* Value,
+ IN AMD_CONFIG_PARAMS *StdHeader
+ )
+{
+ PCI_ADDR PciAddress;
+
+ PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
+ LibAmdPciRead ((ACCESS_WIDTH) OpFlag, PciAddress, Value, StdHeader);
+}
+
+
+VOID
+WritePci (
+ IN UINT32 Address,
+ IN UINT8 OpFlag,
+ IN VOID *Value,
+ IN AMD_CONFIG_PARAMS *StdHeader
+ )
+{
+ PCI_ADDR PciAddress;
+
+ PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
+ LibAmdPciWrite ((ACCESS_WIDTH) OpFlag, PciAddress, Value, StdHeader);
+}
+
+
+VOID
+RwPci (
+ IN UINT32 Address,
+ IN UINT8 OpFlag,
+ IN UINT32 Mask,
+ IN UINT32 Data,
+ IN AMD_CONFIG_PARAMS *StdHeader
+ )
+{
+ PCI_ADDR PciAddress;
+ UINT32 rMask;
+
+ PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
+ rMask = ~Mask;
+ LibAmdPciRMW ((ACCESS_WIDTH) OpFlag, PciAddress, &Data, &rMask, StdHeader);
+}
+
+
diff --git a/src/vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h b/src/vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h
new file mode 100644
index 0000000..bef3016
--- /dev/null
+++ b/src/vendorcode/amd/agesa/common/Proc/Fch/FchPlatform.h
@@ -0,0 +1,128 @@
+/* $NoKeywords:$ */
+/**
+ * @file
+ *
+ * FCH platform definition
+ *
+ *
+ *
+ * @xrefitem bom "File Content Label" "Release Content"
+ * @e project: AGESA
+ * @e sub-project: FCH
+ * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
+ *
+ */
+/*
+*****************************************************************************
+*
+ * 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 _FCH_PLATFORM_H_
+#define _FCH_PLATFORM_H_
+
+#define MAX_SATA_PORTS 8
+
+#include "AGESA.h"
+
+#ifndef FCHOEM_ACPI_RESTORE_SWSMI
+ #define FCHOEM_BEFORE_PCI_RESTORE_SWSMI 0xD3
+ #define FCHOEM_AFTER_PCI_RESTORE_SWSMI 0xD4
+ #define FCHOEM_ENABLE_ACPI_SWSMI 0xA0
+ #define FCHOEM_DISABLE_ACPI_SWSMI 0xA1
+ #define FCHOEM_START_TIMER_SMI 0xBC
+ #define FCHOEM_STOP_TIMER_SMI 0xBD
+#endif
+
+#ifndef FCHOEM_SPI_UNLOCK_SWSMI
+ #define FCHOEM_SPI_UNLOCK_SWSMI 0xAA
+#endif
+#ifndef FCHOEM_SPI_LOCK_SWSMI
+ #define FCHOEM_SPI_LOCK_SWSMI 0xAB
+#endif
+
+#ifndef FCHOEM_ACPI_TABLE_RANGE_LOW
+ #define FCHOEM_ACPI_TABLE_RANGE_LOW 0xE0000ul
+#endif
+
+#ifndef FCHOEM_ACPI_TABLE_RANGE_HIGH
+ #define FCHOEM_ACPI_TABLE_RANGE_HIGH 0xFFFF0ul
+#endif
+
+#ifndef FCHOEM_ACPI_BYTE_CHECHSUM
+ #define FCHOEM_ACPI_BYTE_CHECHSUM 0x100
+#endif
+
+#ifndef FCHOEM_IO_DELAY_PORT
+ #define FCHOEM_IO_DELAY_PORT 0x80
+#endif
+
+#ifndef FCHOEM_OUTPUT_DEBUG_PORT
+ #define FCHOEM_OUTPUT_DEBUG_PORT 0x80
+#endif
+
+#define FCH_PCIRST_BASE_IO 0xCF9
+#define FCH_PCI_RESET_COMMAND06 0x06
+#define FCH_PCI_RESET_COMMAND0E 0x0E
+#define FCH_KBDRST_BASE_IO 0x64
+#define FCH_KBC_RESET_COMMAND 0xFE
+#define FCH_ROMSIG_BASE_IO 0x20000l
+#define FCH_ROMSIG_SIGNATURE 0x55AA55AAul
+#define FCH_MAX_TIMER 0xFFFFFFFFul
+#define FCH_GEC_INTERNAL_REG 0x6804
+#define FCH_HPET_REG_MASK 0xFFFFF800ul
+#define FCH_FAKE_USB_BAR_ADDRESS 0x58830000ul
+
+
+#ifndef FCHOEM_ELAPSED_TIME_UNIT
+ #define FCHOEM_ELAPSED_TIME_UNIT 28
+#endif
+
+#ifndef FCHOEM_ELAPSED_TIME_DIVIDER
+ #define FCHOEM_ELAPSED_TIME_DIVIDER 100
+#endif
+
+#include "Fch.h"
+#include <Lib/amdlib.h>
+#include "Common/FchCommonCfg.h"
+#include "Common/AcpiLib.h"
+#include "Common/FchDef.h"
+#include "Common/FchBiosRamUsage.h"
+#include <Proc/Common/AmdFch.h>
+
+extern BUILD_OPT_CFG UserOptions;
+
+VOID
+FchInitS3EarlyRestore (
+ IN FCH_DATA_BLOCK *FchDataPtr
+ );
+
+VOID
+FchInitS3LateRestore (
+ IN FCH_DATA_BLOCK *FchDataPtr
+ );
+
+#endif // _FCH_PLATFORM_H_
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/AcpiLib.c b/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/AcpiLib.c
deleted file mode 100644
index 16705a1..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/AcpiLib.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH ACPI lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 17:16:51 +0800 (Wed, 22 Dec 2010) $
- *
- */
-/*
-*****************************************************************************
-*
-* Copyright (c) 2011, 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.
-****************************************************************************
-*/
-#include "FchPlatform.h"
-#define FILECODE PROC_FCH_COMMON_ACPILIB_FILECODE
-//
-//
-// Routine Description:
-//
-// Locate ACPI table
-//
-// Arguments:
-//
-// Signature - table signature
-//
-//Returns:
-//
-// pointer to ACPI table
-//
-//
-VOID*
-AcpiLocateTable (
- IN UINT32 Signature
- )
-{
- UINT32 Index;
- UINT32 *RsdPtr;
- UINT32 *Rsdt;
- UINTN TableOffset;
- DESCRIPTION_HEADER *CurrentTable;
-
- RsdPtr = (UINT32*) (UINTN) FCHOEM_ACPI_TABLE_RANGE_LOW;
- Rsdt = NULL;
- do {
- if ( *RsdPtr == ' DSR' && *(RsdPtr + 1) == ' RTP' ) {
- Rsdt = (UINT32*) (UINTN) ((RSDP_HEADER*)RsdPtr)->RsdtAddress;
- break;
- }
- RsdPtr += 4;
- } while ( RsdPtr <= (UINT32*) (UINTN) FCHOEM_ACPI_TABLE_RANGE_HIGH );
-
- if ( Rsdt != NULL && AcpiGetTableCheckSum (Rsdt) == 0 ) {
- for ( Index = 0; Index < (((DESCRIPTION_HEADER*)Rsdt)->Length - sizeof (DESCRIPTION_HEADER)) / 4; Index++ ) {
- TableOffset = *(UINTN*) ((UINT8*)Rsdt + sizeof (DESCRIPTION_HEADER) + Index * 4);
- CurrentTable = (DESCRIPTION_HEADER*)TableOffset;
- if ( CurrentTable->Signature == Signature ) {
- return CurrentTable;
- }
- }
- }
- return NULL;
-}
-
-//
-//
-// Routine Description:
-//
-// Update table CheckSum
-//
-// Arguments:
-//
-// TablePtr - table pointer
-//
-// Returns:
-//
-// none
-//
-//
-VOID
-AcpiSetTableCheckSum (
- IN VOID *TablePtr
- )
-{
- UINT8 CheckSum;
-
- CheckSum = 0;
- ((DESCRIPTION_HEADER*)TablePtr)->CheckSum = 0;
- CheckSum = AcpiGetTableCheckSum (TablePtr);
- ((DESCRIPTION_HEADER*)TablePtr)->CheckSum = (UINT8) (FCHOEM_ACPI_BYTE_CHECHSUM - CheckSum);
-}
-
-//
-//
-// Routine Description:
-//
-// Get table CheckSum - Get ACPI table checksum
-//
-// Arguments:
-//
-// TablePtr - table pointer
-//
-// Returns:
-//
-// none
-//
-//
-UINT8
-AcpiGetTableCheckSum (
- IN VOID *TablePtr
- )
-{
- return GetByteSum (TablePtr, ((DESCRIPTION_HEADER*)TablePtr)->Length);
-}
-
-
-//
-//
-// Routine Description:
-//
-// GetByteSum - Get BYTE checksum value
-//
-// Arguments:
-//
-// DataPtr - table pointer
-// Length - table length
-//
-// Returns:
-//
-// CheckSum - CheckSum value
-//
-//
-UINT8
-GetByteSum (
- IN VOID *DataPtr,
- IN UINT32 Length
- )
-{
- UINT32 Index;
- UINT8 CheckSum;
-
- CheckSum = 0;
- for ( Index = 0; Index < Length; Index++ ) {
- CheckSum = CheckSum + (*((UINT8*)DataPtr + Index));
- }
- return CheckSum;
-}
-
-//
-//
-// Routine Description:
-//
-// GetFchAcpiMmioBase - Get FCH HwAcpi MMIO Base Address
-//
-// Arguments:
-//
-// AcpiMmioBase - HwAcpi MMIO Base Address
-// StdHeader - Amd Stand Header
-//
-// Returns:
-//
-// AcpiMmioBase - HwAcpi MMIO Base Address
-//
-//
-VOID
-GetFchAcpiMmioBase (
- OUT UINT32 *AcpiMmioBase,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- UINT32 AcpiMmioBaseAddressDword;
-
- ReadPmio (FCH_PMIOA_REG24 + 2, AccessWidth16, &AcpiMmioBaseAddressDword, StdHeader);
- *AcpiMmioBase = AcpiMmioBaseAddressDword << 16;
-}
-
-//
-//
-// Routine Description:
-//
-// GetFchAcpiPmBase - Get FCH HwAcpi PM Base Address
-//
-// Arguments:
-//
-// AcpiPmBase - HwAcpi PM Base Address
-// StdHeader - Amd Stand Header
-//
-// Returns:
-//
-// AcpiPmBase - HwAcpi PM Base Address
-//
-//
-VOID
-GetFchAcpiPmBase (
- OUT UINT16 *AcpiPmBase,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- ReadPmio (FCH_PMIOA_REG60, AccessWidth16, AcpiPmBase, StdHeader);
-}
-
-
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/AcpiLib.h b/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/AcpiLib.h
deleted file mode 100644
index 4dc303f..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/AcpiLib.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH ACPI lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 17:16:51 +0800 (Wed, 22 Dec 2010) $
- *
- */
-/*
-*****************************************************************************
-*
-* Copyright (c) 2011, 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.
-****************************************************************************
-*/
-///
-/// RSDP - ACPI 2.0 table RSDP
-///
-typedef struct _RSDP_HEADER {
- UINT64 Signature; ///< RSDP signature "RSD PTR"
- UINT8 CheckSum; ///< checksum of the first 20 bytes
- UINT8 OEMID[6]; ///< OEM ID
- UINT8 Revision; ///< 0 for APCI 1.0, 2 for ACPI 2.0
- UINT32 RsdtAddress; ///< physical address of RSDT
- UINT32 Length; ///< total length of RSDP (including extended part)
- UINT64 XsdtAddress; ///< physical address of XSDT
- UINT8 ExtendedCheckSum; ///< chechsum of whole table
- UINT8 Reserved[3]; ///< Reserved
-} RSDP_HEADER;
-
-///
-/// DESCRIPTION_HEADER - ACPI common table header
-///
-typedef struct _DESCRIPTION_HEADER {
- UINT32 Signature; ///< ACPI signature (4 ASCII characters)
- UINT32 Length; ///< Length of table, in bytes, including header
- UINT8 Revision; ///< ACPI Specification minor version #
- UINT8 CheckSum; ///< To make sum of entire table == 0
- UINT8 OemId[6]; ///< OEM identification
- UINT8 OemTableId[8]; ///< OEM table identification
- UINT32 OemRevision; ///< OEM revision number
- UINT32 CreatorId; ///< ASL compiler vendor ID
- UINT32 CreatorRevision; ///< ASL compiler revision number
-} DESCRIPTION_HEADER;
-
-///
-/// _AcpiRegWrite - ACPI MMIO register R/W structure
-///
-typedef struct _ACPI_REG_WRITE {
- UINT8 MmioBase; /// MmioBase: Index of Fch block (For instance GPIO_BASE:0x01 SMI_BASE:0x02)
- UINT8 MmioReg; /// MmioReg : Register index
- UINT8 DataAndMask; /// DataANDMask : AND Register Data
- UINT8 DataOrMask; /// DataOrMask : Or Register Data
-} ACPI_REG_WRITE;
-
-VOID* AcpiLocateTable (IN UINT32 Signature);
-VOID AcpiSetTableCheckSum (IN VOID *TablePtr);
-UINT8 AcpiGetTableCheckSum (IN VOID *TablePtr);
-UINT8 GetByteSum (IN VOID *DataPtr, IN UINT32 Length);
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/MemLib.c b/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/MemLib.c
deleted file mode 100644
index f478365..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/MemLib.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH memory access lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 46093 $ @e \$Date: 2011-01-28 11:39:58 +0800 (Fri, 28 Jan 2011) $
- *
- */
-/*
-*****************************************************************************
-*
-* Copyright (c) 2011, 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.
-****************************************************************************
-*/
-#include "FchPlatform.h"
-#include "Ids.h"
-#define FILECODE PROC_FCH_COMMON_MEMLIB_FILECODE
-
-
-/**
- * ReadMem - Read FCH BAR Memory
- *
- * @param[in] Address - Memory BAR address
- * @param[in] OpFlag - Access width
- * @param[in] *ValuePtr - In/Out value pointer
- *
- */
-VOID
-ReadMem (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID *ValuePtr
- )
-{
- OpFlag = OpFlag & 0x7f;
-
- switch ( OpFlag ) {
- case AccessWidth8:
- *((UINT8*)ValuePtr) = *((UINT8*) ((UINTN)Address));
- break;
-
- case AccessWidth16:
- *((UINT16*)ValuePtr) = *((UINT16*) ((UINTN)Address));
- break;
-
- case AccessWidth32:
- *((UINT32*)ValuePtr) = *((UINT32*) ((UINTN)Address));
- break;
-
- default:
- ASSERT (FALSE);
- break;
- }
-}
-
-/**
- * WriteMem - Write FCH BAR Memory
- *
- * @param[in] Address - Memory BAR address
- * @param[in] OpFlag - Access width
- * @param[in] *ValuePtr - In/Out Value pointer
- *
- */
-VOID
-WriteMem (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID *ValuePtr
- )
-{
- OpFlag = OpFlag & 0x7f;
-
- switch ( OpFlag ) {
- case AccessWidth8 :
- *((UINT8*) ((UINTN)Address)) = *((UINT8*)ValuePtr);
- break;
-
- case AccessWidth16:
- *((UINT16*) ((UINTN)Address)) = *((UINT16*)ValuePtr);
- break;
-
- case AccessWidth32:
- *((UINT32*) ((UINTN)Address)) = *((UINT32*)ValuePtr);
- break;
-
- default:
- ASSERT (FALSE);
- break;
- }
-}
-
-/**
- * RwMem - Read & Write FCH BAR Memory
- *
- * @param[in] Address - Memory BAR address
- * @param[in] OpFlag - Access width
- * @param[in] Mask - Mask Value of data
- * @param[in] Data - Write data
- *
- */
-VOID
-RwMem (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN UINT32 Mask,
- IN UINT32 Data
- )
-{
- UINT32 Result;
-
- ReadMem (Address, OpFlag, &Result);
- Result = (Result & Mask) | Data;
- WriteMem (Address, OpFlag, &Result);
-}
-
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/PciLib.c b/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/PciLib.c
deleted file mode 100644
index 0c36786..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Fch/Common/PciLib.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH PCI access lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 17:16:51 +0800 (Wed, 22 Dec 2010) $
- *
- */
-/*
-*****************************************************************************
-*
-* Copyright (c) 2011, 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.
-****************************************************************************
-*/
-#include "FchPlatform.h"
-#define FILECODE PROC_FCH_COMMON_PCILIB_FILECODE
-
-VOID
-ReadPci (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID* Value,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- PCI_ADDR PciAddress;
-
- PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
- LibAmdPciRead ((ACCESS_WIDTH) OpFlag, PciAddress, Value, StdHeader);
-}
-
-
-VOID
-WritePci (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID *Value,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- PCI_ADDR PciAddress;
-
- PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
- LibAmdPciWrite ((ACCESS_WIDTH) OpFlag, PciAddress, Value, StdHeader);
-}
-
-
-VOID
-RwPci (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN UINT32 Mask,
- IN UINT32 Data,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- PCI_ADDR PciAddress;
- UINT32 rMask;
-
- PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
- rMask = ~Mask;
- LibAmdPciRMW ((ACCESS_WIDTH) OpFlag, PciAddress, &Data, &rMask, StdHeader);
-}
-
-
diff --git a/src/vendorcode/amd/agesa/f12/Proc/Fch/FchPlatform.h b/src/vendorcode/amd/agesa/f12/Proc/Fch/FchPlatform.h
deleted file mode 100644
index edfbfe9..0000000
--- a/src/vendorcode/amd/agesa/f12/Proc/Fch/FchPlatform.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH platform definition
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 48055 $ @e \$Date: 2011-03-03 10:33:13 +0800 (Thu, 03 Mar 2011) $
- *
- */
-/*
-*****************************************************************************
-*
-* Copyright (c) 2011, 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 _FCH_PLATFORM_H_
-#define _FCH_PLATFORM_H_
-
-#define MAX_SATA_PORTS 8
-
-#include "AGESA.h"
-
-#ifndef FCHOEM_ACPI_RESTORE_SWSMI
- #define FCHOEM_BEFORE_PCI_RESTORE_SWSMI 0xD3
- #define FCHOEM_AFTER_PCI_RESTORE_SWSMI 0xD4
- #define FCHOEM_ENABLE_ACPI_SWSMI 0xA0
- #define FCHOEM_DISABLE_ACPI_SWSMI 0xA1
-#endif
-
-#ifndef FCHOEM_SPI_UNLOCK_SWSMI
- #define FCHOEM_SPI_UNLOCK_SWSMI 0xAA
-#endif
-#ifndef FCHOEM_SPI_LOCK_SWSMI
- #define FCHOEM_SPI_LOCK_SWSMI 0xAB
-#endif
-
-#ifndef FCHOEM_ACPI_TABLE_RANGE_LOW
- #define FCHOEM_ACPI_TABLE_RANGE_LOW 0xE0000
-#endif
-
-#ifndef FCHOEM_ACPI_TABLE_RANGE_HIGH
- #define FCHOEM_ACPI_TABLE_RANGE_HIGH 0xFFFF0
-#endif
-
-#ifndef FCHOEM_ACPI_BYTE_CHECHSUM
- #define FCHOEM_ACPI_BYTE_CHECHSUM 0x100
-#endif
-
-#ifndef FCHOEM_IO_DELAY_PORT
- #define FCHOEM_IO_DELAY_PORT 0x80
-#endif
-
-#ifndef FCHOEM_OUTPUT_DEBUG_PORT
- #define FCHOEM_OUTPUT_DEBUG_PORT 0x80
-#endif
-
-#define FCH_PCIRST_BASE_IO 0xCF9
-#define FCH_PCI_RESET_COMMAND06 0x06
-#define FCH_PCI_RESET_COMMAND0E 0x0E
-#define FCH_KBDRST_BASE_IO 0x64
-#define FCH_KBC_RESET_COMMAND 0xFE
-#define FCH_ROMSIG_BASE_IO 0x20000
-#define FCH_ROMSIG_SIGNATURE 0x55AA55AA
-#define FCH_MAX_TIMER 0xFFFFFFFF
-#define FCH_GEC_INTERNAL_REG 0x6804
-#define FCH_HPET_REG_MASK 0xFFFFF800
-#define FCH_FAKE_USB_BAR_ADDRESS 0x58830000
-
-
-#ifndef FCHOEM_ELAPSED_TIME_UNIT
- #define FCHOEM_ELAPSED_TIME_UNIT 28
-#endif
-
-#ifndef FCHOEM_ELAPSED_TIME_DIVIDER
- #define FCHOEM_ELAPSED_TIME_DIVIDER 100
-#endif
-
-#include "Fch.h"
-#include "amdlib.h"
-#include "FchCommonCfg.h"
-#include "AcpiLib.h"
-#include "FchDef.h"
-#include "OEM.h"
-#include "FchBiosRamUsage.h"
-#include "AmdFch.h"
-
-extern BUILD_OPT_CFG UserOptions;
-
-#endif // _FCH_PLATFORM_H_
diff --git a/src/vendorcode/amd/agesa/f15tn/Makefile.inc b/src/vendorcode/amd/agesa/f15tn/Makefile.inc
index c4a7eeb..0539643 100644
--- a/src/vendorcode/amd/agesa/f15tn/Makefile.inc
+++ b/src/vendorcode/amd/agesa/f15tn/Makefile.inc
@@ -71,6 +71,7 @@ AGESA_INC += -I$(AGESA_ROOT)/Proc/GNB/Modules/GnbTable
AGESA_INC += -I$(AGESA_ROOT)/Proc/GNB/Modules/GnbPcieInitLibV4
AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch
AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Common
+AGESA_INC += -I$(AGESA_ROOT)/../common/Proc/Fch/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/IDS/Debug
AGESA_INC += -I$(AGESA_ROOT)/Proc/GNB/Modules/GnbPcieAspm
AGESA_INC += -I$(AGESA_ROOT)/Proc/GNB/Include/Library
@@ -369,11 +370,11 @@ libagesa-y += Proc/Fch/Azalia/AzaliaEnv.c
libagesa-y += Proc/Fch/Azalia/AzaliaLate.c
libagesa-y += Proc/Fch/Azalia/AzaliaMid.c
libagesa-y += Proc/Fch/Azalia/AzaliaReset.c
-libagesa-y += Proc/Fch/Common/AcpiLib.c
+libagesa-y += ../common/Proc/Fch/Common/AcpiLib.c
libagesa-y += Proc/Fch/Common/FchCommon.c
libagesa-y += Proc/Fch/Common/FchLib.c
libagesa-y += Proc/Fch/Common/FchPeLib.c
-libagesa-y += Proc/Fch/Common/MemLib.c
+libagesa-y += ../common/Proc/Fch/Common/MemLib.c
libagesa-y += Proc/Fch/Common/PciLib.c
libagesa-y += Proc/Fch/Gec/Family/Hudson2/Hudson2GecEnvService.c
libagesa-y += Proc/Fch/Gec/Family/Hudson2/Hudson2GecService.c
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/AcpiLib.c b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/AcpiLib.c
deleted file mode 100644
index 1aaa56c..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/AcpiLib.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH ACPI lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
-*****************************************************************************
-*
- * 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.
-****************************************************************************
-*/
-#include "FchPlatform.h"
-#define FILECODE PROC_FCH_COMMON_ACPILIB_FILECODE
-//
-//
-// Routine Description:
-//
-// Locate ACPI table
-//
-// Arguments:
-//
-// Signature - table signature
-//
-//Returns:
-//
-// pointer to ACPI table
-//
-//
-VOID*
-AcpiLocateTable (
- IN UINT32 Signature
- )
-{
- UINT32 Index;
- UINT32 *RsdPtr;
- UINT32 *Rsdt;
- UINTN TableOffset;
- DESCRIPTION_HEADER *CurrentTable;
-
- RsdPtr = (UINT32*) (UINTN) FCHOEM_ACPI_TABLE_RANGE_LOW;
- Rsdt = NULL;
- do {
- if ( *RsdPtr == Int32FromChar('R','S','D',' ') && *(RsdPtr + 1) == Int32FromChar('P','T','R',' ') ) { /* ' DSR' & ' RTP' */
- Rsdt = (UINT32*) (UINTN) ((RSDP_HEADER*)RsdPtr)->RsdtAddress;
- break;
- }
- RsdPtr += 4;
- } while ( RsdPtr <= (UINT32*) (UINTN) FCHOEM_ACPI_TABLE_RANGE_HIGH );
-
- if ( Rsdt != NULL && AcpiGetTableCheckSum (Rsdt) == 0 ) {
- for ( Index = 0; Index < (((DESCRIPTION_HEADER*)Rsdt)->Length - sizeof (DESCRIPTION_HEADER)) / 4; Index++ ) {
- TableOffset = *(UINTN*) ((UINT8*)Rsdt + sizeof (DESCRIPTION_HEADER) + Index * 4);
- CurrentTable = (DESCRIPTION_HEADER*)TableOffset;
- if ( CurrentTable->Signature == Signature ) {
- return CurrentTable;
- }
- }
- }
- return NULL;
-}
-
-//
-//
-// Routine Description:
-//
-// Update table CheckSum
-//
-// Arguments:
-//
-// TablePtr - table pointer
-//
-// Returns:
-//
-// none
-//
-//
-VOID
-AcpiSetTableCheckSum (
- IN VOID *TablePtr
- )
-{
- UINT8 CheckSum;
-
- CheckSum = 0;
- ((DESCRIPTION_HEADER*)TablePtr)->CheckSum = 0;
- CheckSum = AcpiGetTableCheckSum (TablePtr);
- ((DESCRIPTION_HEADER*)TablePtr)->CheckSum = (UINT8) (FCHOEM_ACPI_BYTE_CHECHSUM - CheckSum);
-}
-
-//
-//
-// Routine Description:
-//
-// Get table CheckSum - Get ACPI table checksum
-//
-// Arguments:
-//
-// TablePtr - table pointer
-//
-// Returns:
-//
-// none
-//
-//
-UINT8
-AcpiGetTableCheckSum (
- IN VOID *TablePtr
- )
-{
- return GetByteSum (TablePtr, ((DESCRIPTION_HEADER*)TablePtr)->Length);
-}
-
-
-//
-//
-// Routine Description:
-//
-// GetByteSum - Get BYTE checksum value
-//
-// Arguments:
-//
-// DataPtr - table pointer
-// Length - table length
-//
-// Returns:
-//
-// CheckSum - CheckSum value
-//
-//
-UINT8
-GetByteSum (
- IN VOID *DataPtr,
- IN UINT32 Length
- )
-{
- UINT32 Index;
- UINT8 CheckSum;
-
- CheckSum = 0;
- for ( Index = 0; Index < Length; Index++ ) {
- CheckSum = CheckSum + (*((UINT8*)DataPtr + Index));
- }
- return CheckSum;
-}
-
-//
-//
-// Routine Description:
-//
-// GetFchAcpiMmioBase - Get FCH HwAcpi MMIO Base Address
-//
-// Arguments:
-//
-// AcpiMmioBase - HwAcpi MMIO Base Address
-// StdHeader - Amd Stand Header
-//
-// Returns:
-//
-// AcpiMmioBase - HwAcpi MMIO Base Address
-//
-//
-VOID
-GetFchAcpiMmioBase (
- OUT UINT32 *AcpiMmioBase,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- UINT32 AcpiMmioBaseAddressDword;
-
- ReadPmio (FCH_PMIOA_REG24 + 2, AccessWidth16, &AcpiMmioBaseAddressDword, StdHeader);
- *AcpiMmioBase = AcpiMmioBaseAddressDword << 16;
-}
-
-//
-//
-// Routine Description:
-//
-// GetFchAcpiPmBase - Get FCH HwAcpi PM Base Address
-//
-// Arguments:
-//
-// AcpiPmBase - HwAcpi PM Base Address
-// StdHeader - Amd Stand Header
-//
-// Returns:
-//
-// AcpiPmBase - HwAcpi PM Base Address
-//
-//
-VOID
-GetFchAcpiPmBase (
- OUT UINT16 *AcpiPmBase,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- ReadPmio (FCH_PMIOA_REG60, AccessWidth16, AcpiPmBase, StdHeader);
-}
-
-
-UINT8
-ReadFchSleepType (
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- UINT16 Value16;
-
- ReadPmio (FCH_PMIOA_REG62, AccessWidth16, &Value16, StdHeader);
- LibAmdIoRead (AccessWidth16, Value16, &Value16, StdHeader);
- return (UINT8) ((Value16 >> 10) & 7);
-}
-
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/AcpiLib.h b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/AcpiLib.h
deleted file mode 100644
index 253920d..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/AcpiLib.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH ACPI lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
-*****************************************************************************
-*
- * 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.
-****************************************************************************
-*/
-///
-/// RSDP - ACPI 2.0 table RSDP
-///
-typedef struct _RSDP_HEADER {
- UINT64 Signature; ///< RSDP signature "RSD PTR"
- UINT8 CheckSum; ///< checksum of the first 20 bytes
- UINT8 OEMID[6]; ///< OEM ID
- UINT8 Revision; ///< 0 for APCI 1.0, 2 for ACPI 2.0
- UINT32 RsdtAddress; ///< physical address of RSDT
- UINT32 Length; ///< total length of RSDP (including extended part)
- UINT64 XsdtAddress; ///< physical address of XSDT
- UINT8 ExtendedCheckSum; ///< chechsum of whole table
- UINT8 Reserved[3]; ///< Reserved
-} RSDP_HEADER;
-
-///
-/// DESCRIPTION_HEADER - ACPI common table header
-///
-typedef struct _DESCRIPTION_HEADER {
- UINT32 Signature; ///< ACPI signature (4 ASCII characters)
- UINT32 Length; ///< Length of table, in bytes, including header
- UINT8 Revision; ///< ACPI Specification minor version #
- UINT8 CheckSum; ///< To make sum of entire table == 0
- UINT8 OemId[6]; ///< OEM identification
- UINT8 OemTableId[8]; ///< OEM table identification
- UINT32 OemRevision; ///< OEM revision number
- UINT32 CreatorId; ///< ASL compiler vendor ID
- UINT32 CreatorRevision; ///< ASL compiler revision number
-} DESCRIPTION_HEADER;
-
-///
-/// _AcpiRegWrite - ACPI MMIO register R/W structure
-///
-typedef struct _ACPI_REG_WRITE {
- UINT8 MmioBase; /// MmioBase: Index of Fch block (For instance GPIO_BASE:0x01 SMI_BASE:0x02)
- UINT8 MmioReg; /// MmioReg : Register index
- UINT8 DataAndMask; /// DataANDMask : AND Register Data
- UINT8 DataOrMask; /// DataOrMask : Or Register Data
-} ACPI_REG_WRITE;
-
-VOID* AcpiLocateTable (IN UINT32 Signature);
-VOID AcpiSetTableCheckSum (IN VOID *TablePtr);
-UINT8 AcpiGetTableCheckSum (IN VOID *TablePtr);
-UINT8 GetByteSum (IN VOID *DataPtr, IN UINT32 Length);
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/MemLib.c b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/MemLib.c
deleted file mode 100644
index 99ed53d..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/MemLib.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH memory access lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
-*****************************************************************************
-*
- * 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.
-****************************************************************************
-*/
-#include "FchPlatform.h"
-#include "Ids.h"
-#define FILECODE PROC_FCH_COMMON_MEMLIB_FILECODE
-
-
-/**
- * ReadMem - Read FCH BAR Memory
- *
- * @param[in] Address - Memory BAR address
- * @param[in] OpFlag - Access width
- * @param[in] *ValuePtr - In/Out value pointer
- *
- */
-VOID
-ReadMem (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID *ValuePtr
- )
-{
- OpFlag = OpFlag & 0x7f;
-
- switch ( OpFlag ) {
- case AccessWidth8:
- *((UINT8*)ValuePtr) = *((UINT8*) ((UINTN)Address));
- break;
-
- case AccessWidth16:
- *((UINT16*)ValuePtr) = *((UINT16*) ((UINTN)Address));
- break;
-
- case AccessWidth32:
- *((UINT32*)ValuePtr) = *((UINT32*) ((UINTN)Address));
- break;
-
- default:
- ASSERT (FALSE);
- break;
- }
-}
-
-/**
- * WriteMem - Write FCH BAR Memory
- *
- * @param[in] Address - Memory BAR address
- * @param[in] OpFlag - Access width
- * @param[in] *ValuePtr - In/Out Value pointer
- *
- */
-VOID
-WriteMem (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID *ValuePtr
- )
-{
- OpFlag = OpFlag & 0x7f;
-
- switch ( OpFlag ) {
- case AccessWidth8 :
- *((UINT8*) ((UINTN)Address)) = *((UINT8*)ValuePtr);
- break;
-
- case AccessWidth16:
- *((UINT16*) ((UINTN)Address)) = *((UINT16*)ValuePtr);
- break;
-
- case AccessWidth32:
- *((UINT32*) ((UINTN)Address)) = *((UINT32*)ValuePtr);
- break;
-
- default:
- ASSERT (FALSE);
- break;
- }
-}
-
-/**
- * RwMem - Read & Write FCH BAR Memory
- *
- * @param[in] Address - Memory BAR address
- * @param[in] OpFlag - Access width
- * @param[in] Mask - Mask Value of data
- * @param[in] Data - Write data
- *
- */
-VOID
-RwMem (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN UINT32 Mask,
- IN UINT32 Data
- )
-{
- UINT32 Result;
-
- ReadMem (Address, OpFlag, &Result);
- Result = (Result & Mask) | Data;
- WriteMem (Address, OpFlag, &Result);
-}
-
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/PciLib.c b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/PciLib.c
deleted file mode 100644
index 6d286e8..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Common/PciLib.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH PCI access lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
-*****************************************************************************
-*
- * 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.
-****************************************************************************
-*/
-#include "FchPlatform.h"
-#define FILECODE PROC_FCH_COMMON_PCILIB_FILECODE
-
-VOID
-ReadPci (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID* Value,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- PCI_ADDR PciAddress;
-
- PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
- LibAmdPciRead ((ACCESS_WIDTH) OpFlag, PciAddress, Value, StdHeader);
-}
-
-
-VOID
-WritePci (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID *Value,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- PCI_ADDR PciAddress;
-
- PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
- LibAmdPciWrite ((ACCESS_WIDTH) OpFlag, PciAddress, Value, StdHeader);
-}
-
-
-VOID
-RwPci (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN UINT32 Mask,
- IN UINT32 Data,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- PCI_ADDR PciAddress;
- UINT32 rMask;
-
- PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
- rMask = ~Mask;
- LibAmdPciRMW ((ACCESS_WIDTH) OpFlag, PciAddress, &Data, &rMask, StdHeader);
-}
-
-
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h
deleted file mode 100644
index bef3016..0000000
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH platform definition
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
- *
- */
-/*
-*****************************************************************************
-*
- * 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 _FCH_PLATFORM_H_
-#define _FCH_PLATFORM_H_
-
-#define MAX_SATA_PORTS 8
-
-#include "AGESA.h"
-
-#ifndef FCHOEM_ACPI_RESTORE_SWSMI
- #define FCHOEM_BEFORE_PCI_RESTORE_SWSMI 0xD3
- #define FCHOEM_AFTER_PCI_RESTORE_SWSMI 0xD4
- #define FCHOEM_ENABLE_ACPI_SWSMI 0xA0
- #define FCHOEM_DISABLE_ACPI_SWSMI 0xA1
- #define FCHOEM_START_TIMER_SMI 0xBC
- #define FCHOEM_STOP_TIMER_SMI 0xBD
-#endif
-
-#ifndef FCHOEM_SPI_UNLOCK_SWSMI
- #define FCHOEM_SPI_UNLOCK_SWSMI 0xAA
-#endif
-#ifndef FCHOEM_SPI_LOCK_SWSMI
- #define FCHOEM_SPI_LOCK_SWSMI 0xAB
-#endif
-
-#ifndef FCHOEM_ACPI_TABLE_RANGE_LOW
- #define FCHOEM_ACPI_TABLE_RANGE_LOW 0xE0000ul
-#endif
-
-#ifndef FCHOEM_ACPI_TABLE_RANGE_HIGH
- #define FCHOEM_ACPI_TABLE_RANGE_HIGH 0xFFFF0ul
-#endif
-
-#ifndef FCHOEM_ACPI_BYTE_CHECHSUM
- #define FCHOEM_ACPI_BYTE_CHECHSUM 0x100
-#endif
-
-#ifndef FCHOEM_IO_DELAY_PORT
- #define FCHOEM_IO_DELAY_PORT 0x80
-#endif
-
-#ifndef FCHOEM_OUTPUT_DEBUG_PORT
- #define FCHOEM_OUTPUT_DEBUG_PORT 0x80
-#endif
-
-#define FCH_PCIRST_BASE_IO 0xCF9
-#define FCH_PCI_RESET_COMMAND06 0x06
-#define FCH_PCI_RESET_COMMAND0E 0x0E
-#define FCH_KBDRST_BASE_IO 0x64
-#define FCH_KBC_RESET_COMMAND 0xFE
-#define FCH_ROMSIG_BASE_IO 0x20000l
-#define FCH_ROMSIG_SIGNATURE 0x55AA55AAul
-#define FCH_MAX_TIMER 0xFFFFFFFFul
-#define FCH_GEC_INTERNAL_REG 0x6804
-#define FCH_HPET_REG_MASK 0xFFFFF800ul
-#define FCH_FAKE_USB_BAR_ADDRESS 0x58830000ul
-
-
-#ifndef FCHOEM_ELAPSED_TIME_UNIT
- #define FCHOEM_ELAPSED_TIME_UNIT 28
-#endif
-
-#ifndef FCHOEM_ELAPSED_TIME_DIVIDER
- #define FCHOEM_ELAPSED_TIME_DIVIDER 100
-#endif
-
-#include "Fch.h"
-#include <Lib/amdlib.h>
-#include "Common/FchCommonCfg.h"
-#include "Common/AcpiLib.h"
-#include "Common/FchDef.h"
-#include "Common/FchBiosRamUsage.h"
-#include <Proc/Common/AmdFch.h>
-
-extern BUILD_OPT_CFG UserOptions;
-
-VOID
-FchInitS3EarlyRestore (
- IN FCH_DATA_BLOCK *FchDataPtr
- );
-
-VOID
-FchInitS3LateRestore (
- IN FCH_DATA_BLOCK *FchDataPtr
- );
-
-#endif // _FCH_PLATFORM_H_
diff --git a/src/vendorcode/amd/agesa/f16kb/Makefile.inc b/src/vendorcode/amd/agesa/f16kb/Makefile.inc
index ab82bcc..367efa9 100644
--- a/src/vendorcode/amd/agesa/f16kb/Makefile.inc
+++ b/src/vendorcode/amd/agesa/f16kb/Makefile.inc
@@ -67,6 +67,7 @@ AGESA_INC += -I$(AGESA_ROOT)/Proc/GNB/Modules/GnbTable
AGESA_INC += -I$(AGESA_ROOT)/Proc/GNB/Modules/GnbPcieInitLibV4
AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch
AGESA_INC += -I$(AGESA_ROOT)/Proc/Fch/Common
+AGESA_INC += -I$(AGESA_ROOT)/../common/Proc/Fch/Common
AGESA_INC += -I$(AGESA_ROOT)/Proc/IDS/Debug
AGESA_INC += -I$(AGESA_ROOT)/Proc/GNB/Modules/GnbPcieAspm
AGESA_INC += -I$(AGESA_ROOT)/Proc/GNB/Modules/GnbSmuLibV7
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/AcpiLib.c b/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/AcpiLib.c
deleted file mode 100644
index 905025f..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/AcpiLib.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH ACPI lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*
-*****************************************************************************
-*
- * Copyright (c) 2008 - 2013, 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.
-****************************************************************************
-*/
-#include "FchPlatform.h"
-#define FILECODE PROC_FCH_COMMON_ACPILIB_FILECODE
-//
-//
-// Routine Description:
-//
-// Locate ACPI table
-//
-// Arguments:
-//
-// Signature - table signature
-//
-//Returns:
-//
-// pointer to ACPI table
-//
-//
-VOID*
-AcpiLocateTable (
- IN UINT32 Signature
- )
-{
- UINT32 Index;
- UINT32 *RsdPtr;
- UINT32 *Rsdt;
- UINTN TableOffset;
- DESCRIPTION_HEADER *CurrentTable;
-
- RsdPtr = (UINT32*) (UINTN) FCHOEM_ACPI_TABLE_RANGE_LOW;
- Rsdt = NULL;
- do {
- if ( *RsdPtr == Int32FromChar('R','S','D',' ') && *(RsdPtr + 1) == Int32FromChar('P','T','R',' ') ) { /* ' DSR' & ' RTP' */
- Rsdt = (UINT32*) (UINTN) ((RSDP_HEADER*)RsdPtr)->RsdtAddress;
- break;
- }
- RsdPtr += 4;
- } while ( RsdPtr <= (UINT32*) (UINTN) FCHOEM_ACPI_TABLE_RANGE_HIGH );
-
- if ( Rsdt != NULL && AcpiGetTableCheckSum (Rsdt) == 0 ) {
- for ( Index = 0; Index < (((DESCRIPTION_HEADER*)Rsdt)->Length - sizeof (DESCRIPTION_HEADER)) / 4; Index++ ) {
- TableOffset = *(UINTN*) ((UINT8*)Rsdt + sizeof (DESCRIPTION_HEADER) + Index * 4);
- CurrentTable = (DESCRIPTION_HEADER*)TableOffset;
- if ( CurrentTable->Signature == Signature ) {
- return CurrentTable;
- }
- }
- }
- return NULL;
-}
-
-//
-//
-// Routine Description:
-//
-// Update table CheckSum
-//
-// Arguments:
-//
-// TablePtr - table pointer
-//
-// Returns:
-//
-// none
-//
-//
-VOID
-AcpiSetTableCheckSum (
- IN VOID *TablePtr
- )
-{
- UINT8 CheckSum;
-
- CheckSum = 0;
- ((DESCRIPTION_HEADER*)TablePtr)->CheckSum = 0;
- CheckSum = AcpiGetTableCheckSum (TablePtr);
- ((DESCRIPTION_HEADER*)TablePtr)->CheckSum = (UINT8) (FCHOEM_ACPI_BYTE_CHECHSUM - CheckSum);
-}
-
-//
-//
-// Routine Description:
-//
-// Get table CheckSum - Get ACPI table checksum
-//
-// Arguments:
-//
-// TablePtr - table pointer
-//
-// Returns:
-//
-// none
-//
-//
-UINT8
-AcpiGetTableCheckSum (
- IN VOID *TablePtr
- )
-{
- return GetByteSum (TablePtr, ((DESCRIPTION_HEADER*)TablePtr)->Length);
-}
-
-
-//
-//
-// Routine Description:
-//
-// GetByteSum - Get BYTE checksum value
-//
-// Arguments:
-//
-// DataPtr - table pointer
-// Length - table length
-//
-// Returns:
-//
-// CheckSum - CheckSum value
-//
-//
-UINT8
-GetByteSum (
- IN VOID *DataPtr,
- IN UINT32 Length
- )
-{
- UINT32 Index;
- UINT8 CheckSum;
-
- CheckSum = 0;
- for ( Index = 0; Index < Length; Index++ ) {
- CheckSum = CheckSum + (*((UINT8*)DataPtr + Index));
- }
- return CheckSum;
-}
-
-//
-//
-// Routine Description:
-//
-// GetFchAcpiMmioBase - Get FCH HwAcpi MMIO Base Address
-//
-// Arguments:
-//
-// AcpiMmioBase - HwAcpi MMIO Base Address
-// StdHeader - Amd Stand Header
-//
-// Returns:
-//
-// AcpiMmioBase - HwAcpi MMIO Base Address
-//
-//
-VOID
-GetFchAcpiMmioBase (
- OUT UINT32 *AcpiMmioBase,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- UINT32 AcpiMmioBaseAddressDword;
-
- ReadPmio (FCH_PMIOA_REG24 + 2, AccessWidth16, &AcpiMmioBaseAddressDword, StdHeader);
- *AcpiMmioBase = AcpiMmioBaseAddressDword << 16;
-}
-
-//
-//
-// Routine Description:
-//
-// GetFchAcpiPmBase - Get FCH HwAcpi PM Base Address
-//
-// Arguments:
-//
-// AcpiPmBase - HwAcpi PM Base Address
-// StdHeader - Amd Stand Header
-//
-// Returns:
-//
-// AcpiPmBase - HwAcpi PM Base Address
-//
-//
-VOID
-GetFchAcpiPmBase (
- OUT UINT16 *AcpiPmBase,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- ReadPmio (FCH_PMIOA_REG60, AccessWidth16, AcpiPmBase, StdHeader);
-}
-
-
-UINT8
-ReadFchSleepType (
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- UINT16 Value16;
- ReadPmio (FCH_PMIOA_REG62, AccessWidth16, &Value16, StdHeader);
- LibAmdIoRead (AccessWidth16, Value16, &Value16, StdHeader);
- return (UINT8) ((Value16 >> 10) & 7);
-}
-
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/AcpiLib.h b/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/AcpiLib.h
deleted file mode 100644
index 5c7f375..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/AcpiLib.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH ACPI lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*
-*****************************************************************************
-*
- * Copyright (c) 2008 - 2013, 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 _FCH_ACPILIB_H_
-#define _FCH_ACPILIB_H_
-///
-/// RSDP - ACPI 2.0 table RSDP
-///
-typedef struct _RSDP_HEADER {
- UINT64 Signature; ///< RSDP signature "RSD PTR"
- UINT8 CheckSum; ///< checksum of the first 20 bytes
- UINT8 OEMID[6]; ///< OEM ID
- UINT8 Revision; ///< 0 for APCI 1.0, 2 for ACPI 2.0
- UINT32 RsdtAddress; ///< physical address of RSDT
- UINT32 Length; ///< total length of RSDP (including extended part)
- UINT64 XsdtAddress; ///< physical address of XSDT
- UINT8 ExtendedCheckSum; ///< chechsum of whole table
- UINT8 Reserved[3]; ///< Reserved
-} RSDP_HEADER;
-
-///
-/// DESCRIPTION_HEADER - ACPI common table header
-///
-typedef struct _DESCRIPTION_HEADER {
- UINT32 Signature; ///< ACPI signature (4 ASCII characters)
- UINT32 Length; ///< Length of table, in bytes, including header
- UINT8 Revision; ///< ACPI Specification minor version #
- UINT8 CheckSum; ///< To make sum of entire table == 0
- UINT8 OemId[6]; ///< OEM identification
- UINT8 OemTableId[8]; ///< OEM table identification
- UINT32 OemRevision; ///< OEM revision number
- UINT32 CreatorId; ///< ASL compiler vendor ID
- UINT32 CreatorRevision; ///< ASL compiler revision number
-} DESCRIPTION_HEADER;
-
-///
-/// _AcpiRegWrite - ACPI MMIO register R/W structure
-///
-typedef struct _ACPI_REG_WRITE {
- UINT8 MmioBase; /// MmioBase: Index of Fch block (For instance GPIO_BASE:0x01 SMI_BASE:0x02)
- UINT8 MmioReg; /// MmioReg : Register index
- UINT8 DataAndMask; /// DataANDMask : AND Register Data
- UINT8 DataOrMask; /// DataOrMask : Or Register Data
-} ACPI_REG_WRITE;
-
-VOID* AcpiLocateTable (IN UINT32 Signature);
-VOID AcpiSetTableCheckSum (IN VOID *TablePtr);
-UINT8 AcpiGetTableCheckSum (IN VOID *TablePtr);
-UINT8 GetByteSum (IN VOID *DataPtr, IN UINT32 Length);
-
-#endif
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/MemLib.c b/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/MemLib.c
deleted file mode 100644
index 08bd0f9..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/MemLib.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH memory access lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*
-*****************************************************************************
-*
- * Copyright (c) 2008 - 2013, 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.
-****************************************************************************
-*/
-#include "FchPlatform.h"
-#include "Ids.h"
-#define FILECODE PROC_FCH_COMMON_MEMLIB_FILECODE
-
-
-/**
- * ReadMem - Read FCH BAR Memory
- *
- * @param[in] Address - Memory BAR address
- * @param[in] OpFlag - Access width
- * @param[in] *ValuePtr - In/Out value pointer
- *
- */
-VOID
-ReadMem (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID *ValuePtr
- )
-{
- OpFlag = OpFlag & 0x7f;
-
- switch ( OpFlag ) {
- case AccessWidth8:
- *((UINT8*)ValuePtr) = *((UINT8*) ((UINTN)Address));
- break;
-
- case AccessWidth16:
- *((UINT16*)ValuePtr) = *((UINT16*) ((UINTN)Address));
- break;
-
- case AccessWidth32:
- *((UINT32*)ValuePtr) = *((UINT32*) ((UINTN)Address));
- break;
-
- default:
- ASSERT (FALSE);
- break;
- }
-}
-
-/**
- * WriteMem - Write FCH BAR Memory
- *
- * @param[in] Address - Memory BAR address
- * @param[in] OpFlag - Access width
- * @param[in] *ValuePtr - In/Out Value pointer
- *
- */
-VOID
-WriteMem (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID *ValuePtr
- )
-{
- OpFlag = OpFlag & 0x7f;
-
- switch ( OpFlag ) {
- case AccessWidth8 :
- *((UINT8*) ((UINTN)Address)) = *((UINT8*)ValuePtr);
- break;
-
- case AccessWidth16:
- *((UINT16*) ((UINTN)Address)) = *((UINT16*)ValuePtr);
- break;
-
- case AccessWidth32:
- *((UINT32*) ((UINTN)Address)) = *((UINT32*)ValuePtr);
- break;
-
- default:
- ASSERT (FALSE);
- break;
- }
-}
-
-/**
- * RwMem - Read & Write FCH BAR Memory
- *
- * @param[in] Address - Memory BAR address
- * @param[in] OpFlag - Access width
- * @param[in] Mask - Mask Value of data
- * @param[in] Data - Write data
- *
- */
-VOID
-RwMem (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN UINT32 Mask,
- IN UINT32 Data
- )
-{
- UINT32 Result;
-
- ReadMem (Address, OpFlag, &Result);
- Result = (Result & Mask) | Data;
- WriteMem (Address, OpFlag, &Result);
- ReadMem (Address, OpFlag, &Result);
-}
-
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/PciLib.c b/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/PciLib.c
deleted file mode 100644
index 6ef1bd0..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/Common/PciLib.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH PCI access lib
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*
-*****************************************************************************
-*
- * Copyright (c) 2008 - 2013, 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.
-****************************************************************************
-*/
-#include "FchPlatform.h"
-#define FILECODE PROC_FCH_COMMON_PCILIB_FILECODE
-
-VOID
-ReadPci (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID* Value,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- PCI_ADDR PciAddress;
-
- PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
- LibAmdPciRead ((ACCESS_WIDTH) OpFlag, PciAddress, Value, StdHeader);
-}
-
-
-VOID
-WritePci (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN VOID *Value,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- PCI_ADDR PciAddress;
-
- PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
- LibAmdPciWrite ((ACCESS_WIDTH) OpFlag, PciAddress, Value, StdHeader);
-}
-
-
-VOID
-RwPci (
- IN UINT32 Address,
- IN UINT8 OpFlag,
- IN UINT32 Mask,
- IN UINT32 Data,
- IN AMD_CONFIG_PARAMS *StdHeader
- )
-{
- PCI_ADDR PciAddress;
- UINT32 rMask;
-
- PciAddress.AddressValue = ((Address >> 4) & ~0xFFF) + (Address & 0xFFF);
- rMask = ~Mask;
- LibAmdPciRMW ((ACCESS_WIDTH) OpFlag, PciAddress, &Data, &rMask, StdHeader);
-}
-
-
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/FchPlatform.h b/src/vendorcode/amd/agesa/f16kb/Proc/Fch/FchPlatform.h
deleted file mode 100644
index 52e24d6..0000000
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Fch/FchPlatform.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $NoKeywords:$ */
-/**
- * @file
- *
- * FCH platform definition
- *
- *
- *
- * @xrefitem bom "File Content Label" "Release Content"
- * @e project: AGESA
- * @e sub-project: FCH
- * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
- *
- */
-/*
-*****************************************************************************
-*
- * Copyright (c) 2008 - 2013, 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 _FCH_PLATFORM_H_
-#define _FCH_PLATFORM_H_
-
-#define MAX_SATA_PORTS 8
-
-#include "AGESA.h"
-
-#ifndef FCHOEM_ACPI_RESTORE_SWSMI
- #define FCHOEM_BEFORE_PCI_RESTORE_SWSMI 0xD3
- #define FCHOEM_AFTER_PCI_RESTORE_SWSMI 0xD4
- #define FCHOEM_ENABLE_ACPI_SWSMI 0xA0
- #define FCHOEM_DISABLE_ACPI_SWSMI 0xA1
- #define FCHOEM_START_TIMER_SMI 0xBC
- #define FCHOEM_STOP_TIMER_SMI 0xBD
-#endif
-
-#ifndef FCHOEM_SPI_UNLOCK_SWSMI
- #define FCHOEM_SPI_UNLOCK_SWSMI 0xAA
-#endif
-#ifndef FCHOEM_SPI_LOCK_SWSMI
- #define FCHOEM_SPI_LOCK_SWSMI 0xAB
-#endif
-
-#ifndef FCHOEM_ACPI_TABLE_RANGE_LOW
- #define FCHOEM_ACPI_TABLE_RANGE_LOW 0xE0000ul
-#endif
-
-#ifndef FCHOEM_ACPI_TABLE_RANGE_HIGH
- #define FCHOEM_ACPI_TABLE_RANGE_HIGH 0xFFFF0ul
-#endif
-
-#ifndef FCHOEM_ACPI_BYTE_CHECHSUM
- #define FCHOEM_ACPI_BYTE_CHECHSUM 0x100
-#endif
-
-#ifndef FCHOEM_IO_DELAY_PORT
- #define FCHOEM_IO_DELAY_PORT 0x80
-#endif
-
-#ifndef FCHOEM_OUTPUT_DEBUG_PORT
- #define FCHOEM_OUTPUT_DEBUG_PORT 0x80
-#endif
-
-#define FCH_PCIRST_BASE_IO 0xCF9
-#define FCH_PCI_RESET_COMMAND06 0x06
-#define FCH_PCI_RESET_COMMAND0E 0x0E
-#define FCH_KBDRST_BASE_IO 0x64
-#define FCH_KBC_RESET_COMMAND 0xFE
-#define FCH_ROMSIG_BASE_IO 0x20000l
-#define FCH_ROMSIG_SIGNATURE 0x55AA55AAul
-#define FCH_MAX_TIMER 0xFFFFFFFFul
-#define FCH_HPET_REG_MASK 0xFFFFF800ul
-#define FCH_FAKE_USB_BAR_ADDRESS 0x58830000ul
-
-
-#ifndef FCHOEM_ELAPSED_TIME_UNIT
- #define FCHOEM_ELAPSED_TIME_UNIT 28
-#endif
-
-#ifndef FCHOEM_ELAPSED_TIME_DIVIDER
- #define FCHOEM_ELAPSED_TIME_DIVIDER 100
-#endif
-
-#include "Fch.h"
-#include "amdlib.h"
-#include "FchCommonCfg.h"
-#include "AcpiLib.h"
-#include "FchDef.h"
-#include "FchBiosRamUsage.h"
-#include "AmdFch.h"
-
-extern BUILD_OPT_CFG UserOptions;
-
-VOID
-FchInitS3EarlyRestore (
- IN FCH_DATA_BLOCK *FchDataPtr
- );
-
-VOID
-FchInitS3LateRestore (
- IN FCH_DATA_BLOCK *FchDataPtr
- );
-
-#endif // _FCH_PLATFORM_H_
Timothy Pearson (tpearson(a)raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14514
-gerrit
commit 94a0b5157322f0ac401dc2376e43e4de025ce885
Author: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
Date: Mon Apr 25 13:33:06 2016 -0500
board_status/to-wiki: Fix background color of very recent test results
Test results under 16 days old display with an incorrect background color
due to the leading zero not being preset in the associated HTML color code.
Add the leading zero where needed to generate a valid HTML color code.
Change-Id: I0dfe29ec1afc409a4908073922ac31a4091f0f1f
Signed-off-by: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
---
util/board_status/to-wiki/towiki.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/util/board_status/to-wiki/towiki.sh b/util/board_status/to-wiki/towiki.sh
index d9ec064..3fec386 100755
--- a/util/board_status/to-wiki/towiki.sh
+++ b/util/board_status/to-wiki/towiki.sh
@@ -427,6 +427,9 @@ EOF
fi
fi
lastgood_diff_hex=$(echo "obase=16; $lastgood_diff" | bc)
+ if [ "$lastgood_diff" -lt 16 ]; then
+ lastgood_diff_hex="0${lastgood_diff_hex}"
+ fi
cell_bgcolor="#${lastgood_diff_hex}ff00"
echo "| style=\"background:${cell_bgcolor}\" | [[#$vendor/$board|$lastgood]]"
fi
Timothy Pearson (tpearson(a)raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14503
-gerrit
commit db38cd31b3d1d43b52e7259b58e47dfa21881764
Author: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
Date: Sun Apr 24 20:56:31 2016 -0500
nb/amd/mct_ddr3: Only initialize ECC bits once
The ECC check bits of all ECC DIMMS were inadvertently initialized
twice in the same routine, significantly delaying startup. Part
of this was related to an obsolete MCA workaround that has been
fixed through multiple commits, therefore the workaround is no
longer needed.
Only initialize the ECC check bits once.
Change-Id: I90ac1147d9b006794d29b866a9cb5b7ead8f01e7
Signed-off-by: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
---
src/northbridge/amd/amdmct/mct_ddr3/mctecc_d.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mctecc_d.c b/src/northbridge/amd/amdmct/mct_ddr3/mctecc_d.c
index abf40a1..c0ae440 100644
--- a/src/northbridge/amd/amdmct/mct_ddr3/mctecc_d.c
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mctecc_d.c
@@ -2,7 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2010 Advanced Micro Devices, Inc.
- * Copyright (C) 2015 Timothy Pearson <tpearson(a)raptorengineeringinc.com>, Raptor Engineering
+ * Copyright (C) 2015 - 2016 Raptor Engineering, LLC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -137,10 +137,6 @@ u8 ECCInit_D(struct MCTStatStruc *pMCTstat, struct DCTStatStruc *pDCTstatA)
/* Clear MC4 error status */
pci_write_config32(pDCTstat->dev_nbmisc, 0x48, 0x0);
pci_write_config32(pDCTstat->dev_nbmisc, 0x4c, 0x0);
-
- /* Clear the RAM before enabling ECC to prevent MCE-related lockups */
- DCTMemClr_Init_D(pMCTstat, pDCTstat);
- DCTMemClr_Sync_D(pMCTstat, pDCTstat);
}
}
Timothy Pearson (tpearson(a)raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14502
-gerrit
commit 44f54bec5a4138d4bccf37320ac7c18ba9071b1b
Author: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
Date: Sun Apr 24 20:33:29 2016 -0500
mainboard/kgpe-d16|kcma-d8: Update memory test to include second PRNG stage
The existing memory test routine was insufficient to detect certain types
of bus instability related to multiple incompatible RDIMMs on one channel.
Add a PRNG second stage test to the memory test routine. This second stage
test reliably detects faults in memory setup for RDIMM configurations that
also fail under the proprietary BIOS.
Change-Id: I44721447ce4c2b728d4a8f328ad1a3eb8f324d3d
Signed-off-by: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
---
src/mainboard/asus/kcma-d8/romstage.c | 62 ++++++++++++++++++++++++++++++----
src/mainboard/asus/kgpe-d16/romstage.c | 62 ++++++++++++++++++++++++++++++----
2 files changed, 110 insertions(+), 14 deletions(-)
diff --git a/src/mainboard/asus/kcma-d8/romstage.c b/src/mainboard/asus/kcma-d8/romstage.c
index c217ff3..9d1d95f 100644
--- a/src/mainboard/asus/kcma-d8/romstage.c
+++ b/src/mainboard/asus/kcma-d8/romstage.c
@@ -1,7 +1,7 @@
/*
* This file is part of the coreboot project.
*
- * Copyright (C) 2015 Raptor Engineering
+ * Copyright (C) 2015 - 2016 Raptor Engineering, LLC
*
* Copyright (C) 2007 AMD
* Written by Yinghai Lu <yinghailu(a)amd.com> for AMD.
@@ -246,28 +246,76 @@ static void execute_memory_test(void)
{
/* Test DRAM functionality */
uint32_t i;
+ uint32_t v;
+ uint32_t w;
+ uint32_t x;
+ uint32_t y;
+ uint32_t z;
uint32_t* dataptr;
- printk(BIOS_DEBUG, "Writing test patterns to memory...\n");
+ uint32_t readback;
+ uint32_t start = 0x300000;
+ printk(BIOS_DEBUG, "Writing test pattern 1 to memory...\n");
for (i=0; i < 0x1000000; i = i + 8) {
- dataptr = (void *)(0x300000 + i);
+ dataptr = (void *)(start + i);
*dataptr = 0x55555555;
- dataptr = (void *)(0x300000 + i + 4);
+ dataptr = (void *)(start + i + 4);
*dataptr = 0xaaaaaaaa;
}
printk(BIOS_DEBUG, "Done!\n");
printk(BIOS_DEBUG, "Testing memory...\n");
- uint32_t readback;
for (i=0; i < 0x1000000; i = i + 8) {
- dataptr = (void *)(0x300000 + i);
+ dataptr = (void *)(start + i);
readback = *dataptr;
if (readback != 0x55555555)
printk(BIOS_DEBUG, "%p: INCORRECT VALUE %08x (should have been %08x)\n", dataptr, readback, 0x55555555);
- dataptr = (void *)(0x300000 + i + 4);
+ dataptr = (void *)(start + i + 4);
readback = *dataptr;
if (readback != 0xaaaaaaaa)
printk(BIOS_DEBUG, "%p: INCORRECT VALUE %08x (should have been %08x)\n", dataptr, readback, 0xaaaaaaaa);
}
printk(BIOS_DEBUG, "Done!\n");
+ printk(BIOS_DEBUG, "Writing test pattern 2 to memory...\n");
+ /* Set up the PRNG seeds for initial write */
+ w = 0x55555555;
+ x = 0xaaaaaaaa;
+ y = 0x12345678;
+ z = 0x87654321;
+ for (i=0; i < 0x1000000; i = i + 4) {
+ /* Use Xorshift as a PRNG to stress test the bus */
+ v = x;
+ v ^= v << 11;
+ v ^= v >> 8;
+ x = y;
+ y = z;
+ z = w;
+ w ^= w >> 19;
+ w ^= v;
+ dataptr = (void *)(start + i);
+ *dataptr = w;
+ }
+ printk(BIOS_DEBUG, "Done!\n");
+ printk(BIOS_DEBUG, "Testing memory...\n");
+ /* Reset the PRNG seeds for readback */
+ w = 0x55555555;
+ x = 0xaaaaaaaa;
+ y = 0x12345678;
+ z = 0x87654321;
+ for (i=0; i < 0x1000000; i = i + 4) {
+ /* Use Xorshift as a PRNG to stress test the bus */
+ v = x;
+ v ^= v << 11;
+ v ^= v >> 8;
+ x = y;
+ y = z;
+ z = w;
+ w ^= w >> 19;
+ w ^= v;
+ dataptr = (void *)(start + i);
+ readback = *dataptr;
+ if (readback != w)
+ printk(BIOS_DEBUG, "%p: INCORRECT VALUE %08x (should have been %08x)\n", dataptr, readback, w);
+ }
+ printk(BIOS_DEBUG, "Done!\n");
}
#endif
diff --git a/src/mainboard/asus/kgpe-d16/romstage.c b/src/mainboard/asus/kgpe-d16/romstage.c
index e6bd91c..5a7400e 100644
--- a/src/mainboard/asus/kgpe-d16/romstage.c
+++ b/src/mainboard/asus/kgpe-d16/romstage.c
@@ -1,7 +1,7 @@
/*
* This file is part of the coreboot project.
*
- * Copyright (C) 2015 Timothy Pearson <tpearson(a)raptorengineeringinc.com>, Raptor Engineering
+ * Copyright (C) 2015 - 2016 Raptor Engineering, LLC
*
* Copyright (C) 2007 AMD
* Written by Yinghai Lu <yinghailu(a)amd.com> for AMD.
@@ -287,28 +287,76 @@ static void execute_memory_test(void)
{
/* Test DRAM functionality */
uint32_t i;
+ uint32_t v;
+ uint32_t w;
+ uint32_t x;
+ uint32_t y;
+ uint32_t z;
uint32_t* dataptr;
- printk(BIOS_DEBUG, "Writing test patterns to memory...\n");
+ uint32_t readback;
+ uint32_t start = 0x300000;
+ printk(BIOS_DEBUG, "Writing test pattern 1 to memory...\n");
for (i=0; i < 0x1000000; i = i + 8) {
- dataptr = (void *)(0x300000 + i);
+ dataptr = (void *)(start + i);
*dataptr = 0x55555555;
- dataptr = (void *)(0x300000 + i + 4);
+ dataptr = (void *)(start + i + 4);
*dataptr = 0xaaaaaaaa;
}
printk(BIOS_DEBUG, "Done!\n");
printk(BIOS_DEBUG, "Testing memory...\n");
- uint32_t readback;
for (i=0; i < 0x1000000; i = i + 8) {
- dataptr = (void *)(0x300000 + i);
+ dataptr = (void *)(start + i);
readback = *dataptr;
if (readback != 0x55555555)
printk(BIOS_DEBUG, "%p: INCORRECT VALUE %08x (should have been %08x)\n", dataptr, readback, 0x55555555);
- dataptr = (void *)(0x300000 + i + 4);
+ dataptr = (void *)(start + i + 4);
readback = *dataptr;
if (readback != 0xaaaaaaaa)
printk(BIOS_DEBUG, "%p: INCORRECT VALUE %08x (should have been %08x)\n", dataptr, readback, 0xaaaaaaaa);
}
printk(BIOS_DEBUG, "Done!\n");
+ printk(BIOS_DEBUG, "Writing test pattern 2 to memory...\n");
+ /* Set up the PRNG seeds for initial write */
+ w = 0x55555555;
+ x = 0xaaaaaaaa;
+ y = 0x12345678;
+ z = 0x87654321;
+ for (i=0; i < 0x1000000; i = i + 4) {
+ /* Use Xorshift as a PRNG to stress test the bus */
+ v = x;
+ v ^= v << 11;
+ v ^= v >> 8;
+ x = y;
+ y = z;
+ z = w;
+ w ^= w >> 19;
+ w ^= v;
+ dataptr = (void *)(start + i);
+ *dataptr = w;
+ }
+ printk(BIOS_DEBUG, "Done!\n");
+ printk(BIOS_DEBUG, "Testing memory...\n");
+ /* Reset the PRNG seeds for readback */
+ w = 0x55555555;
+ x = 0xaaaaaaaa;
+ y = 0x12345678;
+ z = 0x87654321;
+ for (i=0; i < 0x1000000; i = i + 4) {
+ /* Use Xorshift as a PRNG to stress test the bus */
+ v = x;
+ v ^= v << 11;
+ v ^= v >> 8;
+ x = y;
+ y = z;
+ z = w;
+ w ^= w >> 19;
+ w ^= v;
+ dataptr = (void *)(start + i);
+ readback = *dataptr;
+ if (readback != w)
+ printk(BIOS_DEBUG, "%p: INCORRECT VALUE %08x (should have been %08x)\n", dataptr, readback, w);
+ }
+ printk(BIOS_DEBUG, "Done!\n");
}
#endif
Timothy Pearson (tpearson(a)raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14501
-gerrit
commit 0dae23f6b19b1ce668ec36b9988fc8f9b4b23940
Author: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
Date: Sun Apr 24 20:27:28 2016 -0500
nb/amd/mct_ddr3: Report correct DIMM in MRS setup routines
The wrong DIMM number was used in the initial non-target MRS
setup routines. This had no functional impact other than to
print the wrong DIMM number in the DDR3 verbose debug output.
Change-Id: I480118ed00e1786a06e641a56f0fb19cd87f92eb
Signed-off-by: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
---
src/northbridge/amd/amdmct/mct_ddr3/mhwlc_d.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mhwlc_d.c b/src/northbridge/amd/amdmct/mct_ddr3/mhwlc_d.c
index 6e1c850..c6ec905 100644
--- a/src/northbridge/amd/amdmct/mct_ddr3/mhwlc_d.c
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mhwlc_d.c
@@ -2,7 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2010 Advanced Micro Devices, Inc.
- * Copyright (C) 2015 Timothy Pearson <tpearson(a)raptorengineeringinc.com>, Raptor Engineering
+ * Copyright (C) 2015 - 2016 Raptor Engineering, LLC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -779,7 +779,7 @@ void prepareDimms(struct MCTStatStruc *pMCTstat, struct DCTStatStruc *pDCTstat,
/* Retrieve normal settings of the MRS control word and clear Rtt_Nom */
if (is_fam15h()) {
- tempW = mct_MR1(pMCTstat, pDCTstat, dct, dimm*2+rank) & 0xffff;
+ tempW = mct_MR1(pMCTstat, pDCTstat, dct, currDimm*2+rank) & 0xffff;
tempW &= ~(0x0244);
} else {
/* Set TDQS=1b for x8 DIMM, TDQS=0b for x4 DIMM, when mixed x8 & x4 */
@@ -862,7 +862,7 @@ void prepareDimms(struct MCTStatStruc *pMCTstat, struct DCTStatStruc *pDCTstat,
/* Retrieve normal settings of the MRS control word and clear Rtt_WR */
if (is_fam15h()) {
- tempW = mct_MR2(pMCTstat, pDCTstat, dct, dimm*2+rank) & 0xffff;
+ tempW = mct_MR2(pMCTstat, pDCTstat, dct, currDimm*2+rank) & 0xffff;
tempW &= ~(0x0600);
} else {
/* program MrsAddress[7,6,5:3]=SRT,ASR,CWL,