summaryrefslogtreecommitdiff
path: root/Core/EM/BoardInfo
diff options
context:
space:
mode:
authorraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
committerraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
commitb7c51c9cf4864df6aabb99a1ae843becd577237c (patch)
treeeebe9b0d0ca03062955223097e57da84dd618b9a /Core/EM/BoardInfo
downloadzprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'Core/EM/BoardInfo')
-rw-r--r--Core/EM/BoardInfo/AMIBoardInfo.cif15
-rw-r--r--Core/EM/BoardInfo/AmiBoardInfo.c391
-rw-r--r--Core/EM/BoardInfo/AmiBoardInfo.chmbin0 -> 35525 bytes
-rw-r--r--Core/EM/BoardInfo/AmiBoardInfo.dxs55
-rw-r--r--Core/EM/BoardInfo/AmiBoardInfo.mak334
-rw-r--r--Core/EM/BoardInfo/AmiBoardInfo.sdl113
-rw-r--r--Core/EM/BoardInfo/PciBoard.c119
7 files changed, 1027 insertions, 0 deletions
diff --git a/Core/EM/BoardInfo/AMIBoardInfo.cif b/Core/EM/BoardInfo/AMIBoardInfo.cif
new file mode 100644
index 0000000..b4d1a21
--- /dev/null
+++ b/Core/EM/BoardInfo/AMIBoardInfo.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "AmiBoardInfo"
+ category = ModulePart
+ LocalRoot = "Core\EM\BoardInfo"
+ RefName = "AmiBoardInfo"
+[files]
+"AmiBoardInfo.sdl"
+"AmiBoardInfo.mak"
+"AmiBoardInfo.c"
+"AmiBoardInfo.dxs"
+"PciBoard.c"
+"AmiBoardInfo.chm"
+[parts]
+"AmiBoardInfoIncludes"
+<endComponent>
diff --git a/Core/EM/BoardInfo/AmiBoardInfo.c b/Core/EM/BoardInfo/AmiBoardInfo.c
new file mode 100644
index 0000000..2965958
--- /dev/null
+++ b/Core/EM/BoardInfo/AmiBoardInfo.c
@@ -0,0 +1,391 @@
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/BIN/Core/Modules/BoardInfo/AmiBoardInfo.c 7 12/16/11 5:02p Yakovlevs $
+//
+// $Revision: 7 $
+//
+// $Date: 12/16/11 5:02p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Core/Modules/BoardInfo/AmiBoardInfo.c $
+//
+// 7 12/16/11 5:02p Yakovlevs
+// Added functions headers for CHM
+//
+// 6 9/30/11 5:40p Yakovlevs
+// [TAG] EIP66222
+// [Category] New Feature
+// [Description] Modify PCI bus driver to get board info from separate
+// FFS section
+// [Files] AmiBoaardInfo.c;
+// AmiBoaardInfo.mak;
+// AmiBoaardInfo.sdl;
+// PciBoard.c
+// AmiBoaardInfo.h
+//
+// 5 6/28/11 5:51p Yakovlevs
+// [TAG] EIP 60123
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Resource padding is not functional for PCIe hot-plug.
+// [RootCause] In HP Mode #ifndef statement was not working
+// [Solution] Cahnged to reference AMI_HOTPLUG_INIT_SUPPORT token
+// [Files] AmiBoardInfo.c PciBoard.c
+//
+// 4 3/01/10 5:06p Yakovlevs
+// New separate Label with generic Multi-Root support.
+// Uses new AMI SDL "C" sytle output for the former "ASM" style.
+//
+// 3 5/05/09 3:16p Felixp
+// Disable ACPI module dependent code if ACPI_MODULE_VER is less or equal
+// than 30
+//
+// 2 5/05/09 1:07p Felixp
+// Formatting update: File headers are updated.
+//
+// 1 4/28/09 1:20p Yakovlevs
+// Added new ModulePart - Ami Board Info.
+// This module groups together all VeB generated outpit files as well as
+// DSDT generation.
+//
+// 1 3/18/07 5:23p Felixp
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: <This File Name>
+//
+// Description:
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include <Token.h>
+#include <AmiDxeLib.h>
+#include <Protocol\AmiBoardInfo.h>
+
+//----------------------------------------------------------------------------
+//Global GUIDs Definitions goes here
+EFI_GUID gAmiBoardInfoGuid=AMI_BOARD_INFO_PROTOCOL_GUID;
+
+/*
+//----------------------------------------------------------------------------
+//Variable definitions goes here
+//PCI Buses Xlate Table
+extern UINTN BusNumXlatTbl;
+extern UINTN BusNumXlatTblEnd;
+//----------------------------------------------------------------------------
+//Legacy IRQ routing table delivered from oempir.inc and PCIBoard.ASM
+extern UINTN IRQ_Table;
+extern UINTN IRQ_Table_end;
+//----------------------------------------------------------------------------
+//IOAPIC IRQ routing table delivered from mppciirq.inc and PCIBoard.ASM
+#if AMI_BOARD_VER_COMBINED >= 100
+extern MP_IRI_Table;
+extern UINTN MP_IRI_Table_END;
+#else
+extern UINTN MP_IRI_Table;
+extern MP_IRI_Table_END;
+#endif
+//----------------------------------------------------------------------------
+//IO/APIC(s) Info Table
+extern UINTN MP_IAI_Table;
+extern UINTN MP_IAI_Table_END;
+//----------------------------------------------------------------------------
+//Hot pluf stuff
+//For PIC we need it it has SLOT # Info APIC does not.
+//And for verification: HP_SlotP_Count has to much HP_SlotA_Count
+extern HP_SlotP_Start;
+extern HP_SlotP_End;
+//----------------------------------------------------------------------------
+//For APIC used in MP 1.4 Tables generation
+extern HP_SlotA_Start;
+extern HP_SlotA_End;
+*/
+
+extern UINT8 AmlCode[];
+
+//<AMI_SHDR_START>
+//----------------------------------------------------------------------------
+// Name: gAmiBoardProtocol
+//
+// Description: Ami Board Info Protocol Instance.
+//
+//----------------------------------------------------------------------------
+//<AMI_SHDR_END>
+AMI_BOARD_INFO_PROTOCOL gAmiBoardProtocol = {
+ //BOOLEAN DataValid; //Signifies if Board Specific IRQ data was updated.
+ FALSE,
+ //UINT16 BusXlatEntries;
+ 0,
+ //UINT16 SdlPciIrqMask;
+ 0,
+ //UINT8 Reserved[3];
+ {0,0,0},
+ //PCI_BUS_XLAT_HDR *BusXlatTable;
+ //UINTN BusXlatLength;
+ NULL,0,//(PCI_BUS_XLAT_HDR*)&BusNumXlatTbl, 0,
+ //PCI_IRQ_PIC_ROUTE *PicRoutTable;
+ //UINTN PicRoutLength;
+ NULL,0,//(PCI_IRQ_PIC_ROUTE*)&IRQ_Table, 0,
+ //PCI_IRQ_PIC_ROUTE *HpSltTablePic;
+ //UINTN HpSltPicLength;
+ NULL,0,//(PCI_IRQ_PIC_ROUTE*)&HP_SlotP_Start, 0,
+ //PCI_IRQ_APIC_ROUTE *ApicRoutTable;
+ //UINTN ApicRoutLength;
+ NULL,0,//(PCI_IRQ_APIC_ROUTE*)&MP_IRI_Table, 0,
+ //PCI_IRQ_APIC_ROUTE *HpSltTableApic;
+ //UINTN HpSltApicLength;
+ NULL,0,//(PCI_IRQ_APIC_ROUTE*)&HP_SlotA_Start, 0,
+ //AMI_APIC_INFO *ApicInfoTable;
+ //UINTN ApicInfoLength;
+ NULL,0,//(AMI_APIC_INFO*)&MP_IAI_Table, 0,
+ //VOID *BoardAcpiInfo;
+#if ACPI_MODULE_VER<=30
+ NULL,
+#else
+ &AmlCode,
+#endif
+ //VOID *BoardOemInfo;
+ NULL
+};
+
+UINT8 *gSdlDataStart=NULL;
+UINTN gSdlDataLen=0;
+
+//<AMI_SHDR_START>
+//----------------------------------------------------------------------------
+// Name: gAmiBoardProtocolHandle
+//
+// Description: Ami Board Info Protocol Handle.
+//
+//----------------------------------------------------------------------------
+//<AMI_SHDR_END>
+EFI_HANDLE gAmiBoardInfoHandle=NULL;
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ParseAmiSdlData()
+//
+// Description: Seaarches SDL Generated Data structures for specific table
+// Signature.
+//
+// Input:
+// UINT8* IN *DataPtr Pointer To the beginning of SDL Data.
+// UINTN IN DataLen Number of bytes to parse.
+// UINT32 IN Signature Table Signature to Look for.
+// VOID** IN OUT TblPtr Double Pointer To return desired tble start address.
+//
+// Output: EFI_STATUS
+// EFI_SUCCESS When everything is going on fine!
+// EFI_NOT_FOUND When there are no more handles to override.
+// EFI_INVALID_PARAMETER When Parameter passed is invalid.
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ParseAmiSdlData(UINT8 *DataPtr, UINTN DataLen, UINT32 Signature, OUT VOID **TblPtr){
+ UINT8 *start=DataPtr;
+ UINT32 *sig;
+ UINTN i;
+//-----------------
+ if(start==NULL || TblPtr==NULL || DataLen==0 ) return EFI_INVALID_PARAMETER;
+
+ for(i=0; i<DataLen-sizeof(UINT32); i++){
+ sig=(UINT32*)(&start[i]);
+ if(*sig == Signature) {
+ *TblPtr=sig;
+ return EFI_SUCCESS;
+ }
+ }
+ return EFI_NOT_FOUND;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PciBusEntryPoint()
+//
+// Description: This function is the entry point for AMI Board Info Driver.
+// There it will initialize some global data and install an instance of
+// AMI_BOARD_INFO_PROTOCOL.
+//
+// Input:
+// EFI_HANDLE ImageHandle Image handle.
+// EFI_SYSTEM_TABLE *SystemTable Pointer to the EFI system table.
+//
+// Output: EFI_STATUS
+// EFI_SUCCESS When everything is going on fine!
+// EFI_NOT_FOUND When something required is not found!
+// EFI_DEVICE_ERROR When the device is not responding!
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS AmiBoardEntryPoint(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ EFI_STATUS Status;
+ AMI_BOARD_INFO_PROTOCOL *amibrd=NULL;
+ UINT8 *sdldata=NULL;
+ UINTN sdlsize=0;
+ VOID *DataPtr;
+ UINTN DataLen;
+ UINT8 *p8;
+//VARIABLES TO VERIFY CONSISTANCY OF THE DATA STRUCTURES AND PORTING
+ UINTN psc=0; //PIC table slot count
+ UINTN asc=0; //APIC table slot count
+ UINTN hpsc=0; //PIC table slot count
+ UINTN hasc=0; //APIC table slot count
+
+//--------------------------------
+ InitAmiLib(ImageHandle,SystemTable);
+
+ //First try to check if we are running on MultiPlatfortm Enabled BIOS
+ Status=pBS->LocateProtocol(&gAmiBoardInfoGuid, NULL, &amibrd);
+ if(!EFI_ERROR(Status)){
+ TRACE((-1,"AmiBrdInfo: Multi-Platform BrdInfo present Status=%r Exiting",Status));
+ return Status;
+ }
+
+//DEBUG
+//EFI_DEADLOOP();
+//DEBUG
+
+ amibrd=&gAmiBoardProtocol;
+
+ // Reade resource section from this driver image.
+ Status=ReadImageResource(ImageHandle, &gAmiBoardInfoSectionGuid, &gSdlDataStart, &gSdlDataLen);
+ ASSERT_EFI_ERROR(Status);
+ if(EFI_ERROR(Status)) return Status;
+
+ //Init Ami Platform Info Protocol Instance...
+
+ //1. First get Xlat Table Signature
+ Status=ParseAmiSdlData(gSdlDataStart,gSdlDataLen,AMI_XLT_SIGNATURE,&DataPtr);
+ ASSERT_EFI_ERROR(Status);
+ if(EFI_ERROR(Status)) return Status;
+
+ //Here we got XLAT Pointer
+ DataLen=((AMI_SDL_INFO_HDR*)DataPtr)->Size;
+ p8=(UINT8*)DataPtr;
+ gAmiBoardProtocol.BusXlatTable=(PCI_BUS_XLAT_HDR*)(p8+sizeof(AMI_SDL_INFO_HDR));
+ gAmiBoardProtocol.BusXlatLength=DataLen-sizeof(AMI_SDL_INFO_HDR);
+
+ //2. Than get Legacy $PIR table...
+ DataPtr=NULL;
+ Status=ParseAmiSdlData(gSdlDataStart,gSdlDataLen,AMI_PIR_SIGNATURE,&DataPtr);
+ ASSERT_EFI_ERROR(Status);
+ if(EFI_ERROR(Status)) return Status;
+
+ //Here we suppose to get PIC IRQ Routing Table.
+ DataLen=((AMI_SDL_IRQR_HDR*)DataPtr)->Size;
+ p8=(UINT8*)DataPtr; //p8 points on the table header.
+ //Make it point at the beginning of a data
+ p8+=sizeof(AMI_SDL_IRQR_HDR);
+ gAmiBoardProtocol.PicRoutTable=(PCI_IRQ_PIC_ROUTE*)p8;
+
+ //Save slot count data for verification later.
+ psc=((AMI_SDL_IRQR_HDR*)DataPtr)->SlotCount;
+ gAmiBoardProtocol.PicRoutLength=sizeof(PCI_IRQ_PIC_ROUTE)*psc;
+
+ //advance pointer to point on HP slots start
+ p8+=gAmiBoardProtocol.PicRoutLength;
+
+ //Save HP slot count data for verification later.
+ hpsc=((AMI_SDL_IRQR_HDR*)DataPtr)->HpSlotCount;
+
+ //Now check HP Slots if any...
+ if(hpsc) {
+ gAmiBoardProtocol.HpSltTablePic=(PCI_IRQ_PIC_ROUTE*)p8;
+ gAmiBoardProtocol.HpSltPicLength=sizeof(PCI_IRQ_PIC_ROUTE)*hpsc;
+ }
+ //Add to the totoal length of the system's slots length of the HP slots.
+ gAmiBoardProtocol.PicRoutLength+=gAmiBoardProtocol.HpSltPicLength;
+
+ //Update SdlPciIrqMask field ... it is last 2 bytes of the IRQ routing data buffer.
+ p8=(UINT8*)DataPtr+DataLen-sizeof(UINT16);
+ gAmiBoardProtocol.SdlPciIrqMask=*((UINT16*)p8);
+
+ //3. Now get APIC Routing info.
+ DataPtr=NULL;
+ Status=ParseAmiSdlData(gSdlDataStart,gSdlDataLen,AMI_AIR_SIGNATURE,&DataPtr);
+ ASSERT_EFI_ERROR(Status);
+ if(EFI_ERROR(Status)) return Status;
+
+ //Here we suppose to get APIC IRQ Routing Table.
+ DataLen=((AMI_SDL_IRQR_HDR*)DataPtr)->Size;
+ p8=(UINT8*)DataPtr; //p8 points on the table header.
+ //Make it point at the beginning of a data
+ p8+=sizeof(AMI_SDL_IRQR_HDR);
+ gAmiBoardProtocol.ApicRoutTable=(PCI_IRQ_APIC_ROUTE*)p8;
+
+ //Save slot count data for verification later.
+ asc=((AMI_SDL_IRQR_HDR*)DataPtr)->SlotCount;
+ gAmiBoardProtocol.ApicRoutLength=sizeof(PCI_IRQ_APIC_ROUTE)*asc;
+
+ //advance pointer to point on HP slots start
+ p8+=gAmiBoardProtocol.ApicRoutLength;
+
+ //Save HP slot count data for verification later.
+ hasc=((AMI_SDL_IRQR_HDR*)DataPtr)->HpSlotCount;
+
+ //Now check HP Slots if any...
+ if( hasc ) {
+ gAmiBoardProtocol.HpSltTableApic=(PCI_IRQ_APIC_ROUTE*)p8;
+ gAmiBoardProtocol.HpSltApicLength=sizeof(PCI_IRQ_APIC_ROUTE)*hasc;
+ }
+ //Add to the totoal length of the system's slots length of the HP slots.
+ gAmiBoardProtocol.ApicRoutLength+=gAmiBoardProtocol.HpSltApicLength;
+
+ //4. Update IO APIC info.
+ DataPtr=NULL;
+ Status=ParseAmiSdlData(gSdlDataStart,gSdlDataLen,AMI_APD_SIGNATURE,&DataPtr);
+ ASSERT_EFI_ERROR(Status);
+ if(EFI_ERROR(Status)) return Status;
+
+ //Here we suppose to get IOA APIC Informationtable.
+ DataLen=((AMI_SDL_INFO_HDR*)DataPtr)->Size;
+ p8=(UINT8*)DataPtr; //p8 points on the table header.
+ gAmiBoardProtocol.ApicInfoTable=(AMI_APIC_INFO*)(p8+sizeof(AMI_SDL_INFO_HDR));
+ gAmiBoardProtocol.ApicInfoLength=DataLen-sizeof(AMI_SDL_INFO_HDR);
+
+ //So far so good...
+ //Just Check consistancy of data collected.
+ if( psc!=asc || hpsc!=hasc) {
+ ASSERT_EFI_ERROR(EFI_INVALID_PARAMETER);
+ }
+
+ //Now install AMI BOARD INFO Protocol...
+ Status=pBS->InstallMultipleProtocolInterfaces(
+ &gAmiBoardInfoHandle,
+ &gAmiBoardInfoGuid, &gAmiBoardProtocol, NULL
+ );
+
+ return Status;
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//********************************************************************** \ No newline at end of file
diff --git a/Core/EM/BoardInfo/AmiBoardInfo.chm b/Core/EM/BoardInfo/AmiBoardInfo.chm
new file mode 100644
index 0000000..9917931
--- /dev/null
+++ b/Core/EM/BoardInfo/AmiBoardInfo.chm
Binary files differ
diff --git a/Core/EM/BoardInfo/AmiBoardInfo.dxs b/Core/EM/BoardInfo/AmiBoardInfo.dxs
new file mode 100644
index 0000000..8314695
--- /dev/null
+++ b/Core/EM/BoardInfo/AmiBoardInfo.dxs
@@ -0,0 +1,55 @@
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2009, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/BIN/Core/Modules/BoardInfo/AmiBoardInfo.dxs 3 5/05/09 4:05p Yakovlevs $
+//
+// $Revision: 3 $
+//
+// $Date: 5/05/09 4:05p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Core/Modules/BoardInfo/AmiBoardInfo.dxs $
+//
+// 3 5/05/09 4:05p Yakovlevs
+//
+// 2 5/05/09 1:07p Felixp
+// Formatting update: File headers are updated.
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: AmiBoardInfo.dxs
+//
+// Description: Dependency expression for the AMI Board Info Driver
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2009, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/Core/EM/BoardInfo/AmiBoardInfo.mak b/Core/EM/BoardInfo/AmiBoardInfo.mak
new file mode 100644
index 0000000..fcd96ee
--- /dev/null
+++ b/Core/EM/BoardInfo/AmiBoardInfo.mak
@@ -0,0 +1,334 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2009, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/Projects/Intel/Haswell/LynxPoint_SharkBay-DT_Crb_1AQQW/Core/EM/BoardInfo/AmiBoardInfo.mak 14 9/18/13 3:54a Thomaschen $
+#
+# $Revision: 14 $
+#
+# $Date: 9/18/13 3:54a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/Projects/Intel/Haswell/LynxPoint_SharkBay-DT_Crb_1AQQW/Core/EM/BoardInfo/AmiBoardInfo.mak $
+#
+# 14 9/18/13 3:54a Thomaschen
+# Improved solution of EIP107638.
+#
+# 10 6/05/13 5:00a Thomaschen
+# Updated for EIP107638.
+#
+# 9 2/12/13 11:28p Wesleychen
+# - Add eLink "SB_OSCM_ASL" support.
+# - Add eLink "ASL_PCI0_INI" for Thunderbolt support.
+#
+# 8 1/29/13 12:27a Wesleychen
+# Update Core to 4.6.5.4.
+#
+# 13 5/04/12 5:48p Oleksiyy
+# [TAG] EIP89379
+# [Category] Improvement
+# [Description] Add generic support for changing iasl compiler.
+# [Files] ACPI.sdl and AmiBoardInfo.mak
+#
+# 12 1/26/12 3:19p Oleksiyy
+# [TAG] EIP80854
+# [Category] New Feature
+# [Description] Global _OSC control method is not available to read
+# system wide capabilities in multiple ASL files.
+# [Files] ACPI.sdl and AmiBoardInfo.mak
+#
+# 11 9/30/11 5:41p Yakovlevs
+# [TAG] EIP66222
+# [Category] New Feature
+# [Description] Modify PCI bus driver to get board info from separate
+# FFS section
+# [Files] AmiBoaardInfo.mak;
+# AmiBoaardInfo.sdl;
+# PciBoard.c
+# AmiBoaardInfo.h
+#
+# 10 6/17/11 12:28p Yakovlevs
+# [TAG] EIP54238
+# [Category] Improvement
+# [Description] Add ASLPREPROCESS_FLAG for the dsdt.asl proprocessing
+# [Files] AmiBoardInfo.sdl; AmiBoardInfo.mak
+#
+# 9 3/24/11 11:40a Oleksiyy
+# [TAG] EIP56433
+# [Category] Improvement
+# [Description] Elink table of include dirs for aslexpander is added.
+# [Files] AmiBoardInfo.sdl, AmiBoardInfo.mak.
+#
+# 8 12/16/10 10:41a Oleksiyy
+# [TAG] EIP50035
+# [Category] Improvement
+# [Description] #Ifdef support in ASL code generically added.
+# [Files] ACPI.sdl and AmiBoardInfo.mak
+#
+# 7 5/07/09 6:11p Yakovlevs
+# fixed BUILD error with ACPI_MODULE_VER token
+#
+# 6 5/05/09 3:16p Felixp
+# Disable ACPI module dependent code if ACPI_MODULE_VER is less or equal
+# than 30
+#
+# 5 5/05/09 1:07p Felixp
+# Formatting update: File headers are updated.
+#
+# 4 5/05/09 12:53p Yakovlevs
+# Fixed build issue in x64 mode. Default AFLAGS used /Cp switch to
+# preserve case for PUBLIC identifiers.
+#
+# 1 4/28/09 1:20p Yakovlevs
+# Added new ModulePart - Ami Board Info.
+# This module groups together all VeB generated outpit files as well as
+# DSDT generation.
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AmiBoardInfo.mak
+#
+# Description: Make file to create AmiBoardInfo Driver
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+
+all : AmiBoardInfo
+
+AmiBoardInfo : $(BUILD_DIR)\AmiBoardInfo.mak OemPirBin AmiBoardInfoBin
+
+$(BUILD_DIR)\AmiBoardInfo.mak : $(AmiBoardInfo_DIR)\$(@B).cif $(AmiBoardInfo_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmiBoardInfo_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+OemPirBin :
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS) \
+ /f $(BUILD_DIR)\AmiBoardInfo.mak bin \
+ "OBJECTS=$(BUILD_DIR)\$(AmiBoardInfo_DIR)\PciBoard.obj"\
+ "MY_DEFINES=/DPCIIRQ_REMAP"\
+ "EXT_HEADERS=$(BUILD_DIR)\oempir.h $(BUILD_DIR)\mppciirq.h $(BUILD_DIR)\BusNumXlat.h"\
+ NAME=oempirall\
+ MAKEFILE=$(BUILD_DIR)\AmiBoardInfo.mak\
+ TYPE=BINARY
+
+AmiBoardInfoBin : $(AMIDXELIB)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS) \
+ /f $(BUILD_DIR)\AmiBoardInfo.mak all \
+ GUID=9F3A0016-AE55-4288-829D-D22FD344C347 \
+ "AFLAGS=$(AFLAGS:/Cp=)"\
+ "AFLAGSx64=$(AFLAGSx64:/Cp=)"\
+ ENTRY_POINT=AmiBoardEntryPoint \
+ TYPE=BS_DRIVER \
+ EXT_HEADERS=$(BUILD_DIR)\token.h\
+ "OBJECTS=$(BUILD_DIR)\$(AmiBoardInfo_DIR)\AmiBoardInfo.obj"\
+ COMPRESS=1\
+ RESOURCE=$(BUILD_DIR)\oempirall.bin \
+ SECTION_GUID=E6F4F8F7-4992-47b2-8302-8508745E4A23
+
+
+!IF "$(ACPI_SUPPORT)"=="1" && "$(ACPI_MODULE_VER)"!=""
+!IF $(ACPI_MODULE_VER) > 30
+
+AmiBoardInfoBin : $(BUILD_DIR)\dsdt.obj
+
+#----------------------------------------------------------------------------
+# In order to build AML tables (DSDT.AML & SSDT.AML)
+# ASL compiler have to be ran with DSDT.ASL and SSDT.ASL files corespondingly.
+#-----------------------------------------------------------------------
+# GENERATE ASL -> ASM Code
+#-----------------------------------------------------------------------
+
+$(BUILD_DIR)\dsdt.obj: $(PROJECT_DIR)\DSDT.ASL $(IO_ASLS) $(PCI_ASLS) $(BUILD_DIR)\token.mak
+#dsdt.asl must be in the project directory; otherwise, will not be able to include various include files, esp. pcitree.asl
+!IF "$(IFDEF_ASL_SUPPORT)"=="1"
+ $(ASLEXPANDER) $(PROJECT_DIR)\DSDT.ASL $(PROJECT_DIR)\DSDT_Temp.ASL $(PROJECT_DIR) $(ASL_EXP_INCLUDE_PATH)
+ $(CP) /EP /C /FI$(BUILD_DIR)\tokenasl.h $(ASLPREPROCESS_FLAG) $(PROJECT_DIR)\DSDT_Temp.ASL > $(PROJECT_DIR)\DSDT.ASL
+!ENDIF
+!IFDEF ASL_FLAGS
+ $(ACPI_ASL_COMPILER) $(ASL_FLAGS) $(PROJECT_DIR)\DSDT.ASL
+!ELSE
+ $(ACPI_ASL_COMPILER) -tc -vi $(PROJECT_DIR)\DSDT.ASL
+!ENDIF
+ move $(PROJECT_DIR)\DSDT.hex $(BUILD_DIR)\DSDT.c
+ $(CC) $(CFLAGS) /Fo$@ $(BUILD_DIR)\DSDT.c
+
+#-----------------------------------------------------------------------#
+# Description of ASL files that take part in building ACPI DSDT table
+# amlUpd.asl - OperationRegion and Field names to refer to BIOS exchange memory area
+# token.asl - SDL tokens stored in ASL name format
+# aslLib.asl - standard ASL routines (GPRW - generic PRW routine. MCTH - string compare routine)
+# PCItree.asl - file is generated by AMISDL. Defines PCI Devices tree, PCI IRQ routing information
+# oemDSDT.asl - defines Root PCI bridge resources (_CRS), _PTS(prepare to sleep),_WAK(after wake up) routines
+# irqLink.asl - Irq routing devices LINKx
+# ioRoute.asl - Chipset specific routines to route/release IO/DMA resources on ISA/LPC bus. Used only if Positive decoding is selected
+# FAN.asl - OEM Fan device(s) objects
+# TZ.asl - OEM Thermal Zone(s) objects
+# SI.asl - OEM System Indication objects
+#-----------------------------------------------------------------------
+DSDT_ASLS = \
+$(BUILD_DIR)\token.asl\
+!IF "$(PlatformAcpiTables_SUPPORT)"=="0"
+Core\Em\ACPI\asllib.asl\
+!ENDIF
+Core\Em\ACPI\amlupd.asl\
+$(GENERIC_ASL_BEFORE_PCITREE)\
+$(BUILD_DIR)\PCItree.asl\
+$(GENERIC_ASL)\
+!IF "$(A_SIOW)"=="00" #IO_ASLS
+!IFDEF CRB_EC_SUPPORT
+!IF "$(CRB_EC_SUPPORT)"=="0"
+$(PROJECT_DIR)\$(AcpiAslWrap_DIR)\PlatformPS2Wake.ASL\
+!ENDIF
+!ELSE
+!IF "$(CRB_SIO_SUPPORT)"=="0"
+!IF "$(AcpiAslWrap_SUPPORT)"!="0"
+$(PROJECT_DIR)\$(AcpiAslWrap_DIR)\PlatformPS2Wake.ASL\
+!ENDIF #AcpiAslWrap_SUPPORT!=0
+!ENDIF #CRB_SIO_SUPPORT == 0
+!ENDIF #CRB_EC_SUPPORT
+!ENDIF #IO_ASLS
+!IFDEF CRB_EC_SUPPORT
+!IF "$(CRB_EC_SUPPORT)"=="0"
+$(INTEL_EC_ASL)
+!ENDIF
+!ELSE
+$(INTEL_EC_ASL)
+!ENDIF
+
+ASL_SRC = $(**:\=\\)
+
+#-----------------------------------------------------------------------#
+# DSDT.ASL GENERATOR #
+#-----------------------------------------------------------------------#
+# Include any Make flag dependent ASL code in this module,
+# otherwise use OEM ASL files within ACPI_BSP_DIR for OEM modifications
+#
+# Note. 1. Do not change an order ASL files appear in above defined DSDT_ASLS list
+# 2. Any module can include own ASL files to the target DSDT.ASL
+# by adding the files to the dependency list as follows:
+# $(PROJECT_DIR)\DSDT.ASL: $(PATH)\module.asl
+#-----------------------------------------------------------------------#
+$(PROJECT_DIR)\DSDT.ASL: $(DSDT_ASLS)
+ copy << $@
+
+//==========================================================================
+// DO NOT EDIT THIS FILE
+// This file was generated automatically using NMAKE build process(ACPI.MAK)
+// If OEM changes needed, edit ASL file(s) with extension "*.asl"
+//==========================================================================
+DefinitionBlock (
+ "ami.aml",
+ "DSDT",
+!IF "$(ACPI_BUILD_TABLES_3_0)"=="1"
+ 0x02, // DSDT revision.
+!ELSE
+ 0x01, // DSDT revision.
+!ENDIF
+ // A Revision field value greater than or equal to 2 signifies that integers
+ // declared within the Definition Block are to be evaluated as 64-bit values
+ "$(T_ACPI_OEM_ID)", // OEM ID (6 byte string)
+ "$(T_ACPI_OEM_TBL_ID)", // OEM table ID (8 byte string)
+ 0x0$(PROJECT_BUILD) // OEM version of DSDT table (4 byte Integer)
+ )
+
+// BEGIN OF ASL SCOPE
+{
+// Miscellaneous services enabled in Project
+ include ("$(ASL_SRC: ="^)
+ include (")")
+// Sleep states supported by Chipset/Board.
+//----------------------------------------------------------------------
+// SSx - BIOS setup controlled enabled _Sx Sleep state status
+// Values to be written to SLP_TYPE register are provided by SBACPI.SDL (South Bridge ACPI ModulePart)
+ Name(\_S0, Package(4){$(A_S0_PKG)}) // mandatory System state
+!if "$(A_S1)"=="1"
+ if(SS1) { Name(\_S1, Package(4){$(A_S1_PKG)})}
+!endif
+!if "$(A_S2)"=="1"
+ if(SS2) { Name(\_S2, Package(4){$(A_S2_PKG)})}
+!endif
+!if "$(A_S3)"=="1"
+ if(SS3) { Name(\_S3, Package(4){$(A_S3_PKG)})}
+!endif
+!if "$(A_S4)"=="1"
+ if(SS4) { Name(\_S4, Package(4){$(A_S4_PKG)})}
+!endif
+ Name(\_S5, Package(4){$(A_S5_PKG)}) // mandatory System state
+
+ Method(PTS, 1) { // METHOD CALLED FROM _PTS (oemDSDT.asl) PRIOR TO ENTER ANY SLEEP STATE
+ If(Arg0) // entering any sleep state
+ {
+ $(ASL_PTS)
+!if "$(A_SIOW)"=="01" #IO_ASLS
+!IF "$(SIO_SUPPORT)"=="1"
+!IF "$(PlatformAcpiTables_SUPPORT)"=="1"
+ \_SB.PCI0.LPCB.SIOS(Arg0) //- SB name for INTEL LPCB
+!ELSE
+ \_SB.PCI0.SBRG.SIOS(Arg0)
+!ENDIF #PlatformAcpiTables_SUPPORT
+!ENDIF #SIO_SUPPORT
+!endif
+ }
+ }
+ Method(WAK, 1) { // METHOD CALLED FROM _WAK (oemDSDT.asl) RIGHT AFTER WAKE UP
+ $(ASL_WAK)
+!if "$(A_SIOW)"=="01" #IO_ASLS
+!IF "$(SIO_SUPPORT)"=="1"
+!IF "$(PlatformAcpiTables_SUPPORT)"=="1"
+ \_SB.PCI0.LPCB.SIOW(Arg0) //- SB name for INTEL LPCB
+!ELSE
+ \_SB.PCI0.SBRG.SIOW(Arg0)
+!ENDIF #PlatformAcpiTables_SUPPORT
+!ENDIF #SIO_SUPPORT
+!endif
+ }
+
+!IF "$(PlatformAcpiTables_SUPPORT)"=="0"
+ Method(\_SB._OSC,4){
+ $(SB_OSCM_ASL)
+ Return(Arg3)
+ }
+!ELSE
+ Method(OSCM, 4){
+ $(SB_OSCM_ASL)
+ Return(0)
+ }
+!ENDIF #PlatformAcpiTables_SUPPORT
+
+ Method(PINI, 0) { // METHOD CALLED FROM _INI of PCI0 (oemDSDT.asl) RIGHT WHEN ENTER OS
+ $(ASL_PCI0_INI)
+ }
+
+} // End of ASL File
+
+<<
+
+#----------------------------------------------------------------------------
+!ENDIF
+!ENDIF
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2009, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/Core/EM/BoardInfo/AmiBoardInfo.sdl b/Core/EM/BoardInfo/AmiBoardInfo.sdl
new file mode 100644
index 0000000..d9224fb
--- /dev/null
+++ b/Core/EM/BoardInfo/AmiBoardInfo.sdl
@@ -0,0 +1,113 @@
+TOKEN
+ Name = "AmiBoardInfo_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AMI Board Info support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "AMI_BOARD_INFO_MAJOR_VERSION"
+ Value = "2"
+ Help = "AMI Board Info Driver Major Version"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Lock = Yes
+End
+
+TOKEN
+ Name = "AMI_BOARD_INFO_MINOR_VERSION"
+ Value = "1"
+ Help = "AMI Board Info Driver Mainor Version"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Lock = Yes
+End
+
+TOKEN
+ Name = "AMI_BOARD_VER_COMBINED"
+ Value = "$(AMI_BOARD_INFO_MAJOR_VERSION)*100+ $(AMI_BOARD_INFO_MINOR_VERSION)*10"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Lock = Yes
+End
+
+PATH
+ Name = "AmiBoardInfo_DIR"
+ Help = "Path to AMI Board Info Module in Project"
+End
+
+MODULE
+ Help = "Includes AmiBoardInfo.mak to Project"
+ File = "AmiBoardInfo.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmiBoardInfo.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ASL_EXP_INCLUDE_PATH"
+ Help = "Include passes for ASL expander"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "ASLPREPROCESS_FLAG"
+ Help = "Option override for preprocessing ASL files"
+ InvokeOrder = ReplaceParent
+End
+
+OUTPUTREGISTER
+ Name = "BUSNUM_XLAT_C_v2"
+ Path = "Build"
+ File = "BusNumXlat.h"
+ Token = "AMI_BOARD_INFO_MAJOR_VERSION" ">=" "1"
+End
+
+OUTPUTREGISTER
+ Name = "IRQ_C_APIC_v2"
+ Path = "Build"
+ File = "mppciirq.h"
+ Token = "AMI_BOARD_INFO_MAJOR_VERSION" ">=" "1"
+End
+
+OUTPUTREGISTER
+ Name = "IRQ_C_v2"
+ Path = "Build"
+ File = "oempir.h"
+ Token = "AMI_BOARD_INFO_MAJOR_VERSION" ">=" "1"
+End
+
+OUTPUTREGISTER
+ Name = "BUSNUM_XLAT"
+ Path = "Build"
+ File = "BusNumXlat.INC"
+ Token = "AMI_BOARD_INFO_MAJOR_VERSION" "<" "1"
+End
+
+OUTPUTREGISTER
+ Name = "IRQ_ASM_APIC"
+ Path = "Build"
+ File = "mppciirq.inc"
+ Token = "AMI_BOARD_INFO_MAJOR_VERSION" "<" "1"
+End
+
+OUTPUTREGISTER
+ Name = "IRQ_ASM"
+ Path = "Build"
+ File = "oempir.inc"
+ Token = "AMI_BOARD_INFO_MAJOR_VERSION" "<" "1"
+End
+
diff --git a/Core/EM/BoardInfo/PciBoard.c b/Core/EM/BoardInfo/PciBoard.c
new file mode 100644
index 0000000..78867a9
--- /dev/null
+++ b/Core/EM/BoardInfo/PciBoard.c
@@ -0,0 +1,119 @@
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2009, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/BIN/Core/Modules/BoardInfo/PciBoard.c 4 10/03/11 4:40p Yakovlevs $
+//
+// $Revision: 4 $
+//
+// $Date: 10/03/11 4:40p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Core/Modules/BoardInfo/PciBoard.c $
+//
+// 4 10/03/11 4:40p Yakovlevs
+//
+// 3 9/30/11 5:42p Yakovlevs
+// [TAG] EIP66222
+// [Category] New Feature
+// [Description] Modify PCI bus driver to get board info from separate
+// FFS section
+// [Files] AmiBoaardInfo.mak;
+// AmiBoaardInfo.sdl;
+// PciBoard.c
+// AmiBoaardInfo.h
+//
+// 2 6/28/11 5:51p Yakovlevs
+// [TAG] EIP 60123
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Resource padding is not functional for PCIe hot-plug.
+// [RootCause] In HP Mode #ifndef statement was not working
+// [Solution] Cahnged to reference AMI_HOTPLUG_INIT_SUPPORT token
+// [Files] AmiBoardInfo.c PciBoard.c
+//
+// 1 3/01/10 5:04p Yakovlevs
+// "C" syle file replaces PciBoard.asm
+//
+// 3 5/05/09 3:16p Felixp
+// Disable ACPI module dependent code if ACPI_MODULE_VER is less or equal
+// than 30
+//
+// 2 5/05/09 1:07p Felixp
+// Formatting update: File headers are updated.
+//
+// 1 4/28/09 1:20p Yakovlevs
+// Added new ModulePart - Ami Board Info.
+// This module groups together all VeB generated outpit files as well as
+// DSDT generation.
+//
+// 1 3/18/07 5:23p Felixp
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: <This File Name>
+//
+// Description:
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+//#include <Efi.h>
+#pragma pack(push, 1)
+#include "oempir.h"
+#include "BusNumXlat.h"
+#include "mppciirq.h"
+#pragma pack(pop)
+
+/*
+//APIC Hhot Plug Slots
+#if AMI_HOTPLUG_INIT_SUPPORT
+//extern UINT8* APIC_HotPlug_Slots_start;
+UINTN HP_SlotA_Start = (UINTN)&APIC_HotPlug_Slots_start;
+UINTN HP_SlotA_End = (UINTN)&APIC_HotPlug_Slots_start + sizeof(APIC_HotPlug_Slots_start);
+#else
+UINTN HP_SlotA_Start = (UINTN)&MP_IRI_Table+sizeof(MP_IRI_Table);
+UINTN HP_SlotA_End = (UINTN)&MP_IRI_Table+sizeof(MP_IRI_Table);
+#endif
+
+#include "oempir.c"
+UINTN IRQ_Table = (UINTN)arr_rth_pci_dedicated_irqs_equ;
+UINTN IRQ_Table_end=(UINTN)arr_rth_pci_dedicated_irqs_equ+sizeof(arr_rth_pci_dedicated_irqs_equ);
+
+//PIC Hhot Plug Slots
+#if AMI_HOTPLUG_INIT_SUPPORT
+//extern UINT8* HotPlugIrqRoutingStart;
+UINTN HP_SlotP_Start = (UINTN)&HotPlugIrqRoutingStart;
+UINTN HP_SlotP_End = (UINTN)&HotPlugIrqRoutingStart + sizeof(HotPlugIrqRoutingStart);
+#else
+UINTN HP_SlotP_Start = (UINTN)arr_rth_pci_dedicated_irqs_equ+sizeof(arr_rth_pci_dedicated_irqs_equ);
+UINTN HP_SlotP_End = (UINTN)arr_rth_pci_dedicated_irqs_equ+sizeof(arr_rth_pci_dedicated_irqs_equ);
+#endif
+*/
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2009, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//********************************************************************** \ No newline at end of file